Mizusumashi <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #1 from Mizusumashi <> 2011-02-21 
10:34:52 UTC ---
I'm sorry, but I disagree with Jimmy.  I think loading site common.js after
gadgets is better.  Loading user scripts and gadets before site common.js is

I want to detect witch gadgets and/or user setteings in site common.js. 
Jimmy's oder makes this detection impossible.  On the other hand,  hooking
gadget's "real" code by site common.js is not so difficult even in the current

Gadget A:
  var gadget_a_enable = true;

Gadget B:
  function gadget_b_hook () {
      // whatever you want
  if(typeof commonHook == 'undefined'){
   commonHook = new Array();
  commonHook[commonHook.length] = gadget_b_hook;

site commn.js ([[MediaWiki:Common.js]]):
  if(typeof gadget_a_enable != 'undefined' && gadget_a_enable){
      // ... if Gadget A is enable...
      // ... if Gadget A is disable ...

  if(typeof commonHook != 'undefined'){
      for(var i = 0; i < commonHook.length; i++){

I think, anyone can say "But, even in Jimmy's oder, detection gadgets in 'real'
code of common.js is not so diffcult too":

Gadget A:
  var gadget_a_enable = true;

site commn.js ([[MediaWiki:Common.js]]):
  $(document).ready(function ($){
      if(typeof gadget_a_enable != 'undefined' && gadget_a_enable){
          // ... whatevet I want ...

But I need to say, $(document).ready somtime makes waiting for long time.  Of
course,  if you want or need to wait that the document is ready, this is a good
way.  But this long time lag is not fine in some case.

Configure bugmail:
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Wikibugs-l mailing list

Reply via email to