From 2781fdeed8f1d45ebba23fb2b2e22aa3bbd5f2ff Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind1991@gmail.com>
Date: Fri, 29 Jul 2011 16:52:09 +0200
Subject: [PATCH] automatically replace svg images with png for browsers that
 dont support svg

---
 core/js/js.js                   | 10 ++++++++++
 core/templates/layout.admin.php |  4 ++--
 core/templates/layout.user.php  |  4 ++--
 files/templates/index.php       |  4 ++--
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/core/js/js.js b/core/js/js.js
index 407c5708701..db96a1adb3e 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -103,3 +103,13 @@ if (!Array.prototype.indexOf){
 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");
 }
+
+$(document).ready(function(){
+	if(!SVGSupport()){//replace all svg images with png images for browser that dont support svg
+		$('img.svg').each(function(index,element){
+			element=$(element);
+			var src=element.attr('src');
+			element.attr('src',src.substr(0,src.length-3)+'png');
+		});
+	};
+});
diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php
index 78ccf877221..8077fd304f3 100644
--- a/core/templates/layout.admin.php
+++ b/core/templates/layout.admin.php
@@ -30,8 +30,8 @@
 		<div id="header">
 			<a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a>
 			<ul id="metanav">
-				<li><a href="<?php echo link_to('', 'index.php'); ?>" title="Back to files"><img src="<?php echo image_path('', 'actions/back.svg'); ?>"></a></li>
-				<li><a href="<?php echo link_to('', 'index.php?logout=true'); ?>" title="Log out"><img src="<?php echo image_path('', 'actions/logout.svg'); ?>"></a></li>
+				<li><a href="<?php echo link_to('', 'index.php'); ?>" title="Back to files"><img class='svg' src="<?php echo image_path('', 'actions/back.svg'); ?>"></a></li>
+				<li><a href="<?php echo link_to('', 'index.php?logout=true'); ?>" title="Log out"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>"></a></li>
 			</ul>
 		</div>
 
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index f8beb79e81e..a100eed96b1 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -31,8 +31,8 @@
 			<a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img src="<?php echo image_path('', 'owncloud-logo-small-white.png'); ?>" alt="ownCloud" /></a>
 			<?php echo $_['searchbox']?>
 			<ul id="metanav">
-				<li><a href="<?php echo link_to('settings', 'index.php'); ?>" title="Settings"><img src="<?php echo image_path('', 'actions/settings.svg'); ?>"></a></li>
-				<li><a href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="Log out"><img src="<?php echo image_path('', 'actions/logout.svg'); ?>"></a></li>
+				<li><a href="<?php echo link_to('settings', 'index.php'); ?>" title="Settings"><img class='svg' src="<?php echo image_path('', 'actions/settings.svg'); ?>"></a></li>
+				<li><a href="<?php echo link_to('', 'index.php'); ?>?logout=true" title="Log out"><img class='svg' src="<?php echo image_path('', 'actions/logout.svg'); ?>"></a></li>
 			</ul>
 		</div>
 
diff --git a/files/templates/index.php b/files/templates/index.php
index 9bc939ee90a..df78cf0bb2d 100644
--- a/files/templates/index.php
+++ b/files/templates/index.php
@@ -28,12 +28,12 @@
 				<input type="checkbox" id="select_all" />
 				<span class='name'><?php echo $l->t( 'Name' ); ?></span>
 				<span class='selectedActions'>
-					<a href="" title="Download" class="download"><img alt="Download" src="../core/img/actions/download.svg" /></a>
+					<a href="" title="Download" class="download"><img class='svg' alt="Download" src="../core/img/actions/download.svg" /></a>
 					<!--<a href="" title="" class="share">Share</a>-->
 				</span>
 			</th>
 			<th id='headerSize'><?php echo $l->t( 'Size MB' ); ?></th>
-			<th id='headerDate'><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class='selectedActions'><a href="" title="Delete" class="delete"><img alt="Delete" src="../core/img/actions/delete.svg" /></a></span></th>
+			<th id='headerDate'><span id="modified"><?php echo $l->t( 'Modified' ); ?></span><span class='selectedActions'><a href="" title="Delete" class="delete"><img class='svg' alt="Delete" src="../core/img/actions/delete.svg" /></a></span></th>
 		</tr>
 	</thead>
 	<tbody id="fileList">
-- 
GitLab