eslinted util

This commit is contained in:
Kevin Ross 2015-12-01 11:22:13 -06:00
parent d652c7b90b
commit f2116f17ae
3 changed files with 23 additions and 30 deletions

View File

@ -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,

View File

@ -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})`,

View File

@ -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()