MediaWiki:Gadget-VIAFDataImporter.js
Jump to navigation
Jump to search
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/**
* [This gadget is redundant and no longer used - add VIAF data at WikiData]
*
* Gadget that loads [[MediaWiki:VIAFDataImporter.js]]
* (written by [[User:Inductiveload]])
* after clicking the according button
*
* Help at [[Help:Gadget-VIAFDataImporter]]
*
* @rev 1 (2012-06-08)
* @author Rillke, 2012
*
*/
/*global jQuery:false, mediaWiki:false*/
/*jshint curly:false*/
(function($, mw) {
'use strict';
if ( $.inArray( mw.config.get( 'wgNamespaceNumber' ), [ 0, 2, 14, 100, 102, 114 ] ) === -1 ) return;
var ii, // ImporterInstance
waiting = false,
portlet = mw.util.addPortletLink('p-tb', '#', 'Add authority control', 'tb-viaf-authority-control', 'Add an authority control template using data from VIAF');
var _onScriptLoad = function(evt, st, instance) {
if ('VIAFDataImporter' !== st || !instance) return;
ii = instance;
waiting = false;
$(document).off('scriptLoaded.VIAFLoader');
_loadVIAFData();
};
var _loadVIAFData = function(e) {
if (e) e.preventDefault();
if (waiting) return;
if (ii) {
ii.add_VIAF_pane();
$('html,body').stop().animate({scrollTop: $('#add_viaf_data_pane').position().top + mw.util.$content.position().top}, 500);
} else {
waiting = true;
$(document).on('scriptLoaded.VIAFLoader', _onScriptLoad);
mw.loader.load( mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + '?title=MediaWiki:VIAFDataImporter.js&action=raw&ctype=text/javascript&dummy=0' );
}
};
$(portlet).click(_loadVIAFData);
})(jQuery, mediaWiki);