Jump to content

User:Wurgl/WikiHistory.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Wurgl (talk | contribs) at 20:05, 25 November 2017 (Created page with '// Test version! Only the brave shall use it! Test version! var authors = { loadinganimation : 0, execute : function () { if (mw.config.get('wgArticleId')...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Test version! Only the brave shall use it! Test version!
var authors = {
  loadinganimation : 0,
  execute : function () {
  	if (mw.config.get('wgArticleId') == 0) return; // no deleted articles
  	if (mw.config.get('wgCurRevisionId') != mw.config.get('wgRevisionId')) return; // only current revision
  	$("<div id='authors' style='font-size:84%; line-height:1.2em; margin:0 0 0 1em; width:auto;'>von <span id='authorsresult'></span><span id='authorsloading'>...</span></div>").insertBefore("#contentSub");
  	loadinganimation = window.setInterval( function() { if ($("#authorsloading").html() == ".&nbsp;&nbsp;") $("#authorsloading").html("&nbsp;.&nbsp;"); else if ($("#authorsloading").html() == "&nbsp;.&nbsp;") $("#authorsloading").html("&nbsp;&nbsp;."); else $("#authorsloading").html(".&nbsp;&nbsp;"); }, 300);
  	importScriptURI("//tools.wmflabs.org/wikihistory/wiki/getauthors.php?wiki=enwiki&page_id=" +  mw.config.get('wgArticleId'));
  },
  resultloaded : function( res, old ) {
  	$("#authorsresult").html(res);
  	if (old == 1) importScriptURI("//tools.wmflabs.org/wikihistory/wiki/getauthors.php?wiki=enwiki&page_id=" +  mw.config.get('wgArticleId') + '&onlynew=1');
  },
  stoploading : function() {
  	clearInterval(loadinganimation);
  	$('#authorsloading').remove();
  }
}
if ( (mw.config.get('wgNamespaceNumber') == 0) && (mw.config.get('wgAction') == "view") )$( authors.execute );
// Test version! Only the brave shall use it! Test version!