Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHendrik Leppelsack <hendrik@leppelsack.de>2016-06-23 13:15:16 +0300
committerVincent Petry <pvince81@owncloud.com>2016-07-01 17:36:37 +0300
commit1ad97f847920056a6ca1645d5516e010d620ccea (patch)
tree61afc0ef4117f4888531f0ee276cf03ab047468a /core
parent027715f9acba4dc314a7e4c63ac41a58d4e33f22 (diff)
remove javascript png fallback for svg
Diffstat (limited to 'core')
-rw-r--r--core/js/js.js103
1 files changed, 9 insertions, 94 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 7f98668dcb2..8acb08698b2 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -327,8 +327,8 @@ var OC={
* @return {string}
*/
imagePath:function(app,file){
- if(file.indexOf('.')==-1){//if no extension is given, use png or svg depending on browser support
- file+=(OC.Util.hasSVGSupport())?'.svg':'.png';
+ if(file.indexOf('.')==-1){//if no extension is given, use svg
+ file+='.svg';
}
return OC.filePath(app,'img',file);
},
@@ -613,9 +613,6 @@ var OC={
throw e;
});
}
- if(!OC.Util.hasSVGSupport()) {
- OC.Util.replaceSVG();
- }
}).show();
}, 'html');
}
@@ -1358,49 +1355,6 @@ if(typeof localStorage !=='undefined' && localStorage !== null){
}
/**
- * check if the browser support svg images
- * @return {boolean}
- */
-function SVGSupport() {
- return SVGSupport.checkMimeType.correct && !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', "svg").createSVGRect;
-}
-SVGSupport.checkMimeType=function(){
- $.ajax({
- url: OC.imagePath('core','breadcrumb.svg'),
- success:function(data,text,xhr){
- var headerParts=xhr.getAllResponseHeaders().split("\n");
- var headers={};
- $.each(headerParts,function(i,text){
- if(text){
- var parts=text.split(':',2);
- if(parts.length===2){
- var value=parts[1].trim();
- if(value[0]==='"'){
- value=value.substr(1,value.length-2);
- }
- headers[parts[0].toLowerCase()]=value;
- }
- }
- });
- if(headers["content-type"]!=='image/svg+xml'){
- OC.Util.replaceSVG();
- SVGSupport.checkMimeType.correct=false;
- }
- }
- });
-};
-SVGSupport.checkMimeType.correct=true;
-
-/**
- * Replace all svg images with png for browser compatibility
- * @param $el
- * @deprecated use OC.Util.replaceSVG instead
- */
-function replaceSVG($el){
- return OC.Util.replaceSVG($el);
-}
-
-/**
* prototypical inheritance functions
* @todo Write documentation
* usage:
@@ -1517,12 +1471,6 @@ function initCore() {
initSessionHeartBeat();
}
- if(!OC.Util.hasSVGSupport()){ //replace all svg images with png images for browser that don't support svg
- OC.Util.replaceSVG();
- }else{
- SVGSupport.checkMimeType();
- }
-
OC.registerMenu($('#expand'), $('#expanddiv'));
// toggle for menus
@@ -1791,24 +1739,21 @@ OC.Util = {
},
/**
* Returns whether the browser supports SVG
+ * @deprecated SVG is always supported (since 9.0)
* @return {boolean} true if the browser supports SVG, false otherwise
*/
- // TODO: replace with original function
- hasSVGSupport: SVGSupport,
+ hasSVGSupport: function(){
+ return true
+ },
/**
* If SVG is not supported, replaces the given icon's extension
* from ".svg" to ".png".
* If SVG is supported, return the image path as is.
* @param {string} file image path with svg extension
+ * @deprecated SVG is always supported (since 9.0)
* @return {string} fixed image path with png extension if SVG is not supported
*/
replaceSVGIcon: function(file) {
- if (file && !OC.Util.hasSVGSupport()) {
- var i = file.lastIndexOf('.svg');
- if (i >= 0) {
- file = file.substr(0, i) + '.png' + file.substr(i+4);
- }
- }
return file;
},
/**
@@ -1816,39 +1761,9 @@ OC.Util = {
* with PNG images.
*
* @param $el root element from which to search, defaults to $('body')
+ * @deprecated SVG is always supported (since 9.0)
*/
- replaceSVG: function($el) {
- if (!$el) {
- $el = $('body');
- }
- $el.find('img.svg').each(function(index,element){
- element=$(element);
- var src=element.attr('src');
- element.attr('src',src.substr(0, src.length-3) + 'png');
- });
- $el.find('.svg').each(function(index,element){
- element = $(element);
- var background = element.css('background-image');
- 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) {
- var i = background.lastIndexOf('.svg');
- if(i >= 0){
- background = background.substr(0,i) + '.png' + background.substr(i + 4);
- element.css('background-image', background);
- }
- }
- });
- });
- },
+ replaceSVG: function($el) {},
/**
* Fix image scaling for IE8, since background-size is not supported.