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 setPerseidsToolbarEdit() { $('.perseids-toolbar-edit', $(this).parent()).remove(); // Resets all links $('.toolbar-separator', $(this).parent()).remove(); $( '.wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar .wikibase-toolbarbutton' ) .after( $( '<a>' ) .addClass('wikibase-toolbarbutton perseids-toolbar-edit') .attr( { 'href': '#' } ) .before( $('<span class="toolbar-separator">|</span>') ) .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-add') .attr( { 'href': '#' } ) .before( $('<span class="toolbar-separator">|</span>') ) .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-save') .attr( { 'href': '#' } ) .before( $('<span class="toolbar-separator">|</span>') ) .text( 'save to Perseids' ) .click( function ( event ) { event.preventDefault(); } ) ); }); setPerseidsToolbarEdit(); $( '.wikibase-toolbar' ).click( setPerseidsToolbarEdit );