[Xfce4-commits] <www:nick/gettext> Fix homepage when javascript is disabled.

Jérôme Guelfucci noreply at xfce.org
Sun Jan 16 21:32:02 CET 2011


Updating branch refs/heads/nick/gettext
         to 91b76c909b86cf725a29067d4e774c457654ec1a (commit)
       from b29b09040e7b9585030388fc01f4a2c375cf7fb7 (commit)

commit 91b76c909b86cf725a29067d4e774c457654ec1a
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sun Jan 16 21:29:37 2011 +0100

    Fix homepage when javascript is disabled.
    
    Instead of displaying all images which makes the page unreadable, only
    display one image picked randomly.

 pages/frontpage.php |   15 ++++++++++++++-
 style/home.css      |    4 ++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/pages/frontpage.php b/pages/frontpage.php
index 803fa06..29234e4 100644
--- a/pages/frontpage.php
+++ b/pages/frontpage.php
@@ -27,12 +27,25 @@ $head['feed'] = 'http://www.xfce.org/feed?lang='.$lang;
 
 </div>
 <div id="slideshow">
-  <ul id="slides">
+  <ul id="no-show-slides">
     <li><img src="images/frontpage/intro-1-small.jpg" id="intro1" alt="" /></li>
     <li><img src="images/frontpage/intro-2-small.jpg" id="intro2" alt="" /></li>
     <li><img src="images/frontpage/intro-3-small.jpg" id="intro3" alt="" /></li>
     <li><img src="images/frontpage/intro-4-small.jpg" id="intro4" alt="" /></li>
   </ul>
+
+  <script type="text/javascript">
+    // <![CDATA[
+      document.getElementById('no-show-slides').id = 'slides';
+    // ]]>
+  </script>
+
+  <noscript>
+    <ul id="slides">
+      <?php  $i = rand(1,4) ?>
+      <li><img src=<?php echo("\"images/frontpage/intro-" . $i . "-small.jpg\" id=\"intro" . $i . "\" alt=\"\"") ?> /></li>
+    </ul>
+  </noscript>
 </div>
 <div class="clearboth"></div>
 </div>
diff --git a/style/home.css b/style/home.css
index 4be05a4..8643ef8 100644
--- a/style/home.css
+++ b/style/home.css
@@ -39,6 +39,10 @@
 	padding: 0;
 }
 
+#no-show-slides {
+	display: none;
+}
+
 #slides img {
 	cursor: pointer;
 }



More information about the Xfce4-commits mailing list