stricter linting

This commit is contained in:
Mark Salsbery 2020-06-25 16:01:14 -07:00
parent 48a18a6a7d
commit c4351f64e8
27 changed files with 176 additions and 6552 deletions

View File

@ -1,9 +1,33 @@
{ {
"root": true,
"extends": [
"eslint:recommended"
],
"env": { "env": {
"es6": false,
"browser": true "browser": true
}, },
"extends": "eslint:recommended", "parserOptions": {
"ecmaVersion": 5,
"sourceType": "script",
"ecmaFeatures": {
"globalReturn": false,
"impliedStrict": false,
"jsx": false
}
},
"globals": {
"OpenSeadragon": true,
"define": false,
"module": false
},
"rules": { "rules": {
"no-unused-vars": [
"error",
{
"args": "none"
}
],
"indent": [ "indent": [
"off", "off",
4 4
@ -16,24 +40,18 @@
"error", "error",
"always" "always"
], ],
"no-unused-vars": [
"error",
{
"args": "none"
}
],
"block-scoped-var": [ "block-scoped-var": [
"error" "error"
], ],
"consistent-return": [ "consistent-return": [
"off" "error"
], ],
"curly": [ "curly": [
"error", "error",
"all" "all"
], ],
"eqeqeq": [ "eqeqeq": [
"off" "error"
], ],
"no-eval": [ "no-eval": [
"error" "error"
@ -83,7 +101,7 @@
"error" "error"
], ],
"no-useless-escape": [ "no-useless-escape": [
"off" "error"
], ],
"no-useless-return": [ "no-useless-return": [
"error" "error"
@ -103,7 +121,9 @@
"no-use-before-define": [ "no-use-before-define": [
"error", "error",
{ {
"functions": false "functions": false,
"classes": true,
"variables": true
} }
], ],
"array-bracket-spacing": [ "array-bracket-spacing": [
@ -237,7 +257,7 @@
"after" "after"
], ],
"quote-props": [ "quote-props": [
"off", "error",
"as-needed" "as-needed"
], ],
"semi-spacing": [ "semi-spacing": [
@ -273,10 +293,5 @@
"no-loop-func": [ "no-loop-func": [
"error" "error"
] ]
},
"globals": {
"OpenSeadragon": true,
"define": false,
"module": false
} }
} }

View File

@ -1,6 +1,8 @@
/* eslint-disable no-redeclare */
/* global module */ /* global module */
module.exports = function(grunt) { module.exports = function(grunt) {
/* eslint-disable no-undef */
var dateFormat = require('dateformat'); var dateFormat = require('dateformat');
// ---------- // ----------
@ -123,6 +125,7 @@ module.exports = function(grunt) {
banner: banner, banner: banner,
compress: { compress: {
sequences: false, sequences: false,
/* eslint-disable camelcase */
join_vars: false join_vars: false
}, },
sourceMap: true, sourceMap: true,

6400
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
"url": "https://github.com/openseadragon/openseadragon.git" "url": "https://github.com/openseadragon/openseadragon.git"
}, },
"devDependencies": { "devDependencies": {
"grunt": "^1.0.4", "grunt": "^1.1.0",
"grunt-contrib-clean": "^2.0.0", "grunt-contrib-clean": "^2.0.0",
"grunt-contrib-compress": "^1.6.0", "grunt-contrib-compress": "^1.6.0",
"grunt-contrib-concat": "^1.0.1", "grunt-contrib-concat": "^1.0.1",
@ -36,7 +36,7 @@
"grunt-contrib-qunit": "^3.1.0", "grunt-contrib-qunit": "^3.1.0",
"grunt-contrib-uglify": "^4.0.1", "grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-watch": "^1.1.0", "grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^22.0.0", "grunt-eslint": "^23.0.0",
"grunt-git-describe": "^2.4.4", "grunt-git-describe": "^2.4.4",
"grunt-istanbul": "^0.8.0", "grunt-istanbul": "^0.8.0",
"grunt-text-replace": "^0.4.0", "grunt-text-replace": "^0.4.0",

View File

@ -158,7 +158,7 @@ $.Button = function( options ) {
this.imgDown.style.visibility = this.imgDown.style.visibility =
"hidden"; "hidden";
if ($.Browser.vendor == $.BROWSERS.FIREFOX && $.Browser.version < 3) { if ($.Browser.vendor === $.BROWSERS.FIREFOX && $.Browser.version < 3) {
this.imgGroup.style.top = this.imgGroup.style.top =
this.imgHover.style.top = this.imgHover.style.top =
this.imgDown.style.top = this.imgDown.style.top =
@ -465,13 +465,13 @@ function inTo( button, newState ) {
} }
if ( newState >= $.ButtonState.GROUP && if ( newState >= $.ButtonState.GROUP &&
button.currentState == $.ButtonState.REST ) { button.currentState === $.ButtonState.REST ) {
stopFading( button ); stopFading( button );
button.currentState = $.ButtonState.GROUP; button.currentState = $.ButtonState.GROUP;
} }
if ( newState >= $.ButtonState.HOVER && if ( newState >= $.ButtonState.HOVER &&
button.currentState == $.ButtonState.GROUP ) { button.currentState === $.ButtonState.GROUP ) {
if( button.imgHover ){ if( button.imgHover ){
button.imgHover.style.visibility = ""; button.imgHover.style.visibility = "";
} }
@ -479,7 +479,7 @@ function inTo( button, newState ) {
} }
if ( newState >= $.ButtonState.DOWN && if ( newState >= $.ButtonState.DOWN &&
button.currentState == $.ButtonState.HOVER ) { button.currentState === $.ButtonState.HOVER ) {
if( button.imgDown ){ if( button.imgDown ){
button.imgDown.style.visibility = ""; button.imgDown.style.visibility = "";
} }
@ -495,7 +495,7 @@ function outTo( button, newState ) {
} }
if ( newState <= $.ButtonState.HOVER && if ( newState <= $.ButtonState.HOVER &&
button.currentState == $.ButtonState.DOWN ) { button.currentState === $.ButtonState.DOWN ) {
if( button.imgDown ){ if( button.imgDown ){
button.imgDown.style.visibility = "hidden"; button.imgDown.style.visibility = "hidden";
} }
@ -503,7 +503,7 @@ function outTo( button, newState ) {
} }
if ( newState <= $.ButtonState.GROUP && if ( newState <= $.ButtonState.GROUP &&
button.currentState == $.ButtonState.HOVER ) { button.currentState === $.ButtonState.HOVER ) {
if( button.imgHover ){ if( button.imgHover ){
button.imgHover.style.visibility = "hidden"; button.imgHover.style.visibility = "hidden";
} }
@ -511,7 +511,7 @@ function outTo( button, newState ) {
} }
if ( newState <= $.ButtonState.REST && if ( newState <= $.ButtonState.REST &&
button.currentState == $.ButtonState.GROUP ) { button.currentState === $.ButtonState.GROUP ) {
beginFading( button ); beginFading( button );
button.currentState = $.ButtonState.REST; button.currentState = $.ButtonState.REST;
} }

View File

@ -112,13 +112,13 @@ $.Control = function ( element, options, container ) {
* @member {Element} wrapper * @member {Element} wrapper
* @memberof OpenSeadragon.Control# * @memberof OpenSeadragon.Control#
*/ */
if ( this.anchor == $.ControlAnchor.ABSOLUTE ) { if ( this.anchor === $.ControlAnchor.ABSOLUTE ) {
this.wrapper = $.makeNeutralElement( "div" ); this.wrapper = $.makeNeutralElement( "div" );
this.wrapper.style.position = "absolute"; this.wrapper.style.position = "absolute";
this.wrapper.style.top = typeof (options.top) == "number" ? (options.top + 'px') : options.top; this.wrapper.style.top = typeof (options.top) === "number" ? (options.top + 'px') : options.top;
this.wrapper.style.left = typeof (options.left) == "number" ? (options.left + 'px') : options.left; this.wrapper.style.left = typeof (options.left) === "number" ? (options.left + 'px') : options.left;
this.wrapper.style.height = typeof (options.height) == "number" ? (options.height + 'px') : options.height; this.wrapper.style.height = typeof (options.height) === "number" ? (options.height + 'px') : options.height;
this.wrapper.style.width = typeof (options.width) == "number" ? (options.width + 'px') : options.width; this.wrapper.style.width = typeof (options.width) === "number" ? (options.width + 'px') : options.width;
this.wrapper.style.margin = "0px"; this.wrapper.style.margin = "0px";
this.wrapper.style.padding = "0px"; this.wrapper.style.padding = "0px";
@ -130,7 +130,7 @@ $.Control = function ( element, options, container ) {
} else { } else {
this.wrapper = $.makeNeutralElement( "div" ); this.wrapper = $.makeNeutralElement( "div" );
this.wrapper.style.display = "inline-block"; this.wrapper.style.display = "inline-block";
if ( this.anchor == $.ControlAnchor.NONE ) { if ( this.anchor === $.ControlAnchor.NONE ) {
// IE6 fix // IE6 fix
this.wrapper.style.width = this.wrapper.style.height = "100%"; this.wrapper.style.width = this.wrapper.style.height = "100%";
} }
@ -138,8 +138,8 @@ $.Control = function ( element, options, container ) {
this.wrapper.appendChild( this.element ); this.wrapper.appendChild( this.element );
if (options.attachToViewer ) { if (options.attachToViewer ) {
if ( this.anchor == $.ControlAnchor.TOP_RIGHT || if ( this.anchor === $.ControlAnchor.TOP_RIGHT ||
this.anchor == $.ControlAnchor.BOTTOM_RIGHT ) { this.anchor === $.ControlAnchor.BOTTOM_RIGHT ) {
this.container.insertBefore( this.container.insertBefore(
this.wrapper, this.wrapper,
this.container.firstChild this.container.firstChild
@ -170,7 +170,7 @@ $.Control.prototype = {
* @return {Boolean} true if currently visible, false otherwise. * @return {Boolean} true if currently visible, false otherwise.
*/ */
isVisible: function() { isVisible: function() {
return this.wrapper.style.display != "none"; return this.wrapper.style.display !== "none";
}, },
/** /**
@ -180,7 +180,7 @@ $.Control.prototype = {
*/ */
setVisible: function( visible ) { setVisible: function( visible ) {
this.wrapper.style.display = visible ? this.wrapper.style.display = visible ?
( this.anchor == $.ControlAnchor.ABSOLUTE ? 'block' : 'inline-block' ) : ( this.anchor === $.ControlAnchor.ABSOLUTE ? 'block' : 'inline-block' ) :
"none"; "none";
}, },
@ -190,7 +190,7 @@ $.Control.prototype = {
* @param {Number} opactiy - a value between 1 and 0 inclusively. * @param {Number} opactiy - a value between 1 and 0 inclusively.
*/ */
setOpacity: function( opacity ) { setOpacity: function( opacity ) {
if ( this.element[ $.SIGNAL ] && $.Browser.vendor == $.BROWSERS.IE ) { if ( this.element[ $.SIGNAL ] && $.Browser.vendor === $.BROWSERS.IE ) {
$.setElementOpacity( this.element, opacity, true ); $.setElementOpacity( this.element, opacity, true );
} else { } else {
$.setElementOpacity( this.wrapper, opacity, true ); $.setElementOpacity( this.wrapper, opacity, true );

View File

@ -218,7 +218,7 @@
i; i;
for ( i = controls.length - 1; i >= 0; i-- ) { for ( i = controls.length - 1; i >= 0; i-- ) {
if ( controls[ i ].element == element ) { if ( controls[ i ].element === element ) {
return i; return i;
} }
} }

View File

@ -284,8 +284,8 @@ $.Drawer.prototype = {
this.canvas.innerHTML = ""; this.canvas.innerHTML = "";
if ( this.useCanvas ) { if ( this.useCanvas ) {
var viewportSize = this._calculateCanvasSize(); var viewportSize = this._calculateCanvasSize();
if( this.canvas.width != viewportSize.x || if( this.canvas.width !== viewportSize.x ||
this.canvas.height != viewportSize.y ) { this.canvas.height !== viewportSize.y ) {
this.canvas.width = viewportSize.x; this.canvas.width = viewportSize.x;
this.canvas.height = viewportSize.y; this.canvas.height = viewportSize.y;
this._updateImageSmoothingEnabled(this.context); this._updateImageSmoothingEnabled(this.context);

View File

@ -108,7 +108,7 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
if ( data.Image ) { if ( data.Image ) {
ns = data.Image.xmlns; ns = data.Image.xmlns;
} else if ( data.documentElement) { } else if ( data.documentElement) {
if ("Image" == data.documentElement.localName || "Image" == data.documentElement.tagName) { if ("Image" === data.documentElement.localName || "Image" === data.documentElement.tagName) {
ns = data.documentElement.namespaceURI; ns = data.documentElement.namespaceURI;
} }
} }
@ -142,9 +142,9 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
if (url && !options.tilesUrl) { if (url && !options.tilesUrl) {
options.tilesUrl = url.replace( options.tilesUrl = url.replace(
/([^\/]+?)(\.(dzi|xml|js)?(\?[^\/]*)?)?\/?$/, '$1_files/'); /([^/]+?)(\.(dzi|xml|js)?(\?[^/]*)?)?\/?$/, '$1_files/');
if (url.search(/\.(dzi|xml|js)\?/) != -1) { if (url.search(/\.(dzi|xml|js)\?/) !== -1) {
options.queryParams = url.match(/\?.*/); options.queryParams = url.match(/\?.*/);
}else{ }else{
options.queryParams = ''; options.queryParams = '';
@ -240,7 +240,7 @@ function configureFromXML( tileSource, xmlDoc ){
sizeNode, sizeNode,
i; i;
if ( rootName == "Image" ) { if ( rootName === "Image" ) {
try { try {
sizeNode = root.getElementsByTagName("Size" )[ 0 ]; sizeNode = root.getElementsByTagName("Size" )[ 0 ];
@ -304,9 +304,9 @@ function configureFromXML( tileSource, xmlDoc ){
e : e :
new Error( $.getString("Errors.Dzi") ); new Error( $.getString("Errors.Dzi") );
} }
} else if ( rootName == "Collection" ) { } else if ( rootName === "Collection" ) {
throw new Error( $.getString( "Errors.Dzc" ) ); throw new Error( $.getString( "Errors.Dzc" ) );
} else if ( rootName == "Error" ) { } else if ( rootName === "Error" ) {
var messageNode = root.getElementsByTagName("Message")[0]; var messageNode = root.getElementsByTagName("Message")[0];
var message = messageNode.firstChild.nodeValue; var message = messageNode.firstChild.nodeValue;
throw new Error(message); throw new Error(message);

View File

@ -71,7 +71,7 @@ $.IIIFTileSource = function( options ){
options.tileSize = this.tile_height; options.tileSize = this.tile_height;
} else if ( this.tiles ) { } else if ( this.tiles ) {
// Version 2.0 forwards // Version 2.0 forwards
if ( this.tiles.length == 1 ) { if ( this.tiles.length === 1 ) {
options.tileWidth = this.tiles[0].width; options.tileWidth = this.tiles[0].width;
// Use height if provided, otherwise assume square tiles and use width. // Use height if provided, otherwise assume square tiles and use width.
options.tileHeight = this.tiles[0].height || this.tiles[0].width; options.tileHeight = this.tiles[0].height || this.tiles[0].width;
@ -152,12 +152,12 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
supports: function( data, url ) { supports: function( data, url ) {
// Version 2.0 and forwards // Version 2.0 and forwards
if (data.protocol && data.protocol == 'http://iiif.io/api/image') { if (data.protocol && data.protocol === 'http://iiif.io/api/image') {
return true; return true;
// Version 1.1 // Version 1.1
} else if ( data['@context'] && ( } else if ( data['@context'] && (
data['@context'] == "http://library.stanford.edu/iiif/image-api/1.1/context.json" || data['@context'] === "http://library.stanford.edu/iiif/image-api/1.1/context.json" ||
data['@context'] == "http://iiif.io/api/image/1/context.json") ) { data['@context'] === "http://iiif.io/api/image/1/context.json") ) {
// N.B. the iiif.io context is wrong, but where the representation lives so likely to be used // N.B. the iiif.io context is wrong, but where the representation lives so likely to be used
return true; return true;
@ -168,8 +168,8 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
} else if ( data.identifier && data.width && data.height ) { } else if ( data.identifier && data.width && data.height ) {
return true; return true;
} else if ( data.documentElement && } else if ( data.documentElement &&
"info" == data.documentElement.tagName && "info" === data.documentElement.tagName &&
"http://library.stanford.edu/iiif/image-api/ns/" == "http://library.stanford.edu/iiif/image-api/ns/" ===
data.documentElement.namespaceURI) { data.documentElement.namespaceURI) {
return true; return true;
@ -500,7 +500,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
rootName = root.tagName, rootName = root.tagName,
configuration = null; configuration = null;
if ( rootName == "info" ) { if ( rootName === "info" ) {
try { try {
configuration = {}; configuration = {};
parseXML10( root, configuration ); parseXML10( root, configuration );
@ -518,7 +518,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
function parseXML10( node, configuration, property ) { function parseXML10( node, configuration, property ) {
var i, var i,
value; value;
if ( node.nodeType == 3 && property ) {//text node if ( node.nodeType === 3 && property ) {//text node
value = node.nodeValue.trim(); value = node.nodeValue.trim();
if( value.match(/^\d*$/)){ if( value.match(/^\d*$/)){
value = Number( value ); value = Number( value );
@ -531,7 +531,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
} }
configuration[ property ].push( value ); configuration[ property ].push( value );
} }
} else if( node.nodeType == 1 ){ } else if( node.nodeType === 1 ){
for( i = 0; i < node.childNodes.length; i++ ){ for( i = 0; i < node.childNodes.length; i++ ){
parseXML10( node.childNodes[ i ], configuration, node.nodeName ); parseXML10( node.childNodes[ i ], configuration, node.nodeName );
} }

View File

@ -109,10 +109,10 @@ $.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, /** @lends OpenS
supports: function( data, url ){ supports: function( data, url ){
return ( return (
data.type && data.type &&
"legacy-image-pyramid" == data.type "legacy-image-pyramid" === data.type
) || ( ) || (
data.documentElement && data.documentElement &&
"legacy-image-pyramid" == data.documentElement.getAttribute('type') "legacy-image-pyramid" === data.documentElement.getAttribute('type')
); );
}, },
@ -241,7 +241,7 @@ function configureFromXML( tileSource, xmlDoc ){
level, level,
i; i;
if ( rootName == "image" ) { if ( rootName === "image" ) {
try { try {
conf = { conf = {
@ -267,9 +267,9 @@ function configureFromXML( tileSource, xmlDoc ){
e : e :
new Error( 'Unknown error parsing Legacy Image Pyramid XML.' ); new Error( 'Unknown error parsing Legacy Image Pyramid XML.' );
} }
} else if ( rootName == "collection" ) { } else if ( rootName === "collection" ) {
throw new Error( 'Legacy Image Pyramid Collections not yet supported.' ); throw new Error( 'Legacy Image Pyramid Collections not yet supported.' );
} else if ( rootName == "error" ) { } else if ( rootName === "error" ) {
throw new Error( 'Error: ' + xmlDoc ); throw new Error( 'Error: ' + xmlDoc );
} }

View File

@ -997,7 +997,7 @@
/** /**
* Detect available mouse wheel event name. * Detect available mouse wheel event name.
*/ */
$.MouseTracker.wheelEventName = ( $.Browser.vendor == $.BROWSERS.IE && $.Browser.version > 8 ) || $.MouseTracker.wheelEventName = ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version > 8 ) ||
( 'onwheel' in document.createElement( 'div' ) ) ? 'wheel' : // Modern browsers support 'wheel' ( 'onwheel' in document.createElement( 'div' ) ) ? 'wheel' : // Modern browsers support 'wheel'
document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least 'mousewheel' document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least 'mousewheel'
'DOMMouseScroll'; // Assume old Firefox 'DOMMouseScroll'; // Assume old Firefox
@ -1015,7 +1015,7 @@
*/ */
$.MouseTracker.subscribeEvents = [ "click", "dblclick", "keydown", "keyup", "keypress", "focus", "blur", $.MouseTracker.wheelEventName ]; $.MouseTracker.subscribeEvents = [ "click", "dblclick", "keydown", "keyup", "keypress", "focus", "blur", $.MouseTracker.wheelEventName ];
if( $.MouseTracker.wheelEventName == "DOMMouseScroll" ) { if( $.MouseTracker.wheelEventName === "DOMMouseScroll" ) {
// Older Firefox // Older Firefox
$.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" ); $.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" );
} }
@ -1760,13 +1760,13 @@
clientY: event.clientY, clientY: event.clientY,
pageX: event.pageX ? event.pageX : event.clientX, pageX: event.pageX ? event.pageX : event.clientX,
pageY: event.pageY ? event.pageY : event.clientY, pageY: event.pageY ? event.pageY : event.clientY,
deltaMode: event.type == "MozMousePixelScroll" ? 0 : 1, // 0=pixel, 1=line, 2=page deltaMode: event.type === "MozMousePixelScroll" ? 0 : 1, // 0=pixel, 1=line, 2=page
deltaX: 0, deltaX: 0,
deltaZ: 0 deltaZ: 0
}; };
// Calculate deltaY // Calculate deltaY
if ( $.MouseTracker.wheelEventName == "mousewheel" ) { if ( $.MouseTracker.wheelEventName === "mousewheel" ) {
simulatedEvent.deltaY = -event.wheelDelta / $.DEFAULT_SETTINGS.pixelsPerWheelLine; simulatedEvent.deltaY = -event.wheelDelta / $.DEFAULT_SETTINGS.pixelsPerWheelLine;
} else { } else {
simulatedEvent.deltaY = event.detail; simulatedEvent.deltaY = event.detail;
@ -3284,7 +3284,7 @@
// Pinch // Pinch
if ( tracker.pinchHandler && gPoints[ 0 ].type === 'touch' ) { if ( tracker.pinchHandler && gPoints[ 0 ].type === 'touch' ) {
delta = delegate.pinchGPoints[ 0 ].currentPos.distanceTo( delegate.pinchGPoints[ 1 ].currentPos ); delta = delegate.pinchGPoints[ 0 ].currentPos.distanceTo( delegate.pinchGPoints[ 1 ].currentPos );
if ( delta != delegate.currentPinchDist ) { if ( delta !== delegate.currentPinchDist ) {
delegate.lastPinchDist = delegate.currentPinchDist; delegate.lastPinchDist = delegate.currentPinchDist;
delegate.currentPinchDist = delta; delegate.currentPinchDist = delta;
delegate.lastPinchCenter = delegate.currentPinchCenter; delegate.lastPinchCenter = delegate.currentPinchCenter;

View File

@ -66,15 +66,15 @@ $.Navigator = function( options ){
}; };
if( options.position ){ if( options.position ){
if( 'BOTTOM_RIGHT' == options.position ){ if( 'BOTTOM_RIGHT' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.BOTTOM_RIGHT; options.controlOptions.anchor = $.ControlAnchor.BOTTOM_RIGHT;
} else if( 'BOTTOM_LEFT' == options.position ){ } else if( 'BOTTOM_LEFT' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.BOTTOM_LEFT; options.controlOptions.anchor = $.ControlAnchor.BOTTOM_LEFT;
} else if( 'TOP_RIGHT' == options.position ){ } else if( 'TOP_RIGHT' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.TOP_RIGHT; options.controlOptions.anchor = $.ControlAnchor.TOP_RIGHT;
} else if( 'TOP_LEFT' == options.position ){ } else if( 'TOP_LEFT' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.TOP_LEFT; options.controlOptions.anchor = $.ControlAnchor.TOP_LEFT;
} else if( 'ABSOLUTE' == options.position ){ } else if( 'ABSOLUTE' === options.position ){
options.controlOptions.anchor = $.ControlAnchor.ABSOLUTE; options.controlOptions.anchor = $.ControlAnchor.ABSOLUTE;
options.controlOptions.top = options.top; options.controlOptions.top = options.top;
options.controlOptions.left = options.left; options.controlOptions.left = options.left;
@ -128,7 +128,7 @@ $.Navigator = function( options ){
this.totalBorderWidths = new $.Point(this.borderWidth * 2, this.borderWidth * 2).minus(this.fudge); this.totalBorderWidths = new $.Point(this.borderWidth * 2, this.borderWidth * 2).minus(this.fudge);
if ( options.controlOptions.anchor != $.ControlAnchor.NONE ) { if ( options.controlOptions.anchor !== $.ControlAnchor.NONE ) {
(function( style, borderWidth ){ (function( style, borderWidth ){
style.margin = '0px'; style.margin = '0px';
style.border = borderWidth + 'px solid ' + options.borderColor; style.border = borderWidth + 'px solid ' + options.borderColor;
@ -179,8 +179,8 @@ $.Navigator = function( options ){
options.controlOptions options.controlOptions
); );
this._resizeWithViewer = options.controlOptions.anchor != $.ControlAnchor.ABSOLUTE && this._resizeWithViewer = options.controlOptions.anchor !== $.ControlAnchor.ABSOLUTE &&
options.controlOptions.anchor != $.ControlAnchor.NONE; options.controlOptions.anchor !== $.ControlAnchor.NONE;
if (options.width && options.height) { if (options.width && options.height) {
this.setWidth(options.width); this.setWidth(options.width);
@ -282,7 +282,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
*/ */
setWidth: function(width) { setWidth: function(width) {
this.width = width; this.width = width;
this.element.style.width = typeof (width) == "number" ? (width + 'px') : width; this.element.style.width = typeof (width) === "number" ? (width + 'px') : width;
this._resizeWithViewer = false; this._resizeWithViewer = false;
}, },
@ -292,7 +292,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
*/ */
setHeight: function(height) { setHeight: function(height) {
this.height = height; this.height = height;
this.element.style.height = typeof (height) == "number" ? (height + 'px') : height; this.element.style.height = typeof (height) === "number" ? (height + 'px') : height;
this._resizeWithViewer = false; this._resizeWithViewer = false;
}, },

View File

@ -1333,7 +1333,7 @@ function OpenSeadragon( options ){
* @returns {Element} The element with the given id, null, or the element itself. * @returns {Element} The element with the given id, null, or the element itself.
*/ */
getElement: function( element ) { getElement: function( element ) {
if ( typeof ( element ) == "string" ) { if ( typeof ( element ) === "string" ) {
element = document.getElementById( element ); element = document.getElementById( element );
} }
return element; return element;
@ -1352,7 +1352,7 @@ function OpenSeadragon( options ){
offsetParent; offsetParent;
element = $.getElement( element ); element = $.getElement( element );
isFixed = $.getElementStyle( element ).position == "fixed"; isFixed = $.getElementStyle( element ).position === "fixed";
offsetParent = getOffsetParent( element, isFixed ); offsetParent = getOffsetParent( element, isFixed );
while ( offsetParent ) { while ( offsetParent ) {
@ -1365,7 +1365,7 @@ function OpenSeadragon( options ){
} }
element = offsetParent; element = offsetParent;
isFixed = $.getElementStyle( element ).position == "fixed"; isFixed = $.getElementStyle( element ).position === "fixed";
offsetParent = getOffsetParent( element, isFixed ); offsetParent = getOffsetParent( element, isFixed );
} }
@ -1397,7 +1397,7 @@ function OpenSeadragon( options ){
boundingRect = element.getBoundingClientRect(); boundingRect = element.getBoundingClientRect();
} }
win = ( doc == doc.window ) ? win = ( doc === doc.window ) ?
doc : doc :
( doc.nodeType === 9 ) ? ( doc.nodeType === 9 ) ?
doc.defaultView || doc.parentWindow : doc.defaultView || doc.parentWindow :
@ -1548,7 +1548,7 @@ function OpenSeadragon( options ){
*/ */
getMousePosition: function( event ) { getMousePosition: function( event ) {
if ( typeof ( event.pageX ) == "number" ) { if ( typeof ( event.pageX ) === "number" ) {
$.getMousePosition = function( event ){ $.getMousePosition = function( event ){
var result = new $.Point(); var result = new $.Point();
@ -1558,7 +1558,7 @@ function OpenSeadragon( options ){
return result; return result;
}; };
} else if ( typeof ( event.clientX ) == "number" ) { } else if ( typeof ( event.clientX ) === "number" ) {
$.getMousePosition = function( event ){ $.getMousePosition = function( event ){
var result = new $.Point(); var result = new $.Point();
@ -1593,7 +1593,7 @@ function OpenSeadragon( options ){
var docElement = document.documentElement || {}, var docElement = document.documentElement || {},
body = document.body || {}; body = document.body || {};
if ( typeof ( window.pageXOffset ) == "number" ) { if ( typeof ( window.pageXOffset ) === "number" ) {
$.getPageScroll = function(){ $.getPageScroll = function(){
return new $.Point( return new $.Point(
window.pageXOffset, window.pageXOffset,
@ -1670,7 +1670,7 @@ function OpenSeadragon( options ){
}; };
} }
return $.setPageScroll( scroll ); $.setPageScroll( scroll );
}, },
/** /**
@ -1682,7 +1682,7 @@ function OpenSeadragon( options ){
var docElement = document.documentElement || {}, var docElement = document.documentElement || {},
body = document.body || {}; body = document.body || {};
if ( typeof ( window.innerWidth ) == 'number' ) { if ( typeof ( window.innerWidth ) === 'number' ) {
$.getWindowSize = function(){ $.getWindowSize = function(){
return new $.Point( return new $.Point(
window.innerWidth, window.innerWidth,
@ -1814,7 +1814,7 @@ function OpenSeadragon( options ){
return img; return img;
}; };
if ( $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 7 ) { if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 7 ) {
$.makeTransparentImage = function( src ){ $.makeTransparentImage = function( src ){
var img = $.makeNeutralElement( "img" ), var img = $.makeNeutralElement( "img" ),
@ -2227,7 +2227,7 @@ function OpenSeadragon( options ){
request.onreadystatechange = function() { request.onreadystatechange = function() {
// 4 = DONE (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties) // 4 = DONE (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties)
if ( request.readyState == 4 ) { if ( request.readyState === 4 ) {
request.onreadystatechange = function(){}; request.onreadystatechange = function(){};
// With protocols other than http/https, a successful request status is in // With protocols other than http/https, a successful request status is in
@ -2281,8 +2281,8 @@ function OpenSeadragon( options ){
to point developers in the right direction. We test the exception number because IE's to point developers in the right direction. We test the exception number because IE's
error messages are localized. error messages are localized.
*/ */
var oldIE = $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 10; var oldIE = $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 10;
if ( oldIE && typeof ( e.number ) != "undefined" && e.number == -2147024891 ) { if ( oldIE && typeof ( e.number ) !== "undefined" && e.number === -2147024891 ) {
msg += "\nSee http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain"; msg += "\nSee http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain";
} }
@ -2353,7 +2353,7 @@ function OpenSeadragon( options ){
callbackParam = options.param || 'callback', callbackParam = options.param || 'callback',
callback = options.callback; callback = options.callback;
url = url.replace( /(\=)\?(&|$)|\?\?/i, replace ); url = url.replace( /(=)\?(&|$)|\?\?/i, replace );
// Add callback manually // Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + callbackParam + "=" + jsonpCallback; url += (/\?/.test( url ) ? "&" : "?") + callbackParam + "=" + jsonpCallback;
@ -2534,12 +2534,12 @@ function OpenSeadragon( options ){
var FILEFORMATS = { var FILEFORMATS = {
"bmp": false, bmp: false,
"jpeg": true, jpeg: true,
"jpg": true, jpg: true,
"png": true, png: true,
"tif": false, tif: false,
"wdp": false wdp: false
}, },
URLPARAMS = {}; URLPARAMS = {};
@ -2624,17 +2624,17 @@ function OpenSeadragon( options ){
//determine if this browser supports image alpha transparency //determine if this browser supports image alpha transparency
$.Browser.alpha = !( $.Browser.alpha = !(
( (
$.Browser.vendor == $.BROWSERS.IE && $.Browser.vendor === $.BROWSERS.IE &&
$.Browser.version < 9 $.Browser.version < 9
) || ( ) || (
$.Browser.vendor == $.BROWSERS.CHROME && $.Browser.vendor === $.BROWSERS.CHROME &&
$.Browser.version < 2 $.Browser.version < 2
) )
); );
//determine if this browser supports element.style.opacity //determine if this browser supports element.style.opacity
$.Browser.opacity = !( $.Browser.opacity = !(
$.Browser.vendor == $.BROWSERS.IE && $.Browser.vendor === $.BROWSERS.IE &&
$.Browser.version < 9 $.Browser.version < 9
); );
@ -2736,7 +2736,7 @@ function OpenSeadragon( options ){
* @returns {Element} * @returns {Element}
*/ */
function getOffsetParent( element, isFixed ) { function getOffsetParent( element, isFixed ) {
if ( isFixed && element != document.body ) { if ( isFixed && element !== document.body ) {
return document.body; return document.body;
} else { } else {
return element.offsetParent; return element.offsetParent;

View File

@ -113,7 +113,7 @@ $.extend( $.OsmTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
supports: function( data, url ){ supports: function( data, url ){
return ( return (
data.type && data.type &&
"openstreetmaps" == data.type "openstreetmaps" === data.type
); );
}, },

View File

@ -50,13 +50,13 @@ $.Point = function( x, y ) {
* @member {Number} x * @member {Number} x
* @memberof OpenSeadragon.Point# * @memberof OpenSeadragon.Point#
*/ */
this.x = typeof ( x ) == "number" ? x : 0; this.x = typeof ( x ) === "number" ? x : 0;
/** /**
* The vector component 'y'. * The vector component 'y'.
* @member {Number} y * @member {Number} y
* @memberof OpenSeadragon.Point# * @memberof OpenSeadragon.Point#
*/ */
this.y = typeof ( y ) == "number" ? y : 0; this.y = typeof ( y ) === "number" ? y : 0;
}; };
/** @lends OpenSeadragon.Point.prototype */ /** @lends OpenSeadragon.Point.prototype */

View File

@ -98,7 +98,7 @@ $.ReferenceStrip = function ( options ) {
$.extend( this, options ); $.extend( this, options );
//Private state properties //Private state properties
THIS[this.id] = { THIS[this.id] = {
"animating": false animating: false
}; };
this.minPixelRatio = this.viewer.minPixelRatio; this.minPixelRatio = this.viewer.minPixelRatio;
@ -139,7 +139,7 @@ $.ReferenceStrip = function ( options ) {
{ anchor: $.ControlAnchor.BOTTOM_LEFT } { anchor: $.ControlAnchor.BOTTOM_LEFT }
); );
} else { } else {
if ( "horizontal" == options.scroll ) { if ( "horizontal" === options.scroll ) {
this.element.style.width = ( this.element.style.width = (
viewerSize.x * viewerSize.x *
options.sizeRatio * options.sizeRatio *
@ -225,7 +225,7 @@ $.ReferenceStrip = function ( options ) {
this.panels.push( element ); this.panels.push( element );
} }
loadPanels( this, this.scroll == 'vertical' ? viewerSize.y : viewerSize.x, 0 ); loadPanels( this, this.scroll === 'vertical' ? viewerSize.y : viewerSize.x, 0 );
this.setFocus( 0 ); this.setFocus( 0 );
}; };
@ -251,7 +251,7 @@ $.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototyp
this.currentSelected = element; this.currentSelected = element;
this.currentSelected.style.background = '#999'; this.currentSelected.style.background = '#999';
if ( 'horizontal' == this.scroll ) { if ( 'horizontal' === this.scroll ) {
//right left //right left
offset = ( Number( page ) ) * ( this.panelWidth + 3 ); offset = ( Number( page ) ) * ( this.panelWidth + 3 );
if ( offset > offsetLeft + viewerSize.x - this.panelWidth ) { if ( offset > offsetLeft + viewerSize.x - this.panelWidth ) {
@ -324,7 +324,7 @@ function onStripDrag( event ) {
viewerSize = $.getElementSize( this.viewer.canvas ); viewerSize = $.getElementSize( this.viewer.canvas );
this.dragging = true; this.dragging = true;
if ( this.element ) { if ( this.element ) {
if ( 'horizontal' == this.scroll ) { if ( 'horizontal' === this.scroll ) {
if ( -event.delta.x > 0 ) { if ( -event.delta.x > 0 ) {
//forward //forward
if ( offsetLeft > -( scrollWidth - viewerSize.x ) ) { if ( offsetLeft > -( scrollWidth - viewerSize.x ) ) {
@ -372,7 +372,7 @@ function onStripScroll( event ) {
scrollHeight = Number( this.element.style.height.replace( 'px', '' ) ), scrollHeight = Number( this.element.style.height.replace( 'px', '' ) ),
viewerSize = $.getElementSize( this.viewer.canvas ); viewerSize = $.getElementSize( this.viewer.canvas );
if ( this.element ) { if ( this.element ) {
if ( 'horizontal' == this.scroll ) { if ( 'horizontal' === this.scroll ) {
if ( event.scroll > 0 ) { if ( event.scroll > 0 ) {
//forward //forward
if ( offsetLeft > -( scrollWidth - viewerSize.x ) ) { if ( offsetLeft > -( scrollWidth - viewerSize.x ) ) {
@ -415,7 +415,7 @@ function loadPanels( strip, viewerSize, scroll ) {
style, style,
i, i,
element; element;
if ( 'horizontal' == strip.scroll ) { if ( 'horizontal' === strip.scroll ) {
panelSize = strip.panelWidth; panelSize = strip.panelWidth;
} else { } else {
panelSize = strip.panelHeight; panelSize = strip.panelHeight;
@ -504,7 +504,7 @@ function onStripEnter( event ) {
//element.style.border = '1px solid #555'; //element.style.border = '1px solid #555';
//element.style.background = '#000'; //element.style.background = '#000';
if ( 'horizontal' == this.scroll ) { if ( 'horizontal' === this.scroll ) {
//element.style.paddingTop = "0px"; //element.style.paddingTop = "0px";
element.style.marginBottom = "0px"; element.style.marginBottom = "0px";
@ -527,7 +527,7 @@ function onStripEnter( event ) {
function onStripExit( event ) { function onStripExit( event ) {
var element = event.eventSource.element; var element = event.eventSource.element;
if ( 'horizontal' == this.scroll ) { if ( 'horizontal' === this.scroll ) {
//element.style.paddingTop = "10px"; //element.style.paddingTop = "10px";
element.style.marginBottom = "-" + ( $.getElementSize( element ).y / 2 ) + "px"; element.style.marginBottom = "-" + ( $.getElementSize( element ).y / 2 ) + "px";

View File

@ -50,11 +50,11 @@
$.Spring = function( options ) { $.Spring = function( options ) {
var args = arguments; var args = arguments;
if( typeof ( options ) != 'object' ){ if( typeof ( options ) !== 'object' ){
//allows backward compatible use of ( initialValue, config ) as //allows backward compatible use of ( initialValue, config ) as
//constructor parameters //constructor parameters
options = { options = {
initial: args.length && typeof ( args[ 0 ] ) == "number" ? initial: args.length && typeof ( args[ 0 ] ) === "number" ?
args[ 0 ] : args[ 0 ] :
undefined, undefined,
/** /**
@ -96,7 +96,7 @@ $.Spring = function( options ) {
* @property {Number} time * @property {Number} time
*/ */
this.current = { this.current = {
value: typeof ( this.initial ) == "number" ? value: typeof ( this.initial ) === "number" ?
this.initial : this.initial :
(this._exponential ? 0 : 1), (this._exponential ? 0 : 1),
time: $.now() // always work in milliseconds time: $.now() // always work in milliseconds
@ -237,7 +237,7 @@ $.Spring.prototype = {
this.current.value = currentValue; this.current.value = currentValue;
} }
return oldValue != this.current.value; return oldValue !== this.current.value;
}, },
/** /**

View File

@ -82,7 +82,7 @@ $.extend( $, /** @lends OpenSeadragon */{
} }
string = container[ props[ i ] ]; string = container[ props[ i ] ];
if ( typeof ( string ) != "string" ) { if ( typeof ( string ) !== "string" ) {
$.console.log( "Untranslated source string:", prop ); $.console.log( "Untranslated source string:", prop );
string = ""; // FIXME: this breaks gettext()-style convention, which would return source string = ""; // FIXME: this breaks gettext()-style convention, which would return source
} }

View File

@ -284,10 +284,10 @@ $.Tile.prototype = {
this.style = this.element.style; this.style = this.element.style;
this.style.position = "absolute"; this.style.position = "absolute";
} }
if ( this.element.parentNode != container ) { if ( this.element.parentNode !== container ) {
container.appendChild( this.element ); container.appendChild( this.element );
} }
if ( this.imgElement.parentNode != this.element ) { if ( this.imgElement.parentNode !== this.element ) {
this.element.appendChild( this.imgElement ); this.element.appendChild( this.imgElement );
} }

View File

@ -196,7 +196,7 @@ $.TileCache.prototype = {
worstLevel = worstTile.level; worstLevel = worstTile.level;
if ( prevTime < worstTime || if ( prevTime < worstTime ||
( prevTime == worstTime && prevLevel > worstLevel ) ) { ( prevTime === worstTime && prevLevel > worstLevel ) ) {
worstTile = prevTile; worstTile = prevTile;
worstTileIndex = i; worstTileIndex = i;
worstTileRecord = prevTileRecord; worstTileRecord = prevTileRecord;

View File

@ -1874,7 +1874,7 @@ function compareTiles( previousBest, tile ) {
if ( tile.visibility > previousBest.visibility ) { if ( tile.visibility > previousBest.visibility ) {
return tile; return tile;
} else if ( tile.visibility == previousBest.visibility ) { } else if ( tile.visibility === previousBest.visibility ) {
if ( tile.squaredDistance < previousBest.squaredDistance ) { if ( tile.squaredDistance < previousBest.squaredDistance ) {
return tile; return tile;
} }

View File

@ -167,7 +167,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
* @memberof OpenSeadragon.TileSource# * @memberof OpenSeadragon.TileSource#
*/ */
if( 'string' == $.type( arguments[ 0 ] ) ){ if( 'string' === $.type( arguments[ 0 ] ) ){
this.url = arguments[0]; this.url = arguments[0];
} }
@ -500,7 +500,7 @@ $.TileSource.prototype = {
msg = "HTTP " + xhr.status + " attempting to load TileSource"; msg = "HTTP " + xhr.status + " attempting to load TileSource";
} catch ( e ) { } catch ( e ) {
var formattedExc; var formattedExc;
if ( typeof ( exc ) == "undefined" || !exc.toString ) { if ( typeof ( exc ) === "undefined" || !exc.toString ) {
formattedExc = "Unknown error"; formattedExc = "Unknown error";
} else { } else {
formattedExc = exc.toString(); formattedExc = exc.toString();
@ -640,7 +640,7 @@ function processResponse( xhr ){
throw new Error( $.getString( "Errors.Security" ) ); throw new Error( $.getString( "Errors.Security" ) );
} else if ( xhr.status !== 200 && xhr.status !== 0 ) { } else if ( xhr.status !== 200 && xhr.status !== 0 ) {
status = xhr.status; status = xhr.status;
statusText = ( status == 404 ) ? statusText = ( status === 404 ) ?
"Not Found" : "Not Found" :
xhr.statusText; xhr.statusText;
throw new Error( $.getString( "Errors.Status", status, statusText ) ); throw new Error( $.getString( "Errors.Status", status, statusText ) );
@ -654,6 +654,7 @@ function processResponse( xhr ){
} catch (e){ } catch (e){
data = xhr.responseText; data = xhr.responseText;
} }
/* eslint-disable no-useless-escape */
}else if( responseText.match(/\s*[\{\[].*/) ){ }else if( responseText.match(/\s*[\{\[].*/) ){
try{ try{
data = $.parseJSON(responseText); data = $.parseJSON(responseText);
@ -690,6 +691,8 @@ $.TileSource.determineType = function( tileSource, data, url ){
} }
$.console.error( "No TileSource was able to open %s %s", url, data ); $.console.error( "No TileSource was able to open %s %s", url, data );
return null;
}; };

View File

@ -103,7 +103,7 @@ $.extend( $.TmsTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
* @param {String} optional - url * @param {String} optional - url
*/ */
supports: function( data, url ){ supports: function( data, url ){
return ( data.type && "tiledmapservice" == data.type ); return ( data.type && "tiledmapservice" === data.type );
}, },
/** /**

View File

@ -200,19 +200,19 @@ $.Viewer = function( options ) {
//Private state properties //Private state properties
THIS[ this.hash ] = { THIS[ this.hash ] = {
"fsBoundsDelta": new $.Point( 1, 1 ), fsBoundsDelta: new $.Point( 1, 1 ),
"prevContainerSize": null, prevContainerSize: null,
"animating": false, animating: false,
"forceRedraw": false, forceRedraw: false,
"mouseInside": false, mouseInside: false,
"group": null, group: null,
// whether we should be continuously zooming // whether we should be continuously zooming
"zooming": false, zooming: false,
// how much we should be continuously zooming by // how much we should be continuously zooming by
"zoomFactor": null, zoomFactor: null,
"lastZoomTime": null, lastZoomTime: null,
"fullPage": false, fullPage: false,
"onfullscreenchange": null onfullscreenchange: null
}; };
this._sequenceIndex = 0; this._sequenceIndex = 0;
@ -521,7 +521,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
this.close(); this.close();
if (!tileSources) { if (!tileSources) {
return; return this;
} }
if (this.sequenceMode && $.isArray(tileSources)) { if (this.sequenceMode && $.isArray(tileSources)) {
@ -530,7 +530,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
this.referenceStrip = null; this.referenceStrip = null;
} }
if (typeof initialPage != 'undefined' && !isNaN(initialPage)) { if (typeof initialPage !== 'undefined' && !isNaN(initialPage)) {
this.initialPage = initialPage; this.initialPage = initialPage;
} }
@ -545,7 +545,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
} }
this._updateSequenceButtons( this._sequenceIndex ); this._updateSequenceButtons( this._sequenceIndex );
return; return this;
} }
if (!$.isArray(tileSources)) { if (!$.isArray(tileSources)) {
@ -553,7 +553,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
} }
if (!tileSources.length) { if (!tileSources.length) {
return; return this;
} }
this._opening = true; this._opening = true;
@ -931,7 +931,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
i; i;
//don't bother modifying the DOM if we are already in full page mode. //don't bother modifying the DOM if we are already in full page mode.
if ( fullPage == this.isFullPage() ) { if ( fullPage === this.isFullPage() ) {
return this; return this;
} }
@ -1225,7 +1225,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
* @return {Boolean} * @return {Boolean}
*/ */
isVisible: function () { isVisible: function () {
return this.container.style.visibility != "hidden"; return this.container.style.visibility !== "hidden";
}, },
@ -1429,7 +1429,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
if (queueItem.options.replace) { if (queueItem.options.replace) {
var newIndex = _this.world.getIndexOfItem(queueItem.options.replaceItem); var newIndex = _this.world.getIndexOfItem(queueItem.options.replaceItem);
if (newIndex != -1) { if (newIndex !== -1) {
queueItem.options.index = newIndex; queueItem.options.index = newIndex;
} }
_this.world.removeItem(queueItem.options.replaceItem); _this.world.removeItem(queueItem.options.replaceItem);
@ -2283,11 +2283,12 @@ function getTileSourceImplementation( viewer, tileSource, imgOptions, successCal
var _this = viewer; var _this = viewer;
//allow plain xml strings or json strings to be parsed here //allow plain xml strings or json strings to be parsed here
if ( $.type( tileSource ) == 'string' ) { if ( $.type( tileSource ) === 'string' ) {
//xml should start with "<" and end with ">" //xml should start with "<" and end with ">"
if ( tileSource.match( /^\s*<.*>\s*$/ ) ) { if ( tileSource.match( /^\s*<.*>\s*$/ ) ) {
tileSource = $.parseXml( tileSource ); tileSource = $.parseXml( tileSource );
//json should start with "{" or "[" and end with "}" or "]" //json should start with "{" or "[" and end with "}" or "]"
/* eslint-disable no-useless-escape */
} else if ( tileSource.match(/^\s*[\{\[].*[\}\]]\s*$/ ) ) { } else if ( tileSource.match(/^\s*[\{\[].*[\}\]]\s*$/ ) ) {
try { try {
var tileSourceJ = $.parseJSON(tileSource); var tileSourceJ = $.parseJSON(tileSource);
@ -2315,7 +2316,7 @@ function getTileSourceImplementation( viewer, tileSource, imgOptions, successCal
} }
setTimeout( function() { setTimeout( function() {
if ( $.type( tileSource ) == 'string' ) { if ( $.type( tileSource ) === 'string' ) {
//If its still a string it means it must be a url at this point //If its still a string it means it must be a url at this point
tileSource = new $.TileSource({ tileSource = new $.TileSource({
url: tileSource, url: tileSource,
@ -2690,7 +2691,7 @@ function onCanvasKeyPress( event ) {
function onCanvasClick( event ) { function onCanvasClick( event ) {
var gestureSettings; var gestureSettings;
var haveKeyboardFocus = document.activeElement == this.canvas; var haveKeyboardFocus = document.activeElement === this.canvas;
// If we don't have keyboard focus, request it. // If we don't have keyboard focus, request it.
if ( !haveKeyboardFocus ) { if ( !haveKeyboardFocus ) {
@ -2834,11 +2835,11 @@ function onCanvasDrag( event ) {
this.viewport.centerSpringX.target.value -= delta.x; this.viewport.centerSpringX.target.value -= delta.x;
this.viewport.centerSpringY.target.value -= delta.y; this.viewport.centerSpringY.target.value -= delta.y;
if (bounds.x != constrainedBounds.x) { if (bounds.x !== constrainedBounds.x) {
event.delta.x = 0; event.delta.x = 0;
} }
if (bounds.y != constrainedBounds.y) { if (bounds.y !== constrainedBounds.y) {
event.delta.y = 0; event.delta.y = 0;
} }
} }
@ -2927,7 +2928,7 @@ function onCanvasEnter( event ) {
function onCanvasExit( event ) { function onCanvasExit( event ) {
if (window.location != window.parent.location){ if (window.location !== window.parent.location){
$.MouseTracker.resetAllMouseTrackers(); $.MouseTracker.resetAllMouseTrackers();
} }
@ -3193,6 +3194,8 @@ function onCanvasScroll( event ) {
return false; // We are swallowing this event return false; // We are swallowing this event
} }
} }
return true;
} }
function onContainerEnter( event ) { function onContainerEnter( event ) {

View File

@ -898,7 +898,7 @@ $.Viewport.prototype = {
* @property {Number} degrees - The number of degrees the rotation was set to. * @property {Number} degrees - The number of degrees the rotation was set to.
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */
this.viewer.raiseEvent('rotate', {"degrees": degrees}); this.viewer.raiseEvent('rotate', {degrees: degrees});
return this; return this;
}, },
@ -1567,7 +1567,7 @@ $.Viewport.prototype = {
* @property {Number} flipped - The flip state after this change. * @property {Number} flipped - The flip state after this change.
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */
this.viewer.raiseEvent('flip', {"flipped": state}); this.viewer.raiseEvent('flip', {flipped: state});
return this; return this;
} }

View File

@ -107,7 +107,7 @@
* @param {String} optional - url * @param {String} optional - url
*/ */
supports: function(data, url) { supports: function(data, url) {
return (data.type && "zoomifytileservice" == data.type); return (data.type && "zoomifytileservice" === data.type);
}, },
/** /**