This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c05787e39d feat:fixed left menu can fold (#20564)
1c05787e39d is described below

commit 1c05787e39d63f9e0d5755f5b248de18fc146565
Author: davidChan3000 <[email protected]>
AuthorDate: Fri Aug 26 18:13:09 2022 +0800

    feat:fixed left menu can fold (#20564)
---
 .../themes/hugo-theme-learn/static/css/theme.css   |   5 +-
 .../hugo-theme-learn/static/js/hugo-learn.js       |  12 +
 .../hugo-theme-learn/static/js/jquery.sticky.js    | 486 ++++++++++-----------
 .../themes/hugo-theme-learn/static/js/learn.js     |   2 +-
 4 files changed, 259 insertions(+), 246 deletions(-)

diff --git a/docs/community/themes/hugo-theme-learn/static/css/theme.css 
b/docs/community/themes/hugo-theme-learn/static/css/theme.css
index 4bbc871dda2..d95424ede71 100644
--- a/docs/community/themes/hugo-theme-learn/static/css/theme.css
+++ b/docs/community/themes/hugo-theme-learn/static/css/theme.css
@@ -257,7 +257,7 @@ textarea:focus, input[type="email"]:focus, 
input[type="number"]:focus, input[typ
 #sidebar ul.topics ul ul {
     padding-bottom: 0;
 }
-#sidebar ul.topics li.parent ul, #sidebar ul.topics > li.active ul {
+#sidebar ul.topics li.parent>ul, #sidebar ul.topics > li.active>ul {
     display: block;
 }
 #sidebar ul.topics > li > a {
@@ -424,7 +424,8 @@ textarea:focus, input[type="email"]:focus, 
input[type="number"]:focus, input[typ
 }
 #chapter h3 {
     font-family: "Work Sans", "Helvetica", "Tahoma", "Geneva", "Arial", 
sans-serif;
-    font-weight: 500;
+    font-weight: 300;
+    text-align: center;
 }
 #chapter h1 {
     font-size: 5rem;
diff --git a/docs/community/themes/hugo-theme-learn/static/js/hugo-learn.js 
b/docs/community/themes/hugo-theme-learn/static/js/hugo-learn.js
index 213e31e9936..0d16d7604c5 100644
--- a/docs/community/themes/hugo-theme-learn/static/js/hugo-learn.js
+++ b/docs/community/themes/hugo-theme-learn/static/js/hugo-learn.js
@@ -86,3 +86,15 @@ jQuery(document).ready(function() {
   });
 
 });
+
+
+jQuery(document).ready(function(){
+       $("#sidebar .topics li svg").click(function(event){   
+               event.preventDefault();
+               event.stopPropagation();
+               var that=$(this);
+    that.toggle().siblings('svg').toggle()
+               that.closest("li").children("ul").slideToggle('fast',"linear");
+       });
+})
+
diff --git a/docs/community/themes/hugo-theme-learn/static/js/jquery.sticky.js 
b/docs/community/themes/hugo-theme-learn/static/js/jquery.sticky.js
index 8df6db4243f..6ecf036f0bf 100644
--- a/docs/community/themes/hugo-theme-learn/static/js/jquery.sticky.js
+++ b/docs/community/themes/hugo-theme-learn/static/js/jquery.sticky.js
@@ -11,281 +11,281 @@
 //              might need to adjust the width in some cases.
 
 (function (factory) {
-  if (typeof define === 'function' && define.amd) {
-      // AMD. Register as an anonymous module.
-      define(['jquery'], factory);
-  } else if (typeof module === 'object' && module.exports) {
-      // Node/CommonJS
-      module.exports = factory(require('jquery'));
-  } else {
-      // Browser globals
-      factory(jQuery);
-  }
+    if (typeof define === 'function' && define.amd) {
+        // AMD. Register as an anonymous module.
+        define(['jquery'], factory);
+    } else if (typeof module === 'object' && module.exports) {
+        // Node/CommonJS
+        module.exports = factory(require('jquery'));
+    } else {
+        // Browser globals
+        factory(jQuery);
+    }
 }(function ($) {
-  var slice = Array.prototype.slice; // save ref to original slice()
-  var splice = Array.prototype.splice; // save ref to original slice()
+    var slice = Array.prototype.slice; // save ref to original slice()
+    var splice = Array.prototype.splice; // save ref to original slice()
 
-var defaults = {
-    topSpacing: 0,
-    bottomSpacing: 0,
-    className: 'is-sticky',
-    wrapperClassName: 'sticky-wrapper',
-    center: false,
-    getWidthFrom: '',
-    widthFromWrapper: true, // works only when .getWidthFrom is empty
-    responsiveWidth: false,
-    zIndex: 'inherit'
-  },
-  $window = $(window),
-  $document = $(document),
-  $TableOfContents = $('#TableOfContents'),
-  sticked = [],
-  windowHeight = $window.height(),
-  scroller = function() {
-    var scrollTop = $window.scrollTop(),
-      documentHeight = $document.height(),
-      dwh = documentHeight - windowHeight,
-      extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
+  var defaults = {
+      topSpacing: 0,
+      bottomSpacing: 0,
+      className: 'is-sticky',
+      wrapperClassName: 'sticky-wrapper',
+      center: false,
+      getWidthFrom: '',
+      widthFromWrapper: true, // works only when .getWidthFrom is empty
+      responsiveWidth: false,
+      zIndex: 'inherit'
+    },
+    $window = $(window),
+    $document = $(document),
+    $TableOfContents = $('#TableOfContents'),
+    sticked = [],
+    windowHeight = $window.height(),
+    scroller = function() {
+      var scrollTop = $window.scrollTop(),
+        documentHeight = $document.height(),
+        dwh = documentHeight - windowHeight,
+        extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
 
-    for (var i = 0, l = sticked.length; i < l; i++) {
-      var s = sticked[i],
-        elementTop = s.stickyWrapper.offset().top,
-        etse = elementTop - s.topSpacing - extra;
+      for (var i = 0, l = sticked.length; i < l; i++) {
+        var s = sticked[i],
+          elementTop = s.stickyWrapper.offset().top,
+          etse = elementTop - s.topSpacing - extra;
 
-      //update height in case of dynamic content
-      s.stickyWrapper.css('height', s.stickyElement.outerHeight());
+        //update height in case of dynamic content
+        s.stickyWrapper.css('height', s.stickyElement.outerHeight());
 
-      if (scrollTop <= etse) {
-        if (s.currentTop !== null) {
-          s.stickyElement
-            .css({
-              'width': '',
-              'position': '',
-              'top': '',
-              'z-index': ''
-            });
-          s.stickyElement.parent().removeClass(s.className);
-          $TableOfContents.removeClass('sticky');
-          s.stickyElement.trigger('sticky-end', [s]);
-          s.currentTop = null;
-        }
-      }
-      else {
-        var newTop = documentHeight - s.stickyElement.outerHeight()
-          - s.topSpacing - s.bottomSpacing - scrollTop - extra;
-        if (newTop < 0) {
-          newTop = newTop + s.topSpacing;
-        } else {
-          newTop = s.topSpacing;
-        }
-        if (s.currentTop !== newTop) {
-          var newWidth;
-          if (s.getWidthFrom) {
-              padding =  s.stickyElement.innerWidth() - 
s.stickyElement.width();
-              newWidth = $(s.getWidthFrom).width() - padding || null;
-          } else if (s.widthFromWrapper) {
-              newWidth = s.stickyWrapper.width();
+        if (scrollTop <= etse) {
+          if (s.currentTop !== null) {
+            s.stickyElement
+              .css({
+                'width': '',
+                'position': '',
+                'top': '',
+                'z-index': ''
+              });
+            s.stickyElement.parent().removeClass(s.className);
+            $TableOfContents.removeClass('sticky');
+            s.stickyElement.trigger('sticky-end', [s]);
+            s.currentTop = null;
           }
-          if (newWidth == null) {
-              newWidth = s.stickyElement.width();
-          }
-          s.stickyElement
-            .css('width', newWidth)
-            .css('position', 'fixed')
-            .css('top', newTop)
-            .css('z-index', s.zIndex);
-          
-          s.stickyElement.parent().addClass(s.className);
-          $TableOfContents.addClass('sticky')
-
-          if (s.currentTop === null) {
-            s.stickyElement.trigger('sticky-start', [s]);
+        }
+        else {
+          var newTop = documentHeight - s.stickyElement.outerHeight()
+            - s.topSpacing - s.bottomSpacing - scrollTop - extra;
+          if (newTop < 0) {
+            newTop = newTop + s.topSpacing;
           } else {
-            // sticky is started but it have to be repositioned
-            s.stickyElement.trigger('sticky-update', [s]);
+            newTop = s.topSpacing;
           }
+          if (s.currentTop !== newTop) {
+            var newWidth;
+            if (s.getWidthFrom) {
+                padding =  s.stickyElement.innerWidth() - 
s.stickyElement.width();
+                newWidth = $(s.getWidthFrom).width() - padding || null;
+            } else if (s.widthFromWrapper) {
+                newWidth = s.stickyWrapper.width();
+            }
+            if (newWidth == null) {
+                newWidth = s.stickyElement.width();
+            }
+            s.stickyElement
+              .css('width', newWidth)
+              .css('position', 'fixed')
+              .css('top', newTop)
+              .css('z-index', s.zIndex);
+            
+            s.stickyElement.parent().addClass(s.className);
+            $TableOfContents.addClass('sticky')
 
-          if (s.currentTop === s.topSpacing && s.currentTop > newTop || 
s.currentTop === null && newTop < s.topSpacing) {
-            // just reached bottom || just started to stick but bottom is 
already reached
-            s.stickyElement.trigger('sticky-bottom-reached', [s]);
-          } else if(s.currentTop !== null && newTop === s.topSpacing && 
s.currentTop < newTop) {
-            // sticky is started && sticked at topSpacing && overflowing from 
top just finished
-            s.stickyElement.trigger('sticky-bottom-unreached', [s]);
-          }
+            if (s.currentTop === null) {
+              s.stickyElement.trigger('sticky-start', [s]);
+            } else {
+              // sticky is started but it have to be repositioned
+              s.stickyElement.trigger('sticky-update', [s]);
+            }
 
-          s.currentTop = newTop;
-        }
+            if (s.currentTop === s.topSpacing && s.currentTop > newTop || 
s.currentTop === null && newTop < s.topSpacing) {
+              // just reached bottom || just started to stick but bottom is 
already reached
+              s.stickyElement.trigger('sticky-bottom-reached', [s]);
+            } else if(s.currentTop !== null && newTop === s.topSpacing && 
s.currentTop < newTop) {
+              // sticky is started && sticked at topSpacing && overflowing 
from top just finished
+              s.stickyElement.trigger('sticky-bottom-unreached', [s]);
+            }
 
-        // Check if sticky has reached end of container and stop sticking
-        var stickyWrapperContainer = s.stickyWrapper.parent();
-        var unstick = (s.stickyElement.offset().top + 
s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + 
stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= 
s.topSpacing);
+            s.currentTop = newTop;
+          }
 
-        if( unstick ) {
-          s.stickyElement
-            .css('position', 'absolute')
-            .css('top', '')
-            .css('bottom', 0)
-            .css('z-index', '');
-        } else {
-          s.stickyElement
-            .css('position', 'fixed')
-            .css('top', newTop)
-            .css('bottom', '')
-            .css('z-index', s.zIndex);
-        }
-      }
-    }
-  },
-  resizer = function() {
-    windowHeight = $window.height();
+          // Check if sticky has reached end of container and stop sticking
+          var stickyWrapperContainer = s.stickyWrapper.parent();
+          var unstick = (s.stickyElement.offset().top + 
s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + 
stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= 
s.topSpacing);
 
-    for (var i = 0, l = sticked.length; i < l; i++) {
-      var s = sticked[i];
-      var newWidth = null;
-      if (s.getWidthFrom) {
-          if (s.responsiveWidth) {
-              newWidth = $(s.getWidthFrom).width();
+          if( unstick ) {
+            s.stickyElement
+              .css('position', 'absolute')
+              .css('top', '')
+              .css('bottom', 0)
+              .css('z-index', '');
+          } else {
+            s.stickyElement
+              .css('position', 'fixed')
+              .css('top', newTop)
+              .css('bottom', '')
+              .css('z-index', s.zIndex);
           }
-      } else if(s.widthFromWrapper) {
-          newWidth = s.stickyWrapper.width();
+        }
       }
-      if (newWidth != null) {
-          s.stickyElement.css('width', newWidth);
+    },
+    resizer = function() {
+      windowHeight = $window.height();
+
+      for (var i = 0, l = sticked.length; i < l; i++) {
+        var s = sticked[i];
+        var newWidth = null;
+        if (s.getWidthFrom) {
+            if (s.responsiveWidth) {
+                newWidth = $(s.getWidthFrom).width();
+            }
+        } else if(s.widthFromWrapper) {
+            newWidth = s.stickyWrapper.width();
+        }
+        if (newWidth != null) {
+            s.stickyElement.css('width', newWidth);
+        }
       }
-    }
-  },
-  methods = {
-    init: function(options) {
-      return this.each(function() {
-        var o = $.extend({}, defaults, options);
-        var stickyElement = $(this);
+    },
+    methods = {
+      init: function(options) {
+        return this.each(function() {
+          var o = $.extend({}, defaults, options);
+          var stickyElement = $(this);
 
-        var stickyId = stickyElement.attr('id');
-        var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName 
: defaults.wrapperClassName;
-        var wrapper = $('<div></div>')
-          .attr('id', wrapperId)
-          .addClass(o.wrapperClassName);
+          var stickyId = stickyElement.attr('id');
+          var wrapperId = stickyId ? stickyId + '-' + 
defaults.wrapperClassName : defaults.wrapperClassName;
+          var wrapper = $('<div></div>')
+            .attr('id', wrapperId)
+            .addClass(o.wrapperClassName);
 
-        stickyElement.wrapAll(function() {
-          if ($(this).parent("#" + wrapperId).length == 0) {
-                  return wrapper;
-          }
+          stickyElement.wrapAll(function() {
+            if ($(this).parent("#" + wrapperId).length == 0) {
+                    return wrapper;
+            }
 });
 
-        var stickyWrapper = stickyElement.parent();
-
-        if (o.center) {
-          
stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
-        }
-
-        if (stickyElement.css("float") === "right") {
-          stickyElement.css({"float":"none"}).parent().css({"float":"right"});
-        }
+          var stickyWrapper = stickyElement.parent();
 
-        o.stickyElement = stickyElement;
-        o.stickyWrapper = stickyWrapper;
-        o.currentTop    = null;
+          if (o.center) {
+            
stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
+          }
 
-        sticked.push(o);
+          if (stickyElement.css("float") === "right") {
+            
stickyElement.css({"float":"none"}).parent().css({"float":"right"});
+          }
 
-        methods.setWrapperHeight(this);
-        methods.setupChangeListeners(this);
-      });
-    },
+          o.stickyElement = stickyElement;
+          o.stickyWrapper = stickyWrapper;
+          o.currentTop    = null;
 
-    setWrapperHeight: function(stickyElement) {
-      var element = $(stickyElement);
-      var stickyWrapper = element.parent();
-      if (stickyWrapper) {
-        stickyWrapper.css('height', element.outerHeight());
-      }
-    },
+          sticked.push(o);
 
-    setupChangeListeners: function(stickyElement) {
-      if (window.MutationObserver) {
-        var mutationObserver = new window.MutationObserver(function(mutations) 
{
-          if (mutations[0].addedNodes.length || 
mutations[0].removedNodes.length) {
-            methods.setWrapperHeight(stickyElement);
-          }
+          methods.setWrapperHeight(this);
+          methods.setupChangeListeners(this);
         });
-        mutationObserver.observe(stickyElement, {subtree: true, childList: 
true});
-      } else {
-        if (window.addEventListener) {
-          stickyElement.addEventListener('DOMNodeInserted', function() {
-            methods.setWrapperHeight(stickyElement);
-          }, false);
-          stickyElement.addEventListener('DOMNodeRemoved', function() {
-            methods.setWrapperHeight(stickyElement);
-          }, false);
-        } else if (window.attachEvent) {
-          stickyElement.attachEvent('onDOMNodeInserted', function() {
-            methods.setWrapperHeight(stickyElement);
-          });
-          stickyElement.attachEvent('onDOMNodeRemoved', function() {
-            methods.setWrapperHeight(stickyElement);
-          });
+      },
+
+      setWrapperHeight: function(stickyElement) {
+        var element = $(stickyElement);
+        var stickyWrapper = element.parent();
+        if (stickyWrapper) {
+          stickyWrapper.css('height', element.outerHeight());
         }
-      }
-    },
-    update: scroller,
-    unstick: function(options) {
-      return this.each(function() {
-        var that = this;
-        var unstickyElement = $(that);
+      },
 
-        var removeIdx = -1;
-        var i = sticked.length;
-        while (i-- > 0) {
-          if (sticked[i].stickyElement.get(0) === that) {
-              splice.call(sticked,i,1);
-              removeIdx = i;
+      setupChangeListeners: function(stickyElement) {
+        if (window.MutationObserver) {
+          var mutationObserver = new 
window.MutationObserver(function(mutations) {
+            if (mutations[0].addedNodes.length || 
mutations[0].removedNodes.length) {
+              methods.setWrapperHeight(stickyElement);
+            }
+          });
+          mutationObserver.observe(stickyElement, {subtree: true, childList: 
true});
+        } else {
+          if (window.addEventListener) {
+            stickyElement.addEventListener('DOMNodeInserted', function() {
+              methods.setWrapperHeight(stickyElement);
+            }, false);
+            stickyElement.addEventListener('DOMNodeRemoved', function() {
+              methods.setWrapperHeight(stickyElement);
+            }, false);
+          } else if (window.attachEvent) {
+            stickyElement.attachEvent('onDOMNodeInserted', function() {
+              methods.setWrapperHeight(stickyElement);
+            });
+            stickyElement.attachEvent('onDOMNodeRemoved', function() {
+              methods.setWrapperHeight(stickyElement);
+            });
           }
         }
-        if(removeIdx !== -1) {
-          unstickyElement.unwrap();
-          unstickyElement
-            .css({
-              'width': '',
-              'position': '',
-              'top': '',
-              'float': '',
-              'z-index': ''
-            })
-          ;
-        }
-      });
-    }
-  };
+      },
+      update: scroller,
+      unstick: function(options) {
+        return this.each(function() {
+          var that = this;
+          var unstickyElement = $(that);
 
-// should be more efficient than using $window.scroll(scroller) and 
$window.resize(resizer):
-if (window.addEventListener) {
-  window.addEventListener('scroll', scroller, false);
-  window.addEventListener('resize', resizer, false);
-} else if (window.attachEvent) {
-  window.attachEvent('onscroll', scroller);
-  window.attachEvent('onresize', resizer);
-}
+          var removeIdx = -1;
+          var i = sticked.length;
+          while (i-- > 0) {
+            if (sticked[i].stickyElement.get(0) === that) {
+                splice.call(sticked,i,1);
+                removeIdx = i;
+            }
+          }
+          if(removeIdx !== -1) {
+            unstickyElement.unwrap();
+            unstickyElement
+              .css({
+                'width': '',
+                'position': '',
+                'top': '',
+                'float': '',
+                'z-index': ''
+              })
+            ;
+          }
+        });
+      }
+    };
 
-$.fn.sticky = function(method) {
-  if (methods[method]) {
-    return methods[method].apply(this, slice.call(arguments, 1));
-  } else if (typeof method === 'object' || !method ) {
-    return methods.init.apply( this, arguments );
-  } else {
-    $.error('Method ' + method + ' does not exist on jQuery.sticky');
+  // should be more efficient than using $window.scroll(scroller) and 
$window.resize(resizer):
+  if (window.addEventListener) {
+    window.addEventListener('scroll', scroller, false);
+    window.addEventListener('resize', resizer, false);
+  } else if (window.attachEvent) {
+    window.attachEvent('onscroll', scroller);
+    window.attachEvent('onresize', resizer);
   }
-};
 
-$.fn.unstick = function(method) {
-  if (methods[method]) {
-    return methods[method].apply(this, slice.call(arguments, 1));
-  } else if (typeof method === 'object' || !method ) {
-    return methods.unstick.apply( this, arguments );
-  } else {
-    $.error('Method ' + method + ' does not exist on jQuery.sticky');
-  }
-};
-$(function() {
-  setTimeout(scroller, 0);
-});
+  $.fn.sticky = function(method) {
+    if (methods[method]) {
+      return methods[method].apply(this, slice.call(arguments, 1));
+    } else if (typeof method === 'object' || !method ) {
+      return methods.init.apply( this, arguments );
+    } else {
+      $.error('Method ' + method + ' does not exist on jQuery.sticky');
+    }
+  };
+
+  $.fn.unstick = function(method) {
+    if (methods[method]) {
+      return methods[method].apply(this, slice.call(arguments, 1));
+    } else if (typeof method === 'object' || !method ) {
+      return methods.unstick.apply( this, arguments );
+    } else {
+      $.error('Method ' + method + ' does not exist on jQuery.sticky');
+    }
+  };
+  $(function() {
+    setTimeout(scroller, 0);
+  });
 }));
diff --git a/docs/community/themes/hugo-theme-learn/static/js/learn.js 
b/docs/community/themes/hugo-theme-learn/static/js/learn.js
index f62ecae8e84..1eab1a10e65 100644
--- a/docs/community/themes/hugo-theme-learn/static/js/learn.js
+++ b/docs/community/themes/hugo-theme-learn/static/js/learn.js
@@ -90,7 +90,7 @@ jQuery(document).ready(function() {
     });
 
     var sidebarStatus = searchStatus = 'open';
-    $('#sidebar .highlightable').perfectScrollbar();
+    $('#sidebar .leftMenu').perfectScrollbar();
     setMenuHeight();
 
     jQuery('#overlay').on('click', function() {

Reply via email to