mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 23:17:02 +02:00
[Case 4315] ESLint Pass 6 Pt 1 for colpick.js (details below).
First portion of vetted equality check fixes. Issue Count reduced from 28 to 8. Changes Committed: modified: scripts/system/html/js/colpick.js
This commit is contained in:
parent
83749b16c7
commit
59e0b8476a
1 changed files with 12 additions and 12 deletions
|
@ -170,7 +170,7 @@ For usage and examples: colpick.com/plugin
|
||||||
$(document).on('mouseup touchend',current,upHue);
|
$(document).on('mouseup touchend',current,upHue);
|
||||||
$(document).on('mousemove touchmove',current,moveHue);
|
$(document).on('mousemove touchmove',current,moveHue);
|
||||||
|
|
||||||
var pageY = ((ev.type == 'touchstart') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY );
|
var pageY = ((ev.type === 'touchstart') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY );
|
||||||
change.apply(
|
change.apply(
|
||||||
current.cal.data('colpick')
|
current.cal.data('colpick')
|
||||||
.fields.eq(4).val(parseInt(360 * (current.cal.data('colpick').height -
|
.fields.eq(4).val(parseInt(360 * (current.cal.data('colpick').height -
|
||||||
|
@ -181,7 +181,7 @@ For usage and examples: colpick.com/plugin
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
moveHue = function (ev) {
|
moveHue = function (ev) {
|
||||||
var pageY = ((ev.type == 'touchmove') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY );
|
var pageY = ((ev.type === 'touchmove') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY );
|
||||||
change.apply(
|
change.apply(
|
||||||
ev.data.cal.data('colpick')
|
ev.data.cal.data('colpick')
|
||||||
.fields.eq(4).val(parseInt(360 * (ev.data.cal.data('colpick').height -
|
.fields.eq(4).val(parseInt(360 * (ev.data.cal.data('colpick').height -
|
||||||
|
@ -212,7 +212,7 @@ For usage and examples: colpick.com/plugin
|
||||||
$(document).on('mousemove touchmove',current,moveSelector);
|
$(document).on('mousemove touchmove',current,moveSelector);
|
||||||
|
|
||||||
var pageX,pageY;
|
var pageX,pageY;
|
||||||
if (ev.type == 'touchstart') {
|
if (ev.type === 'touchstart') {
|
||||||
pageX = ev.originalEvent.changedTouches[0].pageX,
|
pageX = ev.originalEvent.changedTouches[0].pageX,
|
||||||
pageY = ev.originalEvent.changedTouches[0].pageY;
|
pageY = ev.originalEvent.changedTouches[0].pageY;
|
||||||
} else {
|
} else {
|
||||||
|
@ -232,7 +232,7 @@ For usage and examples: colpick.com/plugin
|
||||||
},
|
},
|
||||||
moveSelector = function (ev) {
|
moveSelector = function (ev) {
|
||||||
var pageX,pageY;
|
var pageX,pageY;
|
||||||
if (ev.type == 'touchmove') {
|
if (ev.type === 'touchmove') {
|
||||||
pageX = ev.originalEvent.changedTouches[0].pageX,
|
pageX = ev.originalEvent.changedTouches[0].pageX,
|
||||||
pageY = ev.originalEvent.changedTouches[0].pageY;
|
pageY = ev.originalEvent.changedTouches[0].pageY;
|
||||||
} else {
|
} else {
|
||||||
|
@ -282,7 +282,7 @@ For usage and examples: colpick.com/plugin
|
||||||
left -= calW;
|
left -= calW;
|
||||||
}
|
}
|
||||||
cal.css({left: left + 'px', top: top + 'px'});
|
cal.css({left: left + 'px', top: top + 'px'});
|
||||||
if (cal.data('colpick').onShow.apply(this, [cal.get(0)]) != false) {
|
if (cal.data('colpick').onShow.apply(this, [cal.get(0)]) !== false) {
|
||||||
cal.show();
|
cal.show();
|
||||||
}
|
}
|
||||||
// Hide when user clicks outside
|
// Hide when user clicks outside
|
||||||
|
@ -292,13 +292,13 @@ For usage and examples: colpick.com/plugin
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
hide = function (ev) {
|
hide = function (ev) {
|
||||||
if (ev.data.cal.data('colpick').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
|
if (ev.data.cal.data('colpick').onHide.apply(this, [ev.data.cal.get(0)]) !== false) {
|
||||||
ev.data.cal.hide();
|
ev.data.cal.hide();
|
||||||
}
|
}
|
||||||
$('html').off('mousedown', hide);
|
$('html').off('mousedown', hide);
|
||||||
},
|
},
|
||||||
getViewport = function () {
|
getViewport = function () {
|
||||||
var m = document.compatMode == 'CSS1Compat';
|
var m = document.compatMode === 'CSS1Compat';
|
||||||
return {
|
return {
|
||||||
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
|
||||||
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth)
|
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth)
|
||||||
|
@ -351,9 +351,9 @@ For usage and examples: colpick.com/plugin
|
||||||
// Set color
|
// Set color
|
||||||
if (typeof opt.color === 'string') {
|
if (typeof opt.color === 'string') {
|
||||||
opt.color = hexToHsb(opt.color);
|
opt.color = hexToHsb(opt.color);
|
||||||
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
|
} else if (opt.color.r !== undefined && opt.color.g !== undefined && opt.color.b !== undefined) {
|
||||||
opt.color = rgbToHsb(opt.color);
|
opt.color = rgbToHsb(opt.color);
|
||||||
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
|
} else if (opt.color.h !== undefined && opt.color.s !== undefined && opt.color.b !== undefined) {
|
||||||
opt.color = fixHSB(opt.color);
|
opt.color = fixHSB(opt.color);
|
||||||
} else {
|
} else {
|
||||||
return this;
|
return this;
|
||||||
|
@ -373,7 +373,7 @@ For usage and examples: colpick.com/plugin
|
||||||
// Add class according to layout
|
// Add class according to layout
|
||||||
cal.addClass('colpick_'+options.layout+(options.submit?'':' colpick_'+options.layout+'_ns'));
|
cal.addClass('colpick_'+options.layout+(options.submit?'':' colpick_'+options.layout+'_ns'));
|
||||||
// Add class if the color scheme is not default
|
// Add class if the color scheme is not default
|
||||||
if (options.colorScheme != 'light') {
|
if (options.colorScheme !== 'light') {
|
||||||
cal.addClass('colpick_'+options.colorScheme);
|
cal.addClass('colpick_'+options.colorScheme);
|
||||||
}
|
}
|
||||||
// Setup submit button
|
// Setup submit button
|
||||||
|
@ -466,9 +466,9 @@ For usage and examples: colpick.com/plugin
|
||||||
setCurrent = (typeof setCurrent === "undefined") ? 1 : setCurrent;
|
setCurrent = (typeof setCurrent === "undefined") ? 1 : setCurrent;
|
||||||
if (typeof col === 'string') {
|
if (typeof col === 'string') {
|
||||||
col = hexToHsb(col);
|
col = hexToHsb(col);
|
||||||
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
|
} else if (col.r !== undefined && col.g !== undefined && col.b !== undefined) {
|
||||||
col = rgbToHsb(col);
|
col = rgbToHsb(col);
|
||||||
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
|
} else if (col.h !== undefined && col.s !== undefined && col.b !== undefined) {
|
||||||
col = fixHSB(col);
|
col = fixHSB(col);
|
||||||
} else {
|
} else {
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue