So I'm beginning to think that hope for developing a k2 clock kindlet is doomed. That's fine. No worries. What about the browser? clocktab.com does not seem to work in my k2i's experimental browser. I see 3 possible solutions:
1. Figure out a way to get clocktab.com working
2. Find another, similar clock site which works
3. Build our own html clock site and run it locally on the kindle
Of the 3, my guess is #3 has the best chances, but alas, I know no html. If you decide to be a wonderful person and code one for me, I'd like the time in AM/PM format with no seconds, and the date, preferably with the month spelled out. Do you think you can help me out? Thanks!
Last edited by space_escalator; 09-02-2015 at 12:29 AM.
Reason: make it clear I want a clock
So I'm beginning to think that hope for developing a k2 clock kindlet is doomed.
That's fine.
No worries.
What about the browser?
clocktab.com does not seem to work in my k2i's experimental browser.
Please give details beyond: "doe not work".
Tell us each thing you have tried and the specifics about each result.
Quote:
Originally Posted by space_escalator
I see 3 possible solutions:
1. Figure out a way to get clocktab.com working
2. Find another, similar clock site which works
3. Build our own html clock site and run it locally on the kindle
So tell us how it is failing for you, other than "not working".
Similar in what way? Works in what manner?
Run the custom client on the Kindle? Run the server on the Kindle? Both? Neither?
Details please, be specific.
Quote:
Originally Posted by space_escalator
Of the 3, my guess is #3 has the best chances, but alas, I know no html. If you decide to be a wonderful person and code one for me, I'd like the time in AM/PM format with no seconds, and the date, preferably with the month spelled out. Do you think you can help me out? Thanks!
Have you tried first to port known, working, "Kindle as a ... Display" applications to the K2i?
There are at least two (probably more) project threads to look at here - -
Using a Kindle to display the weather.
One uses an Internet source of weather information -
One uses a locally generated source of weather information.
It is often better to work on a piece-wise development - -
Move to the K2i something similar, known to work, from another model Kindle.
**AND** describe what works, what doesn't, and what does happen.
From reading that, you see that the page is implemented in (minified) Javascript:
(This horrid glob I will spoiler - it needs to be un-minified at the very least.)
Spoiler:
Code:
(function(){if("undefined"!==typeof document&&(document.head=document.head||document.getElementsByTagName&&document.getElementsByTagName("head")[0],document.body=document.body||document.getElementsByTagName&&document.getElementsByTagName("body")[0],!Element.prototype.hasOwnProperty("classList"))){var r=/^\s+|\s+$/g,g=function(g,k){if(""===k)throw"SYNTAX_ERR";if(/\s/.test(k))throw ml.assert(!1),"INVALID_CHARACTER_ERR";return g.indexOf(k)},u=function(){var i=this,k=i.className.replace(r,"").split(/\s+/);
return{length:k.length,item:function(g){return k[g]||null},contains:function(i){return-1!==g(k,i)},add:function(q){-1===g(k,q)&&(k.push(q),this.length=k.length,i.className=k.join(" "))},remove:function(q){q=g(k,q);-1!==q&&(k.splice(q,1),this.length=k.length,i.className=k.join(" "))},toggle:function(i){-1===g(k,i)?this.add(i):this.remove(i)},toString:function(){return i.className}}};Object.defineProperty?Object.defineProperty(Element.prototype,"classList",{get:u}):Object.prototype.__defineGetter__&&
Element.prototype.__defineGetter__("classList",u)}})();var ml={};
(function(){ml.date={};var r=function(a){return 10>a?"0"+a:""+a},g="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),u="January February March April May June July August September October November December".split(" ");ml.date.getWeek=function(a){dowOffset="int"==typeof dowOffset?dowOffset:0;var b=new Date(a.getFullYear(),0,1),c=b.getDay()-dowOffset,c=0<=c?c:c+7,b=Math.floor((a.getTime()-b.getTime()-6E4*(a.getTimezoneOffset()-b.getTimezoneOffset()))/864E5)+1;4>c?(c=Math.floor((b+
c-1)/7)+1,52<c&&(nYear=new Date(a.getFullYear()+1,0,1),nday=nYear.getDay()-dowOffset,nday=0<=nday?nday:nday+7,c=4>nday?1:53)):c=Math.floor((b+c-1)/7);return c};ml.date.add=function(a,b,c,d,e){void 0===e&&(e=0);e=a.getMilliseconds()+e;d=a.getSeconds()+d+e/1E3;c=a.getMinutes()+c+d/60;b=a.getHours()+b+c/60;a.setHours(b%24,c%60,d%60,e%1E3);a.setUTCDate(a.getUTCDate()+b/24);return a};ml.date.getDayBegining=function(a){a=new Date(+a);return+new Date(a.getFullYear(),a.getMonth(),a.getDate())};ml.date.readable=
{};ml.date.readable.getHours=function(a,b){var c=a.getHours();b&&(c%=12,0==c&&(c=12));return r(c)};ml.date.readable.getMinutes=function(a){return r(a.getMinutes())};ml.date.readable.getSeconds=function(a){return r(a.getSeconds())};ml.date.readable.getDate=function(a){return r(a.getDate())};ml.date.readable.getDay=function(a){return g[a.getDay()]};ml.date.readable.getMonth=function(a){return u[a.getMonth()]};ml.date.readable.getTime=function(a,b,c,d){ml.assert(void 0!==b&&b.constructor===Number);ml.assert(void 0===
c||c.constructor===Number);ml.assert(void 0===d||d.constructor===Number);ml.assert("timer"===a||"time"===a||"time12"===a||"time12_pretty"===a||"countdown"===a||"data"===a);var e="timer"===a,f="timer"===a||"countdown"===a,j="time12"===a||"time12_pretty"===a;if(12<b.toString().length&&(ml.assert("time"===a||"time12"===a||"time12_pretty"===a||"data"===a),b-=ml.date.getDayBegining(b),j)){var h=432E5<=b;h&&(b-=432E5)}var p=[1E3,60,60],l=["ms","s","m","h"];void 0===c&&(c=1);void 0===d&&(d=0);c+=d;for(ml.assert(c<=
p.length);d--;)b/=p[c-(d+1)];b=parseInt(b,10);p.splice(0,c);l.splice(0,c);c=[];for(d=0;d<p.length+1;d++){for(var m=b,g=d-1;0<=g;g--)m/=p[g];c.push(m%(p[d]||Infinity)|0)}if(f)for(;0===c[c.length-1]&&1<c.length;)c.pop();j&&0===c[c.length-1]&&(c[c.length-1]=12);if(e){for(var i=c.length;0===c[0]&&1<c.length;)c.shift();i-=c.length}if(!e)for(d=0;d<c.length;d++)c[d]="00".substring(0,((p[d]||100)-1).toString().length-c[d].toString().length)+c[d];if(e){l.splice(0,i);for(d=0;d<c.length;d++)c[d]+=l[d]}c.reverse();
if("data"===a)return c;c=c.join(e?" ":":");j&&("time12_pretty"===a&&(c=c.replace(/:00$/,"").replace(/^0/,"")),c=c+" "+(h?"PM":"AM"));return c};ml.element={};ml.element.getStyle=function(a,b){return document.defaultView.getComputedStyle(a,null).getPropertyValue(b)};ml.element.getPosition=function(a){var b=0,c=0;do b+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent);return{x:b,y:c}};var i=function(a){a=document.createElement(a||"div");a.style.display="inline-block";a.style.position="absolute";a.style.top=
"0";a.style.top="-9999px";a.style.zIndex="-9999";a.style.visibility="hidden";return a},k=function(a,b,c,d,e){var f=a.innerHTML;f.length<(e&&e.length)&&(f=e);1>f.length&&(f="y");if(d){ml.assert(0===a.children.length);for(var j,e=-1,h=document.body.appendChild(i()),p=0;p<d.length;p++){h.innerHTML=d[p];var l=parseInt(ml.element.getStyle(h,"width"),10);l>e&&(e=l,j=d[p])}document.body.removeChild(h);ml.assert(j);d=j;j=f.length;f="";for(e=0;e<j;e++)f+=d}d=i(a.tagName);d.style.fontFamily=ml.element.getStyle(a,
"font-family");d.style.fontSize=q+"px";d.style.whiteSpace="nowrap";d.style.letterSpacing=ml.element.getStyle(a,"letter-spacing");d.innerHTML=f;document.body.appendChild(d);a=b&&parseInt(ml.element.getStyle(d,"width"),10);f=c&&parseInt(ml.element.getStyle(d,"height"),10);b=Math.min(c?c/f:Infinity,b?b/a:Infinity);return{fontSize:b*q,width:b*a,height:b*f}},q=100,J=null;ml.adjustFontSize=function(a,b,c,d){function e(a,b){return parseInt(ml.element.getStyle(a,b)||0,10)}var f=a.innerHTML.length;if(f!==
a._oldTextLength){a._oldTextLength=f;a._ml_textSizeRatioCache||(a._ml_textSizeRatioCache={});if(a._ml_textSizeRatioCache[f])return a._ml_textSizeRatioCache[f];var f=e(a,"width"),j;c||(j=e(a,"height"));null===J&&(J=["box-sizing","-moz-box-sizing","-o-box-sizing","-ms-box-sizing","-webkit-box-sizing"].filter(function(a){return void 0!==document.createElement("div").style[a]})[0]);J&&"border-box"===ml.element.getStyle(a,J)&&(f-=e(a,"border-left")+e(a,"border-right")+e(a,"padding-left")+e(a,"padding-right"),
j&&(j-=e(a,"border-top")+e(a,"border-bottom")+e(a,"padding-top")+e(a,"padding-bottom")));a.style.fontSize=Math.floor(k(a,f,j,b,d).fontSize)+"px";ml.assert("block"===ml.element.getStyle(a,"display")||"inline-block"===ml.element.getStyle(a,"display")||"table-cell"===ml.element.getStyle(a,"display"),"ml.element.getStyle(el,'display')=="+ml.element.getStyle(a,"display"),1)}};ml.getTextSize=function(a,b,c){return k(a,b,c)};ml.showBrowserHint=function(a,b){var c={init:function(){this.browser=this.searchString(this.dataBrowser);
this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)},searchString:function(a){for(var b=0;b<a.length;b++){var c=a[b].string,e=a[b].prop;this.versionSearchString=a[b].versionSearch||a[b].identity;if(c){if(-1!=c.indexOf(a[b].subString))return a[b].identity}else if(e)return a[b].identity}},searchVersion:function(a){var b=a.indexOf(this.versionSearchString);if(-1!=b)return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,
subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},
{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",
identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};c.init();var d="<div style='padding: 30px'>",e="in order to use "+a+' download the latest version of your browser at <a target="_blank" href=';if(c.browser){var f=c.browser;"Chrome"===f?(f="Google Chrome",e+="'http://www.google.com/chrome/'>www.google.com/chrome</a>"):"Firefox"===f?e+="'http://www.mozilla.com/firefox/'>www.mozilla.com/firefox</a>":"Safari"===f?e+="'http://www.apple.com/safari/download/'>www.apple.com/safari/download</a>":
"Explorer"===f?(f="Internet Explorer",e="in order to use "+a+" install the Google Chrome Frame plug-in at <a target='_blank' href='http://code.google.com/chrome/chromeframe/'>http://code.google.com/chrome/chromeframe</a>"):e=null;d+="you are using the browser "+f;c.version&&(d+=" "+c.version);d+="<br><br>";e&&(d+=e+".<br><br>")}d+=a+" supports following browsers:<br> <ul> <li><b>Internet Explorer</b> with the <b>Google Chrome Frame</b> plug-in</li> <li><b>Firefox 3.5</b> or higher</li> <li><b>Safari 5</b> or higher</li> <li><b>Google Chrome 4</b> or higher</li> </ul> ";
b&&(d+="<br>"+b);document.body.innerHTML=d+"</div>"};"undefined"!==typeof window&&window.console&&(window.console.print=function(a){window.console.log(JSON.stringify(a))},window.console.printStack=function(){window.console&&window.console.log&&window.console.log(Error().stack)});ml.assert=function(a,b,c,d){if("undefined"!==typeof window&&!a){var e=Error().stack,f;c||(c=0);c++;ml.browser().usesGecko&&(window.console&&window.console.log)&&window.console.log(e);if(e){do e=e.replace(/.*[\s\S]/,"");while(c--);
f=/[^\/]*$/.exec(e.split("\n")[0]).toString().replace(/\:[^\:]*$/,"")}f="assertion fail at "+f;void 0!==b&&(f+=" ("+(b.join&&b.join(",")||b)+")");if(d)throw f;var j="localhost"===window.location.hostname;if(-1===window.navigator.userAgent.indexOf("MSIE")){window.console&&(window.console.log&&!j)&&window.console.log(f);for(var h=3;h<arguments.length;h++)window.console&&window.console.log?window.console.log(arguments[h]):f+=arguments[h]+"\n";j&&window.alert(f+"\n"+e);if(j)throw f;}}};var F,A=[];ml.addTactFct=
function(a){A.push(a);F||(F=window.setInterval(function(){for(var a in A)A[a]()},150))};ml.hash={};ml.hash.get=function(){var a=location.hash.substring(1);ml.browser().isSafari&&(a=a.replace(/%23/g,"#"));return a};ml.hash.set=function(a){a[0]&&"#"===a[0]&&(a="#"+a);location.hash=a};ml.hash.isClear=function(){return""===ml.hash.get()};ml.hash.clear=function(){0===scrollY&&0===scrollX?location.hash="#":(this.listenerAdded||(ml.addHashListener(function(){var a=ml.hash.get();if("##"===a||"%23%23"===a)a=
[scrollX,scrollY],location.hash="#",scrollTo(a[0],a[1])}),this.listenerAdded=!0),location.hash="###")};ml.addHashListener=function(a,b){if(void 0!==window.onhashchange)window.addEventListener("hashchange",function(){a()},!1);else{var c=location.hash;ml.addTactFct(function(){location.hash!=c&&(c=location.hash,a())})}b&&a()};ml.getKeyNum=function(a){if(a.mlKeyCode)return a.mlKeyCode;if(window.event)return a.keyCode;if(a.which)return a.which;if(a.keyCode)return a.keyCode};ml.controlKeyPressed=function(a){return a.ctrlKey||
a.altKey||a.metaKey};var C;ml.changeIcon=function(a){var b=ml.browser().usesGecko;if(!C||b){for(var b=document.getElementsByTagName("link"),c=0;c<b.length;c++)"icon"==b[c].getAttribute("rel").toLowerCase()&&document.head.removeChild(b[c]);C=document.createElement("link");C.rel="icon";C.type="image/png";document.head.appendChild(C)}C.href=a};ml.canvasIcon=function(a){var b=document.createElement("canvas");b.height=32;b.width=32;var c=b.getContext("2d");a(c);ml.changeIcon(b.toDataURL())};ml.timeIcon=
function(a,b,c){a||(a=1);b||(b="black");var d=new Date,e=document.createElement("canvas");e.height=32/a;e.width=32/a;var f=e.getContext("2d");f.fillStyle=b;f.font=Math.floor(15/a)+"pt arial";f.fillText(ml.date.readable.getHours(d,c),0,ml.browser().usesGecko?15/a:14/a);f.font=16/a+"pt arial";f.fillText(ml.date.readable.getMinutes(d),5/a,32/a);return e.toDataURL()};ml.doneIcon=function(a,b,c){var d=document.createElement("canvas"),e=d.getContext("2d");d.height=a;d.width=a;e.clearRect(0,0,a,a);var f=
e.createLinearGradient(0,0,0,a);f.addColorStop(0,c);f.addColorStop(1,b);e.fillStyle=f;e.beginPath();var j=[a/20,-a/4],b=[0,a/2],c=[a/10,a/2],f=[a/4,a-a/4],h=[a-a/10,0],p=[a,0],l=[a,a/10],m=[a/4,a],g=[m[0]+j[0]+a/10,m[1]+j[1]-a/10],i=[0,a/2+a/10],P=[m[0]-a/10,m[1]-a/10],P=[P[0]+a/40,P[1]-a/40],a=[f[0]+j[0],f[1]+j[1]];e.moveTo(b[0],b[1]);e.lineTo(c[0],c[1]);e.lineTo(f[0],f[1]);e.lineTo(P[0],P[1]);e.quadraticCurveTo(a[0],a[1],h[0],h[1]);e.lineTo(p[0],p[1]);e.lineTo(l[0],l[1]);e.quadraticCurveTo(g[0],
g[1],m[0],m[1]);e.lineTo(m[0],m[1]);e.lineTo(i[0],i[1]);e.lineTo(b[0],b[1]);e.fill();return d.toDataURL()};ml.getColorImageURL=function(a,b){b||(b=1);arguments.callee.urls||(arguments.callee.urls={});var c=arguments.callee.urls;if(!c[a]){var d=document.createElement("canvas");d.height=32/b;d.width=32/b;var e=d.getContext("2d");e.scale(1/b,1/b);e.fillStyle=a;e.fillRect(0,0,300,150);c[a]=d.toDataURL()}return c[a]};ml.timerIcon=function(a,b,c,d){ml.assert(void 0===c);ml.assert(void 0===d);if(0>=a&&b)return ml.getColorImageURL(0===
Math.abs(a)%2?"#e11":"transparent",16);0>=a&&(a=0);c=document.createElement("canvas");c.height=16;c.width=16;var d=c.getContext("2d"),e=a/60|0,f=99<e;f&&(e%=60);var j=f?a/3600|0:e,a=f?e:a%60;if(void 0!==b&&null!==b){ml.assert(1>=b&&0<=b,"percent==="+b);e=c.height;f=c.width;d.fillStyle="transparent";d.fillRect(0,0,f,e);d.moveTo(f/2,0);var h=(2*e+2*f)*b;h<=f/2?h=[f/2+h,0]:(d.lineTo(f,0),h<=f/2+e?h=[f,h-f/2]:(d.lineTo(f,e),h<=f/2+e+f?h=[f-(h-f/2-e),e]:(d.lineTo(0,e),h<=f/2+e+f+e?h=[0,e-(h-f/2-e-f)]:
(ml.assert(h<=f/2+e+f+e+f/2,b),d.lineTo(0,0),h=[h-(f/2+e+f+e),0]))));d.lineTo(h[0],h[1]);d.lineTo(f/2,e/2);d.fillStyle="#aaf";d.fill()}else d.fillStyle="transparent",d.fillRect(0,0,d.canvas.height,d.canvas.width);d.fillStyle="black";0<j?(d.font="7pt arial",d.fillText(appendZero(j),0,7),d.font="9pt arial",d.fillText(appendZero(a),2,16)):(d.font="10pt arial",d.textAlign="center",d.fillText(a,8+(1===a.length?1:0),12+(ml.browser().usesGecko?1:0)));return c.toDataURL()};ml.circleIcon=function(a,b,c){var d=
document.createElement("canvas"),e=d.getContext("2d");d.height=b;d.width=b;c||(c=[-4,0]);var f=4<a.length?b/3:1==a.length?b:b/2,j=(b-1)/2,h=(b-1)/2,b=b/2-f/2,g;for(g in a){var l=2*Math.PI*g/a.length,m=Math.cos(l)*b-f/2+j+c[0],l=Math.sin(l)*b-f/2+h+c[1];e.drawImage(a[g],m,l,f,f)}return d.toDataURL()};ml.dooityRandColor=function(a,b){function c(){var a,b;if(0===e.length)a=d[0][0];else{var c=Math.floor(Math.random()*e.length);a=e[c][0];b=e[c][1];e.splice(c,1)}b||(b=a,b=[parseInt(b[0]+(255-b[0])/2,10),
parseInt(b[1]+(255-b[1])/2,10),parseInt(b[2]+(255-b[2])/2,10)]);return["rgb("+a[0]+","+a[1]+","+a[2]+")","rgb("+b[0]+","+b[1]+","+b[2]+")"]}var d=[[[71,183,230],[181,226,245]],[[43,171,51]],[[250,27,228]],[[29,189,207]],[[191,82,255]],[[174,82,255]],[[223,45,0]],[[237,85,85]]];a&&(d=[[[100,100,100]]]);var e=d.slice();if(b){for(var f=[];b--;)f.push(c());return f}return c()};ml.webReq=function(a,b,c,d){var e=new XMLHttpRequest,f=arguments.callee;e.onreadystatechange=function(){4==e.readyState&&(c&&
c(e.responseText),d&&(d.pendingReqs--,0===d.pendingReqs&&d()),f.pendingReqs--,0===f.pendingReqs&&f.reqsCallback&&f.reqsCallback())};var g="GET";"GET"==b?b=null:b&&(g="POST");e.open(g,a,!0);"POST"===g&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded");e.send(b);d&&(d.pendingReqs||(d.pendingReqs=0),d.pendingReqs++);f.pendingReqs||(f.pendingReqs=0);f.pendingReqs++};ml.getUrlVars=function(){for(var a=[],b,c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),
d=0;d<c.length;d++)b=c[d].split("="),a.push(b[0]),a[b[0]]=window.decodeURIComponent(b[1]);return a};ml.deleteCookies=function(){for(var a=document.cookie.split(";"),b=0;b<a.length;b++){var c=a[b].indexOf("="),c=-1<c?a[b].substr(0,c):a[b];document.cookie=c+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT"}};var K;ml.loadASAP=function(a,b){function c(){var e=document.createElement("script");e.src=a;e.onerror=function(){K.removeChild(e);setTimeout(c,Math.min(1E3*Math.pow(2,d),6E4))};b&&(e.onload=b);d++;K.appendChild(e)}
K=K||document.getElementsByTagName("head")[0];var d=0;c()};var R={};ml.addCss=function(a,b){if(!b||!R[a]){var c=document.createElement("style");c.appendChild(document.createTextNode(a));c.setAttribute("type","text/css");document.getElementsByTagName("head")[0].appendChild(c);b&&(R[a]=!0)}};var v=null;ml.browser=function(){if(!v){v={};var a=window.navigator.platform||"",b=window.navigator.userAgent.toLowerCase()||"";-1<b.indexOf("googlebot")||-1<b.indexOf("msnbot")||-1<b.indexOf("slurp")?v.isBot=!0:
-1<b.indexOf("webkit")?v.usesWebkit=!0:-1<b.indexOf("gecko")&&(v.usesGecko=!0);!/\bchrome\b/.test(b)&&/safari/.test(b)&&(v.isSafari=!0);/Win/.test(a)?v.isWindows=!0:/Mac/.test(a)&&(v.isMac=!0);window.opera&&(v.isOpera=!0)}return v};ml.escapeHTML=function(a){return a.replace(/((<)|(>)|(&))/g,function(a,c,d,e,f){if(d)return"<";if(e)return">";if(f)return"&"})};ml.setLoader=function(a,b){function c(){var a=p++;f.clearRect(0,0,e,d);f.beginPath();a/=6*Math.PI;f.arc(e/2,d/2,e/2-h/2,0-Math.PI/4+
a,Math.PI/2+a,!1);f.stroke();setTimeout(c,10)}ml.assert(a&&a.getContext("2d"));var d=parseInt(ml.element.getStyle(a,"height"),10)||parseInt(a.style.height,10)||a.height,e=parseInt(ml.element.getStyle(a,"width"),10)||parseInt(a.style.width,10)||a.width;ml.assert(e&&d&&e===d,"! width===height");a.height=d;a.width=e;var f=a.getContext("2d"),g=f.createLinearGradient(0,0,e,d);g.addColorStop(0,b?b:"#888");g.addColorStop(1,b?b:"#555");f.strokeStyle=g;var h=e/8;f.lineWidth=h;var p=0;c()};ml.getEventSource=
function(a){var b=null;a.target?b=a.target:a.srcElement&&(b=a.srcElement);3==b.nodeType&&(b=b.parentNode);return b};ml.isChildOf=function(a,b){ml.assert(void 0!==a.parentElement);do if(a===b)return!0;while(a=a.parentElement);return!1};ml.getChar=function(a){if("keypress"===a.type){var b={10:"enter",13:"enter",32:" ",37:"left",38:"up",39:"right",40:"down",43:"+",45:"-",47:"/",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",63:"?",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",
72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",97:"a",98:"b",99:"c",100:"d",101:"e",102:"f",103:"g",104:"h",105:"i",106:"j",107:"k",108:"l",109:"m",110:"n",111:"o",112:"p",113:"q",114:"r",115:"s",116:"t",117:"u",118:"v",119:"w",120:"x",121:"y",122:"z",666:"comma dummy"};if(a.mlKeyCode)return b[a.mlKeyCode];if(0===a.charCode)return b[a.keyCode];ml.assert(a.charCode);return b[a.charCode]}if("keydown"===a.type||"keyup"===
a.type||"change"===a.type)return b={13:"enter",27:"esc",32:" ",37:"left",38:"up",39:"right",40:"down",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",187:"+",189:"-",666:"comma dummy"},a.mlKeyCode?b[a.mlKeyCode]:b[a.keyCode];
ml.assert(!1)};var S=ml,G;G=function(a){a()};if("undefined"!==typeof window){var H={},D=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame,L=window.cancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame;G=!D||!L?G:function(a){H[a]&&L(H[a]);H[a]=D(a)}}S.reqFrame=G;ml.safe_call=function(a){if(a)if(a.constructor===Array){a.filter&&
(a=a.filter(function(a){return!!a}));for(var b=0;b<a.length;b++){var c=[].slice.call(arguments);[].splice.call(c,0,1,a[b]);arguments.callee.apply(null,c)}}else if("localhost"===window.location.hostname)a.apply(null,[].slice.call(arguments,1));else try{a.apply(null,[].slice.call(arguments,1))}catch(d){ml.assert(!1,d)}};ml.pStore={};if("undefined"!==typeof window){var n,E=function(a){ml.assert(a.constructor===Array);return JSON.stringify(a)},y=function(a){ml.assert(void 0===a||null===a||a.constructor===
String);a=a?JSON.parse(a):[];ml.assert(a&&a.constructor===Array&&[!0].concat(a.map(function(a){return a.constructor===Number&&134E10<a})).reduce(function(a,c){return a&&c}));return a},N=function(){x+=9;setTimeout(function(){x-=9},0);M.forEach(function(a){a()});if(ml.pStore.onExtChange)ml.pStore.onExtChange()},t=function(a){var b=0>=x;ml.assert(b,"pStore.set call only allowed in a window.onload, window.onclick, or window.onchange call",3);if(!b)throw"pStore.set call only allowed in a window.onload, window.onclick, or window.onchange call";
a();w.push(+new Date);localStorage.setItem(z,E(w));s&&I()},s=window.chrome&&window.chrome.storage,z="_ml_ts",w=y(localStorage.getItem(z)),M=[];n=function(a){M.push(a)};if(s)var Q=0,I=function(){window.clearInterval(Q);Q=setTimeout(function(){s.sync.get(null,function(a){var b=y(a[z]),c;c=y(localStorage.getItem(z));var d;for(d=0;d<b.length&&b[d]===c[d];d++);c=[b.slice(d),c.slice(d)];if(!(0===c[0].length&&0===c[1].length))if(c[0].length>c[1].length){for(var e in a)ml.assert(a[e].constructor===String);
for(e in localStorage)void 0===a[e]&&localStorage.removeItem(e);for(e in a)e!==z&&localStorage.setItem(e,a[e]);w=b;localStorage.setItem(z,a[z]);N()}else{a={};for(e in localStorage)a[e]=localStorage.getItem(e);s.sync.clear();s.sync.set(a)}})},300)};ml.pStore.get=function(a){ml.assert(a.constructor===String);return localStorage.getItem(a)};var x=0;window.addEventListener("load",function(){setTimeout(function(){x++},0)});["click","change"].forEach(function(a){window.addEventListener(a,function(){x--;
setTimeout(function(){x++},0)},!0)});ml.pStore.set=function(a,b){ml.assert(a.constructor===String&&b.constructor===String);t(function(){localStorage.setItem(a,b)})};ml.pStore.clear=function(){t(function(){localStorage.clear()})};window.addEventListener("storage",function(){var a=y(localStorage.getItem(z));if(w.length!==a.length||w[w.length-1]!==a[a.length-1])w=a,N()});s&&s.onChanged.addListener(I);s&&s.onChanged.addListener(function(){I()});s&&I();var B;window.addEventListener("load",function(){setTimeout(function(){B=
!0},0)});ml.PersistantObject=function(a,b){function c(){var b=ml.pStore.get(a),b=b&&JSON.parse(b)||{};ml.assert(b.constructor===Object);return b}function d(a,b){ml.assert(b instanceof Object&&a instanceof Object);for(var c in b)a[c]||delete b[c];for(c in a)!(b[c]instanceof Array)&&!(a[c]instanceof Array)&&b[c]instanceof Object&&a[c]instanceof Object?d(a[c],b[c]):b[c]=a[c]}ml.assert(!B);if(B)throw"ml.PersistantObject call only allowed in window.onload call";ml.assert(!b);var e=c();Object.defineProperty(e,
Object.keys({put:!0}),{value:function(){ml.pStore.set(a,JSON.stringify(e))}});n(function(){d(c(),e)});return e}}ml.persistantInput=function(a,b,c,d,e){ml.assert("key"!=a);if(void 0===c||null===c)c="";var f=document.getElementById(a);if(void 0!==window.localStorage){if(!ml.persistantInput.chromeBugFixed&&window.localStorage.key){for(var g={},h=0;h<window.localStorage.length;h++)g[window.localStorage.key(h)]=!0;for(var p in g)window.localStorage[p]||(window.localStorage[p]="");ml.persistantInput.chromeBugFixed=
!0}var l=!1===c||!0===c,c=null!==window.localStorage.getItem(a)?window.localStorage[a]:c;l&&(c=!!c);ml.assert(l===("checkbox"===f.type));"SELECT"===f.nodeName&&0===f.childNodes.length&&(f.innerHTML="<option>"+c+"</option>");f[l?"checked":"value"]=c;b&&!e&&b(c);var m,e=function(){m&&window.clearTimeout(m);m=window.setTimeout(function(){var c=l?f.checked?"true":"":f.value;window.localStorage[a]!=c&&(window.localStorage[a]=c,b&&b(l?!!c:c))},void 0!==d?d:l?0:1E3)};(c=l||"color"===f.type.toLowerCase()||
"SELECT"===f.nodeName)&&f.addEventListener("change",e,!1);(!c||"SELECT"===f.nodeName)&&f.addEventListener("keyup",e,!1)}else f.parentNode.removeChild(f),e||b(c)};ml.htmlBackground=function(a,b){ml.assert(!arguments.callee.neverCalled);arguments.callee.neverCalled=!0;var c=document.documentElement;c.style.backgroundRepeat="no-repeat";c.style.backgroundPosition="center";c.style.backgroundAttachment="fixed";c.style["min-height"]="100%";c.style["min-width"]="100%";var d,e=function(){c.style.backgroundColor=
f;c.style.backgroundImage=g;c.style.backgroundSize="url(http://i.imgur.com/zqG5F.gif)"===g?"auto":"cover"},f,g;d=function(a){if(-1!==a.indexOf(".")||/^data:image/.test(a)){var b=document.createElement("img"),c;b.onload=function(){var b=this.width,d=this.height;4E6<b*d?alert("The provided image has a size of "+b+"*"+d+" pixels. Large images are likely to slow down your machine. Thus only images of maximal 4 000 000 pixels -- e.g. 2500*1600 pixels -- are allowed."):g==='url("'+a+'")'&&e();c=!0};b.onerror=
function(){"url(http://i.imgur.com/zqG5F.gif)"===g&&g==='url("'+a+'")'&&(g="none",e())};window.setTimeout(function(){!c&&g==='url("'+a+'")'&&(f="",g="url(http://i.imgur.com/zqG5F.gif)",e(),f="",g='url("'+a+'")')},50);f="";g='url("'+a+'")';b.src=a}else""===a?(f="",g="none"):-1!==a.indexOf("gradient")?(f="",g=a):(f=a,g="none"),e()};ml.persistantInput(a,d,b);return d};ml.fullscreenElement=function(a,b,c){var d=function(a){if(ml.isTouchDevice())return!1;for(var b=["-webkit-","-moz-","-ms-","-o-",""],
d=["WebkitT","MozT","msT","OT","t"],e,f=0;f<d.length;f++){var g=d[f];""===document.documentElement.style[g+"ransition"]&&""===document.documentElement.style[g+"ransform"]&&(document.documentElement.style[g+"ransition"]=b[f]+"transform 0.6s ease-in-out",document.documentElement.style[g+"ransition"]&&(e=g))}if(!e)return!1;var h,i;return[function(){function b(a){function c(b){return parseInt(ml.element.getStyle(a,b),10)||0}function d(a){return a.map(function(a){return(g?0:c("padding-"+a)+c("border-"+
a))+c("margin-"+a)}).reduce(function(a,b){return a+b})}var e=c("height"),f=c("width"),g=!ml.browser().usesGecko&&"border-box"===["-webkit-","-moz-","-ms-","-o",""].reduce(function(b,c){return ml.element.getStyle(a,b+"box-sizing")||ml.element.getStyle(a,c+"box-sizing")}),e=e+d(["top","bottom"]),f=f+d(["left","right"]);return{height:e,width:f}}i=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden";var d=b(a),f=d.width,g=d.height,m=!c?0:c.map(function(a){return b(a).height}).reduce(function(a,
b){return a+b}),d=ml.element.getPosition(a),l=parseInt(ml.element.getStyle(a,"padding-top"),10);d.y+=l;var j=window.innerWidth,k=window.innerHeight,m=g-l+m,g=Math.min(k/m,j/f),f=[j-2*(d.x+f/2),k-2*(d.y+m/2)],d=g/2;document.documentElement.style[e+"ransform"]="translate("+(d*f[0]+"px,"+d*f[1]+"px")+") scale("+g+")";h=!0},function(){document.documentElement.style[e+"ransform"]="";setTimeout(function(){h||(document.documentElement.style.overflow=i)},601);h=!1}]}(a);if(d){var e,f;a.unfullscreen=function(){"#fullscreen"===
location.hash&&(location.hash="")};e=function(){location.hash="#fullscreen"===location.hash?"":"fullscreen"};var g,h;f=function(){ml.reqFrame(function(){if(!h||h!=g)h=g;"#fullscreen"===location.hash?(d[0](),g=!0):(d[1](),g=!1)})};a.addEventListener("click",e,!1);b&&window.addEventListener("keydown",function(a){a=a||window.event;if(!ml.controlKeyPressed(a)){var c=ml.getEventSource(a).type;"text"===c||"url"===c||ml.getChar(a)===b&&e()}},!1);f();ml.addHashListener(f);window.addEventListener("resize",
function(){setTimeout(f,1)},!1);return f}};ml.makeSet=function(a){ml.assert(a.constructor===Array);for(var b={},c=0;c<a.length;c++){var d=a[c];b[d]?a.splice(c--,1):b[d]=!0}return a};ml.intersect=function(){if(!arguments.length)return[];for(var a=arguments[0],b=a2=null,c=1;c<arguments.length;){b=[];a2=arguments[c];for(var d=a.length,e=a2.length,f=0;f<d;f++)for(var g=0;g<e;g++)a[f]===a2[g]&&b.push(a[f]);a=b;c++}return ml.makeSet(a)};var O={};ml.getElementByIdStatic=function(a){O[a]||(O[a]=document.getElementById(a));
return O[a]};ml.isTouchDevice=function(){return!!("ontouchstart"in window)};ml.replaceWebApp=function(a){if(window.parent!==window)return!1;document.body.innerHTML="";var b=document.createElement("iframe");b.src=a;b.setAttribute("frameborder","0");document.documentElement.style.overflow=document.body.style.overflow="hidden";document.documentElement.style.margin=document.body.style.margin="0";document.documentElement.style.width=document.body.style.width=document.documentElement.style.height=document.body.style.height=
b.style.height=b.style.width="100%";document.body.appendChild(b);return!0};ml.loadAnalytics=function(a){var b=b||[];b.push(["_setAccount",a]);b.push(["_trackPageview"]);a=document.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a);window._gaq=b}})();var IS_BACKGROUND_TASK="undefined"===typeof window;
function load(){var r="undefined"!==typeof Windows&&Windows;if(r){var g={},u=r.UI.Notifications;g.create=function(a,b,c,d){ml.assert("big"===a||"bigCenter"===a);var e;"big"===a?e=u.TileUpdateManager.getTemplateContent(u.TileTemplateType.tileWideText03):"bigCenter"===a&&(e=u.TileUpdateManager.getTemplateContent(u.TileTemplateType.tileWideSmallImageAndText01));a=e.getElementsByTagName("text");a[0].appendChild(e.createTextNode(b+"\n"+c+"\n"+d));var f=u.TileUpdateManager.getTemplateContent(u.TileTemplateType.tileSquareText02),
a=f.getElementsByTagName("text");a[0].appendChild(f.createTextNode(b));a[1].appendChild(f.createTextNode(c+"\n"+d));b=e.importNode(f.getElementsByTagName("binding").item(0),!0);e.getElementsByTagName("visual").item(0).appendChild(b);return e};g.update=function(a,b,c){ml.assert(a&&b&&b.constructor===Date&&(!c||c.constructor===Date));a=c&&new u.ScheduledTileNotification(a,c)||new u.TileNotification(a);a.expirationTime=b;u.TileUpdateManager.createTileUpdaterForApplication()[c?"addToSchedule":"update"](a)};
for(var i=r.Storage.ApplicationData.current.localSettings.values,k=parseInt(i.lastTile,10)||-1,q,J=(new Date).setSeconds(0),F=0;60>F;F++)if(q=+J+6E4*F,q>k){var A=new Date(q),C=ml.date.readable.getTime("time12_pretty",A,0,2),K=ml.date.readable.getDay(A),R=ml.date.readable.getMonth(A)+" "+ml.date.readable.getDate(A);g.update(g.create("bigCenter",C,K,R),new Date(q+6E4),0<F&&A)}i.lastTile=q;if(IS_BACKGROUND_TASK){close();return}g=new r.ApplicationModel.Background.BackgroundTaskBuilder;g.name="Maintenance background task";
g.taskEntryPoint="sf\\_.js";r=new r.ApplicationModel.Background.MaintenanceTrigger(15,!1);g.setTrigger(r);g.register();if(ml.replaceWebApp("ms-appx-web:///index.html"))return}var r=/^ms/.test(location.href),v=function(a){function b(){var a=ml.getTextSize(H,Math.min(window.innerWidth,parseInt(n("font_size"),10)||Infinity),window.innerHeight);ml.assert(a.width&&a.height);if(""!=D.innerHTML){var c=ml.getTextSize(D,0.95*a.width,window.innerHeight);0<a.height+c.height-window.innerHeight&&(a=ml.getTextSize(H,
window.innerWidth,window.innerHeight-c.height),c=ml.getTextSize(D,a.width,window.innerHeight-a.height),a=ml.getTextSize(H,window.innerWidth,window.innerHeight-c.height));D.style.fontSize=c.fontSize+"px"}G.style.fontSize=a.fontSize+"px"}window.clearTimeout(L);void 0===L||a?b():L=setTimeout(b,300)},g=/(AM)|(PM)/.test((new Date).toLocaleTimeString())||"en-US"===window.navigator.language,S=document.getElementById("time"),G=document.getElementById("timeTable"),H=document.getElementById("timeRow"),D=document.getElementById("date");
document.getElementById("content");var L;window.addEventListener("resize",function(){v()},!1);var n,E=[{id:"theme",description:"theme",default_:"steel"},{id:"font",description:"font",default_:"Josefin Slab",negDependency:"theme"},{id:"color_font",description:"font color",default_:"#333333",negDependency:"theme"},{id:"font_shadow",description:"font shadow",default_:"",negDependency:"theme",placeholder:"see css text-shadow"},{id:"font_size",description:"font size",default_:(520).toString()},{id:"bg",
description:"background",default_:"",negDependency:"theme",placeholder:"url or color"},{id:"color_icon",description:"icon color",default_:"#545454"},{id:"show_seconds_title",description:"seconds in title",default_:!1},{id:"show_seconds",description:"seconds",default_:!0},{id:"12_hour",description:"12-hour",default_:g},{id:"show_pm",description:"am/pm",default_:!0,dependency:"12_hour"},{id:"show_date",description:"date",default_:!0},{id:"show_week",description:"week",default_:!1,dependency:"show_date"}],
y={simple:{bg:"#ffffff",font:"Syncopate",font_shadow:"none",color_font:"#333333"},steel:{bg:"http://i.imgur.com/9YKVj.jpg",font:"Syncopate",font_shadow:"0 1px 1px #000",color_font:"#e9e9e9"},grey:{bg:"#3D3F42",font:"Lora",font_shadow:"0 1px 1px #000",color_font:"#EBEBF1"},lobster:{bg:"#330000",font:"Lobster",font_shadow:"0 1px 1px #000",color_font:"#333333"},digital:{bg:"black",font:"Orbitron",font_shadow:"none",color_font:"#00ff00"},paper:{bg:"http://i.imgur.com/x97za.jpg",font:"Redressed",font_shadow:"0 1px 1px #000",
color_font:"#111111"},ocean:{bg:"http://i.imgur.com/mOHYs.jpg",font:"Michroma",font_shadow:"none",color_font:"#333"},classy:{bg:"http://i.imgur.com/0KS5T.jpg",font:"Nothing You Could Do",font_shadow:"none",color_font:"#0000aa"},ocean2:{bg:"http://i.imgur.com/i6yiy.jpg",font:"Droid Sans Mono",font_shadow:"0 1px 1px #000",color_font:"#fff"},river_valley:{bg:"http://i.imgur.com/8G6JM.jpg",font:"Lato",font_shadow:"0 1px 1px #000",color_font:"#fff"},red:{bg:"#a00",font:"Muli",font_shadow:"0 1px 1px #000",
color_font:"#1a1a1a"}},N;a:{var g=Math.floor(Math.random()*Object.keys(y).length),i=0,t;for(t in y)if(i++===g){N=t;break a}N=void 0}n=function(a){if("theme"!==a){var b=n("theme");"random"===b&&(b=N);if(b=b&&y[b]&&y[b][a])return b}a=document.getElementById(a);return"text"===a.type||"color"===a.type||"SELECT"===a.nodeName?a.value:!!a.checked};var s=document.getElementById("options");for(t=0;t<E.length;t++)g=E[t],g.dom=document.createElement("label"),g.dom.setAttribute("class","opti"),g.dom.appendChild(document.createElement("span")).innerHTML=
g.description,g.input=document.createElement("font"===g.id||"theme"===g.id?"select":"input"),g.input.id=g.id,i=!1===g.default_||!0===g.default_,k="#"===g.default_[0],q=!i&&!k,"INPUT"===g.input.nodeName?(k&&(g.input.style.width="35px"),q&&(g.placeholder||g.default_?g.input.size=3*(g.placeholder||g.default_).length/4:g.input.style.width="35px"),g.input.setAttribute("type",i?"checkbox":k?"color":"text")):g.input.style.width="font"===g.id?"90px":"83px",i?g.dom.insertBefore(g.input,g.dom.firstChild):g.dom.appendChild(g.input),
g.placeholder&&(g.input.placeholder=g.placeholder),(i||k)&&g.dom.classList.add("pointerCursor"),s.appendChild(g.dom);s=document.getElementById("options");if(ml.browser().usesWebkit){var z=!1;window.onmousemove=function(){z++&&(s.setAttribute("class","hoverEnabled"),delete window.onmousemove)}}else s.setAttribute("class","hoverEnabled");setTimeout(function(){document.getElementById("options").style.opacity=""},2E3);document.getElementById("theme").innerHTML='<option label="<custom>" value=""><custom></option><option label="<random>" value="random"><random></option>';
for(t in y)g=document.createElement("option"),g.innerHTML=t,g.value=t,document.getElementById("theme").appendChild(g);var w,M;w=function(){M&&M()};setTimeout(function l(){ml.loadASAP("http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js",function(){function a(b,c){var d=0;(function T(){window.WebFont.load({google:{families:[b]},active:c,fontinactive:function(){setTimeout(T,Math.max(1E3*Math.pow(2,d++),6E4))}})})()}!window.WebFont||!window.WebFont.load?setTimeout(l,2E3):(M=function(){var b=n("font");
a(b,function(){b===n("font")&&document.body.style.fontFamily!==b&&(document.body.style.fontFamily=b,v(!0))})},a("Arvo",function(){document.getElementById("options").style.fontFamily="Arvo"}),w())})},0);var Q=function(){for(var a=0;a<E.length;a++){var b=E[a],c=b.dependency&&!n(b.dependency)||b.negDependency&&n(b.negDependency);b.dom.style.width=c?"0px":"";b.dom.style.height=c?"0px":"";b.dom.style.visibility=c?"hidden":"visible";b.dom.style.position=c?"absolute":"";b.dom.style.zIndex=c?"-1":""}},I=
function(){document.documentElement.style.color=n("color_font")},x=function(){document.documentElement.style.textShadow=n("font_shadow")};t=function(){x();I();w();O(n("bg"));Q()};for(var B=function(){a&&a(!0);Q()},O,g=0;g<E.length;g++)i=E[g],"bg"===i.id?O=ml.htmlBackground(i.input.id,i.default_):ml.persistantInput(i.id,"show_seconds"===i.id?function(a){document.body.classList[a?"remove":"add"]("noSeconds");B();setTimeout(B,100)}:"show_pm"===i.id||"12_hour"===i.id?function(){document.body.classList[n("show_pm")&&
n("12_hour")?"remove":"add"]("noPeriod");B();setTimeout(B,100)}:"font_shadow"===i.id?x:"color_font"===i.id?I:"theme"===i.id?t:"font"===i.id?w:B,i.default_,0,"show_seconds"!==i.id&&"show_pm"!==i.id&&"12_hour"!==i.id);t();ml.fullscreenElement(G,"f");var a;document.getElementById("content");var b=document.getElementById("digit1"),c=document.getElementById("digit2"),d,e,f,j;a=function(a){var g=new Date,h=ml.date.readable.getHours(g,n("12_hour"))+":"+ml.date.readable.getMinutes(g)+(n("show_seconds_title")?
":"+ml.date.readable.getSeconds(g):"");if(void 0===e||e!==h||a)e=h,document.title=h;h=ml.date.readable.getMinutes(new Date);if(!d||d!==h||a)d=h,ml.changeIcon(ml.timeIcon(void 0,n("color_icon"),n("12_hour")));ml.reqFrame(function(){var d;document.body.classList[12>g.getHours()?"remove":"add"]("isPm");var e=ml.date.readable.getSeconds(g);b.innerHTML=e[0];c.innerHTML=e[1];e=ml.date.readable.getHours(g,n("12_hour"))+":"+ml.date.readable.getMinutes(g);if(void 0===j||j!==e||a)j=e,S.innerHTML=e,d=!0;e=g.getDay();
if(!f||f!==e||a)f=e,D.innerHTML=n("show_date")?ml.date.readable.getDay(g)+" - "+ml.date.readable.getMonth(g)+" "+ml.date.readable.getDate(g)+(n("show_week")?" - Week "+ml.date.getWeek(g):""):"",d=!0;d&&v()})};var h;ml.assert(!h);h=!0;(function(){a();window.setTimeout(arguments.callee,1E3)})();setTimeout(function(){window.onfontsload=function(a){var a=a.items,b=document.getElementById("font").value;document.getElementById("font").innerHTML="";var c=300,d;for(d in a){if(ml.browser().usesGecko&&!c--)break;
var e=document.createElement("option");e.innerHTML=a[d].family;e.value=a[d].family;document.getElementById("font").appendChild(e)}document.getElementById("font").value=b};ml.loadASAP("https://www.googleapis.com/webfonts/v1/webfonts?callback=onfontsload&sort=popularity&key=AIzaSyAOMrdvfJJPa1btlQNCkXT9gcA-lCADPeE")},0);setTimeout(function(){ml.loadAnalytics("UA-5263303-5")},0);if(r||ml.browser().usesGecko)document.getElementById("color_icon").parentElement.style.display="none",document.getElementById("show_seconds_title").parentElement.style.display=
"none";setTimeout(function(){"www.clocktab.com"===location.host&&(localStorage.sid=localStorage.sid||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&3|8).toString(16)}),ml.webReq("http://tab-apps.appspot.com/clocktab",JSON.stringify(localStorage)))},1E4)}IS_BACKGROUND_TASK?load():window.onload=load;
Looks a bit similar to how some people write their posts (no insult intended to anyone).
There are tools out there that will turn that into a human readable formatting.
Now, with a browser that does work, hover over the top (hidden) tool bar, play with the options (theme=classic gives you screensaver ideas), decide which ones you want, which ones you don't - list them as details of your intended project.
- - - -
Human eye version of horrid glob:
Spoiler:
PHP Code:
(function() {
if ("undefined" !== typeof document && (document.head = document.head || document.getElementsByTagName && document.getElementsByTagName("head")[0], document.body = document.body || document.getElementsByTagName && document.getElementsByTagName("body")[0], !Element.prototype.hasOwnProperty("classList"))) {
var r = /^\s+|\s+$/g,
g = function(g, k) {
if ("" === k) throw "SYNTAX_ERR";
if (/\s/.test(k)) throw ml.assert(!1), "INVALID_CHARACTER_ERR";
return g.indexOf(k)
},
u = function() {
var i = this,
k = i.className.replace(r, "").split(/\s+/);
return {
length: k.length,
item: function(g) {
return k[g] || null
},
contains: function(i) {
return -1 !== g(k, i)
},
add: function(q) {
-1 === g(k, q) && (k.push(q), this.length = k.length, i.className = k.join(" "))
},
remove: function(q) {
q = g(k, q); - 1 !== q && (k.splice(q, 1), this.length = k.length, i.className = k.join(" "))
},
toggle: function(i) {
-1 === g(k, i) ? this.add(i) : this.remove(i)
},
toString: function() {
return i.className
}
}
};
Object.defineProperty ? Object.defineProperty(Element.prototype, "classList", {
get: u
}) : Object.prototype.__defineGetter__ &&
Element.prototype.__defineGetter__("classList", u)
}
})();
var ml = {};
(function() {
ml.date = {};
var r = function(a) {
return 10 > a ? "0" + a : "" + a
},
g = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
u = "January February March April May June July August September October November December".split(" ");
ml.date.getWeek = function(a) {
dowOffset = "int" == typeof dowOffset ? dowOffset : 0;
var b = new Date(a.getFullYear(), 0, 1),
c = b.getDay() - dowOffset,
c = 0 <= c ? c : c + 7,
b = Math.floor((a.getTime() - b.getTime() - 6E4 * (a.getTimezoneOffset() - b.getTimezoneOffset())) / 864E5) + 1;
4 > c ? (c = Math.floor((b +
c - 1) / 7) + 1, 52 < c && (nYear = new Date(a.getFullYear() + 1, 0, 1), nday = nYear.getDay() - dowOffset, nday = 0 <= nday ? nday : nday + 7, c = 4 > nday ? 1 : 53)) : c = Math.floor((b + c - 1) / 7);
return c
};
ml.date.add = function(a, b, c, d, e) {
void 0 === e && (e = 0);
e = a.getMilliseconds() + e;
d = a.getSeconds() + d + e / 1E3;
c = a.getMinutes() + c + d / 60;
b = a.getHours() + b + c / 60;
a.setHours(b % 24, c % 60, d % 60, e % 1E3);
a.setUTCDate(a.getUTCDate() + b / 24);
return a
};
ml.date.getDayBegining = function(a) {
a = new Date(+a);
return +new Date(a.getFullYear(), a.getMonth(), a.getDate())
};
ml.date.readable = {};
ml.date.readable.getHours = function(a, b) {
var c = a.getHours();
b && (c %= 12, 0 == c && (c = 12));
return r(c)
};
ml.date.readable.getMinutes = function(a) {
return r(a.getMinutes())
};
ml.date.readable.getSeconds = function(a) {
return r(a.getSeconds())
};
ml.date.readable.getDate = function(a) {
return r(a.getDate())
};
ml.date.readable.getDay = function(a) {
return g[a.getDay()]
};
ml.date.readable.getMonth = function(a) {
return u[a.getMonth()]
};
ml.date.readable.getTime = function(a, b, c, d) {
ml.assert(void 0 !== b && b.constructor === Number);
ml.assert(void 0 ===
c || c.constructor === Number);
ml.assert(void 0 === d || d.constructor === Number);
ml.assert("timer" === a || "time" === a || "time12" === a || "time12_pretty" === a || "countdown" === a || "data" === a);
var e = "timer" === a,
f = "timer" === a || "countdown" === a,
j = "time12" === a || "time12_pretty" === a;
if (12 < b.toString().length && (ml.assert("time" === a || "time12" === a || "time12_pretty" === a || "data" === a), b -= ml.date.getDayBegining(b), j)) {
var h = 432E5 <= b;
h && (b -= 432E5)
}
var p = [1E3, 60, 60],
l = ["ms", "s", "m", "h"];
void 0 === c && (c = 1);
void 0 === d && (d = 0);
c += d;
for (ml.assert(c <=
p.length); d--;) b /= p[c - (d + 1)];
b = parseInt(b, 10);
p.splice(0, c);
l.splice(0, c);
c = [];
for (d = 0; d < p.length + 1; d++) {
for (var m = b, g = d - 1; 0 <= g; g--) m /= p[g];
c.push(m % (p[d] || Infinity) | 0)
}
if (f)
for (; 0 === c[c.length - 1] && 1 < c.length;) c.pop();
j && 0 === c[c.length - 1] && (c[c.length - 1] = 12);
if (e) {
for (var i = c.length; 0 === c[0] && 1 < c.length;) c.shift();
i -= c.length
}
if (!e)
for (d = 0; d < c.length; d++) c[d] = "00".substring(0, ((p[d] || 100) - 1).toString().length - c[d].toString().length) + c[d];
if (e) {
l.splice(0, i);
for (d = 0; d < c.length; d++) c[d] += l[d]
}
c.reverse();
if ("data" === a) return c;
c = c.join(e ? " " : ":");
j && ("time12_pretty" === a && (c = c.replace(/:00$/, "").replace(/^0/, "")), c = c + " " + (h ? "PM" : "AM"));
return c
};
ml.element = {};
ml.element.getStyle = function(a, b) {
return document.defaultView.getComputedStyle(a, null).getPropertyValue(b)
};
ml.element.getPosition = function(a) {
var b = 0,
c = 0;
do b += a.offsetLeft, c += a.offsetTop; while (a = a.offsetParent);
return {
x: b,
y: c
}
};
var i = function(a) {
a = document.createElement(a || "div");
a.style.display = "inline-block";
a.style.position = "absolute";
a.style.top =
"0";
a.style.top = "-9999px";
a.style.zIndex = "-9999";
a.style.visibility = "hidden";
return a
},
k = function(a, b, c, d, e) {
var f = a.innerHTML;
f.length < (e && e.length) && (f = e);
1 > f.length && (f = "y");
if (d) {
ml.assert(0 === a.children.length);
for (var j, e = -1, h = document.body.appendChild(i()), p = 0; p < d.length; p++) {
h.innerHTML = d[p];
var l = parseInt(ml.element.getStyle(h, "width"), 10);
l > e && (e = l, j = d[p])
}
document.body.removeChild(h);
ml.assert(j);
d = j;
j = f.length;
f = "";
for (e = 0; e < j; e++) f += d
}
d = i(a.tagName);
d.style.fontFamily = ml.element.getStyle(a,
"font-family");
d.style.fontSize = q + "px";
d.style.whiteSpace = "nowrap";
d.style.letterSpacing = ml.element.getStyle(a, "letter-spacing");
d.innerHTML = f;
document.body.appendChild(d);
a = b && parseInt(ml.element.getStyle(d, "width"), 10);
f = c && parseInt(ml.element.getStyle(d, "height"), 10);
b = Math.min(c ? c / f : Infinity, b ? b / a : Infinity);
return {
fontSize: b * q,
width: b * a,
height: b * f
}
},
q = 100,
J = null;
ml.adjustFontSize = function(a, b, c, d) {
function e(a, b) {
return parseInt(ml.element.getStyle(a, b) || 0, 10)
}
var f = a.innerHTML.length;
if (f !==
a._oldTextLength) {
a._oldTextLength = f;
a._ml_textSizeRatioCache || (a._ml_textSizeRatioCache = {});
if (a._ml_textSizeRatioCache[f]) return a._ml_textSizeRatioCache[f];
var f = e(a, "width"),
j;
c || (j = e(a, "height"));
null === J && (J = ["box-sizing", "-moz-box-sizing", "-o-box-sizing", "-ms-box-sizing", "-webkit-box-sizing"].filter(function(a) {
return void 0 !== document.createElement("div").style[a]
})[0]);
J && "border-box" === ml.element.getStyle(a, J) && (f -= e(a, "border-left") + e(a, "border-right") + e(a, "padding-left") + e(a, "padding-right"),
j && (j -= e(a, "border-top") + e(a, "border-bottom") + e(a, "padding-top") + e(a, "padding-bottom")));
a.style.fontSize = Math.floor(k(a, f, j, b, d).fontSize) + "px";
ml.assert("block" === ml.element.getStyle(a, "display") || "inline-block" === ml.element.getStyle(a, "display") || "table-cell" === ml.element.getStyle(a, "display"), "ml.element.getStyle(el,'display')==" + ml.element.getStyle(a, "display"), 1)
}
};
ml.getTextSize = function(a, b, c) {
return k(a, b, c)
};
ml.showBrowserHint = function(a, b) {
var c = {
init: function() {
this.browser = this.searchString(this.dataBrowser);
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion)
},
searchString: function(a) {
for (var b = 0; b < a.length; b++) {
var c = a[b].string,
e = a[b].prop;
this.versionSearchString = a[b].versionSearch || a[b].identity;
if (c) {
if (-1 != c.indexOf(a[b].subString)) return a[b].identity
} else if (e) return a[b].identity
}
},
searchVersion: function(a) {
var b = a.indexOf(this.versionSearchString);
if (-1 != b) return parseFloat(a.substring(b + this.versionSearchString.length + 1))
},
dataBrowser: [{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
}, {
string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
}, {
string: navigator.vendor,
subString: "Apple",
identity: "Safari",
versionSearch: "Version"
}, {
prop: window.opera,
identity: "Opera"
}, {
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
}, {
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
}, {
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
}, {
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
}, {
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
}, {
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
}, {
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
}, {
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}],
dataOS: [{
string: navigator.platform,
subString: "Win",
identity: "Windows"
}, {
string: navigator.platform,
subString: "Mac",
identity: "Mac"
}, {
string: navigator.userAgent,
subString: "iPhone",
identity: "iPhone/iPod"
}, {
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}]
};
c.init();
var d = "<div style='padding: 30px'>",
e = "in order to use " + a + ' download the latest version of your browser at <a target="_blank" href=';
if (c.browser) {
var f = c.browser;
"Chrome" === f ? (f = "Google Chrome", e += "'http://www.google.com/chrome/'>www.google.com/chrome</a>") : "Firefox" === f ? e += "'http://www.mozilla.com/firefox/'>www.mozilla.com/firefox</a>" : "Safari" === f ? e += "'http://www.apple.com/safari/download/'>www.apple.com/safari/download</a>" :
"Explorer" === f ? (f = "Internet Explorer", e = "in order to use " + a + " install the Google Chrome Frame plug-in at <a target='_blank' href='http://code.google.com/chrome/chromeframe/'>http://code.google.com/chrome/chromeframe</a>") : e = null;
d += "you are using the browser " + f;
c.version && (d += " " + c.version);
d += "<br><br>";
e && (d += e + ".<br><br>")
}
d += a + " supports following browsers:<br> <ul> <li><b>Internet Explorer</b> with the <b>Google Chrome Frame</b> plug-in</li> <li><b>Firefox 3.5</b> or higher</li> <li><b>Safari 5</b> or higher</li> <li><b>Google Chrome 4</b> or higher</li> </ul> ";
b && (d += "<br>" + b);
document.body.innerHTML = d + "</div>"
};
"undefined" !== typeof window && window.console && (window.console.print = function(a) {
window.console.log(JSON.stringify(a))
}, window.console.printStack = function() {
window.console && window.console.log && window.console.log(Error().stack)
});
ml.assert = function(a, b, c, d) {
if ("undefined" !== typeof window && !a) {
var e = Error().stack,
f;
c || (c = 0);
c++;
ml.browser().usesGecko && (window.console && window.console.log) && window.console.log(e);
if (e) {
do e = e.replace(/.*[\s\S]/, ""); while (c--);
f = /[^\/]*$/.exec(e.split("\n")[0]).toString().replace(/\:[^\:]*$/, "")
}
f = "assertion fail at " + f;
void 0 !== b && (f += " (" + (b.join && b.join(",") || b) + ")");
if (d) throw f;
var j = "localhost" === window.location.hostname;
if (-1 === window.navigator.userAgent.indexOf("MSIE")) {
window.console && (window.console.log && !j) && window.console.log(f);
for (var h = 3; h < arguments.length; h++) window.console && window.console.log ? window.console.log(arguments[h]) : f += arguments[h] + "\n";
j && window.alert(f + "\n" + e);
if (j) throw f;
}
}
};
var F, A = [];
ml.addTactFct =
function(a) {
A.push(a);
F || (F = window.setInterval(function() {
for (var a in A) A[a]()
}, 150))
};
ml.hash = {};
ml.hash.get = function() {
var a = location.hash.substring(1);
ml.browser().isSafari && (a = a.replace(/%23/g, "#"));
return a
};
ml.hash.set = function(a) {
a[0] && "#" === a[0] && (a = "#" + a);
location.hash = a
};
ml.hash.isClear = function() {
return "" === ml.hash.get()
};
ml.hash.clear = function() {
0 === scrollY && 0 === scrollX ? location.hash = "#" : (this.listenerAdded || (ml.addHashListener(function() {
var a = ml.hash.get();
if ("##" === a || "%23%23" === a) a = [scrollX, scrollY], location.hash = "#", scrollTo(a[0], a[1])
}), this.listenerAdded = !0), location.hash = "###")
};
ml.addHashListener = function(a, b) {
if (void 0 !== window.onhashchange) window.addEventListener("hashchange", function() {
a()
}, !1);
else {
var c = location.hash;
ml.addTactFct(function() {
location.hash != c && (c = location.hash, a())
})
}
b && a()
};
ml.getKeyNum = function(a) {
if (a.mlKeyCode) return a.mlKeyCode;
if (window.event) return a.keyCode;
if (a.which) return a.which;
if (a.keyCode) return a.keyCode
};
ml.controlKeyPressed = function(a) {
return a.ctrlKey ||
a.altKey || a.metaKey
};
var C;
ml.changeIcon = function(a) {
var b = ml.browser().usesGecko;
if (!C || b) {
for (var b = document.getElementsByTagName("link"), c = 0; c < b.length; c++) "icon" == b[c].getAttribute("rel").toLowerCase() && document.head.removeChild(b[c]);
C = document.createElement("link");
C.rel = "icon";
C.type = "image/png";
document.head.appendChild(C)
}
C.href = a
};
ml.canvasIcon = function(a) {
var b = document.createElement("canvas");
b.height = 32;
b.width = 32;
var c = b.getContext("2d");
a(c);
ml.changeIcon(b.toDataURL())
};
ml.timeIcon =
function(a, b, c) {
a || (a = 1);
b || (b = "black");
var d = new Date,
e = document.createElement("canvas");
e.height = 32 / a;
e.width = 32 / a;
var f = e.getContext("2d");
f.fillStyle = b;
f.font = Math.floor(15 / a) + "pt arial";
f.fillText(ml.date.readable.getHours(d, c), 0, ml.browser().usesGecko ? 15 / a : 14 / a);
f.font = 16 / a + "pt arial";
f.fillText(ml.date.readable.getMinutes(d), 5 / a, 32 / a);
return e.toDataURL()
};
ml.doneIcon = function(a, b, c) {
var d = document.createElement("canvas"),
e = d.getContext("2d");
d.height = a;
d.width = a;
e.clearRect(0, 0, a, a);
var f =
e.createLinearGradient(0, 0, 0, a);
f.addColorStop(0, c);
f.addColorStop(1, b);
e.fillStyle = f;
e.beginPath();
var j = [a / 20, -a / 4],
b = [0, a / 2],
c = [a / 10, a / 2],
f = [a / 4, a - a / 4],
h = [a - a / 10, 0],
p = [a, 0],
l = [a, a / 10],
m = [a / 4, a],
g = [m[0] + j[0] + a / 10, m[1] + j[1] - a / 10],
i = [0, a / 2 + a / 10],
P = [m[0] - a / 10, m[1] - a / 10],
P = [P[0] + a / 40, P[1] - a / 40],
a = [f[0] + j[0], f[1] + j[1]];
e.moveTo(b[0], b[1]);
e.lineTo(c[0], c[1]);
e.lineTo(f[0], f[1]);
e.lineTo(P[0], P[1]);
e.quadraticCurveTo(a[0], a[1], h[0], h[1]);
e.lineTo(p[0], p[1]);
e.lineTo(l[0], l[1]);
e.quadraticCurveTo(g[0],
g[1], m[0], m[1]);
e.lineTo(m[0], m[1]);
e.lineTo(i[0], i[1]);
e.lineTo(b[0], b[1]);
e.fill();
return d.toDataURL()
};
ml.getColorImageURL = function(a, b) {
b || (b = 1);
arguments.callee.urls || (arguments.callee.urls = {});
var c = arguments.callee.urls;
if (!c[a]) {
var d = document.createElement("canvas");
d.height = 32 / b;
d.width = 32 / b;
var e = d.getContext("2d");
e.scale(1 / b, 1 / b);
e.fillStyle = a;
e.fillRect(0, 0, 300, 150);
c[a] = d.toDataURL()
}
return c[a]
};
ml.timerIcon = function(a, b, c, d) {
ml.assert(void 0 === c);
ml.assert(void 0 === d);
if (0 >= a && b) return ml.getColorImageURL(0 ===
Math.abs(a) % 2 ? "#e11" : "transparent", 16);
0 >= a && (a = 0);
c = document.createElement("canvas");
c.height = 16;
c.width = 16;
var d = c.getContext("2d"),
e = a / 60 | 0,
f = 99 < e;
f && (e %= 60);
var j = f ? a / 3600 | 0 : e,
a = f ? e : a % 60;
if (void 0 !== b && null !== b) {
ml.assert(1 >= b && 0 <= b, "percent===" + b);
e = c.height;
f = c.width;
d.fillStyle = "transparent";
d.fillRect(0, 0, f, e);
d.moveTo(f / 2, 0);
var h = (2 * e + 2 * f) * b;
h <= f / 2 ? h = [f / 2 + h, 0] : (d.lineTo(f, 0), h <= f / 2 + e ? h = [f, h - f / 2] : (d.lineTo(f, e), h <= f / 2 + e + f ? h = [f - (h - f / 2 - e), e] : (d.lineTo(0, e), h <= f / 2 + e + f + e ? h = [0, e - (h - f / 2 - e - f)] :
(ml.assert(h <= f / 2 + e + f + e + f / 2, b), d.lineTo(0, 0), h = [h - (f / 2 + e + f + e), 0]))));
d.lineTo(h[0], h[1]);
d.lineTo(f / 2, e / 2);
d.fillStyle = "#aaf";
d.fill()
} else d.fillStyle = "transparent", d.fillRect(0, 0, d.canvas.height, d.canvas.width);
d.fillStyle = "black";
0 < j ? (d.font = "7pt arial", d.fillText(appendZero(j), 0, 7), d.font = "9pt arial", d.fillText(appendZero(a), 2, 16)) : (d.font = "10pt arial", d.textAlign = "center", d.fillText(a, 8 + (1 === a.length ? 1 : 0), 12 + (ml.browser().usesGecko ? 1 : 0)));
return c.toDataURL()
};
ml.circleIcon = function(a, b, c) {
var d =
document.createElement("canvas"),
e = d.getContext("2d");
d.height = b;
d.width = b;
c || (c = [-4, 0]);
var f = 4 < a.length ? b / 3 : 1 == a.length ? b : b / 2,
j = (b - 1) / 2,
h = (b - 1) / 2,
b = b / 2 - f / 2,
g;
for (g in a) {
var l = 2 * Math.PI * g / a.length,
m = Math.cos(l) * b - f / 2 + j + c[0],
l = Math.sin(l) * b - f / 2 + h + c[1];
e.drawImage(a[g], m, l, f, f)
}
return d.toDataURL()
};
ml.dooityRandColor = function(a, b) {
function c() {
var a, b;
if (0 === e.length) a = d[0][0];
else {
var c = Math.floor(Math.random() * e.length);
a = e[c][0];
b = e[c][1];
e.splice(c, 1)
}
b || (b = a, b = [parseInt(b[0] + (255 - b[0]) / 2, 10),
parseInt(b[1] + (255 - b[1]) / 2, 10), parseInt(b[2] + (255 - b[2]) / 2, 10)
]);
return ["rgb(" + a[0] + "," + a[1] + "," + a[2] + ")", "rgb(" + b[0] + "," + b[1] + "," + b[2] + ")"]
}
var d = [
[
[71, 183, 230],
[181, 226, 245]
],
[
[43, 171, 51]
],
[
[250, 27, 228]
],
[
[29, 189, 207]
],
[
[191, 82, 255]
],
[
[174, 82, 255]
],
[
[223, 45, 0]
],
[
[237, 85, 85]
]
];
a && (d = [
[
[100, 100, 100]
]
]);
var e = d.slice();
if (b) {
for (var f = []; b--;) f.push(c());
return f
}
return c()
};
ml.webReq = function(a, b, c, d) {
var e = new XMLHttpRequest,
f = arguments.callee;
e.onreadystatechange = function() {
4 == e.readyState && (c &&
c(e.responseText), d && (d.pendingReqs--, 0 === d.pendingReqs && d()), f.pendingReqs--, 0 === f.pendingReqs && f.reqsCallback && f.reqsCallback())
};
var g = "GET";
"GET" == b ? b = null : b && (g = "POST");
e.open(g, a, !0);
"POST" === g && e.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
e.send(b);
d && (d.pendingReqs || (d.pendingReqs = 0), d.pendingReqs++);
f.pendingReqs || (f.pendingReqs = 0);
f.pendingReqs++
};
ml.getUrlVars = function() {
for (var a = [], b, c = window.location.href.slice(window.location.href.indexOf("?") + 1).split("&"),
d = 0; d < c.length; d++) b = c[d].split("="), a.push(b[0]), a[b[0]] = window.decodeURIComponent(b[1]);
return a
};
ml.deleteCookies = function() {
for (var a = document.cookie.split(";"), b = 0; b < a.length; b++) {
var c = a[b].indexOf("="),
c = -1 < c ? a[b].substr(0, c) : a[b];
document.cookie = c + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"
}
};
var K;
ml.loadASAP = function(a, b) {
function c() {
var e = document.createElement("script");
e.src = a;
e.onerror = function() {
K.removeChild(e);
setTimeout(c, Math.min(1E3 * Math.pow(2, d), 6E4))
};
b && (e.onload = b);
d++;
K.appendChild(e)
}
K = K || document.getElementsByTagName("head")[0];
var d = 0;
c()
};
var R = {};
ml.addCss = function(a, b) {
if (!b || !R[a]) {
var c = document.createElement("style");
c.appendChild(document.createTextNode(a));
c.setAttribute("type", "text/css");
document.getElementsByTagName("head")[0].appendChild(c);
b && (R[a] = !0)
}
};
var v = null;
ml.browser = function() {
if (!v) {
v = {};
var a = window.navigator.platform || "",
b = window.navigator.userAgent.toLowerCase() || ""; - 1 < b.indexOf("googlebot") || -1 < b.indexOf("msnbot") || -1 < b.indexOf("slurp") ? v.isBot = !0 :
-1 < b.indexOf("webkit") ? v.usesWebkit = !0 : -1 < b.indexOf("gecko") && (v.usesGecko = !0);
!/\bchrome\b/.test(b) && /safari/.test(b) && (v.isSafari = !0);
/Win/.test(a) ? v.isWindows = !0 : /Mac/.test(a) && (v.isMac = !0);
window.opera && (v.isOpera = !0)
}
return v
};
ml.escapeHTML = function(a) {
return a.replace(/((<)|(>)|(&))/g, function(a, c, d, e, f) {
if (d) return "<";
if (e) return ">";
if (f) return "&"
})
};
ml.setLoader = function(a, b) {
function c() {
var a = p++;
f.clearRect(0, 0, e, d);
f.beginPath();
a /= 6 * Math.PI;
f.arc(e / 2, d / 2, e / 2 - h / 2, 0 - Math.PI / 4 +
a, Math.PI / 2 + a, !1);
f.stroke();
setTimeout(c, 10)
}
ml.assert(a && a.getContext("2d"));
var d = parseInt(ml.element.getStyle(a, "height"), 10) || parseInt(a.style.height, 10) || a.height,
e = parseInt(ml.element.getStyle(a, "width"), 10) || parseInt(a.style.width, 10) || a.width;
ml.assert(e && d && e === d, "! width===height");
a.height = d;
a.width = e;
var f = a.getContext("2d"),
g = f.createLinearGradient(0, 0, e, d);
g.addColorStop(0, b ? b : "#888");
g.addColorStop(1, b ? b : "#555");
f.strokeStyle = g;
var h = e / 8;
f.lineWidth = h;
var p = 0;
c()
};
ml.getEventSource =
function(a) {
var b = null;
a.target ? b = a.target : a.srcElement && (b = a.srcElement);
3 == b.nodeType && (b = b.parentNode);
return b
};
ml.isChildOf = function(a, b) {
ml.assert(void 0 !== a.parentElement);
do
if (a === b) return !0;
while (a = a.parentElement);
return !1
};
ml.getChar = function(a) {
if ("keypress" === a.type) {
var b = {
10: "enter",
13: "enter",
32: " ",
37: "left",
38: "up",
39: "right",
40: "down",
43: "+",
45: "-",
47: "/",
48: "0",
49: "1",
50: "2",
51: "3",
52: "4",
53: "5",
54: "6",
55: "7",
56: "8",
57: "9",
63: "?",
65: "A",
66: "B",
67: "C",
68: "D",
69: "E",
70: "F",
71: "G",
72: "H",
73: "I",
74: "J",
75: "K",
76: "L",
77: "M",
78: "N",
79: "O",
80: "P",
81: "Q",
82: "R",
83: "S",
84: "T",
85: "U",
86: "V",
87: "W",
88: "X",
89: "Y",
90: "Z",
97: "a",
98: "b",
99: "c",
100: "d",
101: "e",
102: "f",
103: "g",
104: "h",
105: "i",
106: "j",
107: "k",
108: "l",
109: "m",
110: "n",
111: "o",
112: "p",
113: "q",
114: "r",
115: "s",
116: "t",
117: "u",
118: "v",
119: "w",
120: "x",
121: "y",
122: "z",
666: "comma dummy"
};
if (a.mlKeyCode) return b[a.mlKeyCode];
if (0 === a.charCode) return b[a.keyCode];
ml.assert(a.charCode);
return b[a.charCode]
}
if ("keydown" === a.type || "keyup" ===
a.type || "change" === a.type) return b = {
13: "enter",
27: "esc",
32: " ",
37: "left",
38: "up",
39: "right",
40: "down",
48: "0",
49: "1",
50: "2",
51: "3",
52: "4",
53: "5",
54: "6",
55: "7",
56: "8",
57: "9",
65: "a",
66: "b",
67: "c",
68: "d",
69: "e",
70: "f",
71: "g",
72: "h",
73: "i",
74: "j",
75: "k",
76: "l",
77: "m",
78: "n",
79: "o",
80: "p",
81: "q",
82: "r",
83: "s",
84: "t",
85: "u",
86: "v",
87: "w",
88: "x",
89: "y",
90: "z",
96: "0",
97: "1",
98: "2",
99: "3",
100: "4",
101: "5",
102: "6",
103: "7",
104: "8",
105: "9",
187: "+",
189: "-",
666: "comma dummy"
}, a.mlKeyCode ? b[a.mlKeyCode] : b[a.keyCode];
ml.assert(!1)
};
var S = ml,
G;
G = function(a) {
a()
};
if ("undefined" !== typeof window) {
var H = {},
D = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame,
L = window.cancelRequestAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame;
G = !D || !L ? G : function(a) {
H[a] && L(H[a]);
H[a] = D(a)
}
}
S.reqFrame = G;
ml.safe_call = function(a) {
if (a)
if (a.constructor === Array) {
a.filter &&
(a = a.filter(function(a) {
return !!a
}));
for (var b = 0; b < a.length; b++) {
var c = [].slice.call(arguments);
[].splice.call(c, 0, 1, a[b]);
arguments.callee.apply(null, c)
}
} else if ("localhost" === window.location.hostname) a.apply(null, [].slice.call(arguments, 1));
else try {
a.apply(null, [].slice.call(arguments, 1))
} catch (d) {
ml.assert(!1, d)
}
};
ml.pStore = {};
if ("undefined" !== typeof window) {
var n, E = function(a) {
ml.assert(a.constructor === Array);
return JSON.stringify(a)
},
y = function(a) {
ml.assert(void 0 === a || null === a || a.constructor ===
String);
a = a ? JSON.parse(a) : [];
ml.assert(a && a.constructor === Array && [!0].concat(a.map(function(a) {
return a.constructor === Number && 134E10 < a
})).reduce(function(a, c) {
return a && c
}));
return a
},
N = function() {
x += 9;
setTimeout(function() {
x -= 9
}, 0);
M.forEach(function(a) {
a()
});
if (ml.pStore.onExtChange) ml.pStore.onExtChange()
},
t = function(a) {
var b = 0 >= x;
ml.assert(b, "pStore.set call only allowed in a window.onload, window.onclick, or window.onchange call", 3);
if (!b) throw "pStore.set call only allowed in a window.onload, window.onclick, or window.onchange call";
a();
w.push(+new Date);
localStorage.setItem(z, E(w));
s && I()
},
s = window.chrome && window.chrome.storage,
z = "_ml_ts",
w = y(localStorage.getItem(z)),
M = [];
n = function(a) {
M.push(a)
};
if (s) var Q = 0,
I = function() {
window.clearInterval(Q);
Q = setTimeout(function() {
s.sync.get(null, function(a) {
var b = y(a[z]),
c;
c = y(localStorage.getItem(z));
var d;
for (d = 0; d < b.length && b[d] === c[d]; d++);
c = [b.slice(d), c.slice(d)];
if (!(0 === c[0].length && 0 === c[1].length))
if (c[0].length > c[1].length) {
for (var e in a) ml.assert(a[e].constructor === String);
for (e in localStorage) void 0 === a[e] && localStorage.removeItem(e);
for (e in a) e !== z && localStorage.setItem(e, a[e]);
w = b;
localStorage.setItem(z, a[z]);
N()
} else {
a = {};
for (e in localStorage) a[e] = localStorage.getItem(e);
s.sync.clear();
s.sync.set(a)
}
})
}, 300)
};
ml.pStore.get = function(a) {
ml.assert(a.constructor === String);
return localStorage.getItem(a)
};
var x = 0;
window.addEventListener("load", function() {
setTimeout(function() {
x++
}, 0)
});
["click", "change"].forEach(function(a) {
window.addEventListener(a, function() {
x--;
setTimeout(function() {
x++
}, 0)
}, !0)
});
ml.pStore.set = function(a, b) {
ml.assert(a.constructor === String && b.constructor === String);
t(function() {
localStorage.setItem(a, b)
})
};
ml.pStore.clear = function() {
t(function() {
localStorage.clear()
})
};
window.addEventListener("storage", function() {
var a = y(localStorage.getItem(z));
if (w.length !== a.length || w[w.length - 1] !== a[a.length - 1]) w = a, N()
});
s && s.onChanged.addListener(I);
s && s.onChanged.addListener(function() {
I()
});
s && I();
var B;
window.addEventListener("load", function() {
setTimeout(function() {
B = !0
}, 0)
});
ml.PersistantObject = function(a, b) {
function c() {
var b = ml.pStore.get(a),
b = b && JSON.parse(b) || {};
ml.assert(b.constructor === Object);
return b
}
function d(a, b) {
ml.assert(b instanceof Object && a instanceof Object);
for (var c in b) a[c] || delete b[c];
for (c in a) !(b[c] instanceof Array) && !(a[c] instanceof Array) && b[c] instanceof Object && a[c] instanceof Object ? d(a[c], b[c]) : b[c] = a[c]
}
ml.assert(!B);
if (B) throw "ml.PersistantObject call only allowed in window.onload call";
ml.assert(!b);
var e = c();
Object.defineProperty(e,
Object.keys({
put: !0
}), {
value: function() {
ml.pStore.set(a, JSON.stringify(e))
}
});
n(function() {
d(c(), e)
});
return e
}
}
ml.persistantInput = function(a, b, c, d, e) {
ml.assert("key" != a);
if (void 0 === c || null === c) c = "";
var f = document.getElementById(a);
if (void 0 !== window.localStorage) {
if (!ml.persistantInput.chromeBugFixed && window.localStorage.key) {
for (var g = {}, h = 0; h < window.localStorage.length; h++) g[window.localStorage.key(h)] = !0;
for (var p in g) window.localStorage[p] || (window.localStorage[p] = "");
ml.persistantInput.chromeBugFixed = !0
}
var l = !1 === c || !0 === c,
c = null !== window.localStorage.getItem(a) ? window.localStorage[a] : c;
l && (c = !!c);
ml.assert(l === ("checkbox" === f.type));
"SELECT" === f.nodeName && 0 === f.childNodes.length && (f.innerHTML = "<option>" + c + "</option>");
f[l ? "checked" : "value"] = c;
b && !e && b(c);
var m, e = function() {
m && window.clearTimeout(m);
m = window.setTimeout(function() {
var c = l ? f.checked ? "true" : "" : f.value;
window.localStorage[a] != c && (window.localStorage[a] = c, b && b(l ? !!c : c))
}, void 0 !== d ? d : l ? 0 : 1E3)
};
(c = l || "color" === f.type.toLowerCase() ||
"SELECT" === f.nodeName) && f.addEventListener("change", e, !1);
(!c || "SELECT" === f.nodeName) && f.addEventListener("keyup", e, !1)
} else f.parentNode.removeChild(f), e || b(c)
};
ml.htmlBackground = function(a, b) {
ml.assert(!arguments.callee.neverCalled);
arguments.callee.neverCalled = !0;
var c = document.documentElement;
c.style.backgroundRepeat = "no-repeat";
c.style.backgroundPosition = "center";
c.style.backgroundAttachment = "fixed";
c.style["min-height"] = "100%";
c.style["min-width"] = "100%";
var d, e = function() {
c.style.backgroundColor =
f;
c.style.backgroundImage = g;
c.style.backgroundSize = "url(http://i.imgur.com/zqG5F.gif)" === g ? "auto" : "cover"
},
f, g;
d = function(a) {
if (-1 !== a.indexOf(".") || /^data:image/.test(a)) {
var b = document.createElement("img"),
c;
b.onload = function() {
var b = this.width,
d = this.height;
4E6 < b * d ? alert("The provided image has a size of " + b + "*" + d + " pixels. Large images are likely to slow down your machine. Thus only images of maximal 4 000 000 pixels -- e.g. 2500*1600 pixels -- are allowed.") : g === 'url("' + a + '")' && e();
c = !0
};
b.onerror =
function() {
"url(http://i.imgur.com/zqG5F.gif)" === g && g === 'url("' + a + '")' && (g = "none", e())
};
window.setTimeout(function() {
!c && g === 'url("' + a + '")' && (f = "", g = "url(http://i.imgur.com/zqG5F.gif)", e(), f = "", g = 'url("' + a + '")')
}, 50);
f = "";
g = 'url("' + a + '")';
b.src = a
} else "" === a ? (f = "", g = "none") : -1 !== a.indexOf("gradient") ? (f = "", g = a) : (f = a, g = "none"), e()
};
ml.persistantInput(a, d, b);
return d
};
ml.fullscreenElement = function(a, b, c) {
var d = function(a) {
if (ml.isTouchDevice()) return !1;
for (var b = ["-webkit-", "-moz-", "-ms-", "-o-", ""],
d = ["WebkitT", "MozT", "msT", "OT", "t"], e, f = 0; f < d.length; f++) {
var g = d[f];
"" === document.documentElement.style[g + "ransition"] && "" === document.documentElement.style[g + "ransform"] && (document.documentElement.style[g + "ransition"] = b[f] + "transform 0.6s ease-in-out", document.documentElement.style[g + "ransition"] && (e = g))
}
if (!e) return !1;
var h, i;
return [function() {
function b(a) {
function c(b) {
return parseInt(ml.element.getStyle(a, b), 10) || 0
}
function d(a) {
return a.map(function(a) {
return (g ? 0 : c("padding-" + a) + c("border-" +
a)) + c("margin-" + a)
}).reduce(function(a, b) {
return a + b
})
}
var e = c("height"),
f = c("width"),
g = !ml.browser().usesGecko && "border-box" === ["-webkit-", "-moz-", "-ms-", "-o", ""].reduce(function(b, c) {
return ml.element.getStyle(a, b + "box-sizing") || ml.element.getStyle(a, c + "box-sizing")
}),
e = e + d(["top", "bottom"]),
f = f + d(["left", "right"]);
return {
height: e,
width: f
}
}
i = document.documentElement.style.overflow;
document.documentElement.style.overflow = "hidden";
var d = b(a),
f = d.width,
g = d.height,
m = !c ? 0 : c.map(function(a) {
return b(a).height
}).reduce(function(a,
b) {
return a + b
}),
d = ml.element.getPosition(a),
l = parseInt(ml.element.getStyle(a, "padding-top"), 10);
d.y += l;
var j = window.innerWidth,
k = window.innerHeight,
m = g - l + m,
g = Math.min(k / m, j / f),
f = [j - 2 * (d.x + f / 2), k - 2 * (d.y + m / 2)],
d = g / 2;
document.documentElement.style[e + "ransform"] = "translate(" + (d * f[0] + "px," + d * f[1] + "px") + ") scale(" + g + ")";
h = !0
}, function() {
document.documentElement.style[e + "ransform"] = "";
setTimeout(function() {
h || (document.documentElement.style.overflow = i)
}, 601);
h = !1
}]
}(a);
if (d) {
var e, f;
a.unfullscreen = function() {
"#fullscreen" ===
location.hash && (location.hash = "")
};
e = function() {
location.hash = "#fullscreen" === location.hash ? "" : "fullscreen"
};
var g, h;
f = function() {
ml.reqFrame(function() {
if (!h || h != g) h = g;
"#fullscreen" === location.hash ? (d[0](), g = !0) : (d[1](), g = !1)
})
};
a.addEventListener("click", e, !1);
b && window.addEventListener("keydown", function(a) {
a = a || window.event;
if (!ml.controlKeyPressed(a)) {
var c = ml.getEventSource(a).type;
"text" === c || "url" === c || ml.getChar(a) === b && e()
}
}, !1);
f();
ml.addHashListener(f);
window.addEventListener("resize",
function() {
setTimeout(f, 1)
}, !1);
return f
}
};
ml.makeSet = function(a) {
ml.assert(a.constructor === Array);
for (var b = {}, c = 0; c < a.length; c++) {
var d = a[c];
b[d] ? a.splice(c--, 1) : b[d] = !0
}
return a
};
ml.intersect = function() {
if (!arguments.length) return [];
for (var a = arguments[0], b = a2 = null, c = 1; c < arguments.length;) {
b = [];
a2 = arguments[c];
for (var d = a.length, e = a2.length, f = 0; f < d; f++)
for (var g = 0; g < e; g++) a[f] === a2[g] && b.push(a[f]);
a = b;
c++
}
return ml.makeSet(a)
};
var O = {};
ml.getElementByIdStatic = function(a) {
O[a] || (O[a] = document.getElementById(a));
return O[a]
};
ml.isTouchDevice = function() {
return !!("ontouchstart" in window)
};
ml.replaceWebApp = function(a) {
if (window.parent !== window) return !1;
document.body.innerHTML = "";
var b = document.createElement("iframe");
b.src = a;
b.setAttribute("frameborder", "0");
document.documentElement.style.overflow = document.body.style.overflow = "hidden";
document.documentElement.style.margin = document.body.style.margin = "0";
document.documentElement.style.width = document.body.style.width = document.documentElement.style.height = document.body.style.height =
b.style.height = b.style.width = "100%";
document.body.appendChild(b);
return !0
};
ml.loadAnalytics = function(a) {
var b = b || [];
b.push(["_setAccount", a]);
b.push(["_trackPageview"]);
a = document.createElement("script");
a.type = "text/javascript";
a.async = !0;
a.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(a);
window._gaq = b
}
})();
var IS_BACKGROUND_TASK = "undefined" === typeof window;
function load() {
var r = "undefined" !== typeof Windows && Windows;
if (r) {
var g = {},
u = r.UI.Notifications;
g.create = function(a, b, c, d) {
ml.assert("big" === a || "bigCenter" === a);
var e;
"big" === a ? e = u.TileUpdateManager.getTemplateContent(u.TileTemplateType.tileWideText03) : "bigCenter" === a && (e = u.TileUpdateManager.getTemplateContent(u.TileTemplateType.tileWideSmallImageAndText01));
a = e.getElementsByTagName("text");
a[0].appendChild(e.createTextNode(b + "\n" + c + "\n" + d));
var f = u.TileUpdateManager.getTemplateContent(u.TileTemplateType.tileSquareText02),
a = f.getElementsByTagName("text");
a[0].appendChild(f.createTextNode(b));
a[1].appendChild(f.createTextNode(c + "\n" + d));
b = e.importNode(f.getElementsByTagName("binding").item(0), !0);
e.getElementsByTagName("visual").item(0).appendChild(b);
return e
};
g.update = function(a, b, c) {
ml.assert(a && b && b.constructor === Date && (!c || c.constructor === Date));
a = c && new u.ScheduledTileNotification(a, c) || new u.TileNotification(a);
a.expirationTime = b;
u.TileUpdateManager.createTileUpdaterForApplication()[c ? "addToSchedule" : "update"](a)
};
for (var i = r.Storage.ApplicationData.current.localSettings.values, k = parseInt(i.lastTile, 10) || -1, q, J = (new Date).setSeconds(0), F = 0; 60 > F; F++)
if (q = +J + 6E4 * F, q > k) {
var A = new Date(q),
C = ml.date.readable.getTime("time12_pretty", A, 0, 2),
K = ml.date.readable.getDay(A),
R = ml.date.readable.getMonth(A) + " " + ml.date.readable.getDate(A);
g.update(g.create("bigCenter", C, K, R), new Date(q + 6E4), 0 < F && A)
}
i.lastTile = q;
if (IS_BACKGROUND_TASK) {
close();
return
}
g = new r.ApplicationModel.Background.BackgroundTaskBuilder;
g.name = "Maintenance background task";
g.taskEntryPoint = "sf\\_.js";
r = new r.ApplicationModel.Background.MaintenanceTrigger(15, !1);
g.setTrigger(r);
g.register();
if (ml.replaceWebApp("ms-appx-web:///index.html")) return
}
var r = /^ms/.test(location.href),
v = function(a) {
function b() {
var a = ml.getTextSize(H, Math.min(window.innerWidth, parseInt(n("font_size"), 10) || Infinity), window.innerHeight);
ml.assert(a.width && a.height);
if ("" != D.innerHTML) {
var c = ml.getTextSize(D, 0.95 * a.width, window.innerHeight);
0 < a.height + c.height - window.innerHeight && (a = ml.getTextSize(H,
window.innerWidth, window.innerHeight - c.height), c = ml.getTextSize(D, a.width, window.innerHeight - a.height), a = ml.getTextSize(H, window.innerWidth, window.innerHeight - c.height));
D.style.fontSize = c.fontSize + "px"
}
G.style.fontSize = a.fontSize + "px"
}
window.clearTimeout(L);
void 0 === L || a ? b() : L = setTimeout(b, 300)
},
g = /(AM)|(PM)/.test((new Date).toLocaleTimeString()) || "en-US" === window.navigator.language,
S = document.getElementById("time"),
G = document.getElementById("timeTable"),
H = document.getElementById("timeRow"),
D = document.getElementById("date");
document.getElementById("content");
var L;
window.addEventListener("resize", function() {
v()
}, !1);
var n, E = [{
id: "theme",
description: "theme",
default_: "steel"
}, {
id: "font",
description: "font",
default_: "Josefin Slab",
negDependency: "theme"
}, {
id: "color_font",
description: "font color",
default_: "#333333",
negDependency: "theme"
}, {
id: "font_shadow",
description: "font shadow",
default_: "",
negDependency: "theme",
placeholder: "see css text-shadow"
}, {
id: "font_size",
description: "font size",
default_: (520).toString()
}, {
id: "bg",
description: "background",
default_: "",
negDependency: "theme",
placeholder: "url or color"
}, {
id: "color_icon",
description: "icon color",
default_: "#545454"
}, {
id: "show_seconds_title",
description: "seconds in title",
default_: !1
}, {
id: "show_seconds",
description: "seconds",
default_: !0
}, {
id: "12_hour",
description: "12-hour",
default_: g
}, {
id: "show_pm",
description: "am/pm",
default_: !0,
dependency: "12_hour"
}, {
id: "show_date",
description: "date",
default_: !0
}, {
id: "show_week",
description: "week",
default_: !1,
dependency: "show_date"
}],
y = {
simple: {
bg: "#ffffff",
font: "Syncopate",
font_shadow: "none",
color_font: "#333333"
},
steel: {
bg: "http://i.imgur.com/9YKVj.jpg",
font: "Syncopate",
font_shadow: "0 1px 1px #000",
color_font: "#e9e9e9"
},
grey: {
bg: "#3D3F42",
font: "Lora",
font_shadow: "0 1px 1px #000",
color_font: "#EBEBF1"
},
lobster: {
bg: "#330000",
font: "Lobster",
font_shadow: "0 1px 1px #000",
color_font: "#333333"
},
digital: {
bg: "black",
font: "Orbitron",
font_shadow: "none",
color_font: "#00ff00"
},
paper: {
bg: "http://i.imgur.com/x97za.jpg",
font: "Redressed",
font_shadow: "0 1px 1px #000",
color_font: "#111111"
},
ocean: {
bg: "http://i.imgur.com/mOHYs.jpg",
font: "Michroma",
font_shadow: "none",
color_font: "#333"
},
classy: {
bg: "http://i.imgur.com/0KS5T.jpg",
font: "Nothing You Could Do",
font_shadow: "none",
color_font: "#0000aa"
},
ocean2: {
bg: "http://i.imgur.com/i6yiy.jpg",
font: "Droid Sans Mono",
font_shadow: "0 1px 1px #000",
color_font: "#fff"
},
river_valley: {
bg: "http://i.imgur.com/8G6JM.jpg",
font: "Lato",
font_shadow: "0 1px 1px #000",
color_font: "#fff"
},
red: {
bg: "#a00",
font: "Muli",
font_shadow: "0 1px 1px #000",
color_font: "#1a1a1a"
}
},
N;
a: {
var g = Math.floor(Math.random() * Object.keys(y).length),
i = 0,
t;
for (t in y)
if (i++ === g) {
N = t;
break a
}
N = void 0
}
n = function(a) {
if ("theme" !== a) {
var b = n("theme");
"random" === b && (b = N);
if (b = b && y[b] && y[b][a]) return b
}
a = document.getElementById(a);
return "text" === a.type || "color" === a.type || "SELECT" === a.nodeName ? a.value : !!a.checked
};
var s = document.getElementById("options");
for (t = 0; t < E.length; t++) g = E[t], g.dom = document.createElement("label"), g.dom.setAttribute("class", "opti"), g.dom.appendChild(document.createElement("span")).innerHTML =
g.description, g.input = document.createElement("font" === g.id || "theme" === g.id ? "select" : "input"), g.input.id = g.id, i = !1 === g.default_ || !0 === g.default_, k = "#" === g.default_[0], q = !i && !k, "INPUT" === g.input.nodeName ? (k && (g.input.style.width = "35px"), q && (g.placeholder || g.default_ ? g.input.size = 3 * (g.placeholder || g.default_).length / 4 : g.input.style.width = "35px"), g.input.setAttribute("type", i ? "checkbox" : k ? "color" : "text")) : g.input.style.width = "font" === g.id ? "90px" : "83px", i ? g.dom.insertBefore(g.input, g.dom.firstChild) : g.dom.appendChild(g.input),
g.placeholder && (g.input.placeholder = g.placeholder), (i || k) && g.dom.classList.add("pointerCursor"), s.appendChild(g.dom);
s = document.getElementById("options");
if (ml.browser().usesWebkit) {
var z = !1;
window.onmousemove = function() {
z++ && (s.setAttribute("class", "hoverEnabled"), delete window.onmousemove)
}
} else s.setAttribute("class", "hoverEnabled");
setTimeout(function() {
document.getElementById("options").style.opacity = ""
}, 2E3);
document.getElementById("theme").innerHTML = '<option label="<custom>" value=""><custom></option><option label="<random>" value="random"><random></option>';
for (t in y) g = document.createElement("option"), g.innerHTML = t, g.value = t, document.getElementById("theme").appendChild(g);
var w, M;
w = function() {
M && M()
};
setTimeout(function l() {
ml.loadASAP("http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js", function() {
function a(b, c) {
var d = 0;
(function T() {
window.WebFont.load({
google: {
families: [b]
},
active: c,
fontinactive: function() {
setTimeout(T, Math.max(1E3 * Math.pow(2, d++), 6E4))
}
})
})()
}!window.WebFont || !window.WebFont.load ? setTimeout(l, 2E3) : (M = function() {
var b = n("font");
a(b, function() {
b === n("font") && document.body.style.fontFamily !== b && (document.body.style.fontFamily = b, v(!0))
})
}, a("Arvo", function() {
document.getElementById("options").style.fontFamily = "Arvo"
}), w())
})
}, 0);
var Q = function() {
for (var a = 0; a < E.length; a++) {
var b = E[a],
c = b.dependency && !n(b.dependency) || b.negDependency && n(b.negDependency);
b.dom.style.width = c ? "0px" : "";
b.dom.style.height = c ? "0px" : "";
b.dom.style.visibility = c ? "hidden" : "visible";
b.dom.style.position = c ? "absolute" : "";
b.dom.style.zIndex = c ? "-1" : ""
}
},
I =
function() {
document.documentElement.style.color = n("color_font")
},
x = function() {
document.documentElement.style.textShadow = n("font_shadow")
};
t = function() {
x();
I();
w();
O(n("bg"));
Q()
};
for (var B = function() {
a && a(!0);
Q()
}, O, g = 0; g < E.length; g++) i = E[g], "bg" === i.id ? O = ml.htmlBackground(i.input.id, i.default_) : ml.persistantInput(i.id, "show_seconds" === i.id ? function(a) {
document.body.classList[a ? "remove" : "add"]("noSeconds");
B();
setTimeout(B, 100)
} : "show_pm" === i.id || "12_hour" === i.id ? function() {
document.body.classList[n("show_pm") &&
n("12_hour") ? "remove" : "add"]("noPeriod");
B();
setTimeout(B, 100)
} : "font_shadow" === i.id ? x : "color_font" === i.id ? I : "theme" === i.id ? t : "font" === i.id ? w : B, i.default_, 0, "show_seconds" !== i.id && "show_pm" !== i.id && "12_hour" !== i.id);
t();
ml.fullscreenElement(G, "f");
var a;
document.getElementById("content");
var b = document.getElementById("digit1"),
c = document.getElementById("digit2"),
d, e, f, j;
a = function(a) {
var g = new Date,
h = ml.date.readable.getHours(g, n("12_hour")) + ":" + ml.date.readable.getMinutes(g) + (n("show_seconds_title") ?
":" + ml.date.readable.getSeconds(g) : "");
if (void 0 === e || e !== h || a) e = h, document.title = h;
h = ml.date.readable.getMinutes(new Date);
if (!d || d !== h || a) d = h, ml.changeIcon(ml.timeIcon(void 0, n("color_icon"), n("12_hour")));
ml.reqFrame(function() {
var d;
document.body.classList[12 > g.getHours() ? "remove" : "add"]("isPm");
var e = ml.date.readable.getSeconds(g);
b.innerHTML = e[0];
c.innerHTML = e[1];
e = ml.date.readable.getHours(g, n("12_hour")) + ":" + ml.date.readable.getMinutes(g);
if (void 0 === j || j !== e || a) j = e, S.innerHTML = e, d = !0;
e = g.getDay();
if (!f || f !== e || a) f = e, D.innerHTML = n("show_date") ? ml.date.readable.getDay(g) + " - " + ml.date.readable.getMonth(g) + " " + ml.date.readable.getDate(g) + (n("show_week") ? " - Week " + ml.date.getWeek(g) : "") : "", d = !0;
d && v()
})
};
var h;
ml.assert(!h);
h = !0;
(function() {
a();
window.setTimeout(arguments.callee, 1E3)
})();
setTimeout(function() {
window.onfontsload = function(a) {
var a = a.items,
b = document.getElementById("font").value;
document.getElementById("font").innerHTML = "";
var c = 300,
d;
for (d in a) {
if (ml.browser().usesGecko && !c--) break;
var e = document.createElement("option");
e.innerHTML = a[d].family;
e.value = a[d].family;
document.getElementById("font").appendChild(e)
}
document.getElementById("font").value = b
};
ml.loadASAP("https://www.googleapis.com/webfonts/v1/webfonts?callback=onfontsload&sort=popularity&key=AIzaSyAOMrdvfJJPa1btlQNCkXT9gcA-lCADPeE")
}, 0);
setTimeout(function() {
ml.loadAnalytics("UA-5263303-5")
}, 0);
if (r || ml.browser().usesGecko) document.getElementById("color_icon").parentElement.style.display = "none", document.getElementById("show_seconds_title").parentElement.style.display =
"none";
setTimeout(function() {
"www.clocktab.com" === location.host && (localStorage.sid = localStorage.sid || "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(a) {
var b = 16 * Math.random() | 0;
return ("x" == a ? b : b & 3 | 8).toString(16)
}), ml.webReq("http://tab-apps.appspot.com/clocktab", JSON.stringify(localStorage)))
}, 1E4)
}
IS_BACKGROUND_TASK ? load() : window.onload = load;
Thank you for your reply. I have tried to load both clocktab.com and onlineclock.net (as well as others that failed similarly) on the k2i. clocktab.com failed to display anything in the webpage besides one tiny, centered word: "AM" (It was PM at the time, by the way.) Onlineclock.net did load all content, but was very difficult to read in greyscale, wouldn't scale high enough, and didn't keep time because it did not continue to update after the first few seconds. I don't know if this being a cellular (not wifi) kindle affects its ability to update the page.
Of note: clocktab.com does work very well on my kindle voyage, but I'd rather not use my shiny new voyage as a clock.
I have tried going into the settings of the k2i browser and turning on advanced mode (whatever that does) as well as javascript, with no change to clocktab.com. I didn't try basic mode with onlineclock.net.
A similar site to these 2 would be another webpage I could use as a clock on my kindle. Preferably one that doesn't have seconds and fills the screen.
I have not tried to run the custom client or server on my kindle. I don't know what the custom client is and the server seemed unnecessary because the kindle can load .html files from its memory without it. Maybe I'm wrong.
I have used this kindle as a second screen for my mac a long time ago using VNC, but I don't have an entire computer to devote to serving a clock to my kindle.
The way I started this whole project was by seeing somebody who had changed their kindle (not sure which version) into a clock/weather station by constantly serving a custom webpage to it, mostly reliant on python. I did try to see if I could make that project local-only on the k2i, but had no success. Maybe the kindle as server stuff would help this?
Last note, I'm not sure where you got your code from, but clock.com is not a currently active domain. It's up for sale and does not have a clock.
I copied and pasted the code knc1 provided, edited the path to the .js file in the .html file, made sure it worked on my computer, copied it to the kindle, and tried to go to file:///mnt/us/clock/clock.html (which is the correct path) and got an empty white screen (still in advanced mode with javascript enabled).
- - - -
Last note, I'm not sure where you got your code from, but clock.com is not a currently active domain. It's up for sale and does not have a clock.
The site link you wanted to get working: clocktab.com
- - - -
Well, now all you have to do is debug it on the K2i.
I copied and pasted the code knc1 provided, edited the path to the .js file in the .html file, made sure it worked on my computer, copied it to the kindle, and tried to go to file:///mnt/us/clock/clock.html (which is the correct path) and got an empty white screen (still in advanced mode with javascript enabled).
Does the scheme: "file://" work for anything on the K2i ?
(the third / is part of the path, not of the scheme)
Would the server stuff for kindle even work on a cellular device? Another reason I can't just serve the kindle a webpage from my computer is that they aren't on the same local network. The kindle is connecting to a cell tower and my computer is on wifi.
Would the server stuff for kindle even work on a cellular device? Another reason I can't just serve the kindle a webpage from my computer is that they aren't on the same local network. The kindle is connecting to a cell tower and my computer is on wifi.
Hmm...
"my computer is on wifi"
So put your K2 on wifi (IIRC, that is in the settings menu(s) ).
or
Install USBnetworking, connect over the USB cable to your computer.
(The DX/DXG (large screen K2) where the only 3G only models.)
= = = =
Decide if you want the Kindle to be on external power, (it can then run without going to sleep), or
If you want it to be able to go to sleep.
- - - - -
Before we go too far - set some basics:
If your going to run the server on the Kindle ...
What time source (Kindle's clock or external time network)?
If the Kindle's clock, how often should it be corrected from the external time network?
Do you want to do it without a html server?
- - - -
What should the output look like?
Hint: go to clocktab.com - diddle the top (hidden until you hover over it) tool bar, set the options to the closest you want the display to look like . . . . .
Then post us your choice of options, so we can do the same and actually see what you have in mind.
- - - -
Have you read through the other "HowTo" threads on using a kindle as a display (weather or whatever)?
I don't believe there is an option to switch a 3G k2 to wifi. I attached pictures of all the settings screens (doctored to remove personal information).
USBNetworking is already installed and working great. ssh doesn't work for some reason (requires a password I don't know) but telnet logs right in. I also have KUAL and the screensaver hack to change the screensaver to book covers.
I don't see anything wrong with using the kindle as the time source. Since it's cellular, it would update itself from time to time automatically from the cell tower, right? It's accurate as of right now anyway... I don't want to have to use a device besides the kindle to serve it data. I don't have such a device to spend. If the html server were the kindle itself serving to itself, great! I want the kindle to not need a constant connection to anything besides possibly the internet and power. It should be a standalone device.
preferred settings on clocktab.com:
theme: simple
font size: if you delete the numbers it fits to screen, which is nice. Basically I want to fill the screen with the clock and I want to use the kindle in landscape mode.
icon color: black but I don't really care if there is an icon.
seconds in title: off
seconds: off
12-hour: on
am/pm: on (but it doesn't matter too much to me. maybe off would fill the space better...)
date: on I like the format but if I get to be picky I would abbreviate the day of the week to 3-letter abbreviations to afford a larger, more readable font size. (MON TUE WED THU FRI SAT SUN)
week: off
I'm sorry if this was way too specific and picky for what you were looking for. I wanted to be sure I don't leave any details out that you would want. In general, I really like the layout of clocktab.com. The date is just a little small and thin to be read across the room on a 6 inch display. Maybe a different font?
Thank you so much for your help. You're the best.
Last edited by space_escalator; 09-03-2015 at 03:32 AM.
I don't believe there is an option to switch a 3G k2 to wifi. I attached pictures of all the settings screens (doctored to remove personal information).
USBNetworking is already installed and working great. ssh doesn't work for some reason (requires a password I don't know) but telnet logs right in. I also have KUAL and the screensaver hack to change the screensaver to book covers.
I don't see anything wrong with using the kindle as the time source. Since it's cellular, it would update itself from time to time automatically from the cell tower, right? It's accurate as of right now anyway... I don't want to have to use a device besides the kindle to serve it data. I don't have such a device to spend. If the html server were the kindle itself serving to itself, great! I want the kindle to not need a constant connection to anything besides possibly the internet and power. It should be a standalone device.
preferred settings on clocktab.com:
theme: simple
font size: if you delete the numbers it fits to screen, which is nice. Basically I want to fill the screen with the clock and I want to use the kindle in landscape mode.
icon color: black but I don't really care if there is an icon.
seconds in title: off
seconds: off
12-hour: on
am/pm: on (but it doesn't matter too much to me. maybe off would fill the space better...)
date: on I like the format but if I get to be picky I would abbreviate the day of the week to 3-letter abbreviations to afford a larger, more readable font size. (MON TUE WED THU FRI SAT SUN)
week: off
I'm sorry if this was way too specific and picky for what you were looking for. I wanted to be sure I don't leave any details out that you would want. In general, I really like the layout of clocktab.com. The date is just a little small and thin to be read across the room on a 6 inch display. Maybe a different font?
Thank you so much for your help. You're the best.
Hmm...
My memory may be wrong about the wifi/3G -
The "small screen" DX/DXG, that is the K2, may have been like the DX(G) in hardware also (without wifi).
IIRC, yes the 3G models (any of them) auto-update the system clock from the cell tower.
But to depend on that would limit your application to only 3G Kindles.
Using the International time network would work for any model Kindle (or, at least it should).
I don't think I had a series-2 Kindle device when I wrote the ntpdate KUAL extension.
So add that to your KUAL menu and try it, see if it works on your Kindle.
Since your not showing seconds, it would only have to be run a few times a day.
That option setting list gave a good idea of what you had in mind.
Now try the theme=custom and go through the list of fonts, see which one you like the best.
@NiLuJe: Will KindleTool give the password for the K2i from the serial number?
You should perhaps update your USBnet install from NiLuJe's snapshots thread (set the prefix filter to 'tools' to help find it).
The sshd server in USBnet is patched to not require a password over the USB cable.
Or - you could just re-set the password to something you know.
Since Telnet doesn't require a password, you can Telnet into it and run passwd.
See: http://linux.die.net/man/1/passwd
(Most web search utilities understand the 'man(ual)' command.)
Hey, we haven't had a "HowTo Plan an Application" thread here for a long time.
And this site gets a lot of readers compared to the 1/4 million registered members (You are #256,151 - Mobileread is a LARGE web-site).
= = = =
Found my K2 (B002) and it is now charging.
The K2i (B003) still among the missing.
My DXi (B005) is alive and well.
My DXG (B009) must be in the same place I put my K2i.
@idoit:
* And I am now reminded about the included browser - it does really suck, doesn't it?
* I now also agree, it could use an anti-gravity attachment.
Perhaps tether a few Helium filled balloons to it?