[geeklog-hg] geeklog: Fixed FixHTML() to support IE 10 (bug #0001599)

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun May 12 03:08:10 EDT 2013


changeset 9066:366267805178
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/366267805178
user: Kenji ITO <mystralkk at gmail.com>
date: Sun May 12 16:06:41 2013 +0900
description:
Fixed FixHTML() to support IE 10 (bug #0001599)

diffstat:

 public_html/layout/denim/javascript/script.js              |  259 ++++++------
 public_html/layout/modern_curve/javascript/fix_html.js     |    5 +-
 public_html/layout/professional_css/javascript/fix_html.js |    5 +-
 3 files changed, 139 insertions(+), 130 deletions(-)

diffs (truncated from 330 to 300 lines):

diff -r cc72bb2d6ad6 -r 366267805178 public_html/layout/denim/javascript/script.js
--- a/public_html/layout/denim/javascript/script.js	Sat May 11 19:14:27 2013 +0200
+++ b/public_html/layout/denim/javascript/script.js	Sun May 12 16:06:41 2013 +0900
@@ -2,11 +2,12 @@
 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);
+                    (ua.indexOf("msie 9") == -1) && (ua.indexOf("msie 10") == -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';
+    var classattr = is_old_ie ? 'className' : 'class';
 
     if (document.body.getAttribute(classattr) != 'js_off') return;
 
@@ -26,145 +27,151 @@
 
 
 function delconfirm() {
-  return (confirm("Delete this?")) ? true : false;
+    return confirm("Delete this?");
 }
 
 function postconfirm() {
-  return (confirm("Send this?")) ? true : false;
+    return confirm("Send this?");
 }
 
 
 /* http://tinynav.viljamis.com v1.03 by @viljamis */
 /* Modified by dengen */
 (function ($, window, i) {
-  $.fn.tinyNav = function (options) {
-
-    // Default settings
-    var settings = $.extend({
-      'active' : 'selected',  // String: Set the "active" class
-      'header' : true,        // Boolean: Show header instead of the active item
-      'string' : 'Navigation' // String: String for header
-    }, options);
-
-    return this.each(function () {
-
-      // Used for namespacing
-      i++;
-
-      var $nav = $(this),
-        // Namespacing
-        namespace = 'tinynav',
-        namespace_i = namespace + i,
-        l_namespace_i = '.l_' + namespace_i,
-        $select = $('<select/>').addClass(namespace + ' ' + namespace_i);
-
-      if ($nav.is('ul,ol')) {
-
-        if (settings.header) {
-          $select.append(
-            $('<option/>').text(settings.string)
-          );
-        }
-
-        // Build options
-        var options = '';
-
-        $nav
-          .addClass('l_' + namespace_i)
-          .find('a')
-          .each(function () {
-            options += '<option value="' + $(this).attr('href') + '">';
-            for (j = 0; j < $(this).parents('ul, ol').length - 1; j++) { 
-               options += ' ';
+    $.fn.tinyNav = function (options) {
+        // Default settings
+        var settings = $.extend({
+            'active': 'selected',  // String: Set the "active" class
+            'header': true,        // Boolean: Show header instead of the active item
+            'string': 'Navigation' // String: String for header
+        }, options);
+        
+        return this.each(function () {
+            // Used for namespacing
+            i++;
+            
+            var $nav = $(this),
+                // Namespacing
+                namespace = 'tinynav',
+                namespace_i = namespace + i,
+                l_namespace_i = '.l_' + namespace_i,
+                $select = $('<select/>').addClass(namespace + ' ' + namespace_i);
+            
+            if ($nav.is('ul,ol')) {
+                if (settings.header) {
+                    $select.append($('<option/>').text(settings.string));
+                }
+                
+                // Build options
+                var options = '';
+                
+                $nav
+                    .addClass('l_' + namespace_i)
+                    .find('a')
+                    .each(function () {
+                        options += '<option value="' + $(this).attr('href') + '">';
+                        
+                        for (j = 0; j < $(this).parents('ul, ol').length - 1; j++) {
+                            options += ' ';
+                        }
+                        
+                        options += $(this).text() + '</option>';
+                    });
+                
+                // Append options into a select
+                $select.append(options);
+                
+                // Select the active item
+                if (!settings.header) {
+                    $select
+                        .find(':eq(' + $(l_namespace_i + ' li')
+                            .index($(l_namespace_i + ' li.' + settings.active)) + ')')
+                        .attr('selected', true);
+                }
+                
+                // Change window location
+                $select.change(function () {
+                    window.location.href = $(this).val();
+                });
+                
+                // Inject select
+                $(l_namespace_i).after($select);
             }
-            options += $(this).text() + '</option>';
-          });
-
-        // Append options into a select
-        $select.append(options);
-
-        // Select the active item
-        if (!settings.header) {
-          $select
-            .find(':eq(' + $(l_namespace_i + ' li')
-            .index($(l_namespace_i + ' li.' + settings.active)) + ')')
-            .attr('selected', true);
-        }
-
-        // Change window location
-        $select.change(function () {
-          window.location.href = $(this).val();
         });
-
-        // Inject select
-        $(l_namespace_i).after($select);
-
-      }
-
-    });
-
-  };
+    };
 })(jQuery, this, 0);
 
-
 $(function() {
-  $('#navigation_ul').tinyNav({
-    active: 'selected',
-    string: 'Jump to...'
-  });
-  var istouch = ('ontouchstart' in window);
-  if (istouch) {
-    var ua = navigator.userAgent;
-    var istablet = ((ua.indexOf('Android') > 0 && ua.indexOf('Mobile') == -1)
-                       || ua.indexOf('iPad') > 0 || ua.indexOf('SC-01C') > 0);
-    if (!istablet) {
-      var obj = $('.block-title');
-      obj.addClass("show");
-      $(".block-left-content").css("display", "none");
-      $(".block-right-content").css("display", "none");
-      $(".block-list-content").css("display", "none");
-      $(document).on('touchstart', '.block-title', function() {
-        this.touched = true;
-      });
-      $(document).on('touchmove', '.block-title', function() {
-        this.touchmoved = true;
-      });
-      $(document).on('touchend', '.block-title', function() {
-        if (this.touched && !this.touchmoved) {
-          $(this).next().toggle();
-          $(this).toggleClass("show");
-          $(this).toggleClass("hide");
+    $('#navigation_ul').tinyNav({
+        active: 'selected',
+        string: 'Jump to...'
+    });
+    
+    var istouch = ('ontouchstart' in window);
+    
+    if (istouch) {
+        var ua = navigator.userAgent;
+        var istablet = (ua.indexOf('Android') > 0 && ua.indexOf('Mobile') == -1) ||
+                       (ua.indexOf('iPad') > 0) || (ua.indexOf('SC-01C') > 0);
+        
+        if (!istablet) {
+            var obj = $('.block-title');
+            
+            obj.addClass("show");
+            $(".block-left-content").css("display", "none");
+            $(".block-right-content").css("display", "none");
+            $(".block-list-content").css("display", "none");
+            $(document).on('touchstart', '.block-title', function () {
+                this.touched = true;
+            });
+            $(document).on('touchmove', '.block-title', function () {
+                this.touchmoved = true;
+            });
+            $(document).on('touchend', '.block-title', function () {
+                if (this.touched && !this.touchmoved) {
+                    $(this).next().toggle();
+                    $(this).toggleClass("show");
+                    $(this).toggleClass("hide");
+                }
+                
+                this.touched = false;
+                this.touchmoved = false;
+            });
         }
-        this.touched = false;
-        this.touchmoved = false;
-      });
     }
-  }
-
-  var iswide = false;
-  var classname1 = 'table-wrapper';
-  var classname2 = 'table-wrapper-fit';
-  var btntext1 = 'Fit';
-  var btntext2 = 'Expand';
-  
-  if (istouch && !istablet) iswide = true;
-  $('.table-wrapper').before('<div class="admin-table-changer">'
-    + '<a class="admin-list-table-changer button" href="javascript:void(0);">'
-    + (iswide ? btntext1 : btntext2)
-    + '</a></div>');
-  var tablechanger = $('.admin-list-table-changer');
-  if (!iswide) {
-    $('.' + classname1).attr('class', classname2);
-    tablechanger.text(btntext2);
-  }
-  $(document).on('click', '.admin-list-table-changer', function() {
-    if (iswide) {
-      $('.' + classname1).attr('class', classname2);
-      tablechanger.text(btntext2);
-    } else {
-      $('.' + classname2).attr('class', classname1);
-      tablechanger.text(btntext1);
+    
+    var iswide = false;
+    var classname1 = 'table-wrapper';
+    var classname2 = 'table-wrapper-fit';
+    var btntext1 = 'Fit';
+    var btntext2 = 'Expand';
+    
+    if (istouch && !istablet) {
+        iswide = true;
     }
-    iswide = !iswide;
-  });
+    
+    $('.table-wrapper').before('<div class="admin-table-changer">'
+        + '<a class="admin-list-table-changer button" href="javascript:void(0);">'
+        + (iswide ? btntext1 : btntext2)
+        + '</a></div>'
+    );
+    
+    var tablechanger = $('.admin-list-table-changer');
+    
+    if (!iswide) {
+        $('.' + classname1).attr('class', classname2);
+        tablechanger.text(btntext2);
+    }
+    
+    $(document).on('click', '.admin-list-table-changer', function () {
+        if (iswide) {
+            $('.' + classname1).attr('class', classname2);
+            tablechanger.text(btntext2);
+        } else {
+            $('.' + classname2).attr('class', classname1);
+            tablechanger.text(btntext1);
+        }
+        
+        iswide = !iswide;
+    });
 });
diff -r cc72bb2d6ad6 -r 366267805178 public_html/layout/modern_curve/javascript/fix_html.js
--- a/public_html/layout/modern_curve/javascript/fix_html.js	Sat May 11 19:14:27 2013 +0200
+++ b/public_html/layout/modern_curve/javascript/fix_html.js	Sun May 12 16:06:41 2013 +0900
@@ -2,11 +2,12 @@
 function FixHTML(leftblocksID, centerblocksID, rightblocksID) {
     var ua = navigator.userAgent.toLowerCase();



More information about the geeklog-cvs mailing list