Content deleted Content added
(!) moving window.addToolbarButtons to mediaWiki.libs.addToolbarButtons |
don't try to add to classic toolbar unless the newer one in not used and mw.toolbar exists |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1:
/*
* addToolbarButtons.js
* version
*
* 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),
* or the newer, 2010 wikitext editor. (The visual editor is not supported).▼
▲ * (The visual editor is not supported).
*
* Home: //en.wikipedia.org/wiki/User:V111P/js/addToolbarButtons
* You can use this code under the license CC0
*/
Line 15 ⟶ 14:
// add a single button or several buttons from the supplied array
// or else add all buttons specified in the array window.toolbarButtonsToAdd
mediaWiki.libs.addToolbarButtons = window.addToolbarButtons = function (props) {
"use strict";
Line 26 ⟶ 25:
$.each(arr, function (i, val) {
if (typeof val == 'object' && !val[0])
});
Line 99 ⟶ 98:
mw.loader.using( 'user.options', function () {
if ( mw.user.options.get('usebetatoolbar') ) {
mw.loader.using( 'ext.wikiEditor
$( customizeBetaToolbar );
} );
}
else if (mw.toolbar && mw.toolbar.addButton) {
// add a button to the classic toolbar▼
▲ // add a button to the classic toolbar
var tempButtonId = button.id + (!button.inserts ? 'TempButton' : '');
mw.toolbar.addButton(
Line 131 ⟶ 127:
}
}
}
}); };
mediaWiki.libs.addToolbarButtons.version = 1000;
|