Jump to content

User:Jeph paul/common.js

From Wikipedia, the free encyclopedia
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.
function newTab(){
	if(mw.config.get('wgIsArticle')){
		mw.util.addPortletLink( 'p-views', '#', 'Replay Edits','t-mworg', 'Visualize the edits of an article', 'm', '#t-print' );
	}
  var addClick = function(){
	  $('#t-mworg').click(function(e){
	  		e.preventDefault();
	  		var layout ='<div id="header"><input id="pageTitle" type="text" placeholder="Enter article name"></input><input id="pageButton" type="submit" value="Load Edits"></input></div><div class="cB"></div></div><div class="notify"></div><div id="wikiBodySlider"><div id="wikiBody" class="absolute"></div><div id="sliderComplete"><div id="enlargedContainer"><div id="controlsInfoContainer"><div class="controls"><div id="playButtonContainer" class="customTooltip" data-title="Play/Pause"><div id="playButton"class="play"></div></div><div class="speedSlider customTooltip" data-title="Speed Control"><div class="noUiSlider"></div></div></div><div id="infoBox"><div class="userName left"></div><div class="editDate left"></div><div class="minor left"></div></div></div><div id="enlarged"></div></div><div></div><div id="outerContainer"><div id="outerEndDateLeg" class="leg"></div><div id="outerStartDateLeg" class="leg"></div><div class="outerInfo" id="outerEndDate"></div><div class="outerInfo" id="outerStartDate"></div><div id="outer"></div><div class="info" id="olderEditsInfo"><span class="customTooltip" data-title="Drag slider right to load older edits">?</span></div></div></div></div>';
	  		$('#content').html(layout);
	  		loadTool();
	  		$('#content').addClass('replayEdit');
	  		$('#pageTitle').val(mw.config.get('wgPageName'));
	  		start('#pageTitle');
	  });
  };
  //Getting the lib files
 
  d3Promise = jQuery.getScript('https://en.wikipedia.org/w/index.php?title=User:Jeph_paul/d3.v3.min.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
  jQueryPromise = jQuery.getScript('https://en.wikipedia.org/w/index.php?title=User:Jeph_paul/jquery-2.0.2.min.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
  diffMatchPatchPromise = jQuery.getScript('https://en.wikipedia.org/w/index.php?title=User:Jeph_paul/diff_match_patch.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
 
  $.when(d3Promise,jQueryPromise,diffMatchPatchPromise).then(function(){
  																visualisationPromise = jQuery.getScript('https://en.wikipedia.org/w/index.php?title=User:Jeph_paul/visualisationscript.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
  																
  																$.when(visualisationPromise).then(function(){
  																	addClick();
  																});
 
  															});
}
newTab();