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

Content deleted Content added
No edit summary
No edit summary
Line 63:
 
var oldButton = $('#' + button.id);
if (!button.inserts && oldButton[0]) {
oldButton.attr('id', button.id + '_ButtonToBeRemoved')
.replaceWith(
$(oldButton[0].cloneNode()) // clone the button to remove added event handlers
newB.attr('id =', button.id;)
$(newB).click(button.callback);
);
return;
}
 
// add button to the new, WikiEditor, toolbar
Line 73 ⟶ 82:
action: {
type: (button.inserts ? 'encapsulate' : 'callback'),
execute: (button.inserts ? void(0) : button.callback),
options: (button.inserts ? {
pre: button.before,
Line 81 ⟶ 90:
}
};
oldButton.remove();
$('#wpTextbox1').wikiEditor('addToToolbar', {
'section': button.section,
Line 102 ⟶ 110:
if ($('#' + button.id).size() == 0) {
// add a button to the classic toolbar
mw.loader.using('mediawiki.action.edit', function () {
if (!button.inserts && oldButton[0]) {
oldButton.attrremove('id', button.id + 'TempButton');
.replaceWith($(oldButton[0].cloneNode()).attr('id',var tempButtonId = button.id).click; //+ (!button.callback)inserts ? 'TempButton' : '');
mw.toolbar.addButton(
}
(button.iconUrlClassic || button.iconUrl),
else
if (button.inserts) {tooltip,
mw.loader.using('mediawiki.action.edit', function () {
button.before, button.after, button.between,
oldButton.remove();
var tempButtonId = button.id + (!button.inserts ? 'TempButton' : '');,
tempButtonId
mw.toolbar.addButton(
});
(button.iconUrlClassic || button.iconUrl),
if (button.tooltip,callback) {
button.before,$('#' + button.after, id).click(button.between,callback);
}
tempButtonId,
});
tempButtonId
);
if (button.inserts) {
button.callback && $('#' + button.id).click(button.callback);
}
else {
var $tempButton = $('#' + tempButtonId);
if ($tempButton[0]) {
// clone the button to remove added event handlers
var newB = $tempButton[0].cloneNode();
newB.id = button.id;
$tempButton.after(newB).remove();
$(newB).click(button.callback);
}
}
});
}
}