Difference between revisions of "MediaWiki:Perseids-toolbar.js"
Jump to navigation
Jump to search
Line 34: | Line 34: | ||
} |
} |
||
− | $( '.wb-claimlist .wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child' ).each(function(){ |
+ | $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child' ).each(function(){ |
var itemId = wb.entity.getId(); |
var itemId = wb.entity.getId(); |
||
var claimId = $(this).parents('.wb-statement-claim').find('.wb-claim').attr('class').split(' ')[1]; |
var claimId = $(this).parents('.wb-statement-claim').find('.wb-claim').attr('class').split(' ')[1]; |
||
Line 46: | Line 46: | ||
}); |
}); |
||
− | $( '.wb-claimlist .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child') |
+ | $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child') |
.after(generateButton('save')); |
.after(generateButton('save')); |
||
/* Quando clicco sul pulsante "edit"... */ |
/* Quando clicco sul pulsante "edit"... */ |
||
− | $( '.wb-claimlist .wikibase-toolbareditgroup .wikibase-toolbarbutton:first-child:not(.wikibase-toolbarbutton-disabled)' ).click(function () { |
+ | $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup .wikibase-toolbarbutton:first-child:not(.wikibase-toolbarbutton-disabled)' ).click(function () { |
/* Genero il pulsante "save to Perseids" */ |
/* Genero il pulsante "save to Perseids" */ |
||
− | $( '.wb-claimlist .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar:not(:has(.perseids-save)) .wikibase-toolbarbutton:first-child') |
+ | $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar:not(:has(.perseids-save)) .wikibase-toolbarbutton:first-child') |
.after(generateButton('save')); |
.after(generateButton('save')); |
||
/* Click su "annulla": rigenero il pulsante "edit" */ |
/* Click su "annulla": rigenero il pulsante "edit" */ |
||
− | $( '.wb-claimlist .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:last-child').click(function(){ |
+ | $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:last-child').click(function(){ |
− | $( '.wb-claimlist .wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar:not(:has(.perseids-edit)) .wikibase-toolbarbutton:first-child' ).after(generateButton('edit')); |
+ | $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar:not(:has(.perseids-edit)) .wikibase-toolbarbutton:first-child' ).after(generateButton('edit')); |
}); |
}); |
||
}); |
}); |
Revision as of 16:19, 15 September 2014
function generateButton(type, itemId, claimId, lang) { if(type == 'edit') { var editUrl = 'http://sosol.perseids.org/sosol/cts_publications/create_from_agent?agent=' + 'http://www.eagle-network.eu&id=' + itemId + '&filter=' + claimId; return $( '<a>' ) .attr( { 'class': 'wikibase-toolbarbutton perseids-edit', 'href': editUrl, } ) .before( '|' ) .text( 'edit in Perseids' ); } else if (type == 'save') { return $( '<a>' ) .attr( { 'class': 'wikibase-toolbarbutton perseids-save', 'href': 'javascript:void(0);' } ) .before( '|' ) .text( 'save to Perseids' ); } else if (type == 'add') { var addUrl = 'http://sosol.perseids.org/sosol/cts_publications/create_from_agent?agent=' + 'http://www.eagle-network.eu&id=' + itemId + '&lang=' + lang; return $( '<a>' ) .attr( { 'class': 'wikibase-toolbarbutton perseids-add', 'href': addUrl, } ) .before( '|' ) .text( 'add via Perseids' ); } } $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child' ).each(function(){ var itemId = wb.entity.getId(); var claimId = $(this).parents('.wb-statement-claim').find('.wb-claim').attr('class').split(' ')[1]; $(this).after(generateButton('edit', itemId, claimId, null)); }); $( '.wb-claimlist .wb-addtoolbar .wb-editsection a.wikibase-toolbarbutton:first-child').each(function(){ var itemId = wb.entity.getId(); $(this).after(generateButton('add', itemId, null, 'EN')); }); $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:first-child') .after(generateButton('save')); /* Quando clicco sul pulsante "edit"... */ $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup .wikibase-toolbarbutton:first-child:not(.wikibase-toolbarbutton-disabled)' ).click(function () { /* Genero il pulsante "save to Perseids" */ $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar:not(:has(.perseids-save)) .wikibase-toolbarbutton:first-child') .after(generateButton('save')); /* Click su "annulla": rigenero il pulsante "edit" */ $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-ineditmode .wikibase-toolbar .wikibase-toolbarbutton:last-child').click(function(){ $( '.wb-claimlist .wb-statement-claim .wikibase-toolbareditgroup-innoneditmode .wikibase-toolbar:not(:has(.perseids-edit)) .wikibase-toolbarbutton:first-child' ).after(generateButton('edit')); }); });