diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-02-26 03:10:01 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-02-26 03:10:29 +0100 |
commit | a5e892505e494b906f942aa3ac1d6489f73a5f05 (patch) | |
tree | 270baecccd4c55e8207924a3c864a82051ae2a42 /core | |
parent | 797e921b9aa25f832718a3c44cfcb936f96c49df (diff) | |
download | nextcloud-server-a5e892505e494b906f942aa3ac1d6489f73a5f05.tar.gz nextcloud-server-a5e892505e494b906f942aa3ac1d6489f73a5f05.zip |
more robust png fallback
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/core/js/js.js b/core/js/js.js index 076fbf04c78..4b5062eb1a6 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -252,16 +252,22 @@ function replaceSVG(){ $('.svg').each(function(index,element){ element=$(element); var background=element.css('background-image'); - if(background && background!='none'){ - background=background.substr(0,background.length-4)+'png)'; - element.css('background-image',background); + if(background){ + var i=background.lastIndexOf('.svg'); + if(i>=0){ + background=background.substr(0,i)+'.png'+background.substr(i+4); + element.css('background-image',background); + } } element.find('*').each(function(index,element) { element=$(element); var background=element.css('background-image'); - if(background && background!='none'){ - background=background.substr(0,background.length-4)+'png)'; - element.css('background-image',background); + if(background){ + var i=background.lastIndexOf('.svg'); + if(i>=0){ + background=background.substr(0,i)+'.png'+background.substr(i+4); + element.css('background-image',background); + } } }); }); |