Difference between revisions of "MediaWiki:Perseids-toolbar.js"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
function setPerseidsToolbarEdit() { |
function setPerseidsToolbarEdit() { |
||
− | $('.perseids-toolbar-edit').remove(); // Resets all links |
+ | $('.perseids-toolbar-edit', $(this).parent()).remove(); // Resets all links |
+ | $('.toolbar-separator', $(this).parent()).remove(); |
||
$( '.wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar .wikibase-toolbarbutton' ) |
$( '.wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar .wikibase-toolbarbutton' ) |
||
Line 10: | Line 10: | ||
'href': '#' |
'href': '#' |
||
} ) |
} ) |
||
− | .before( '|' ) |
+ | .before( '<span class="toolbar-separator">|</span>' ) |
.text( 'edit in Perseids' ) |
.text( 'edit in Perseids' ) |
||
.click( function ( event ) { |
.click( function ( event ) { |
||
Line 25: | Line 25: | ||
'href': '#' |
'href': '#' |
||
} ) |
} ) |
||
− | .before( '|' ) |
+ | .before( '<span class="toolbar-separator">|</span>' ) |
.text( 'add via Perseids' ) |
.text( 'add via Perseids' ) |
||
.click( function ( event ) { |
.click( function ( event ) { |
||
Line 41: | Line 41: | ||
'href': '#' |
'href': '#' |
||
} ) |
} ) |
||
− | .before( '|' ) |
+ | .before( '<span class="toolbar-separator">|</span>' ) |
.text( 'save to Perseids' ) |
.text( 'save to Perseids' ) |
||
.click( function ( event ) { |
.click( function ( event ) { |
Revision as of 11:15, 31 July 2014
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 );