User:FINNER/common.js

/* FINNER/Test10 START */ /* Baro START */ function BaroCountdown { var now = new Date; now.setFullYear(now.getUTCFullYear); now.setMonth(now.getUTCMonth); now.setDate(now.getUTCDate); now.setHours(now.getUTCHours); var nextDate = new Date("September 10, 2018 20:59:59 UTC"); var nextDate2 = new Date("September 12, 2018 20:59:59 UTC"); var start = new Date(now.getFullYear, 0, 0); var oneDay = 1000 * 60 * 60 * 24; var nowdiff = (now - start) + ((start.getTimezoneOffset - now.getTimezoneOffset) * 60 * 1000); var nowDay = Math.floor(nowdiff / oneDay); while (nextDate.getTime <= now.getTime) { nextDate.setDate(nextDate.getDate + 14); if ((nextDate.getFullYear) % 4 === 0) nowDay += 1 / 13; }   var nextdiff = (nextDate - start) + ((start.getTimezoneOffset - nextDate.getTimezoneOffset) * 60 * 1000); var nextDay = Math.floor(nextdiff / oneDay); while (nextDate2.getTime <= now.getTime) { nextDate2.setDate(nextDate2.getDate + 14); if ((nextDate2.getFullYear) % 4 === 0) nowDay += 1 / 13; }   nextdiff = (nextDate2 - start) + ((start.getTimezoneOffset - nextDate2.getTimezoneOffset) * 60 * 1000); var nextDay2 = Math.floor(nextdiff / oneDay); var daysleft = nextDay - Math.round(nowDay); var daysleft2 = nextDay2 - Math.round(nowDay); var hoursleft = nextDay.getHours - now.getHours; var minutesleft = 59 - now.getMinutes; var secondsleft = 59 - now.getSeconds;

if(daysleft < 0) daysleft = 365 + daysleft; if(daysleft2 < 0) daysleft2 = 365 + daysleft2; if(daysleft < 10) daysleft = "0" + daysleft; if(daysleft2 < 10) daysleft2 = "0" + daysleft2; if(hoursleft < 10) hoursleft = "0" + hoursleft; if(minutesleft < 10) minutesleft = "0" + minutesleft; if(secondsleft < 10) secondsleft = "0" + secondsleft;

if (daysleft2 < 2) { $('#baro-countdown').html("The Void Trader is scheduled to depart in " + daysleft2 + "d " + hoursleft + "h " + minutesleft + "m " + secondsleft + "s"); } else { $('#baro-countdown').html("The Void Trader is scheduled to arrive in " + daysleft + "d " + hoursleft + "h " + minutesleft + "m " + secondsleft + "s"); } } BaroCountdown; setInterval(BaroCountdown, 1000); /* Baro END */

