User:Ainz Ooal Gown/mobilemorelinks/movetocommons.js

// For moving files to Commons $.when(mw.loader.using(['mediawiki.util', 'oojs-ui-core','oojs-ui.styles.icons-wikimedia'])).then( function { //JavaScript variables var	namespaceNumber = mw.config.get( 'wgNamespaceNumber' ),	serverName = mw.config.get( 'wgServerName' ),	contentLanguage = mw.config.get( 'wgContentLanguage' ),	noticeProject = mw.config.get( 'wgNoticeProject' ),	articleId = mw.config.get( 'wgArticleId' ),	encodedTitle = encodeURIComponent( mw.config.get( 'wgTitle' ) ),	encodedPageName = encodeURIComponent( mw.config.get( 'wgPageName') ); // Don't run this script if it's Commons or test wiki. if (noticeProject === "commons" || noticeProject === "test" ) { return; } //Namespace module if (namespaceNumber == 6 && document.getElementById('file') && articleId ) { var movetocommons = function($) { // Button links var	ch = '//tools.wmflabs.org/commonshelper/?language='+ contentLanguage +'&project='+ noticeProject +'&image='+ encodedTitle ,	etocom = '//commons.m.wikimedia.org/wiki/Special:ImportFile?importSource=FileExporter&clientUrl=%2F%2F'+ serverName +'%2Fwiki%2F'+ encodedPageName ; // Buttons start here var	etocomBtn = new OO.ui.ButtonWidget({ label: 'Export to Wikimedia Commons', href: etocom , flags: ['primary','progressive'] , icon: 'logoWikimediaCommons' }),	chBtn = new OO.ui.ButtonWidget({ label: 'CommonsHelper', href: ch , flags: 'progressive' , icon: 'logoWikimediaCommons' }); //Change link order here $("#siteNotice").append( chBtn.$element, etocomBtn.$element ); }} $(document).ready(movetocommons) ; });