]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
chore: resolving eslint errors and warnings
authorpebutler3 <paul@heysparkbox.com>
Thu, 28 Oct 2021 19:41:44 +0000 (13:41 -0600)
committerpebutler3 <paul@heysparkbox.com>
Thu, 28 Oct 2021 19:41:44 +0000 (13:41 -0600)
Following the rules outlined in .eslintrc the javascript files have been
updated to satisfy these.

27 files changed:
js/foundation.abide.js
js/foundation.accordionMenu.js
js/foundation.core.js
js/foundation.core.plugin.js
js/foundation.drilldown.js
js/foundation.dropdown.js
js/foundation.dropdownMenu.js
js/foundation.equalizer.js
js/foundation.interchange.js
js/foundation.magellan.js
js/foundation.offcanvas.js
js/foundation.orbit.js
js/foundation.positionable.js
js/foundation.responsiveAccordionTabs.js
js/foundation.responsiveMenu.js
js/foundation.responsiveToggle.js
js/foundation.reveal.js
js/foundation.slider.js
js/foundation.sticky.js
js/foundation.tabs.js
js/foundation.tooltip.js
js/foundation.util.imageLoader.js
js/foundation.util.keyboard.js
js/foundation.util.mediaQuery.js
js/foundation.util.timer.js
js/foundation.util.touch.js
js/foundation.util.triggers.js

