Skip to content

Commit 0738a21

Browse files
committed
Merge pull request #13 from hitautodestruct/patch-1
Added minified version of svgeezy
2 parents 5f4b320 + cbc41cd commit 0738a21

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

svgeezy.min.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* SVGeezy.js 1.0
3+
*
4+
* Copyright 2012, Ben Howdle http://twostepmedia.co.uk
5+
* Released under the WTFPL license
6+
* http://sam.zoy.org/wtfpl/
7+
*
8+
* Date: Sun Aug 26 20:38 2012 GMT
9+
* //call like so, pass in a class name that you don't want it to check and a filetype to replace .svg with
10+
* svgeezy.init('nocheck', 'png');
11+
*/
12+
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 commit comments

Comments
 (0)