diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-07-28 04:28:04 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-07-28 04:28:04 +0200 |
commit | 74249c65da5b21c4b191f9792b510268c4b83454 (patch) | |
tree | 4f8b20b713c20db911463bc6359ad780c51f0cca /core | |
parent | 09eff063debd42b1c8e9873a3593fb2b0cfcda39 (diff) | |
download | nextcloud-server-74249c65da5b21c4b191f9792b510268c4b83454.tar.gz nextcloud-server-74249c65da5b21c4b191f9792b510268c4b83454.zip |
give OC.imagePath the ability to detect whether to use svg or png images
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js index 2f74bda2588..407c5708701 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -40,6 +40,9 @@ OC={ return link; }, 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); }, addScript:function(app,script,ready){ @@ -95,4 +98,8 @@ if (!Array.prototype.indexOf){ } 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"); +} |