Jump to content

User talk:Ebrahim

Add topic
From mediawiki.org
Latest comment: 10 years ago by Ebraminio in topic wikipage.content

Hello, Ebraminio. Was wondering if you could share me how to set-up a bot for the sandbox cleaner? The one like yours -User:Ebrambot, Thanks! :-) It'll be a great help! If you are kind enough, please leave me a message on my talk page. Thanks, once again.

wikipage.content

[edit]

Hi,

You asked me on IRC earlier about fa:User:Ebraminio/common.js.

mw.hook "wikipage.content" is for the wikipage content (e.g. the part that is editable). Not for the MediaWiki interface (e.g. search field, rollback links). Also, hooks can fire more than once in a single session. For example, after saving an edit in VisualEditor, or when using AJAX live preview. That way, gadgets like tablesorter can look for tables in the new content and make them sortable again.

What you are looking for is not mw.hook (because your code does not account for multiple fires, right now Deferred.resolve is being invoked more than once, which fails). What you're looking for is $(document).ready, or, since you're using $.when, use the $.ready promise:

$.when(
 mw.loader.using('jquery.ui.dialog'),
 $.ready
).done(function () {
  $('.mw-rollback-link a');
  ...
});

Krinkle (talk) 19:37, 4 June 2014 (UTC)Reply

Insightful. Done. Thank you. ebraminiotalk 19:45, 4 June 2014 (UTC)Reply