User:V111P/js/addToolbarButtons.js: Difference between revisions

Content deleted Content added
Maintenance: mw:RL/MGU - Replaced .size() (removed in jQuery 3.0) phab:T169385, Updated deprecated module name
don't try to add to classic toolbar unless the newer one in not used and mw.toolbar exists
 
Line 1:
/*
* addToolbarButtons.js
* version 20132019-1105-0209
*
* This function lets you add function-calling buttons
* to the toolbar above the textarea, regardless of whether the user is using
* the legacy/classic (2006) editing toolbar (now only available as a gadget),
* regardless of whether the user is using the old toolbar,
* or the newer, 2010 wikitext editor. (The visual editor is not supported).
* or the "enhanced editing" WikiEditor toolbar.
* (The visual editor is not supported).
*
* Home: //en.wikipedia.org/wiki/User:V111P/js/addToolbarButtons
Line 103 ⟶ 102:
} );
}
else if (mw.toolbar && mw.toolbar.addButton) {
} );
// add a button to the classic toolbar
 
if ($('#' + button.id).length == 0) {
// add a button to the classic toolbar
mw.loader.using('mediawiki.action.edit', function () {
var tempButtonId = button.id + (!button.inserts ? 'TempButton' : '');
mw.toolbar.addButton(
Line 131 ⟶ 127:
}
}
}
});
 
}
};
 
mediaWiki.libs.addToolbarButtons.version = 1000;