MediaWiki:Common.js

if (mw.config.get('wgTitle') === 'Changelogs') { $.ajax("https://starblast.io/changelog.txt") .done(function (data) {		function t{};		t.months = ["January","February","March","April","May","June","July","August","September","October","November","December"];		function addMonth(str) {			str = str.split("-");			return t.months[Number(str[1])-1]+" "+Number(str[2])+", "+str[0];		}		function space(n) {			return new Array(n*2).fill(" ").join("");		}		t.date=data.match(/(\d{4}[-]\d{2}[-]\d{2})/g);		$("#mw-changelog").html("Filter by Date: ");		$("#mw-changelog_filter").append(" Full Changelogs "+t.date.map(function(i){return addMonth(i)}).join("  ")+"  ");		t.date.unshift("Full_Changelogs");		t.filter = $("#mw-changelog-date_filter"); t.filter.on("change",function(e){			e.preventDefault;			window.location.hash=t.date[t.filter.prop('selectedIndex')]||"";		}); $("#mw-changelog").append(data.replace(/(\d{4}[-]\d{2}[-]\d{2})/g,function(v){return ' '+addMonth(v)+' '}).replace(/\n+/g,"\n").replace(/^[^<]\s*(\*|\+|-|–)*\s*.+/gm,function (v) { t.sp = 0; t.u = v;			t.u=t.u.replace(/^\s+/g,function(d){return t.sp=d.length, ""}); if ("*-+–".indexOf(t.u[0])!= -1) {				t.fc=t.u[0]; t.u=t.u.slice(1,t.u.length).replace(/^\s*/g,""); }			else t.fc = ""; t.u=t.u[0].toUpperCase+t.u.slice(1,v.length); switch (t.fc) {				case "*": return ""+t.u+""; case "–": case "-": return " "+space(2)+"– "+t.u+" "; case "+": return " "+space(3)+"+ "+t.u+" "; default: return " "+space(t.sp)+t.fc+t.u+" "; }		}).replace(/<\/ul>(\n|\r)*/g,"")); t.filter_container = $("#mw-changelog_filter"); t.fixmeTop = t.filter_container.offset.top; t.fixmeBottom = $("#catlinks").offset.top; $(window).scroll(function {   	if ($(window).scrollTop >= t.fixmeTop && $(window).scrollTop <= t.fixmeBottom) t.filter_container.css({position:'fixed',top:'0.5em',right:parseInt($("#content").css("margin-right"))+parseInt($("#content").css("padding-right"))+"px"});    	else t.filter_container.css({position:"static",float:"right"});		}); })	.fail(function (e) {$("#mw-changelog").html(" An error occured while loading data from the server! Please reload the page and try again ")}); }

(function{	function hideFade {		$( "#backtotop" ).hide ;		$( function  { $( window ).scroll( function {				if ( $( this ).scrollTop  > $(window).innerHeight/2 ) {					$( '#backtotop' ).fadeIn ;				} else {					$( '#backtotop' ).fadeOut ;				}			}); });	}	function goToTop {		$( 'body,html' ).animate ({ scrollTop: 0 }, ScrollSpeed );		return false;	}	function addBackToTop {		$('').appendTo($(document.body));			$("#backtotop").on("click", goToTop);		hideFade ;	}	var ScrollSpeed = 600;	if( !window.BackToTop  ) {		addBackToTop ; 		window.BackToTop = true;	} });