|
|
@ -498,7 +498,7 @@ var OC={ |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if(!SVGSupport()) { |
|
|
|
if(!SVGSupport()) { |
|
|
|
replaceSVG(); |
|
|
|
OC.Util.replaceSVG(); |
|
|
|
} |
|
|
|
} |
|
|
|
}).show(); |
|
|
|
}).show(); |
|
|
|
}, 'html'); |
|
|
|
}, 'html'); |
|
|
@ -785,7 +785,7 @@ SVGSupport.checkMimeType=function(){ |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if(headers["content-type"]!=='image/svg+xml'){ |
|
|
|
if(headers["content-type"]!=='image/svg+xml'){ |
|
|
|
replaceSVG(); |
|
|
|
OC.Util.replaceSVG(); |
|
|
|
SVGSupport.checkMimeType.correct=false; |
|
|
|
SVGSupport.checkMimeType.correct=false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -793,35 +793,10 @@ SVGSupport.checkMimeType=function(){ |
|
|
|
}; |
|
|
|
}; |
|
|
|
SVGSupport.checkMimeType.correct=true; |
|
|
|
SVGSupport.checkMimeType.correct=true; |
|
|
|
|
|
|
|
|
|
|
|
//replace all svg images with png for browser compatibility
|
|
|
|
// replace all svg images with png for browser compatibility
|
|
|
|
function replaceSVG(){ |
|
|
|
// @deprecated use OC.Util.replaceSVG instead
|
|
|
|
$('img.svg').each(function(index,element){ |
|
|
|
function replaceSVG($el){ |
|
|
|
element=$(element); |
|
|
|
return OC.Util.replaceSVG($el); |
|
|
|
var src=element.attr('src'); |
|
|
|
|
|
|
|
element.attr('src',src.substr(0,src.length-3)+'png'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
$('.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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -900,7 +875,7 @@ function initCore() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!SVGSupport()){ //replace all svg images with png images for browser that dont support svg
|
|
|
|
if(!SVGSupport()){ //replace all svg images with png images for browser that dont support svg
|
|
|
|
replaceSVG(); |
|
|
|
OC.Util.replaceSVG(); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
SVGSupport.checkMimeType(); |
|
|
|
SVGSupport.checkMimeType(); |
|
|
|
} |
|
|
|
} |
|
|
@ -1134,6 +1109,72 @@ function relative_modified_date(timestamp) { |
|
|
|
else { return t('core','years ago'); } |
|
|
|
else { return t('core','years ago'); } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OC.Util = { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Returns whether the browser supports SVG |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return true if the browser supports SVG, false otherwise |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
// TODO: replace with original function
|
|
|
|
|
|
|
|
hasSVGSupport: SVGSupport, |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 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 file image path with svg extension |
|
|
|
|
|
|
|
* @return fixed image path with png extension if SVG is not |
|
|
|
|
|
|
|
* supported |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
replaceSVGIcon: function(file) { |
|
|
|
|
|
|
|
if (!OC.Util.hasSVGSupport()) { |
|
|
|
|
|
|
|
var i = file.lastIndexOf('.svg'); |
|
|
|
|
|
|
|
if (i >= 0) { |
|
|
|
|
|
|
|
file = file.substr(0, i) + '.png' + file.substr(i+4); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return file; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Replace SVG images in all elements that have the "svg" class set |
|
|
|
|
|
|
|
* with PNG images. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param $el root element from which to search, defaults to $('body') |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* get a variable by name |
|
|
|
* get a variable by name |
|
|
|
* @param string name |
|
|
|
* @param string name |
|
|
|