Skip to content

Commit

Permalink
Added minified version
Browse files Browse the repository at this point in the history
  • Loading branch information
hitautodestruct committed Aug 4, 2013
1 parent 5f4b320 commit cbc41cd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions svgeezy.min.js
Original file line number Original file line Diff line number Diff line change
@@ -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.