Обсуждение MediaWiki:Gadget-markblocked.js: различия между версиями

Содержимое удалено Содержимое добавлено
→‎mw.util.$content: :::{{re|TheDJ}} What are those dependencies, and how can we simulate loading as a true gadget from another project? ~~~~
Строка 84:
: {{re|TheDJ}} Do I get it right that given the code in [https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki/mediawiki.util.js mediawiki.util.js] and [https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki/page/startup.js page/startup.js], the success of $content usage in this gadget is determined by the fact whether mediawiki.util.js (where $content is initialized inside $()) is executed earlier than page/startup.js (where wikipage.content hook is fired inside $())? This way <code>mw.hook( 'wikipage.content' ).add()</code> code in this gadget, which $content usage is wrapped in, could run with $content initialized, as far as I can see. If this is correct, I guess we could change <code>mw.hook( 'wikipage.content' ).add()</code> to just <code>$()</code> to ensure $content is always initialized before the run. — ''[[У:Jack who built the house|Джек, который построил дом]]'' ([[ОУ:Jack who built the house|обс.]]) 00:55, 12 июля 2017 (UTC)
::Correct on the first part, less sure about the conclusion you make. Again, i'm not entirely sure what that block is trying to achieve (why does it have to listen for content to begin with ?), making it harder to give the right advise. It also would be wise to wrap that mw.util.addPortletlink with mw.loader.using( 'mediawiki.util'). Several people seem to make use of this gadget by direct loading of this file, instead of using it as a gadget, so they don't receive the dependencies that are delivered when you use this as a true Gadget. [[У:TheDJ|TheDJ]] ([[ОУ:TheDJ|обс.]]) 10:07, 12 июля 2017 (UTC)
:::{{re|TheDJ}} What are those dependencies, and how can we simulate loading as a true gadget from another project? &nbsp; — <font size="4">[[User:Jeff G.|Jeff]] [[User:Jeff G./talk|G. ツ]]</font> 02:47, 11 апреля 2018 (UTC)
 
== Globally locked and blocked users ==