Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upped version to 0.6

  • Loading branch information...
commit 353f493722d0b1736e14ef295c6f6a577b1e7827 1 parent 4e5d216
@tommoor authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  tinycon.js
  2. +1 −1  tinycon.min.js
View
2  tinycon.js
@@ -3,7 +3,7 @@
* Tom Moor, http://tommoor.com
* Copyright (c) 2012 Tom Moor
* MIT Licensed
- * @version 0.5
+ * @version 0.6
*/
(function(){
View
2  tinycon.min.js
@@ -3,6 +3,6 @@
Tom Moor, http://tommoor.com
Copyright (c) 2012 Tom Moor
MIT Licensed
- @version 0.5
+ @version 0.6
*/
(function(){var e={};var t=null;var n=null;var r=document.title;var i=null;var s=null;var o={};var u=window.devicePixelRatio||1;var a=16*u;var f={width:7,height:9,font:10*u+"px arial",colour:"#ffffff",background:"#F03D25",fallback:true,abbreviate:true};var l=function(){var e=navigator.userAgent.toLowerCase();return function(t){return e.indexOf(t)!==-1}}();var c={ie:l("msie"),chrome:l("chrome"),webkit:l("chrome")||l("safari"),safari:l("safari")&&!l("chrome"),mozilla:l("mozilla")&&!l("chrome")&&!l("safari")};var h=function(){var e=document.getElementsByTagName("link");for(var t=0,n=e.length;t<n;t++){if((e[t].getAttribute("rel")||"").match(/\bicon\b/)){return e[t]}}return false};var p=function(){var e=document.getElementsByTagName("link");var t=document.getElementsByTagName("head")[0];for(var n=0,r=e.length;n<r;n++){var i=typeof e[n]!=="undefined";if(i&&(e[n].getAttribute("rel")||"").match(/\bicon\b/)){t.removeChild(e[n])}}};var d=function(){if(!n||!t){var e=h();n=t=e?e.getAttribute("href"):"/favicon.ico"}return t};var v=function(){if(!s){s=document.createElement("canvas");s.width=a;s.height=a}return s};var m=function(e){p();var t=document.createElement("link");t.type="image/x-icon";t.rel="icon";t.href=e;document.getElementsByTagName("head")[0].appendChild(t)};var g=function(e){if(window.console)window.console.log(e)};var y=function(e,t){if(!v().getContext||c.ie||c.safari||o.fallback==="force"){return b(e)}var n=v().getContext("2d");var t=t||"#000000";var r=d();i=document.createElement("img");i.onload=function(){n.clearRect(0,0,a,a);n.drawImage(i,0,0,16,16,0,0,a,a);if(!c.mozilla)n.drawImage(i,0,0,32,32,0,0,a,a);if((e+"").length>0)w(n,e,t);E()};if(!r.match(/^data/)){i.crossOrigin="anonymous"}i.src=r};var b=function(e){if(o.fallback){if((e+"").length>0){document.title="("+e+") "+r}else{document.title=r}}};var w=function(e,t,n){if(typeof t=="number"&&t>99&&o.abbreviate){t=S(t)}var r=(t+"").length-1;var i=o.width*u+6*u*r,s=o.height*u;var f=a-s,l=a-i-u,h=16*u,p=16*u,d=2*u;e.font=(c.webkit?"bold ":"")+o.font;e.fillStyle=o.background;e.strokeStyle=o.background;e.lineWidth=u;e.beginPath();e.moveTo(l+d,f);e.quadraticCurveTo(l,f,l,f+d);e.lineTo(l,h-d);e.quadraticCurveTo(l,h,l+d,h);e.lineTo(p-d,h);e.quadraticCurveTo(p,h,p,h-d);e.lineTo(p,f+d);e.quadraticCurveTo(p,f,p-d,f);e.closePath();e.fill();e.beginPath();e.strokeStyle="rgba(0,0,0,0.3)";e.moveTo(l+d/2,h);e.lineTo(p-d/2,h);e.stroke();e.fillStyle=o.colour;e.textAlign="right";e.textBaseline="top";e.fillText(t,u===2?29:15,c.mozilla?7*u:6*u)};var E=function(){if(!v().getContext)return;m(v().toDataURL())};var S=function(e){var t=[["G",1e9],["M",1e6],["k",1e3]];for(var n=0;n<t.length;++n){if(e>=t[n][1]){e=x(e/t[n][1])+t[n][0];break}}return e};var x=function(e,t){var n=new Number(e);return n.toFixed(t)};e.setOptions=function(e){o={};for(var t in f){o[t]=e.hasOwnProperty(t)?e[t]:f[t]}return this};e.setImage=function(e){t=e;E();return this};e.setBubble=function(e,t){e=e||"";y(e,t);return this};e.reset=function(){m(n)};e.setOptions(f);window.Tinycon=e})()
Please sign in to comment.
Something went wrong with that request. Please try again.