Difference between revisions of "MediaWiki:Perseids-toolbar.js"
Jump to navigation
Jump to search
(versione riveduta e corretta) |
|||
Line 47: | Line 47: | ||
.after(generateButton('add')); |
.after(generateButton('add')); |
||
− | + | $( '.wb-claimlist wb-addtoolbar wb-editsection .wikibase-toolbar .wikibase-toolbar:first-child a.wikibase-toolbarbutton') |
|
+ | .after(generateButton('add')); |
||
+ | |||
+ | $( '.wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child') |
||
.after(generateButton('save')); |
.after(generateButton('save')); |
||
Revision as of 18:22, 14 September 2014
function generateButton(type) { var pulsanti = { 'edit': $( '<a>' ) .attr( { 'class': 'wikibase-toolbarbutton perseids-edit', 'href': '#' } ) .before( '|' ) .text( 'edit in Perseids' ) .click( function ( event ) { event.preventDefault(); } ), 'save': $( '<a>' ) .attr( { 'class': 'wikibase-toolbarbutton perseids-save', 'href': '#' } ) .before( '|' ) .text( 'save to Perseids' ) .click( function ( event ) { event.preventDefault(); } ), 'add': $( '<a>' ) .attr( { 'class': 'wikibase-toolbarbutton perseids-add', 'href': '#' } ) .before( '|' ) .text( 'add via Perseids' ) .click( function ( event ) { event.preventDefault(); } ), }; return pulsanti[type].clone(); } $( '.wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child' ) .after(generateButton('edit')); $( '.wb-claim-section .wb-addtoolbar .wb-editsection a.wikibase-toolbarbutton:first-child') .after(generateButton('add')); $( '.wb-claimlist wb-addtoolbar wb-editsection .wikibase-toolbar .wikibase-toolbar:first-child a.wikibase-toolbarbutton') .after(generateButton('add')); $( '.wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child') .after(generateButton('save')); /* Quando clicco sul pulsante "edit"... */ $( '.wikibase-toolbareditgroup .wikibase-toolbarbutton:first-child:not(.wikibase-toolbarbutton-disabled)' ).click(function () { /* Genero il pulsante "save to Perseids" */ $( '.wikibase-toolbareditgroup-ineditmode .wikibase-toolbar:not(:has(.perseids-save)) .wikibase-toolbarbutton:first-child') .after(generateButton('save')); /* Click su "annulla": rigenero il pulsante "edit" */ $( '.wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:last-child').click(function(){ $( '.wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar:not(:has(.perseids-edit))' ).append(generateButton('edit')); }); });