[library-web] add js snippet to add operating system class to <body>



commit b7361dfdd1819444cb5d5e439a4a9307d9f95f18
Author: Frédéric Péters <fpeters 0d be>
Date:   Sun Jan 26 12:32:16 2014 +0000

    add js snippet to add operating system class to <body>
    
    This is an extract from www.gnome.org template.js script.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643375

 data/xslt/heading.xsl |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/data/xslt/heading.xsl b/data/xslt/heading.xsl
index bda6a62..168c35c 100644
--- a/data/xslt/heading.xsl
+++ b/data/xslt/heading.xsl
@@ -183,6 +183,23 @@ $('#s').autocomplete('/symbols/lookup/',
         </div>
     </div>
 
+    <script type="text/javascript">
+$(document).ready(function() {
+    // Get browser
+    $.each($.browser, function(i) {
+        $('body').addClass(i);
+        return false;
+    });
+
+    // Get OS and add it as class to body tag, this then allows forcing some
+    // customisation in the CSS rules.
+    var match = navigator.userAgent.toLowerCase().match(/(win|mac|linux)/);
+    if (match) {
+        $('body').addClass(match[0]);
+    }
+});
+</script>
+
     <!-- Piwik webstats -->
     <script type="text/javascript">
        var _paq = _paq || [];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]