User:FINNER/common.js

/* FINNER/Test10 START */ /* Daily Tribute START */ function TributeCountdown { var seedDate = '"' + tribute-countdown.innerText + '"'; var now = new Date; var i = 0; var nextDate = new Date(seedDate); 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 + 50); if ((nextDate.getFullYear) % 4 === 0) nowDay += 1 / 7; i += 1; }   var nextdiff = (nextDate - start) + ((start.getTimezoneOffset - nextDate.getTimezoneOffset) * 60 * 1000); var nextDay = Math.floor(nextdiff / oneDay); var daysleft = nextDay - Math.round(nowDay); 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(hoursleft < 10) hoursleft = "0" + hoursleft; if(minutesleft < 10) minutesleft = "0" + minutesleft; if(secondsleft < 10) secondsleft = "0" + secondsleft;

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

/* Sortie Countdown START * function SortieCountdown {	var now = new Date; var hoursleft = 23 - now.getUTCHours + 16; var minutesleft = 59 - now.getUTCMinutes; var secondsleft = 59 - now.getUTCSeconds;

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

$('#sortie-countdown').html(hoursleft + "h " + minutesleft + "m " + secondsleft + "s"); } SortieCountdown; setInterval(SortieCountdown, 1000); /* Sortie Countdown 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 */