User:Bodhisattwa/CropTool.js

// CropTool code begins, see CropTool for details ( function( mw, $ ) {

if ( mw.config.get( 'wgCanonicalNamespace' ) !== "Page" ) return; // if ( mw.config.get( 'wgAction' ) !== 'view' ) return;

$( function {

var currentUri = new mw.Uri, croptoolUri = new mw.Uri( '//tools.wmflabs.org/croptool/' );

croptoolUri.extend({			title: /(.+)\//.exec(mw.config.get("wgTitle"))[1],			page: /\d+$/.exec(mw.config.get("wgTitle"))[0]		});

mw.util.addPortletLink(			'p-tb',			croptoolUri.toString,			'CropTool',			't-cropNew',			'Ritaglio con CropTool'		); $("#t-cropNew a").attr("target","_blank"); });

})( mediaWiki, jQuery );