Skip to content
Snippets Groups Projects
Commit 74249c65 authored by Robin Appelman's avatar Robin Appelman
Browse files

give OC.imagePath the ability to detect whether to use svg or png images

parent 09eff063
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,9 @@ OC={ ...@@ -40,6 +40,9 @@ OC={
return link; return link;
}, },
imagePath:function(app,file){ imagePath:function(app,file){
if(file.indexOf('.')==-1){//if no extention is given, use png or svg depending on browser support
file+=(SVGSupport())?'.svg':'.png'
}
return OC.filePath(app,'img',file); return OC.filePath(app,'img',file);
}, },
addScript:function(app,script,ready){ addScript:function(app,script,ready){
...@@ -95,4 +98,8 @@ if (!Array.prototype.indexOf){ ...@@ -95,4 +98,8 @@ if (!Array.prototype.indexOf){
} }
return -1; return -1;
}; };
} }
\ No newline at end of file
function SVGSupport() {
return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") || document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape", "1.0");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment