// SET STAT VARIABLES var statWorldPop =7202951778; // UN Census //2014 var statWorldPopGrowth=81664687; // UN Pop Growth //2014 // POPULATION PAGE 1 DEMOGRAPHICS var pwcstat1 = 135585505; // Births (pre 141147017) var pwcstat2 = 53920818; // Deaths (pre 59108127) var pwcstat3 = .0928491; // Age 0-4 var pwcstat4 = .2611457; // Age 5-19 var pwcstat5 = .5693000; // Age 20-64 var pwcstat6 = .0766542; // Age 65-99 var pwcstat7 = .0000511; // Age 100+ var pwcstat8 = 7244880029; // UN Upper Projection var pwcstat8b = 97984000; // UN Upper Projection Growth var pwcstat9 = 7161457885; // UN Lower Projection var pwcstat9b = 65255000; // UN Lower Projection Growth var pwcstat10 = 7137783669; // US Census Projection var pwcstat10b = 77237094; // US Census Projection Growth // MAKE STAT function ms( statidnum, statlabel, staty){ return '
' + statlabel + '
--
'; } //UPDATE STAT function us(statnum, statformula){ document.getElementById("pwcstatdata" + statnum).innerHTML = Math.floor(eval(statformula)).toLocaleString('en'); } function editpage(){ PopWorld = Math.floor(statWorldPop+statWorldPopGrowth*yrF); document.getElementById("pwcstatprogress1").value=((statWorldPop+statWorldPopGrowth*yrF)-Math.floor(statWorldPop+statWorldPopGrowth*yrF))*100; document.getElementById("pwcstatdata1").innerHTML = PopWorld.toLocaleString('en'); us(2, "pwcstat1*yrFD"); us(3, "pwcstat2*yrFD"); us(4, "(pwcstat1-pwcstat2)*yrFD"); us(5, "PopWorld*pwcstat3"); us(6, "PopWorld*pwcstat4"); us(7, "PopWorld*pwcstat5"); us(8, "PopWorld*pwcstat6"); us(9, "PopWorld*pwcstat7"); us(10, "pwcstat8+pwcstat8b*yrF"); us(11, "pwcstat9+pwcstat9b*yrF"); us(12, "pwcstat10+pwcstat10b*yrF"); } var pwcbodycontent = '
World Population
--
' + '
' + ms(2, "Births", 120)+ ms(3, "Deaths *", 150)+ ms(4, "Population Growth", 180)+ '
' + ms(5, "Babies", 220)+ ms(6, "Youth (5 - 19)", 250)+ ms(7, "Adults (20 - 64)", 280)+ ms(8, "Seniors (65 - 99)", 310)+ ms(9, "100 + Years Old", 340)+ '
' + ms(10, "UN Projected Range ↑", 380)+ ms(11, "↓", 410)+ ms(12, "US Census Projection", 440)+ '
Detailed information and sources below
'; // STUFF ABOVE CHANGES WITH PAGE. STUFF BELOW HAS NO CHANGES document.getElementById("poodwaddleworldclock").innerHTML = ' ' + '
' + pwcbodycontent + '
'+ '
'; // set clocks variables var latime="2017/10/19 13:17:27"; var nytime="2017/10/19 16:17:27"; var londontime="2017/10/19 21:17:27"; var tokyotime="2017/10/20 05:17:27"; var d = new Date(); dtime = d.getTime(); var ladate = new Date(latime); var nydate = new Date(nytime); var londondate = new Date(londontime); var tokyodate = new Date(tokyotime); latimedif = ladate.getTime() - dtime; nytimedif = nydate.getTime() - dtime; londontimedif = londondate.getTime() - dtime; tokyotimedif = tokyodate.getTime() - dtime; /* INTRO -----------------------------------------------------------------*/ function switchpage(selectory, pg){ document.getElementById("pwcselector").style.top = selectory + "px"; document.getElementById("pwcbody").style.opacity = "0"; window.location = "http://www.poodwaddle.com/worldclock/" + pg; } /* FILTER MENU ------------------------------------------------------------------ */ function filteryr(){ wcfilter="yr"; document.getElementById("pwcfilterlight").style["left"] = "354px"; if(wcfilterpaused==true)filterpause(); dt = new Date(filterYr, 0, 1); offsetTime = dt.getTime(); } function filtermth(){ wcfilter="mth"; document.getElementById("pwcfilterlight").style["left"] = "396px"; if(wcfilterpaused==true)filterpause(); dt = new Date(filterYr, filterMth, 1); offsetTime = dt.getTime(); } function filterwk(){ wcfilter="wk"; document.getElementById("pwcfilterlight").style["left"] = "438px"; if(wcfilterpaused==true)filterpause(); dt = new Date(filterYr, filterMth, filterDt - filterDay); offsetTime = dt.getTime(); } function filterday(){ wcfilter="day"; document.getElementById("pwcfilterlight").style["left"] = "483px"; if(wcfilterpaused==true)filterpause(); dt = new Date(filterYr, filterMth, filterDt); offsetTime = dt.getTime(); } function filternow(){ wcfilter="now"; document.getElementById("pwcfilterlight").style["left"] = "530px"; if(wcfilterpaused==true)filterpause(); dt = new Date(filterYr, filterMth, filterDt, filterHr, filterMin, filterSec, filterMs); offsetTime = dt.getTime(); } function filterpause(){ if(wcfilterpaused){ wcfilterpaused = false; document.getElementById("pwcfilterpauseoff").style.visibility="visible"; }else{ wcfilterpaused = true; document.getElementById("pwcfilterpauseoff").style.visibility="hidden"; } } var msInThisYear = 31536000000; var msStartOf2014 = 1388563200000; // VARIABLES FOR THE FILTER PERIODS var wcfilter; var wcfilterpaused = false; var dt = new Date(); var filterYr = dt.getFullYear(); var filterMth = dt.getMonth(); var filterDt = dt.getDate(); var filterDay = dt.getDay(); var filterHr = dt.getHours(); var filterMin = dt.getMinutes(); var filterSec = dt.getSeconds(); var filterMs = dt.getMilliseconds(); // SET THE DEFAULT YEAR OFFSET (THE MILLISECONDS AT THE START OF THE CURRENT YEAR) dt = new Date(filterYr, 0, 1); var offsetTime = dt.getTime(); var yrF; var yrFD; var filterNowMs; var timerDays; var timerHrs; var timerMins; var timerMinsTxt; var timerSecs; var timerSecsTxt; var PopWorld; // RESET DATE FOR THE FIRST SETTINGS OF THE CYCLE TIMER dt = new Date(); var wccycletime = dt.getTime(); /* BRAIN FUNCTION -----------------------------------------------------------------*/ function brain(){ if(wcfilterpaused==false) { // SET DATE VARIABLES FOR FILTERS dt = new Date(); filterYr = dt.getFullYear(); filterMth = dt.getMonth(); filterDt = dt.getDate(); filterDay = dt.getDay(); filterHr = dt.getHours(); filterMin = dt.getMinutes(); filterSec = dt.getSeconds(); filterMs = dt.getMilliseconds(); // SET YEAR FRACTIONS filterNowMs = dt.getTime(); yrF = (filterNowMs - msStartOf2014) / msInThisYear; // THIS YEAR FRACTION IS FOR STATS THAT DO NOT GET FILTERED (WORLD POP FOR EXAMPLE) yrFD = (filterNowMs - offsetTime) / msInThisYear; // YEAR FRACTION DYNAMIC IS THE FRACTION OF THE YEAR EXPIRED DYNAMICALLY SET BY THE FILTERED TIME PERIOD // SET TIMER timerDays = Math.floor((filterNowMs - offsetTime) / 86400000); timerHrs = Math.floor(((filterNowMs - offsetTime) / 86400000 - timerDays) * 86400000 / 3600000); timerMins = Math.floor((((filterNowMs - offsetTime) / 86400000 - timerDays) * 86400000 / 3600000 - timerHrs) * 3600000 / 60000); timerMinsTxt = timerMins.toString(); if (timerMins < 10)timerMinsTxt = "0" + timerMins.toString(); timerSecs = Math.floor(((((filterNowMs - offsetTime) / 86400000 - timerDays) * 86400000 / 3600000 - timerHrs) * 3600000 / 60000 - timerMins) * 60000 / 1000); timerSecsTxt = timerSecs.toString(); if (timerSecs < 10)timerSecsTxt = "0" + timerSecs.toString(); document.getElementById("pwcfiltercounter").innerHTML = timerDays + " days " + timerHrs + ":" + timerMinsTxt + ":" + timerSecsTxt; editpage(); } setclock(); } setInterval(function(){brain()},33); //CLOCK var monthnames = [ "JAN", "FEB", "MAR", "APR", "MAY", "JUNE", "JULY", "AUG", "SEP", "OCT", "NOV", "DEC" ]; var weeknames = [ "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]; function setclock() { var d = new Date(); var clockhr=0; var clockampm="AM"; var deg; var hr = d.getHours(); var min = d.getMinutes(); clockhr = hr; if(hr<12){ if(hr==0)clockhr=12; clockampm="AM"; }else{ clockhr-=12; if(hr==12)clockhr=12; clockampm="PM"; } deg = (hr*30+min/2)-90; var div = document.getElementById('pwcclk1hrhand'); document.getElementById("pwcclk1digitalhr").innerHTML = clockhr; document.getElementById("pwcclk1digitalampm").innerHTML = clockampm; div.style.webkitTransform = 'rotate('+deg+'deg)'; div.style.mozTransform = 'rotate('+deg+'deg)'; div.style.msTransform = 'rotate('+deg+'deg)'; div.style.oTransform = 'rotate('+deg+'deg)'; div.style.transform = 'rotate('+deg+'deg)'; deg = min*6-90; if(min<10){ document.getElementById("pwcclk1digitalmin").innerHTML = "0" + min; }else{ document.getElementById("pwcclk1digitalmin").innerHTML = min; } div = document.getElementById('pwcclk1minhand'); div.style.webkitTransform = 'rotate('+deg+'deg)'; div.style.mozTransform = 'rotate('+deg+'deg)'; div.style.msTransform = 'rotate('+deg+'deg)'; div.style.oTransform = 'rotate('+deg+'deg)'; div.style.transform = 'rotate('+deg+'deg)'; deg = d.getSeconds()*6-90; div = document.getElementById('pwcclk1sechand'); div.style.webkitTransform = 'rotate('+deg+'deg)'; div.style.mozTransform = 'rotate('+deg+'deg)'; div.style.msTransform = 'rotate('+deg+'deg)'; div.style.oTransform = 'rotate('+deg+'deg)'; div.style.transform = 'rotate('+deg+'deg)'; document.getElementById("pwcclk1digitaldate").innerHTML = d.getDate(); document.getElementById("pwcclk1digitalmth").innerHTML = monthnames[d.getMonth()]; document.getElementById("pwcclk1digitalweekday").innerHTML = weeknames[d.getDay()]; // clock 2 var d2 = new Date(d.getTime()+latimedif); hr = d2.getHours(); min = d2.getMinutes(); var day = d2.getDay(); setclk(2, hr, min, day); // clock 3 var d3 = new Date(d.getTime()+nytimedif); hr = d3.getHours(); min = d3.getMinutes(); day = d3.getDay(); setclk(3, hr, min, day); // clock 4 var d4 = new Date(d.getTime()+londontimedif); hr = d4.getHours(); min = d4.getMinutes(); day = d4.getDay(); setclk(4, hr, min, day); // clock 5 var d5 = new Date(d.getTime()+tokyotimedif); hr = d5.getHours(); min = d5.getMinutes(); day = d5.getDay(); setclk(5, hr, min, day); } function setclk(divnum, sethr, setmin, setday){ var clockhr = sethr; if(sethr<12){ if(sethr==0)clockhr=12; var clockampm="AM"; }else{ clockhr-=12; if(sethr==12)clockhr=12; var clockampm="PM"; } deg = (sethr*30+setmin/2)-90; div = document.getElementById('pwcclk' + divnum + 'hrhand'); div.style.webkitTransform = 'rotate('+deg+'deg)'; div.style.mozTransform = 'rotate('+deg+'deg)'; div.style.msTransform = 'rotate('+deg+'deg)'; div.style.oTransform = 'rotate('+deg+'deg)'; div.style.transform = 'rotate('+deg+'deg)'; deg = setmin*6-90; if(setmin<10){ document.getElementById("pwcclk" + divnum + "dig").innerHTML = clockhr + ":0" + setmin + " " + clockampm; }else{ document.getElementById("pwcclk" + divnum + "dig").innerHTML = clockhr + ":" + setmin + " " + clockampm; } div = document.getElementById('pwcclk' + divnum + 'minhand'); div.style.webkitTransform = 'rotate('+deg+'deg)'; div.style.mozTransform = 'rotate('+deg+'deg)'; div.style.msTransform = 'rotate('+deg+'deg)'; div.style.oTransform = 'rotate('+deg+'deg)'; div.style.transform = 'rotate('+deg+'deg)'; document.getElementById("pwcclk" + divnum + "day").innerHTML = weeknames[setday]; } // SET UP STARTING FILTER BASED ON HASH. THIS SHOULD BE AT END OF CODE // FOR THE PUBLIC VERSION HASHES ARE NOT SET AND YEAR IS DEFAULT filteryr(); window.onload = function() { document.getElementById("pwcbody").style.opacity = "1.0"; document.getElementById("pwcselector").style.top = "30px"; }