Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add makefile and minify with uglifyjs

  • Loading branch information...
commit d0f19120c033b9cd6bd3cfda62840c688c095a12 1 parent 0ad0bfe
@makeable authored
Showing with 8 additions and 4 deletions.
  1. +7 −0 Makefile
  2. +1 −4 notificon.min.js
View
7 Makefile
@@ -0,0 +1,7 @@
+all:
+ @uglifyjs -nc -o notificon.min.js notificon.js
+
+clean:
+ @rm notificon.min.js
+
+.PHONY: clean all
View
5 notificon.min.js
@@ -1,4 +1 @@
-(function(){var g=false,k=function(){if(g)return false;return!document.createElement("canvas").getContext?(g=true,console&&console.log("Notificon: requires canvas support"),false):true},l=function(c){c||(c={});var b=h(),b={color:"#000000",stroke:"rgba(255,255,255,0.85)",favicon:b?b.getAttribute("href"):"/favicon.ico"},a;for(a in b)c[a]||(c[a]=b[a]);return c},h=function(c){for(var b=document.getElementsByTagName("link"),a=0;a<b.length;a++)if(c&&/\bnotificon\b/i.test(b[a].getAttribute("rel")))return b[a];
-else if(!c&&/\bicon\b/i.test(b[a].getAttribute("rel")))return b[a];return false},m=function b(){var a=h(true);a&&(a.parentNode.removeChild(a),b())},j=function(b){var a=document.createElement("link");a.type="image/x-icon";a.rel="icon notificon";a.href=b;m();document.getElementsByTagName("head")[0].appendChild(a)},n=function(b,a){if(!k())return false;var f=l(a);if(!b.length)return j(f.favicon);var e=document.createElement("img");e.src=f.favicon;e.onload=function(){var a=document.createElement("canvas");
-a.width=e.width;a.height=e.height;a.getContext("2d").drawImage(e,0,0);if(b){var g=f.color,h=f.stroke,d=a.getContext("2d");d.font="10px monospace";d.fillStyle=g;d.textAlign="right";d.textBaseline="top";d.strokeStyle=h;d.lineWidth=4;d.strokeText(b,16,6);d.fillText(b,16,6)}try{return j(a.toDataURL("image/png"))}catch(i){if(console)return console.log("Notificon: cannot use icons located on a different domain ("+favicon+")"),false}};e.onerror=function(){if(console)return console.log("Notificon: image not found ("+
-f.favicon+")"),false};return true},i=function(b,a){n(b,a)};typeof exports!=="undefined"?module.exports=i:this.Notificon=i})(this);
+(function(){var a=!1,b=function(){return a?!1:document.createElement("canvas").getContext?!0:(a=!0,console&&console.log("Notificon: requires canvas support"),!1)},c=function(a){a||(a={});var b={color:"#000000",stroke:"rgba(255,255,255,0.85)",favicon:e()};for(var c in b)a[c]||(a[c]=b[c]);return a},d=function(a){var b=document.getElementsByTagName("link");for(var c=0;c<b.length;c++){if(a&&/\bnotificon\b/i.test(b[c].getAttribute("rel")))return b[c];if(!a&&/\bicon\b/i.test(b[c].getAttribute("rel")))return b[c]}return!1},e=function(){var a=d();return a?a.getAttribute("href"):"/favicon.ico"},f=function p(){var a=d(!0);a&&(a.parentNode.removeChild(a),p())},g=function(a){var b=document.createElement("link");b.type="image/x-icon",b.rel="icon notificon",b.href=a,f(),document.getElementsByTagName("head")[0].appendChild(b)},h=function(a,b,c,d){var e=a.getContext("2d");e.font="10px monospace",e.fillStyle=c,e.textAlign="right",e.textBaseline="top",e.strokeStyle=d,e.lineWidth=4,e.strokeText(b,16,6),e.fillText(b,16,6)},i=function(a){var b=document.createElement("canvas");b.width=a.width,b.height=a.height;var c=b.getContext("2d");return c.drawImage(a,0,0),b},j=function(a,d){if(!b())return!1;var e=c(d);if(!a.length)return g(e.favicon);var f=document.createElement("img");return f.src=e.favicon,f.onload=function(){var b=i(f);a&&h(b,a,e.color,e.stroke);try{return g(b.toDataURL("image/png"))}catch(c){if(console)return console.log("Notificon: cannot use icons located on a different domain ("+favicon+")"),!1}},f.onerror=function(){if(console)return console.log("Notificon: image not found ("+e.favicon+")"),!1},!0},k=function(a,b){j(a,b)};typeof exports!="undefined"?module.exports=k:this.Notificon=k})(this);
Please sign in to comment.
Something went wrong with that request. Please try again.