[geeklog-cvs] geeklog: Modern Curve: Added fix_html javascript back in to supp...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri May 11 10:44:43 EDT 2012


changeset 8693:ff7fbfb86b8c
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/ff7fbfb86b8c
user: Tom <websitemaster at cogeco.net>
date: Fri May 11 10:44:00 2012 -0400
description:
Modern Curve: Added fix_html javascript back in to support HTML body element's class attribute. This is needed when a plugin doesn't support the theme 2.0 engine

diffstat:

 public_html/layout/modern_curve/footer.thtml           |   8 +++++
 public_html/layout/modern_curve/functions.php          |   1 +
 public_html/layout/modern_curve/javascript/fix_html.js |  25 ++++++++++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)

diffs (58 lines):

diff -r bdc63b6b4e16 -r ff7fbfb86b8c public_html/layout/modern_curve/footer.thtml
--- a/public_html/layout/modern_curve/footer.thtml	Fri May 11 01:55:00 2012 +0900
+++ b/public_html/layout/modern_curve/footer.thtml	Fri May 11 10:44:00 2012 -0400
@@ -32,6 +32,14 @@
     <!-- } #container -->
 
     {plg_footercode} 
+    
+    <!-- Depending on the situation, HTML body element's class attribute to specify a value by JavaScript
+       The argument from the left, the right block container, the middle block left the right block id attribute value -->
+    <script type="text/javascript">
+    <!--
+    FixHTML('leftblocks', 'centerblocks', 'rightblocks');
+    -->
+    </script>    
 
 <!-- } footer.thtml -->
 
diff -r bdc63b6b4e16 -r ff7fbfb86b8c public_html/layout/modern_curve/functions.php
--- a/public_html/layout/modern_curve/functions.php	Fri May 11 01:55:00 2012 +0900
+++ b/public_html/layout/modern_curve/functions.php	Fri May 11 10:44:00 2012 -0400
@@ -80,6 +80,7 @@
 {
     global $_CONF;
     return array(
+        '/layout/' . $_CONF['theme'] . '/javascript/fix_html.js',
         '/layout/' . $_CONF['theme'] . '/javascript/confirm.js',
         '/layout/' . $_CONF['theme'] . '/javascript/search.js'
     );
diff -r bdc63b6b4e16 -r ff7fbfb86b8c public_html/layout/modern_curve/javascript/fix_html.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/modern_curve/javascript/fix_html.js	Fri May 11 10:44:00 2012 -0400
@@ -0,0 +1,25 @@
+
+function FixHTML(leftblocksID, centerblocksID, rightblocksID) {
+    var ua = navigator.userAgent.toLowerCase();
+    var is_old_ie = (ua.indexOf("msie") != -1) && (ua.indexOf("msie 8") == -1) &&
+                    (ua.indexOf("msie 9") == -1) && (ua.indexOf("opera") == -1);
+    // Set class attribute name
+    // 'class'     for Gecko, Opera, Safari, IE9 and other
+    // 'className' for IE8, IE7, IE6
+    var classattr = (is_old_ie) ? 'className' : 'class';
+
+    if (document.body.getAttribute(classattr) != '') return;
+
+    var leftblocks   = document.getElementById(leftblocksID);
+    var centerblocks = document.getElementById(centerblocksID);
+    var rightblocks  = document.getElementById(rightblocksID);
+
+    // Check HTML id attribute
+    var classValue = 'left-center-right';
+    if (leftblocks  && centerblocks && !rightblocks) classValue = 'left-center';
+    if (!leftblocks && centerblocks && rightblocks ) classValue = 'center-right';
+    if (!leftblocks && centerblocks && !rightblocks) classValue = 'center';
+    
+    // Set body class attribute by HTML structure
+    document.body.setAttribute(classattr, classValue);
+}



More information about the geeklog-cvs mailing list