MediaWiki:Perseids-toolbar.js
Jump to navigation
Jump to search
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
function setPerseidsToolbar() { $('.perseids-toolbar').remove(); // Resets all links $( '.wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar .wikibase-toolbarbutton' ) .after( $( '<a>' ) .addClass('wikibase-toolbarbutton', 'perseids-toolbar') .attr( { 'href': '#' } ) .before( '|' ) .text( 'edit in Perseids' ) .click( function ( event ) { event.preventDefault(); } ) ); $( '.wb-claim-section .wb-addtoolbar .wb-editsection a.wikibase-toolbarbutton') .after( $( '<a>' ) .addClass('wikibase-toolbarbutton', 'perseids-toolbar') .attr( { 'href': '#' } ) .before( '|' ) .text( 'add via Perseids' ) .click( function ( event ) { event.preventDefault(); } ) ); $( '.wikibase-toolbareditgroup .wikibase-toolbarbutton:not(.wikibase-toolbarbutton-disabled' ).click(function () { $( '.wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton') .slice(-2,-1) .after( $( '<a>' ) .addClass('wikibase-toolbarbutton', 'perseids-toolbar') .attr( { 'href': '#' } ) .before( '|' ) .text( 'save to Perseids' ) .click( function ( event ) { event.preventDefault(); } ) ); }); } $( '.wikibase-toolbar' ).click( setPerseidsToolbar );