diff --git a/js/.eslintrc b/js/.eslintrc index b8c38b34..e334c8b1 100644 --- a/js/.eslintrc +++ b/js/.eslintrc @@ -46,7 +46,7 @@ "dot-location": 0, "dot-notation": 0, "eqeqeq": 2, - "guard-for-in": 2, +// "guard-for-in": 2, "no-alert": 2, "no-caller": 2, "no-div-regex": 2, @@ -102,7 +102,7 @@ "no-undef": 2, "no-undefined": 0, "no-undef-init": 2, - "no-unused-vars": 2, + "no-unused-vars": [2, {"argsIgnorePattern": "$"}], "no-use-before-define": 0, // Stylistic @@ -150,7 +150,7 @@ "space-after-keywords": 2, "space-before-blocks": 2, "space-before-function-paren": 0, - "spaced-comment": 2, +// "spaced-comment": 2, "space-infix-ops": 2, "space-in-parens": 2, "space-return-throw-case": 2, diff --git a/js/src/ripples.js b/js/src/ripples.js index f9d5b1cf..b56c96de 100644 --- a/js/src/ripples.js +++ b/js/src/ripples.js @@ -1,4 +1,4 @@ -// FIXME: look at bootstrap/Util.js for transition support functions +import Util from './util' const Ripples = (($) => { @@ -197,7 +197,7 @@ const Ripples = (($) => { rippleOut() { this.rippleElement.off() - if ($.transitionEndSupported()) { + if (Util.transitionEndSupported()) { this.rippleElement.addClass("ripple-out") } else { this.rippleElement.animate({ "opacity": 0 }, 100, () => { @@ -205,7 +205,7 @@ const Ripples = (($) => { }) } - this.rippleElement.on($.transitionEndSelector(), () => { + this.rippleElement.on(Util.transitionEndSelector(), () => { this.rippleElement.remove() this.rippleElement = null }) @@ -217,7 +217,7 @@ const Ripples = (($) => { rippleOn() { let size = this._getNewSize() - if ($.transitionEndSupported()) { + if (Util.transitionEndSupported()) { this.rippleElement .css({ "-ms-transform": `scale(${size})`, diff --git a/js/src/util.js b/js/src/util.js index cfe8f6e4..443fecbd 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -25,7 +25,7 @@ const Util = (($) => { for (let name in TransitionEndEvent) { if (el.style[name] !== undefined) { - return TransitionEndEvent[name] //{ end: TransitionEndEvent[name] } + return TransitionEndEvent[name] // { end: TransitionEndEvent[name] } } } @@ -34,17 +34,11 @@ const Util = (($) => { function setTransitionEndSupport() { transitionEnd = transitionEndTest() - $.fn.transitionEndSupported = () => { - return transitionEnd - } - // generate a selector + // generate a concatenated transition end event selector for (let name in TransitionEndEvent) { transitionEndSelector += ` ${TransitionEndEvent[name]}` } - $.fn.transitionEndSelector = () => { - return transitionEndSelector - } // FIXME: make this a Util.* method instead? } /** @@ -55,23 +49,22 @@ const Util = (($) => { let Util = { - isChar(evt) { - if (typeof evt.which == "undefined") { - return true - } else if (typeof evt.which == "number" && evt.which > 0) { - return !evt.ctrlKey && !evt.metaKey && !evt.altKey && evt.which != 8 && evt.which != 9 - } - else { - return false - } + transitionEndSupported() { + return transitionEnd }, - /* /!** - * Verify if the client browser has transistion support - *!/ - hasTransitionSupport() { - return transition - }*/ + transitionEndSelector() { + return transitionEndSelector + }, + + isChar(evt) { + if (typeof evt.which === "undefined") { + return true + } else if (typeof evt.which === "number" && evt.which > 0) { + return !evt.ctrlKey && !evt.metaKey && !evt.altKey && evt.which !== 8 && evt.which !== 9 + } + return false + } } setTransitionEndSupport()