/* Daily Tribute START * function TributeCountdown { var now = new Date; var i = 0, j = 0, k = 0; var nextDate = new Date("December 3, 2015 23:59:59"); var nextDateConsole = new Date("December 18, 2015 23:59:59"); var nextDateSwitch = new Date("November 20, 2018 23:59:59"); var start = new Date(now.getFullYear, 0, 0); var oneDay = 1000 * 60 * 60 * 24; var nowdiff = (now - start) + ((start.getTimezoneOffset - now.getTimezoneOffset) * 60 * 1000); var nowDay = Math.floor(nowdiff / oneDay); var nowDayConsole = Math.floor(nowdiff / oneDay); var nowDaySwitch = Math.floor(nowdiff / oneDay); while (nextDate.getTime <= now.getTime) { nextDate.setDate(nextDate.getDate + 50); if ((nextDate.getFullYear) % 4 === 0) nowDay += 1 / 7; i += 1; }   while (nextDateConsole.getTime <= now.getTime) { nextDateConsole.setDate(nextDateConsole.getDate + 50); if ((nextDateConsole.getFullYear) % 4 === 0) nowDayConsole += 1 / 7; j += 1; }   while (nextDateSwitch.getTime <= now.getTime) { nextDateSwitch.setDate(nextDateSwitch.getDate + 50); if ((nextDateSwitch.getFullYear) % 4 === 0) nowDaySwitch += 1 / 7; k += 1; }   var nextdiff = (nextDate - start) + ((start.getTimezoneOffset - nextDate.getTimezoneOffset) * 60 * 1000); var nextdiffConsole = (nextDateConsole - start) + ((start.getTimezoneOffset - nextDateConsole.getTimezoneOffset) * 60 * 1000); var nextdiffSwitch = (nextDateSwitch - start) + ((start.getTimezoneOffset - nextDateSwitch.getTimezoneOffset) * 60 * 1000); var nextDay = Math.floor(nextdiff / oneDay); var nextDayConsole = Math.floor(nextdiffConsole / oneDay); var nextDaySwitch = Math.floor(nextdiffSwitch / oneDay); var daysleft = nextDay - Math.round(nowDay); var daysleftConsole = nextDayConsole - Math.round(nowDayConsole); var daysleftSwitch = nextDaySwitch - Math.round(nowDaySwitch); var hoursleft = 23 - now.getUTCHours; var minutesleft = 59 - now.getUTCMinutes; var secondsleft = 59 - now.getUTCSeconds;

if(daysleft < 0) daysleft = 365 + daysleft; if(daysleft < 10) daysleft = "0" + daysleft; if(daysleftConsole < 0) daysleftConsole = 365 + daysleftConsole; if(daysleftConsole < 10) daysleftConsole = "0" + daysleftConsole; if(daysleftSwitch < 0) daysleftSwitch = 365 + daysleftSwitch; if(daysleftSwitch < 10) daysleftSwitch = "0" + daysleftSwitch; if(hoursleft < 10) hoursleft = "0" + hoursleft; if(minutesleft < 10) minutesleft = "0" + minutesleft; if(secondsleft < 10) secondsleft = "0" + secondsleft;

$('#tribute-countdown-PC').html("The " + 50 * i + "th Milestone will be available in " + daysleft + "d " + hoursleft + "h " + minutesleft + "m " + secondsleft + "s"); $('#tribute-countdown-Console').html("The " + 50 * j + "th Milestone will be available in " + daysleftConsole + "d " + hoursleft + "h " + minutesleft + "m " + secondsleft + "s"); $('#tribute-countdown-Switch').html("The " + 50 * k + "th Milestone will be available in " + daysleftSwitch + "d " + hoursleft + "h " + minutesleft + "m " + secondsleft + "s"); } TributeCountdown; setInterval(TributeCountdown, 1000); /* Daily Tribute END */ /* FINNER/Test10 END */

/////////////////////////////////////////////////////////////////////////////////   /* FINNER/Dupes START *

dil = new Array; function findDupImages(gf) { output = ""; url = "/api.php?action=query&generator=allimages&prop=duplicatefiles&gailimit=5000&format=json"; if (gf) url += "&gaifrom=" + gf; $.getJSON(url,function (data) { if (data.query) { pages = data.query.pages; for (pageID in pages) { dils = ","+dil.join; if (dils.indexOf(","+pages[pageID].title) == -1 && pages[pageID].title.indexOf("File::") == -1 && pages[pageID].duplicatefiles) { output += " "+pages[pageID].title+" \n\n"; for (x=0;xFile:"+pages[pageID].duplicatefiles[x].name+"\n"; dil.push("File:"+pages[pageID].duplicatefiles[x].name.replace(/_/g," ")); } output += "\n\n"; } } $("#mw-dupimages").append(output); if (data["query-continue"]) setTimeout("findDupImages('"+data["query-continue"].allimages.gaifrom+"');",5000); } }); } $(function { if ($("#mw-dupimages").length) findDupImages; });

/* FINNER/Dupes END */