Sophivorus has submitted this change and it was merged. Change subject: Add button for OldToolbar ......................................................................
Add button for OldToolbar Fix for destroing buttons in OldToolbar Bug: T149562 Change-Id: Iebda85ddfa60906f3f491ca025b1146104586f14 --- M proveit.js 1 file changed, 37 insertions(+), 22 deletions(-) Approvals: Sophivorus: Verified; Looks good to me, approved diff --git a/proveit.js b/proveit.js index 4c1456e..f19cae4 100755 --- a/proveit.js +++ b/proveit.js @@ -16,9 +16,11 @@ var proveit = { /** - * URL of the ProveIt icon hosted at Commons + * URL of the ProveIt icons hosted at Commons */ ICON: '//upload.wikimedia.org/wikipedia/commons/thumb/1/19/ProveIt_logo_for_user_boxes.svg/22px-ProveIt_logo_for_user_boxes.svg.png', + + OLDICON: '//upload.wikimedia.org/wikipedia/commons/d/df/ProveitOldIcon.png', /** * Template data retrieved from the wiki @@ -119,29 +121,42 @@ }); }); - // Replace the Reference button for the ProveIt button - proveit.getTextbox().wikiEditor( 'removeFromToolbar', { - 'section': 'main', - 'group': 'insert', - 'tool': 'reference' - }); - proveit.getTextbox().wikiEditor( 'addToToolbar', { - 'section': 'main', - 'group': 'insert', - 'tools': { - 'proveit': { - 'label': 'ProveIt', - 'type': 'button', - 'icon': proveit.ICON, - 'action': { - 'type': 'callback', - 'execute': function () { - $( '#proveit' ).toggle(); + // Replace the Reference button for the ProveIt button in the new toolbar + if ( mw.user.options.get( 'usebetatoolbar' ) === 1 ) { + proveit.getTextbox().wikiEditor( 'removeFromToolbar', { + 'section': 'main', + 'group': 'insert', + 'tool': 'reference' + }); + proveit.getTextbox().wikiEditor( 'addToToolbar', { + 'section': 'main', + 'group': 'insert', + 'tools': { + 'proveit': { + 'label': 'ProveIt', + 'type': 'button', + 'icon': proveit.ICON, + 'action': { + 'type': 'callback', + 'execute': function () { + $( '#proveit' ).toggle(); + } } } } - } - }); + }); + // Add the ProveIt button in the old toolbar + } else if ( mw.user.options.get( 'showtoolbar' ) === 1 ) { + mw.loader.using( 'mediawiki.toolbar', function () { + $( '<div>' ) + .addClass( 'mw-toolbar-editbutton' ) + .attr( 'title', 'ProveIt' ) + .css( 'background-image', 'url(' + proveit.OLDICON + ')' ) + .appendTo( '#toolbar' ).click( function () { + $( '#proveit' ).toggle(); + }); + }); + } }, /** @@ -1058,4 +1073,4 @@ $( proveit.init ); -}( mw, jQuery ) ); \ No newline at end of file +}( mw, jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/318910 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iebda85ddfa60906f3f491ca025b1146104586f14 Gerrit-PatchSet: 4 Gerrit-Project: wikipedia/gadgets/ProveIt Gerrit-Branch: master Gerrit-Owner: Iniquity <inite...@gmail.com> Gerrit-Reviewer: Sophivorus <scheno...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits