]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
refactor: rename Reveal internal methods for a better clarity
authorNicolas Coden <nicolas@ncoden.fr>
Mon, 18 Jun 2018 21:27:39 +0000 (23:27 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Mon, 18 Jun 2018 21:27:39 +0000 (23:27 +0200)
js/foundation.reveal.js

index caf222c71c4c94d41c50530c2de7d4f39aa487bf..0c6dcf98ba555da7c00e522603300bea5b1bfa96 100644 (file)
@@ -283,7 +283,7 @@ class Reveal extends Plugin {
             'tabindex': -1
           })
           .focus();
-        _this._addRevealOpenClasses();
+        _this._addGlobalClasses();
         Keyboard.trapFocus(_this.$element);
       }
       if (this.options.overlay) {
@@ -313,9 +313,9 @@ class Reveal extends Plugin {
       .focus();
     Keyboard.trapFocus(this.$element);
 
-    this._addRevealOpenClasses();
+    this._addGlobalClasses();
 
-    this._extraHandlers();
+    this._addGlobalListeners();
 
     /**
      * Fires when the modal has successfully opened.
@@ -324,7 +324,7 @@ class Reveal extends Plugin {
     this.$element.trigger('open.zf.reveal');
   }
 
-  _addRevealOpenClasses() {
+  _addGlobalClasses() {
     const updateScrollbarClass = () => {
       $('html').toggleClass('zf-has-scroll', !!($(document).height() > $(window).height()));
     };
@@ -334,7 +334,7 @@ class Reveal extends Plugin {
     $('html').addClass('is-reveal-open');
   }
 
-  _removeRevealOpenClasses() {
+  _removeGlobalClasses() {
     this.$element.off('resizeme.zf.trigger.revealScrollbarListener');
     $('html').removeClass('is-reveal-open');
     $('html').removeClass('zf-has-scroll');
@@ -344,7 +344,7 @@ class Reveal extends Plugin {
    * Adds extra event handlers for the body and window if necessary.
    * @private
    */
-  _extraHandlers() {
+  _addGlobalListeners() {
     var _this = this;
     if(!this.$element) { return; } // If we're in the middle of cleanup, don't freak out
     this.focusableElements = Keyboard.findFocusable(this.$element);
@@ -421,7 +421,7 @@ class Reveal extends Plugin {
       var scrollTop = parseInt($("html").css("top"));
 
       if ($('.reveal:visible').length  === 0) {
-        _this._removeRevealOpenClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal
+        _this._removeGlobalClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal
       }
 
       Keyboard.releaseFocus(_this.$element);
@@ -492,7 +492,7 @@ class Reveal extends Plugin {
       .off(this.onLoadListener);
 
     if ($('.reveal:visible').length  === 0) {
-      this._removeRevealOpenClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal
+      this._removeGlobalClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal
     }
   };
 }