User:Microchip08/common.js

//

function initTemplates { if ( wgNamespaceNumber == 6 ) { mw.util.addPortletLink( 'p-cactions', 'javascript:listTemplates', 'Add template', 'ca-addTP', 'Add template to image', ,  ); } } $( initTemplates ); function addTemplate( template ) { api( wgPageName.replace( "_", " " ) ).setDefaultSummary( 'adding ' ).getPage.lift( function ( pageText ) {       return pageText + '\n';    } ).savePage.exec; jsMsg( 'Template added' ); } function listTemplates { var templates = { "trans-commons": "Freely licensed image to be moved to Commons", "no-commons": "Freely licensed local copy", "missing fair use rationale": "Fair use image missing rationale", "Image-source": "Image missing source", "fu": "Fair use image", "fair use orphan": "Orphaned FU image" };   var msg = ''; for ( var template in templates ) { msg += '' + templates[template] + '\n'; }   jsMsg( msg ); }