Permalink
Browse files

Added minified version

  • Loading branch information...
1 parent 5f4b320 commit cbc41cd033d446ff3c4e55234bbcf2700cdb23d1 @hitautodestruct hitautodestruct committed Aug 4, 2013
Showing with 12 additions and 0 deletions.
  1. +12 −0 svgeezy.min.js
View
@@ -0,0 +1,12 @@
+/*
+ * SVGeezy.js 1.0
+ *
+ * Copyright 2012, Ben Howdle http://twostepmedia.co.uk
+ * Released under the WTFPL license
+ * http://sam.zoy.org/wtfpl/
+ *
+ * Date: Sun Aug 26 20:38 2012 GMT
+ * //call like so, pass in a class name that you don't want it to check and a filetype to replace .svg with
+ * svgeezy.init('nocheck', 'png');
+*/
+var svgeezy=function(){return{init:function(a,b){this.avoid=a||!1,this.filetype=b||"png",this.svgSupport=this.supportsSvg(),this.svgSupport||(this.images=document.getElementsByTagName("img"),this.imgL=this.images.length,this.fallbacks())},fallbacks:function(){for(;this.imgL--;)if(!this.hasClass(this.images[this.imgL],this.avoid)||!this.avoid){var a=this.images[this.imgL].getAttribute("src");if(null===a)continue;if("svg"==this.getFileExt(a)){var b=a.replace(".svg","."+this.filetype);this.images[this.imgL].setAttribute("src",b)}}},getFileExt:function(a){var b=a.split(".").pop();return-1!==b.indexOf("?")&&(b=b.split("?")[0]),b},hasClass:function(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")>-1},supportsSvg:function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")}}}();

0 comments on commit cbc41cd

Please sign in to comment.