MediaWiki:WebArchive.js

/** * WebArchive * @author Rail01 */ require([   'jquery',    'mw',    'wikia.window' ], function( $, mw, window ) {    if ( window.WebArchiveLoaded || mw.config.get( 'wgArticleId' ) === 0 ) return;    window.WebArchiveLoaded = true;

function init(i18n) { var url = 'https://web.archive.org/save/' + window.location.href; $('', {           class: 'wds-button wds-is-secondary',            id: 'WebArchiveLink',            href: url,            target: ( !window.WebArchiveNewTab ? '_blank' : null )       }).append(            $(' ', { text: i18n.msg( 'archive-text' ).plain, title: i18n.msg( 'archive-title' ).plain })       ).appendTo( '.page-header__contribution-buttons' ); }

mw.hook( 'dev.i18n' ).add(function(i18n) {       i18n.loadMessages( 'WebArchive' ).then(init);    }); importArticles({       type: 'script',        article: 'u:dev:MediaWiki:I18n-js/code.js'    }); });