index 8f16b22c68533eab694aba4b5b515d24b81a3637..099c9093d324642da8f91efc388b6272d7f04b8c 100644 (file)
@@ -396,11 +396,11 @@ class Abide extends Plugin {
    */
   removeErrorClasses($el) {
     // radios need to clear all of the els
-    if ($el[0].type == 'radio') {
+    if ($el[0].type === 'radio') {
       return this.removeRadioErrorClasses($el.attr('name'));
     }
     // checkboxes need to clear all of the els
-    else if ($el[0].type == 'checkbox') {
+    else if ($el[0].type === 'checkbox') {
       return this.removeCheckboxErrorClasses($el.attr('name'));
     }
 
@@ -652,7 +652,7 @@ class Abide extends Plugin {
           checked++;
         }
         if (typeof $(e).attr('data-min-required') !== 'undefined') {
-          minRequired = parseInt($(e).attr('data-min-required'));
+          minRequired = parseInt($(e).attr('data-min-required'), 10);
         }
       });
 
@@ -868,7 +868,7 @@ Abide.defaults = {
     // Domain || URL
     website: {
       test: (text) => {
-        return Abide.defaults.patterns['domain'].test(text) || Abide.defaults.patterns['url'].test(text);
+        return Abide.defaults.patterns.domain.test(text) || Abide.defaults.patterns.url.test(text);
       }
     }
   },
@@ -877,12 +877,10 @@ Abide.defaults = {
    * Optional validation functions to be used. `equalTo` being the only default included function.
    * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments:
    * el : The jQuery element to validate.
-   * required : Boolean value of the required attribute be present or not.
-   * parent : The direct parent of the input.
    * @option
    */
   validators: {
-    equalTo: function (el, required, parent) {
+    equalTo: function (el) {
       return $(`#${el.attr('data-equalto')}`).val() === el.val();
     }
   }
index 13c9af7cdc976daac38e1c7cbbb4dfa153f7f4ca..405c52382bcf19517d9fb24f7831ab0429abb294 100644 (file)
@@ -105,7 +105,7 @@ class AccordionMenu extends Plugin {
 
       if ($submenu.length) {
         if (_this.options.submenuToggle) {
-          $(this).children('.submenu-toggle').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function(e) {
+          $(this).children('.submenu-toggle').off('click.zf.accordionMenu').on('click.zf.accordionMenu', function() {
             _this.toggle($submenu);
           });
         } else {
index 93b506c569f0b35a3babe07f34f1403447a43226..399c0a86b912414ed6f41a01b164062de2aeaf4d 100644 (file)
@@ -78,7 +78,9 @@ var Foundation = {
            */
           .trigger(`destroyed.zf.${pluginName}`);
     for(var prop in plugin){
-      plugin[prop] = null;//clean up script to prep for garbage collection.
+      if(typeof plugin[prop] === 'function'){
+        plugin[prop] = null; //clean up script to prep for garbage collection.
+      }
     }
     return;
   },
@@ -111,7 +113,7 @@ var Foundation = {
              $('[data-'+ plugins +']').foundation('_init');
            },
            'undefined': function(){
-             this['object'](Object.keys(_this._plugins));
+             this.object(Object.keys(_this._plugins));
            }
          };
          fns[type](plugins);
@@ -157,7 +159,7 @@ var Foundation = {
             opts = { reflow: true };
 
         if($el.attr('data-options')){
-          $el.attr('data-options').split(';').forEach(function(option, _index){
+          $el.attr('data-options').split(';').forEach(function(option){
             var opt = option.split(':').map(function(el){ return el.trim(); });
             if(opt[0]) opts[opt[0]] = parseValue(opt[1]);
           });
@@ -174,7 +176,7 @@ var Foundation = {
   },
   getFnName: functionName,
 
-  addToJquery: function($) {
+  addToJquery: function() {
     // TODO: consider not making this a jQuery function
     // TODO: need way to reflow vs. re-initialize
     /**
@@ -277,6 +279,7 @@ window.Foundation = Foundation;
   }
 })();
 if (!Function.prototype.bind) {
+  /* eslint-disable no-extend-native */
   Function.prototype.bind = function(oThis) {
     if (typeof this !== 'function') {
       // closest thing possible to the ECMAScript 5
index a8187ec7bcf771a665aca967406f1f159ec023c7..719f1d4f93a52d2675fbf1e573e2ad26df5aa2d0 100644 (file)
@@ -1,4 +1,3 @@
-import $ from 'jquery';
 import { GetYoDigits } from './foundation.core.utils';
 
 // Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST
@@ -30,7 +29,9 @@ class Plugin {
          */
         .trigger(`destroyed.zf.${pluginName}`);
     for(var prop in this){
-      this[prop] = null;//clean up script to prep for garbage collection.
+      if (this.hasOwnProperty(prop)) {
+        this[prop] = null; //clean up script to prep for garbage collection.
+      }
     }
   }
 }
index 4119e200325760d872f108f5a3058a5cea28997a..4fcbef44f615377e23e3fcd36c2bd154b6df5405 100644 (file)
@@ -146,7 +146,7 @@ class Drilldown extends Plugin {
     var _this = this;
 
     $elem.off('click.zf.drilldown')
-    .on('click.zf.drilldown', function(e){
+    .on('click.zf.drilldown', function(e) {
       if($(e.target).parentsUntil('ul', 'li').hasClass('is-drilldown-submenu-parent')){
         e.preventDefault();
       }
@@ -158,7 +158,7 @@ class Drilldown extends Plugin {
 
       if(_this.options.closeOnClick){
         var $body = $('body');
-        $body.off('.zf.drilldown').on('click.zf.drilldown', function(e){
+        $body.off('.zf.drilldown').on('click.zf.drilldown', function({
           if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target)) { return; }
           e.preventDefault();
           _this._hideAll();
@@ -188,7 +188,7 @@ class Drilldown extends Plugin {
    */
   _scrollTop() {
     var _this = this;
-    var $scrollTopElement = _this.options.scrollTopElement!=''?$(_this.options.scrollTopElement):_this.$element,
+    var $scrollTopElement = _this.options.scrollTopElement !== ''?$(_this.options.scrollTopElement):_this.$element,
         scrollPos = parseInt($scrollTopElement.offset().top+_this.options.scrollTopOffset, 10);
     $('html, body').stop(true).animate({ scrollTop: scrollPos }, _this.options.animationDuration, _this.options.animationEasing,function(){
       /**
@@ -326,7 +326,7 @@ class Drilldown extends Plugin {
     var _this = this;
     $elem.off('click.zf.drilldown');
     $elem.children('.js-drilldown-back')
-      .on('click.zf.drilldown', function(e){
+      .on('click.zf.drilldown', function({
         // console.log('mouseup on back');
         _this._hide($elem);
 
@@ -350,8 +350,8 @@ class Drilldown extends Plugin {
     var _this = this;
     this.$menuItems.not('.is-drilldown-submenu-parent')
         .off('click.zf.drilldown')
-        .on('click.zf.drilldown', function(e){
-          setTimeout(function(){
+        .on('click.zf.drilldown', function({
+          setTimeout(function() {
             _this._hideAll();
           }, 0);
       });
@@ -401,7 +401,7 @@ class Drilldown extends Plugin {
 
     // Reset drilldown
     var $expandedSubmenus = this.$element.find('li[aria-expanded="true"] > ul[data-submenu]');
-    $expandedSubmenus.each(function(index) {
+    $expandedSubmenus.each(function() {
       _this._setHideSubMenuClasses($(this));
     });
 
@@ -426,7 +426,7 @@ class Drilldown extends Plugin {
         _this.$wrapper.css('height', $(this).data('calcHeight'));
       }
 
-      var isLastChild = index == $submenus.length - 1;
+      var isLastChild = index === $submenus.length - 1;
 
       // Add transitionsend listener to last child (root due to reverse order) to open target menu's first link
       // Last child makes sure the event gets always triggered even if going through several menus
@@ -481,7 +481,6 @@ class Drilldown extends Plugin {
    */
   _hide($elem) {
     if(this.options.autoHeight) this.$wrapper.css({height:$elem.parent().closest('ul').data('calcHeight')});
-    var _this = this;
     $elem.parent().closest('ul').removeClass('invisible');
     $elem.parent('li').attr('aria-expanded', false);
     $elem.attr('aria-hidden', true);
@@ -508,7 +507,6 @@ class Drilldown extends Plugin {
 
     // Recalculate menu heights and total max height
     this.$submenus.add(this.$element).each(function(){
-      var numOfElems = $(this).children('li').length;
       var height = Box.GetDimensions(this).height;
 
       maxHeight = height > maxHeight ? height : maxHeight;
@@ -519,7 +517,7 @@ class Drilldown extends Plugin {
     });
 
     if (this.options.autoHeight)
-      result['height'] = this.$currentMenu.data('calcHeight');
+      result.height = this.$currentMenu.data('calcHeight');
     else
       result['min-height'] = `${maxHeight}px`;
 
index d694c7b6ee9ae9bafb4c33e77330d66653aea062..69d3758c8942d949c0f0edc0fc7b10409de9ae16 100644 (file)
@@ -197,8 +197,7 @@ class Dropdown extends Positionable {
     }
     this.$anchors.add(this.$element).on('keydown.zf.dropdown', function(e) {
 
-      var $target = $(this),
-        visibleFocusableElements = Keyboard.findFocusable(_this.$element);
+      var $target = $(this);
 
       Keyboard.handleKey(e, 'Dropdown', {
         open: function() {
index fb0444f278b95bb20c94f9c247fcfaeb579c64a2..f5635b1ab8072fa6221dda86b34df4edf60fc1f3 100644 (file)
@@ -130,7 +130,7 @@ class DropdownMenu extends Plugin {
 
     // Handle Leaf element Clicks
     if(_this.options.closeOnClickInside){
-      this.$menuItems.on('click.zf.dropdownMenu', function(e) {
+      this.$menuItems.on('click.zf.dropdownMenu', function() {
         var $elem = $(this),
             hasSub = $elem.hasClass(parClass);
         if(!hasSub){
@@ -142,7 +142,7 @@ class DropdownMenu extends Plugin {
     if (hasTouch && this.options.disableHoverOnTouch) this.options.disableHover = true;
 
     if (!this.options.disableHover) {
-      this.$menuItems.on('mouseenter.zf.dropdownMenu', function (e) {
+      this.$menuItems.on('mouseenter.zf.dropdownMenu', function () {
         var $elem = $(this),
           hasSub = $elem.hasClass(parClass);
 
@@ -152,7 +152,7 @@ class DropdownMenu extends Plugin {
             _this._show($elem.children('.is-dropdown-submenu'));
           }, _this.options.hoverDelay));
         }
-      }).on('mouseleave.zf.dropdownMenu', ignoreMousedisappear(function (e) {
+      }).on('mouseleave.zf.dropdownMenu', ignoreMousedisappear(function () {
         var $elem = $(this),
             hasSub = $elem.hasClass(parClass);
         if (hasSub && _this.options.autoclose) {
@@ -340,7 +340,7 @@ class DropdownMenu extends Plugin {
     if ($elem && $elem.length) {
       $toClose = $elem;
     } else if (typeof idx !== 'undefined') {
-      $toClose = this.$tabs.not(function(i, el) {
+      $toClose = this.$tabs.not(function(i) {
         return i === idx;
       });
     }
index a3e9bbe98bece896e3dd60222635df7b17c11311..7d2c0b42f02c11e766e015ab195c2c85947f6c3d 100644 (file)
@@ -84,7 +84,7 @@ class Equalizer extends Plugin {
    * function to handle $elements resizeme.zf.trigger, with bound this on _bindHandler.onResizeMeBound
    * @private
    */
-  _onResizeMe(e) {
+  _onResizeMe() {
     this._reflow();
   }
 
@@ -101,7 +101,6 @@ class Equalizer extends Plugin {
    * @private
    */
   _events() {
-    var _this = this;
     this._pauseEvents();
     if(this.hasNested){
       this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound);
@@ -197,7 +196,7 @@ class Equalizer extends Plugin {
       this.$watched[i].style.height = 'auto';
       //maybe could use this.$watched[i].offsetTop
       var elOffsetTop = $(this.$watched[i]).offset().top;
-      if (elOffsetTop!=lastElTopOffset) {
+      if (elOffsetTop !== lastElTopOffset) {
         group++;
         groups[group] = [];
         lastElTopOffset=elOffsetTop;
index 8718592815f80dc16d228a9fd401651bd00ef807..b03bfe3f7570d90715f61241cf397dba5692ef53 100644 (file)
@@ -119,10 +119,9 @@ class Interchange extends Plugin {
    * Checks the Interchange element for the provided media query + content pairings
    * @function
    * @private
-   * @param {Object} element - jQuery object that is an Interchange instance
    * @returns {Array} scenarios - Array of objects that have 'mq' and 'path' keys with corresponding keys
    */
-  _generateRules(element) {
+  _generateRules() {
     var rulesList = [];
     var rules;
 
index f2d9ec479ee58b8fad3f2ca530dbf1d9d4bfd4d7..0284407c135f9eae7792942fc729268331e60b8d 100644 (file)
@@ -39,7 +39,6 @@ class Magellan extends Plugin {
    */
   _init() {
     var id = this.$element[0].id || GetYoDigits(6, 'magellan');
-    var _this = this;
     this.$targets = $('[data-magellan-target]');
     this.$links = this.$element.find('a');
     this.$element.attr({
@@ -105,7 +104,7 @@ class Magellan extends Plugin {
         });
     });
 
-    this._deepLinkScroll = function(e) {
+    this._deepLinkScroll = function() {
       if(_this.options.deepLinking) {
         _this.scrollToLoc(window.location.hash);
       }
@@ -164,7 +163,7 @@ class Magellan extends Plugin {
     else if(newScrollPos + this.winHeight === this.docHeight){ activeIdx = this.points.length - 1; }
     // Otherwhise, use the last visible link
     else{
-      const visibleLinks = this.points.filter((p, i) => {
+      const visibleLinks = this.points.filter((p) => {
         return (p - this.options.offset - (isScrollingUp ? this.options.threshold : 0)) <= newScrollPos;
       });
       activeIdx = visibleLinks.length ? visibleLinks.length - 1 : 0;
index 37c6b17b24eebd680b00602385371fa3c7fea669..20224abb17f0490782180f83776fd199ed222989 100644 (file)
@@ -319,7 +319,7 @@ class OffCanvas extends Plugin {
    * @function
    * @private
    */
-  _stopScrolling(event) {
+  _stopScrolling() {
     return false;
   }
 
@@ -487,7 +487,7 @@ class OffCanvas extends Plugin {
    * @fires OffCanvas#close
    * @fires OffCanvas#closed
    */
-  close(cb) {
+  close() {
     if (!this.$element.hasClass('is-open') || this.isRevealed) { return; }
 
     /**
@@ -496,8 +496,6 @@ class OffCanvas extends Plugin {
      */
     this.$element.trigger('close.zf.offCanvas');
 
-    var _this = this;
-
     this.$element.removeClass('is-open');
 
     this.$element.attr('aria-hidden', 'true');
@@ -516,7 +514,7 @@ class OffCanvas extends Plugin {
 
 
     // Listen to transitionEnd: add class, re-enable scrolling and release focus when done.
-    this.$element.one(transitionend(this.$element), (e) => {
+    this.$element.one(transitionend(this.$element), () => {
 
       this.$element.addClass('is-closed');
       this._removeContentClasses();
index e22c0212c6a9c5d1c00307d0395872c737d93eb4..e9e9d591abc9a6bc4fa79ba7dcae52da6e3efe7f 100644 (file)
@@ -130,7 +130,6 @@ class Orbit extends Plugin {
   * @private
   */
   _prepareForOrbit() {
-    var _this = this;
     this._setWrapperHeight();
   }
 
@@ -266,7 +265,7 @@ class Orbit extends Plugin {
    */
   _reset() {
     // Don't do anything if there are no slides (first run)
-    if (typeof this.$slides == 'undefined') {
+    if (typeof this.$slides === 'undefined') {
       return;
     }
 
index c5832a414c6e4cf423bc1b95d2169886a444fad4..ab6acf24f8805feec23eb942b9b3c98b3fd0b20f 100644 (file)
@@ -97,7 +97,7 @@ class Positionable extends Plugin {
   }
 
   _alignmentsExhausted(position) {
-    return this.triedPositions[position] && this.triedPositions[position].length == ALIGNMENTS[position].length;
+    return this.triedPositions[position] && this.triedPositions[position].length === ALIGNMENTS[position].length;
   }
 
 
index cc4a12b04563b26cb42bdea48b4167a3e0028f1a..78ade843ed30ca4df2f608549a1c8ca76bbff9e6 100644 (file)
@@ -120,6 +120,7 @@ class ResponsiveAccordionTabs extends Plugin{
           tmpPlugin.destroy();
         }
         catch(e) {
+          console.log(e);
         }
       }
     }
@@ -245,7 +246,7 @@ class ResponsiveAccordionTabs extends Plugin{
    * @see Tabs.selectTab
    * @function
    */
-  open(_target) {
+  open() {
     if (this.currentRule && typeof this.currentRule.open === 'function') {
       return this.currentRule.open(this.currentPlugin, ...arguments);
     }
@@ -257,7 +258,7 @@ class ResponsiveAccordionTabs extends Plugin{
    * @see Accordion.up
    * @function
    */
-  close(_target) {
+  close() {
     if (this.currentRule && typeof this.currentRule.close === 'function') {
       return this.currentRule.close(this.currentPlugin, ...arguments);
     }
@@ -269,7 +270,7 @@ class ResponsiveAccordionTabs extends Plugin{
    * @see Accordion.toggle
    * @function
    */
-  toggle(_target) {
+  toggle() {
     if (this.currentRule && typeof this.currentRule.toggle === 'function') {
       return this.currentRule.toggle(this.currentPlugin, ...arguments);
     }
index 34cd4bb43c89bd3c91750883818ef94de7584c6e..1b70e9bf608c6236349a365dd232caa54fbd8809 100644 (file)
@@ -42,7 +42,7 @@ class ResponsiveMenu extends Plugin {
    * @param {jQuery} element - jQuery object to make into a dropdown menu.
    * @param {Object} options - Overrides to the default plugin settings.
    */
-  _setup(element, options) {
+  _setup(element) {
     this.$element = $(element);
     this.rules = this.$element.data('responsive-menu');
     this.currentMq = null;
index 9ebed9abdf258739581684e1c311c810ca64c085..b53ce4734db87017a65d1394d0a05e2ee7d49185 100644 (file)
@@ -65,8 +65,6 @@ class ResponsiveToggle extends Plugin {
    * @private
    */
   _events() {
-    var _this = this;
-
     this._updateMqHandler = this._update.bind(this);
 
     $(window).on('changed.zf.mediaquery', this._updateMqHandler);
index 3a999bf7554e8147093ff5f2fc2a91f9c2c052be..845ae5a041a37fba616923ad087c10bc792fa750 100644 (file)
@@ -179,7 +179,7 @@ class Reveal extends Plugin {
    * Handles modal methods on back/forward button clicks or any other event that triggers hashchange.
    * @private
    */
-  _handleState(e) {
+  _handleState() {
     if(window.location.hash === ( '#' + this.id) && !this.isActive){ this.open(); }
     else{ this.close(); }
   }
@@ -201,7 +201,7 @@ class Reveal extends Plugin {
   * @param {number} scrollTop - Scroll to restore, html "top" property by default (as set by `_disableScroll`)
   */
   _enableScroll(scrollTop) {
-    scrollTop = scrollTop || parseInt($("html").css("top"));
+    scrollTop = scrollTop || parseInt($("html").css("top"), 10);
     if ($(document).height() > $(window).height()) {
       $("html")
         .css("top", "");
@@ -436,7 +436,7 @@ class Reveal extends Plugin {
       // Get the current top before the modal is closed and restore the scroll after.
       // TODO: use component properties instead of HTML properties
       // See https://github.com/foundation/foundation-sites/pull/10786
-      var scrollTop = parseInt($("html").css("top"));
+      var scrollTop = parseInt($("html").css("top"), 10);
 
       if ($('.reveal:visible').length  === 0) {
         _this._removeGlobalClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal
index 2bb6a978abc7700b7337d3dd675cafaf028ee898..7d000f1ef9634fe21dc5c8977048f82d6110008e 100644 (file)
@@ -42,18 +42,18 @@ class Slider extends Plugin {
         'ARROW_UP': 'increase',
         'ARROW_DOWN': 'decrease',
         'ARROW_LEFT': 'decrease',
-        'SHIFT_ARROW_RIGHT': 'increase_fast',
-        'SHIFT_ARROW_UP': 'increase_fast',
-        'SHIFT_ARROW_DOWN': 'decrease_fast',
-        'SHIFT_ARROW_LEFT': 'decrease_fast',
+        'SHIFT_ARROW_RIGHT': 'increaseFast',
+        'SHIFT_ARROW_UP': 'increaseFast',
+        'SHIFT_ARROW_DOWN': 'decreaseFast',
+        'SHIFT_ARROW_LEFT': 'decreaseFast',
         'HOME': 'min',
         'END': 'max'
       },
       'rtl': {
         'ARROW_LEFT': 'increase',
         'ARROW_RIGHT': 'decrease',
-        'SHIFT_ARROW_LEFT': 'increase_fast',
-        'SHIFT_ARROW_RIGHT': 'decrease_fast'
+        'SHIFT_ARROW_LEFT': 'increaseFast',
+        'SHIFT_ARROW_RIGHT': 'decreaseFast'
       }
     });
   }
@@ -71,7 +71,6 @@ class Slider extends Plugin {
     this.$input = this.inputs.length ? this.inputs.eq(0) : $(`#${this.$handle.attr('aria-controls')}`);
     this.$fill = this.$element.find('[data-slider-fill]').css(this.options.vertical ? 'height' : 'width', 0);
 
-    var _this = this;
     if (this.options.disabled || this.$element.hasClass(this.options.disabledClass)) {
       this.options.disabled = true;
       this.$element.addClass(this.options.disabledClass);
@@ -239,7 +238,7 @@ class Slider extends Plugin {
           //empty variable, will be used for min-height/width for fill bar
           dim,
           //percentage w/h of the handle compared to the slider bar
-          handlePct =  ~~(percent(handleDim, elemDim) * 100);
+          handlePct =  Math.floor(percent(handleDim, elemDim) * 100);
       //if left handle, the math is slightly different than if it's the right handle, and the left/top property needs to be changed for the fill bar
       if (isLeftHndl) {
         //left or top percentage value to apply to the fill bar.
@@ -354,7 +353,7 @@ class Slider extends Plugin {
    * TODO clean this up, there's a lot of repeated code between this and the _setHandlePos fn.
    */
   _handleEvent(e, $handle, val) {
-    var value, hasVal;
+    var value;
     if (!val) {//click or drag events
       e.preventDefault();
       var _this = this,
@@ -387,8 +386,6 @@ class Slider extends Plugin {
       if (Rtl() && !this.options.vertical) {value = this.options.end - value;}
 
       value = _this._adjustValue(null, value);
-      //boolean flag for the setHandlePos fn, specifically for vertical sliders
-      hasVal = false;
 
       if (!$handle) {//figure out which handle it is, pass it to the next function.
         var firstHndlPos = absPosition(this.$handle, direction, barXY, param),
@@ -398,7 +395,6 @@ class Slider extends Plugin {
 
     } else {//change event on input
       value = this._adjustValue(null, val);
-      hasVal = true;
     }
 
     this._setHandlePos($handle, value);
@@ -415,7 +411,7 @@ class Slider extends Plugin {
     var val,
       step = this.options.step,
       div = parseFloat(step/2),
-      left, prev_val, next_val;
+      left, previousVal, nextVal;
     if (!!$handle) {
       val = parseFloat($handle.attr('aria-valuenow'));
     }
@@ -427,12 +423,12 @@ class Slider extends Plugin {
     } else {
       left = step + (val % step);
     }
-    prev_val = val - left;
-    next_val = prev_val + step;
+    previousVal = val - left;
+    nextVal = previousVal + step;
     if (left === 0) {
       return val;
     }
-    val = val >= prev_val + div ? next_val : prev_val;
+    val = val >= previousVal + div ? nextVal : previousVal;
     return val;
   }
 
@@ -468,7 +464,7 @@ class Slider extends Plugin {
       // listen for the enter key and trigger a change
       // @see https://html.spec.whatwg.org/multipage/input.html#common-input-element-events
       this.inputs.off('keyup.zf.slider').on('keyup.zf.slider', function (e) {
-        if(e.keyCode == 13) handleChangeEvent.call(this, e);
+        if(e.keyCode === 13) handleChangeEvent.call(this, e);
       });
 
       this.inputs.off('change.zf.slider').on('change.zf.slider', handleChangeEvent);
@@ -500,11 +496,11 @@ class Slider extends Plugin {
 
           curHandle = $(e.currentTarget);
 
-          $body.on('mousemove.zf.slider', function(e) {
+          $body.on('mousemove.zf.slider', function() {
             e.preventDefault();
             _this._handleEvent(e, curHandle);
 
-          }).on('mouseup.zf.slider', function(e) {
+          }).on('mouseup.zf.slider', function() {
             _this._handleEvent(e, curHandle);
 
             $handle.removeClass('is-dragging');
@@ -534,10 +530,10 @@ class Slider extends Plugin {
         increase: function() {
           newValue = oldValue + _this.options.step;
         },
-        decrease_fast: function() {
+        decreaseFast: function() {
           newValue = oldValue - _this.options.step * 10;
         },
-        increase_fast: function() {
+        increaseFast: function() {
           newValue = oldValue + _this.options.step * 10;
         },
         min: function() {
index d8990653cedfe669fae7217b0091fca736d35323..3edb06f95d7db93bf4afec41765443b9a007c803 100644 (file)
@@ -60,7 +60,7 @@ class Sticky extends Plugin {
     this.isStuck = false;
     this.onLoadListener = onLoad($(window), function () {
       //We calculate the container height to have correct values for anchor points offset calculation.
-      _this.containerHeight = _this.$element.css("display") == "none" ? 0 : _this.$element[0].getBoundingClientRect().height;
+      _this.containerHeight = _this.$element.css("display") === "none" ? 0 : _this.$element[0].getBoundingClientRect().height;
       _this.$container.css('height', _this.containerHeight);
       _this.elemHeight = _this.containerHeight;
       if (_this.options.anchor !== '') {
@@ -87,8 +87,8 @@ class Sticky extends Plugin {
    * @private
    */
   _parsePoints() {
-    var top = this.options.topAnchor == "" ? 1 : this.options.topAnchor,
-        btm = this.options.btmAnchor== "" ? document.documentElement.scrollHeight : this.options.btmAnchor,
+    var top = this.options.topAnchor === "" ? 1 : this.options.topAnchor,
+        btm = this.options.btmAnchor === "" ? document.documentElement.scrollHeight : this.options.btmAnchor,
         pts = [top, btm],
         breaks = {};
     for (var i = 0, len = pts.length; i < len && pts[i]; i++) {
@@ -124,7 +124,7 @@ class Sticky extends Plugin {
     if (this.canStick) {
       this.isOn = true;
       $(window).off(scrollListener)
-               .on(scrollListener, function(e) {
+               .on(scrollListener, function() {
                  if (_this.scrollCount === 0) {
                    _this.scrollCount = _this.options.checkEvery;
                    _this._setSizes(function() {
@@ -138,16 +138,16 @@ class Sticky extends Plugin {
     }
 
     this.$element.off('resizeme.zf.trigger')
-                 .on('resizeme.zf.trigger', function(e, el) {
+                 .on('resizeme.zf.trigger', function() {
                     _this._eventsHandler(id);
     });
 
-    this.$element.on('mutateme.zf.trigger', function (e, el) {
+    this.$element.on('mutateme.zf.trigger', function () {
         _this._eventsHandler(id);
     });
 
     if(this.$anchor) {
-      this.$anchor.on('mutateme.zf.trigger', function (e, el) {
+      this.$anchor.on('mutateme.zf.trigger', function () {
           _this._eventsHandler(id);
       });
     }
@@ -276,11 +276,11 @@ class Sticky extends Plugin {
 
     css[mrgn] = 0;
 
-    css['bottom'] = 'auto';
+    css.bottom = 'auto';
     if(isTop) {
-      css['top'] = 0;
+      css.top = 0;
     } else {
-      css['top'] = anchorPt;
+      css.top = anchorPt;
     }
 
     this.isStuck = false;
@@ -307,11 +307,10 @@ class Sticky extends Plugin {
       if (cb && typeof cb === 'function') { cb(); }
     }
 
-    var _this = this,
-        newElemWidth = this.$container[0].getBoundingClientRect().width,
-        comp = window.getComputedStyle(this.$container[0]),
-        pdngl = parseInt(comp['padding-left'], 10),
-        pdngr = parseInt(comp['padding-right'], 10);
+    var newElemWidth = this.$container[0].getBoundingClientRect().width,
+      comp = window.getComputedStyle(this.$container[0]),
+      pdngl = parseInt(comp['padding-left'], 10),
+      pdngr = parseInt(comp['padding-right'], 10);
 
     if (this.$anchor && this.$anchor.length) {
       this.anchorHeight = this.$anchor[0].getBoundingClientRect().height;
@@ -327,7 +326,7 @@ class Sticky extends Plugin {
     if (this.options.dynamicHeight || !this.containerHeight) {
       // Get the sticked element height and apply it to the container to "hold the place"
       var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight;
-      newContainerHeight = this.$element.css("display") == "none" ? 0 : newContainerHeight;
+      newContainerHeight = this.$element.css("display") === "none" ? 0 : newContainerHeight;
       this.$container.css('height', newContainerHeight);
       this.containerHeight = newContainerHeight;
     }
index 02f69718bf55f9fa7de3c4896d588c38ded768da..6e5248309eb52b28c48a09d4a34e63eb5ed27292 100644 (file)
@@ -312,7 +312,7 @@ class Tabs extends Plugin {
    * @function
    */
   _collapseTab($target) {
-    var $target_anchor = $target
+    var $targetAnchor = $target
       .removeClass(`${this.options.linkActiveClass}`)
       .find('[role="tab"]')
       .attr({
@@ -320,7 +320,7 @@ class Tabs extends Plugin {
         'tabindex': -1
       });
 
-    $(`#${$target_anchor.attr('aria-controls')}`)
+    $(`#${$targetAnchor.attr('aria-controls')}`)
       .removeClass(`${this.options.panelActiveClass}`)
       .attr({ 'aria-hidden': 'true' })
   }
index a1920d7335805f69071e729104a59f45f69c6f02..f90e8465cac51bce57b670ade624fdc7b82ed7e1 100644 (file)
@@ -194,7 +194,6 @@ class Tooltip extends Positionable {
   _events() {
     const _this = this;
     const hasTouch = 'ontouchstart' in window || (typeof window.ontouchstart !== 'undefined');
-    const $template = this.template;
     var isFocus = false;
 
     // `disableForTouch: Fully disable the tooltip on touch devices
@@ -202,14 +201,14 @@ class Tooltip extends Positionable {
 
     if (!this.options.disableHover) {
       this.$element
-      .on('mouseenter.zf.tooltip', function(e) {
+      .on('mouseenter.zf.tooltip', function() {
         if (!_this.isActive) {
           _this.timeout = setTimeout(function() {
             _this.show();
           }, _this.options.hoverDelay);
         }
       })
-      .on('mouseleave.zf.tooltip', ignoreMousedisappear(function(e) {
+      .on('mouseleave.zf.tooltip', ignoreMousedisappear(function() {
         clearTimeout(_this.timeout);
         if (!isFocus || (_this.isClick && !_this.options.clickOpen)) {
           _this.hide();
@@ -219,13 +218,13 @@ class Tooltip extends Positionable {
 
     if (hasTouch) {
       this.$element
-      .on('tap.zf.tooltip touchend.zf.tooltip', function (e) {
+      .on('tap.zf.tooltip touchend.zf.tooltip', function () {
         _this.isActive ? _this.hide() : _this.show();
       });
     }
 
     if (this.options.clickOpen) {
-      this.$element.on('mousedown.zf.tooltip', function(e) {
+      this.$element.on('mousedown.zf.tooltip', function() {
         if (_this.isClick) {
           //_this.hide();
           // _this.isClick = false;
@@ -237,7 +236,7 @@ class Tooltip extends Positionable {
         }
       });
     } else {
-      this.$element.on('mousedown.zf.tooltip', function(e) {
+      this.$element.on('mousedown.zf.tooltip', function() {
         _this.isClick = true;
       });
     }
@@ -249,7 +248,7 @@ class Tooltip extends Positionable {
     });
 
     this.$element
-      .on('focus.zf.tooltip', function(e) {
+      .on('focus.zf.tooltip', function() {
         isFocus = true;
         if (_this.isClick) {
           // If we're not showing open on clicks, we need to pretend a click-launched focus isn't
@@ -261,7 +260,7 @@ class Tooltip extends Positionable {
         }
       })
 
-      .on('focusout.zf.tooltip', function(e) {
+      .on('focusout.zf.tooltip', function() {
         isFocus = false;
         _this.isClick = false;
         _this.hide();
index 7a3b14a103583f5121054d42b85d2e50b7f38dd2..7409120bc4ac65dcb9205a5ef898772c78064bcc 100644 (file)
@@ -6,8 +6,7 @@ import $ from 'jquery';
  * @param {Func} callback - Function to execute when image is fully loaded.
  */
 function onImagesLoaded(images, callback){
-  var self = this,
-      unloaded = images.length;
+  var unloaded = images.length;
 
   if (unloaded === 0) {
     callback();
@@ -23,7 +22,7 @@ function onImagesLoaded(images, callback){
       var image = new Image();
       // Still count image as loaded if it finalizes with an error.
       var events = "load.zf.images error.zf.images";
-      $(image).one(events, function me(event){
+      $(image).one(events, function me(){
         // Unbind the event listeners. We're using 'one' but only one of the two events will have fired.
         $(this).off(events, me);
         singleImageLoaded();
index 929efec83f9b0fa8b2e44a66edc97fa010316ab0..a95b634212d059bb6b3884e2c16b1f8024fb8c9c 100644 (file)
@@ -32,22 +32,22 @@ function findFocusable($element) {
     return true;
   })
   .sort( function( a, b ) {
-    if ($(a).attr('tabindex') == $(b).attr('tabindex')) {
+    if ($(a).attr('tabindex') === $(b).attr('tabindex')) {
       return 0;
     }
-    let aTabIndex = parseInt($(a).attr('tabindex')),
-      bTabIndex = parseInt($(b).attr('tabindex'));
+    let aTabIndex = parseInt($(a).attr('tabindex'), 10),
+      bTabIndex = parseInt($(b).attr('tabindex'), 10);
     // Undefined is treated the same as 0
-    if (typeof $(a).attr('tabindex') == 'undefined' && bTabIndex > 0) {
+    if (typeof $(a).attr('tabindex') === 'undefined' && bTabIndex > 0) {
       return 1;
     }
-    if (typeof $(b).attr('tabindex') == 'undefined' && aTabIndex > 0) {
+    if (typeof $(b).attr('tabindex') === 'undefined' && aTabIndex > 0) {
       return -1;
     }
-    if (aTabIndex == 0 && bTabIndex > 0) {
+    if (aTabIndex === 0 && bTabIndex > 0) {
       return 1;
     }
-    if (bTabIndex == 0 && aTabIndex > 0) {
+    if (bTabIndex === 0 && aTabIndex > 0) {
       return -1;
     }
     if (aTabIndex < bTabIndex) {
@@ -190,7 +190,9 @@ var Keyboard = {
  */
 function getKeyCodes(kcs) {
   var k = {};
-  for (var kc in kcs) k[kcs[kc]] = kcs[kc];
+  for (var kc in kcs) {
+    if (kcs.hasOwnProperty(kc)) k[kcs[kc]] = kcs[kc];
+  }
   return k;
 }
 
index a45a06efd35b5691c2672a67abfb318a3d9e2b01..6e42e4d3993884339d98ccaa24f32362db88bce6 100644 (file)
@@ -1,17 +1,17 @@
 import $ from 'jquery';
 
 // Default set of media queries
-const defaultQueries = {
-  'default' : 'only screen',
-  landscape : 'only screen and (orientation: landscape)',
-  portrait : 'only screen and (orientation: portrait)',
-  retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
-    'only screen and (min--moz-device-pixel-ratio: 2),' +
-    'only screen and (-o-min-device-pixel-ratio: 2/1),' +
-    'only screen and (min-device-pixel-ratio: 2),' +
-    'only screen and (min-resolution: 192dpi),' +
-    'only screen and (min-resolution: 2dppx)'
-  };
+// const defaultQueries = {
+//   'default' : 'only screen',
+//   landscape : 'only screen and (orientation: landscape)',
+//   portrait : 'only screen and (orientation: portrait)',
+//   retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
+//     'only screen and (min--moz-device-pixel-ratio: 2),' +
+//     'only screen and (-o-min-device-pixel-ratio: 2/1),' +
+//     'only screen and (min-device-pixel-ratio: 2),' +
+//     'only screen and (min-resolution: 192dpi),' +
+//     'only screen and (min-resolution: 2dppx)'
+//   };
 
 
 // matchMedia() polyfill - Test a CSS media type/query in JS.
index 1427f50856310b635bd4749c6dd2b481432f77cf..2dc1c5e27f95f26fcafa7323326dbafdf811c126 100644 (file)
@@ -1,5 +1,3 @@
-import $ from 'jquery';
-
 function Timer(elem, options, cb) {
   var _this = this,
       duration = options.duration,//options is an object for easily adding features later.
index 7a927950ae780859f5fec5371165e5212365f4a0..92aee0b1d922810618fc54e450ba1782bd5db1c6 100644 (file)
@@ -8,7 +8,6 @@ import $ from 'jquery';
 var Touch = {};
 
 var startPosX,
-    startPosY,
     startTime,
     elapsedTime,
     startEvent,
@@ -62,7 +61,6 @@ function onTouchStart(e) {
 
   if (e.touches.length === 1) {
     startPosX = e.touches[0].pageX;
-    startPosY = e.touches[0].pageY;
     startEvent = e;
     isMoving = true;
     didMoved = false;
@@ -76,23 +74,22 @@ function init() {
   this.addEventListener && this.addEventListener('touchstart', onTouchStart, { passive : true });
 }
 
-function teardown() {
-  this.removeEventListener('touchstart', onTouchStart);
-}
+// function teardown() {
+//   this.removeEventListener('touchstart', onTouchStart);
+// }
 
 class SpotSwipe {
-  constructor($) {
+  constructor() {
     this.version = '1.0.0';
     this.enabled = 'ontouchstart' in document.documentElement;
     this.preventDefault = false;
     this.moveThreshold = 75;
     this.timeThreshold = 200;
-    this.$ = $;
     this._init();
   }
 
   _init() {
-    var $ = this.$;
+    // var $ = this.$;
     $.event.special.swipe = { setup: init };
     $.event.special.tap = { setup: init };
 
@@ -111,16 +108,16 @@ class SpotSwipe {
  * values, and do not add event handlers directly.  *
  ****************************************************/
 
-Touch.setupSpotSwipe = function($) {
+Touch.setupSpotSwipe = function() {
   $.spotSwipe = new SpotSwipe($);
 };
 
 /****************************************************
  * Method for adding pseudo drag events to elements *
  ***************************************************/
-Touch.setupTouchHandler = function($) {
+Touch.setupTouchHandler = function() {
   $.fn.addTouch = function(){
-    this.each(function(i,el){
+    this.each(function(i, el){
       $(el).bind('touchstart touchmove touchend touchcancel', function(event)  {
         //we pass the original event object because the jQuery event
         //object is normalized to w3c specs and does not provide the TouchList
@@ -128,7 +125,7 @@ Touch.setupTouchHandler = function($) {
       });
     });
 
-    var handleTouch = function(event){
+    var handleTouch = function(event) {
       var touches = event.changedTouches,
           first = touches[0],
           eventTypes = {
@@ -158,8 +155,7 @@ Touch.setupTouchHandler = function($) {
   };
 };
 
-Touch.init = function ($) {
-
+Touch.init = function () {
   if(typeof($.spotSwipe) === 'undefined') {
     Touch.setupSpotSwipe($);
     Touch.setupTouchHandler($);
index fb14c61ab188e2a2f780bff9f1b247be410075e3..7757de777f36c40e2a3e27bce587b2bc2ba0d08f 100644 (file)
@@ -10,7 +10,7 @@ const MutationObserver = (function () {
     }
   }
   return false;
-}());
+})();
 
 const triggers = (el, type) => {
   el.data(type).split(' ').forEach(id => {
@@ -156,7 +156,7 @@ Triggers.Initializers.addClosemeListener = function(pluginName) {
 
 function debounceGlobalListener(debounce, trigger, listener) {
   let timer, args = Array.prototype.slice.call(arguments, 3);
-  $(window).off(trigger).on(trigger, function(e) {
+  $(window).off(trigger).on(trigger, function() {
     if (timer) { clearTimeout(timer); }
     timer = setTimeout(function(){
       listener.apply(null, args);
@@ -241,7 +241,7 @@ Triggers.Initializers.addGlobalListeners = function() {
 }
 
 
-Triggers.init = function ($, Foundation) {
+Triggers.init = function (__, Foundation) {
   onLoad($(window), function () {
     if ($.triggersInitialized !== true) {
       Triggers.Initializers.addSimpleListeners();