mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
stricter linting
This commit is contained in:
parent
48a18a6a7d
commit
c4351f64e8
@ -1,9 +1,33 @@
|
||||
{
|
||||
"root": true,
|
||||
"extends": [
|
||||
"eslint:recommended"
|
||||
],
|
||||
"env": {
|
||||
"es6": false,
|
||||
"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": {
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"args": "none"
|
||||
}
|
||||
],
|
||||
"indent": [
|
||||
"off",
|
||||
4
|
||||
@ -16,24 +40,18 @@
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"args": "none"
|
||||
}
|
||||
],
|
||||
"block-scoped-var": [
|
||||
"error"
|
||||
],
|
||||
"consistent-return": [
|
||||
"off"
|
||||
"error"
|
||||
],
|
||||
"curly": [
|
||||
"error",
|
||||
"all"
|
||||
],
|
||||
"eqeqeq": [
|
||||
"off"
|
||||
"error"
|
||||
],
|
||||
"no-eval": [
|
||||
"error"
|
||||
@ -83,7 +101,7 @@
|
||||
"error"
|
||||
],
|
||||
"no-useless-escape": [
|
||||
"off"
|
||||
"error"
|
||||
],
|
||||
"no-useless-return": [
|
||||
"error"
|
||||
@ -103,7 +121,9 @@
|
||||
"no-use-before-define": [
|
||||
"error",
|
||||
{
|
||||
"functions": false
|
||||
"functions": false,
|
||||
"classes": true,
|
||||
"variables": true
|
||||
}
|
||||
],
|
||||
"array-bracket-spacing": [
|
||||
@ -237,7 +257,7 @@
|
||||
"after"
|
||||
],
|
||||
"quote-props": [
|
||||
"off",
|
||||
"error",
|
||||
"as-needed"
|
||||
],
|
||||
"semi-spacing": [
|
||||
@ -273,10 +293,5 @@
|
||||
"no-loop-func": [
|
||||
"error"
|
||||
]
|
||||
},
|
||||
"globals": {
|
||||
"OpenSeadragon": true,
|
||||
"define": false,
|
||||
"module": false
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
/* eslint-disable no-redeclare */
|
||||
/* global module */
|
||||
|
||||
module.exports = function(grunt) {
|
||||
/* eslint-disable no-undef */
|
||||
var dateFormat = require('dateformat');
|
||||
|
||||
// ----------
|
||||
@ -123,6 +125,7 @@ module.exports = function(grunt) {
|
||||
banner: banner,
|
||||
compress: {
|
||||
sequences: false,
|
||||
/* eslint-disable camelcase */
|
||||
join_vars: false
|
||||
},
|
||||
sourceMap: true,
|
||||
|
6400
package-lock.json
generated
6400
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@
|
||||
"url": "https://github.com/openseadragon/openseadragon.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^1.0.4",
|
||||
"grunt": "^1.1.0",
|
||||
"grunt-contrib-clean": "^2.0.0",
|
||||
"grunt-contrib-compress": "^1.6.0",
|
||||
"grunt-contrib-concat": "^1.0.1",
|
||||
@ -36,7 +36,7 @@
|
||||
"grunt-contrib-qunit": "^3.1.0",
|
||||
"grunt-contrib-uglify": "^4.0.1",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-eslint": "^22.0.0",
|
||||
"grunt-eslint": "^23.0.0",
|
||||
"grunt-git-describe": "^2.4.4",
|
||||
"grunt-istanbul": "^0.8.0",
|
||||
"grunt-text-replace": "^0.4.0",
|
||||
|
@ -158,7 +158,7 @@ $.Button = function( options ) {
|
||||
this.imgDown.style.visibility =
|
||||
"hidden";
|
||||
|
||||
if ($.Browser.vendor == $.BROWSERS.FIREFOX && $.Browser.version < 3) {
|
||||
if ($.Browser.vendor === $.BROWSERS.FIREFOX && $.Browser.version < 3) {
|
||||
this.imgGroup.style.top =
|
||||
this.imgHover.style.top =
|
||||
this.imgDown.style.top =
|
||||
@ -465,13 +465,13 @@ function inTo( button, newState ) {
|
||||
}
|
||||
|
||||
if ( newState >= $.ButtonState.GROUP &&
|
||||
button.currentState == $.ButtonState.REST ) {
|
||||
button.currentState === $.ButtonState.REST ) {
|
||||
stopFading( button );
|
||||
button.currentState = $.ButtonState.GROUP;
|
||||
}
|
||||
|
||||
if ( newState >= $.ButtonState.HOVER &&
|
||||
button.currentState == $.ButtonState.GROUP ) {
|
||||
button.currentState === $.ButtonState.GROUP ) {
|
||||
if( button.imgHover ){
|
||||
button.imgHover.style.visibility = "";
|
||||
}
|
||||
@ -479,7 +479,7 @@ function inTo( button, newState ) {
|
||||
}
|
||||
|
||||
if ( newState >= $.ButtonState.DOWN &&
|
||||
button.currentState == $.ButtonState.HOVER ) {
|
||||
button.currentState === $.ButtonState.HOVER ) {
|
||||
if( button.imgDown ){
|
||||
button.imgDown.style.visibility = "";
|
||||
}
|
||||
@ -495,7 +495,7 @@ function outTo( button, newState ) {
|
||||
}
|
||||
|
||||
if ( newState <= $.ButtonState.HOVER &&
|
||||
button.currentState == $.ButtonState.DOWN ) {
|
||||
button.currentState === $.ButtonState.DOWN ) {
|
||||
if( button.imgDown ){
|
||||
button.imgDown.style.visibility = "hidden";
|
||||
}
|
||||
@ -503,7 +503,7 @@ function outTo( button, newState ) {
|
||||
}
|
||||
|
||||
if ( newState <= $.ButtonState.GROUP &&
|
||||
button.currentState == $.ButtonState.HOVER ) {
|
||||
button.currentState === $.ButtonState.HOVER ) {
|
||||
if( button.imgHover ){
|
||||
button.imgHover.style.visibility = "hidden";
|
||||
}
|
||||
@ -511,7 +511,7 @@ function outTo( button, newState ) {
|
||||
}
|
||||
|
||||
if ( newState <= $.ButtonState.REST &&
|
||||
button.currentState == $.ButtonState.GROUP ) {
|
||||
button.currentState === $.ButtonState.GROUP ) {
|
||||
beginFading( button );
|
||||
button.currentState = $.ButtonState.REST;
|
||||
}
|
||||
|
@ -112,13 +112,13 @@ $.Control = function ( element, options, container ) {
|
||||
* @member {Element} wrapper
|
||||
* @memberof OpenSeadragon.Control#
|
||||
*/
|
||||
if ( this.anchor == $.ControlAnchor.ABSOLUTE ) {
|
||||
if ( this.anchor === $.ControlAnchor.ABSOLUTE ) {
|
||||
this.wrapper = $.makeNeutralElement( "div" );
|
||||
this.wrapper.style.position = "absolute";
|
||||
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.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.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.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.margin = "0px";
|
||||
this.wrapper.style.padding = "0px";
|
||||
|
||||
@ -130,7 +130,7 @@ $.Control = function ( element, options, container ) {
|
||||
} else {
|
||||
this.wrapper = $.makeNeutralElement( "div" );
|
||||
this.wrapper.style.display = "inline-block";
|
||||
if ( this.anchor == $.ControlAnchor.NONE ) {
|
||||
if ( this.anchor === $.ControlAnchor.NONE ) {
|
||||
// IE6 fix
|
||||
this.wrapper.style.width = this.wrapper.style.height = "100%";
|
||||
}
|
||||
@ -138,8 +138,8 @@ $.Control = function ( element, options, container ) {
|
||||
this.wrapper.appendChild( this.element );
|
||||
|
||||
if (options.attachToViewer ) {
|
||||
if ( this.anchor == $.ControlAnchor.TOP_RIGHT ||
|
||||
this.anchor == $.ControlAnchor.BOTTOM_RIGHT ) {
|
||||
if ( this.anchor === $.ControlAnchor.TOP_RIGHT ||
|
||||
this.anchor === $.ControlAnchor.BOTTOM_RIGHT ) {
|
||||
this.container.insertBefore(
|
||||
this.wrapper,
|
||||
this.container.firstChild
|
||||
@ -170,7 +170,7 @@ $.Control.prototype = {
|
||||
* @return {Boolean} true if currently visible, false otherwise.
|
||||
*/
|
||||
isVisible: function() {
|
||||
return this.wrapper.style.display != "none";
|
||||
return this.wrapper.style.display !== "none";
|
||||
},
|
||||
|
||||
/**
|
||||
@ -180,7 +180,7 @@ $.Control.prototype = {
|
||||
*/
|
||||
setVisible: function( visible ) {
|
||||
this.wrapper.style.display = visible ?
|
||||
( this.anchor == $.ControlAnchor.ABSOLUTE ? 'block' : 'inline-block' ) :
|
||||
( this.anchor === $.ControlAnchor.ABSOLUTE ? 'block' : 'inline-block' ) :
|
||||
"none";
|
||||
},
|
||||
|
||||
@ -190,7 +190,7 @@ $.Control.prototype = {
|
||||
* @param {Number} opactiy - a value between 1 and 0 inclusively.
|
||||
*/
|
||||
setOpacity: function( opacity ) {
|
||||
if ( this.element[ $.SIGNAL ] && $.Browser.vendor == $.BROWSERS.IE ) {
|
||||
if ( this.element[ $.SIGNAL ] && $.Browser.vendor === $.BROWSERS.IE ) {
|
||||
$.setElementOpacity( this.element, opacity, true );
|
||||
} else {
|
||||
$.setElementOpacity( this.wrapper, opacity, true );
|
||||
|
@ -218,7 +218,7 @@
|
||||
i;
|
||||
|
||||
for ( i = controls.length - 1; i >= 0; i-- ) {
|
||||
if ( controls[ i ].element == element ) {
|
||||
if ( controls[ i ].element === element ) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -284,8 +284,8 @@ $.Drawer.prototype = {
|
||||
this.canvas.innerHTML = "";
|
||||
if ( this.useCanvas ) {
|
||||
var viewportSize = this._calculateCanvasSize();
|
||||
if( this.canvas.width != viewportSize.x ||
|
||||
this.canvas.height != viewportSize.y ) {
|
||||
if( this.canvas.width !== viewportSize.x ||
|
||||
this.canvas.height !== viewportSize.y ) {
|
||||
this.canvas.width = viewportSize.x;
|
||||
this.canvas.height = viewportSize.y;
|
||||
this._updateImageSmoothingEnabled(this.context);
|
||||
|
@ -108,7 +108,7 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
|
||||
if ( data.Image ) {
|
||||
ns = data.Image.xmlns;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@ -142,9 +142,9 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
|
||||
|
||||
if (url && !options.tilesUrl) {
|
||||
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(/\?.*/);
|
||||
}else{
|
||||
options.queryParams = '';
|
||||
@ -240,7 +240,7 @@ function configureFromXML( tileSource, xmlDoc ){
|
||||
sizeNode,
|
||||
i;
|
||||
|
||||
if ( rootName == "Image" ) {
|
||||
if ( rootName === "Image" ) {
|
||||
|
||||
try {
|
||||
sizeNode = root.getElementsByTagName("Size" )[ 0 ];
|
||||
@ -304,9 +304,9 @@ function configureFromXML( tileSource, xmlDoc ){
|
||||
e :
|
||||
new Error( $.getString("Errors.Dzi") );
|
||||
}
|
||||
} else if ( rootName == "Collection" ) {
|
||||
} else if ( rootName === "Collection" ) {
|
||||
throw new Error( $.getString( "Errors.Dzc" ) );
|
||||
} else if ( rootName == "Error" ) {
|
||||
} else if ( rootName === "Error" ) {
|
||||
var messageNode = root.getElementsByTagName("Message")[0];
|
||||
var message = messageNode.firstChild.nodeValue;
|
||||
throw new Error(message);
|
||||
|
@ -71,7 +71,7 @@ $.IIIFTileSource = function( options ){
|
||||
options.tileSize = this.tile_height;
|
||||
} else if ( this.tiles ) {
|
||||
// Version 2.0 forwards
|
||||
if ( this.tiles.length == 1 ) {
|
||||
if ( this.tiles.length === 1 ) {
|
||||
options.tileWidth = this.tiles[0].width;
|
||||
// Use height if provided, otherwise assume square tiles and use 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 ) {
|
||||
// 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;
|
||||
// Version 1.1
|
||||
} else if ( data['@context'] && (
|
||||
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://library.stanford.edu/iiif/image-api/1.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
|
||||
return true;
|
||||
|
||||
@ -168,8 +168,8 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
|
||||
} else if ( data.identifier && data.width && data.height ) {
|
||||
return true;
|
||||
} else if ( data.documentElement &&
|
||||
"info" == data.documentElement.tagName &&
|
||||
"http://library.stanford.edu/iiif/image-api/ns/" ==
|
||||
"info" === data.documentElement.tagName &&
|
||||
"http://library.stanford.edu/iiif/image-api/ns/" ===
|
||||
data.documentElement.namespaceURI) {
|
||||
return true;
|
||||
|
||||
@ -500,7 +500,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
|
||||
rootName = root.tagName,
|
||||
configuration = null;
|
||||
|
||||
if ( rootName == "info" ) {
|
||||
if ( rootName === "info" ) {
|
||||
try {
|
||||
configuration = {};
|
||||
parseXML10( root, configuration );
|
||||
@ -518,7 +518,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
|
||||
function parseXML10( node, configuration, property ) {
|
||||
var i,
|
||||
value;
|
||||
if ( node.nodeType == 3 && property ) {//text node
|
||||
if ( node.nodeType === 3 && property ) {//text node
|
||||
value = node.nodeValue.trim();
|
||||
if( value.match(/^\d*$/)){
|
||||
value = Number( value );
|
||||
@ -531,7 +531,7 @@ $.extend( $.IIIFTileSource.prototype, $.TileSource.prototype, /** @lends OpenSea
|
||||
}
|
||||
configuration[ property ].push( value );
|
||||
}
|
||||
} else if( node.nodeType == 1 ){
|
||||
} else if( node.nodeType === 1 ){
|
||||
for( i = 0; i < node.childNodes.length; i++ ){
|
||||
parseXML10( node.childNodes[ i ], configuration, node.nodeName );
|
||||
}
|
||||
|
@ -109,10 +109,10 @@ $.extend( $.LegacyTileSource.prototype, $.TileSource.prototype, /** @lends OpenS
|
||||
supports: function( data, url ){
|
||||
return (
|
||||
data.type &&
|
||||
"legacy-image-pyramid" == data.type
|
||||
"legacy-image-pyramid" === data.type
|
||||
) || (
|
||||
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,
|
||||
i;
|
||||
|
||||
if ( rootName == "image" ) {
|
||||
if ( rootName === "image" ) {
|
||||
|
||||
try {
|
||||
conf = {
|
||||
@ -267,9 +267,9 @@ function configureFromXML( tileSource, xmlDoc ){
|
||||
e :
|
||||
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.' );
|
||||
} else if ( rootName == "error" ) {
|
||||
} else if ( rootName === "error" ) {
|
||||
throw new Error( 'Error: ' + xmlDoc );
|
||||
}
|
||||
|
||||
|
@ -997,7 +997,7 @@
|
||||
/**
|
||||
* 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'
|
||||
document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least 'mousewheel'
|
||||
'DOMMouseScroll'; // Assume old Firefox
|
||||
@ -1015,7 +1015,7 @@
|
||||
*/
|
||||
$.MouseTracker.subscribeEvents = [ "click", "dblclick", "keydown", "keyup", "keypress", "focus", "blur", $.MouseTracker.wheelEventName ];
|
||||
|
||||
if( $.MouseTracker.wheelEventName == "DOMMouseScroll" ) {
|
||||
if( $.MouseTracker.wheelEventName === "DOMMouseScroll" ) {
|
||||
// Older Firefox
|
||||
$.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" );
|
||||
}
|
||||
@ -1760,13 +1760,13 @@
|
||||
clientY: event.clientY,
|
||||
pageX: event.pageX ? event.pageX : event.clientX,
|
||||
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,
|
||||
deltaZ: 0
|
||||
};
|
||||
|
||||
// Calculate deltaY
|
||||
if ( $.MouseTracker.wheelEventName == "mousewheel" ) {
|
||||
if ( $.MouseTracker.wheelEventName === "mousewheel" ) {
|
||||
simulatedEvent.deltaY = -event.wheelDelta / $.DEFAULT_SETTINGS.pixelsPerWheelLine;
|
||||
} else {
|
||||
simulatedEvent.deltaY = event.detail;
|
||||
@ -3284,7 +3284,7 @@
|
||||
// Pinch
|
||||
if ( tracker.pinchHandler && gPoints[ 0 ].type === 'touch' ) {
|
||||
delta = delegate.pinchGPoints[ 0 ].currentPos.distanceTo( delegate.pinchGPoints[ 1 ].currentPos );
|
||||
if ( delta != delegate.currentPinchDist ) {
|
||||
if ( delta !== delegate.currentPinchDist ) {
|
||||
delegate.lastPinchDist = delegate.currentPinchDist;
|
||||
delegate.currentPinchDist = delta;
|
||||
delegate.lastPinchCenter = delegate.currentPinchCenter;
|
||||
|
@ -66,15 +66,15 @@ $.Navigator = function( options ){
|
||||
};
|
||||
|
||||
if( options.position ){
|
||||
if( 'BOTTOM_RIGHT' == options.position ){
|
||||
if( 'BOTTOM_RIGHT' === options.position ){
|
||||
options.controlOptions.anchor = $.ControlAnchor.BOTTOM_RIGHT;
|
||||
} else if( 'BOTTOM_LEFT' == options.position ){
|
||||
} else if( 'BOTTOM_LEFT' === options.position ){
|
||||
options.controlOptions.anchor = $.ControlAnchor.BOTTOM_LEFT;
|
||||
} else if( 'TOP_RIGHT' == options.position ){
|
||||
} else if( 'TOP_RIGHT' === options.position ){
|
||||
options.controlOptions.anchor = $.ControlAnchor.TOP_RIGHT;
|
||||
} else if( 'TOP_LEFT' == options.position ){
|
||||
} else if( 'TOP_LEFT' === options.position ){
|
||||
options.controlOptions.anchor = $.ControlAnchor.TOP_LEFT;
|
||||
} else if( 'ABSOLUTE' == options.position ){
|
||||
} else if( 'ABSOLUTE' === options.position ){
|
||||
options.controlOptions.anchor = $.ControlAnchor.ABSOLUTE;
|
||||
options.controlOptions.top = options.top;
|
||||
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);
|
||||
|
||||
|
||||
if ( options.controlOptions.anchor != $.ControlAnchor.NONE ) {
|
||||
if ( options.controlOptions.anchor !== $.ControlAnchor.NONE ) {
|
||||
(function( style, borderWidth ){
|
||||
style.margin = '0px';
|
||||
style.border = borderWidth + 'px solid ' + options.borderColor;
|
||||
@ -179,8 +179,8 @@ $.Navigator = function( options ){
|
||||
options.controlOptions
|
||||
);
|
||||
|
||||
this._resizeWithViewer = options.controlOptions.anchor != $.ControlAnchor.ABSOLUTE &&
|
||||
options.controlOptions.anchor != $.ControlAnchor.NONE;
|
||||
this._resizeWithViewer = options.controlOptions.anchor !== $.ControlAnchor.ABSOLUTE &&
|
||||
options.controlOptions.anchor !== $.ControlAnchor.NONE;
|
||||
|
||||
if (options.width && options.height) {
|
||||
this.setWidth(options.width);
|
||||
@ -282,7 +282,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
||||
*/
|
||||
setWidth: function(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;
|
||||
},
|
||||
|
||||
@ -292,7 +292,7 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
||||
*/
|
||||
setHeight: function(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;
|
||||
},
|
||||
|
||||
|
@ -1333,7 +1333,7 @@ function OpenSeadragon( options ){
|
||||
* @returns {Element} The element with the given id, null, or the element itself.
|
||||
*/
|
||||
getElement: function( element ) {
|
||||
if ( typeof ( element ) == "string" ) {
|
||||
if ( typeof ( element ) === "string" ) {
|
||||
element = document.getElementById( element );
|
||||
}
|
||||
return element;
|
||||
@ -1352,7 +1352,7 @@ function OpenSeadragon( options ){
|
||||
offsetParent;
|
||||
|
||||
element = $.getElement( element );
|
||||
isFixed = $.getElementStyle( element ).position == "fixed";
|
||||
isFixed = $.getElementStyle( element ).position === "fixed";
|
||||
offsetParent = getOffsetParent( element, isFixed );
|
||||
|
||||
while ( offsetParent ) {
|
||||
@ -1365,7 +1365,7 @@ function OpenSeadragon( options ){
|
||||
}
|
||||
|
||||
element = offsetParent;
|
||||
isFixed = $.getElementStyle( element ).position == "fixed";
|
||||
isFixed = $.getElementStyle( element ).position === "fixed";
|
||||
offsetParent = getOffsetParent( element, isFixed );
|
||||
}
|
||||
|
||||
@ -1397,7 +1397,7 @@ function OpenSeadragon( options ){
|
||||
boundingRect = element.getBoundingClientRect();
|
||||
}
|
||||
|
||||
win = ( doc == doc.window ) ?
|
||||
win = ( doc === doc.window ) ?
|
||||
doc :
|
||||
( doc.nodeType === 9 ) ?
|
||||
doc.defaultView || doc.parentWindow :
|
||||
@ -1548,7 +1548,7 @@ function OpenSeadragon( options ){
|
||||
*/
|
||||
getMousePosition: function( event ) {
|
||||
|
||||
if ( typeof ( event.pageX ) == "number" ) {
|
||||
if ( typeof ( event.pageX ) === "number" ) {
|
||||
$.getMousePosition = function( event ){
|
||||
var result = new $.Point();
|
||||
|
||||
@ -1558,7 +1558,7 @@ function OpenSeadragon( options ){
|
||||
|
||||
return result;
|
||||
};
|
||||
} else if ( typeof ( event.clientX ) == "number" ) {
|
||||
} else if ( typeof ( event.clientX ) === "number" ) {
|
||||
$.getMousePosition = function( event ){
|
||||
var result = new $.Point();
|
||||
|
||||
@ -1593,7 +1593,7 @@ function OpenSeadragon( options ){
|
||||
var docElement = document.documentElement || {},
|
||||
body = document.body || {};
|
||||
|
||||
if ( typeof ( window.pageXOffset ) == "number" ) {
|
||||
if ( typeof ( window.pageXOffset ) === "number" ) {
|
||||
$.getPageScroll = function(){
|
||||
return new $.Point(
|
||||
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 || {},
|
||||
body = document.body || {};
|
||||
|
||||
if ( typeof ( window.innerWidth ) == 'number' ) {
|
||||
if ( typeof ( window.innerWidth ) === 'number' ) {
|
||||
$.getWindowSize = function(){
|
||||
return new $.Point(
|
||||
window.innerWidth,
|
||||
@ -1814,7 +1814,7 @@ function OpenSeadragon( options ){
|
||||
return img;
|
||||
};
|
||||
|
||||
if ( $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 7 ) {
|
||||
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 7 ) {
|
||||
|
||||
$.makeTransparentImage = function( src ){
|
||||
var img = $.makeNeutralElement( "img" ),
|
||||
@ -2227,7 +2227,7 @@ function OpenSeadragon( options ){
|
||||
|
||||
request.onreadystatechange = function() {
|
||||
// 4 = DONE (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties)
|
||||
if ( request.readyState == 4 ) {
|
||||
if ( request.readyState === 4 ) {
|
||||
request.onreadystatechange = function(){};
|
||||
|
||||
// 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
|
||||
error messages are localized.
|
||||
*/
|
||||
var oldIE = $.Browser.vendor == $.BROWSERS.IE && $.Browser.version < 10;
|
||||
if ( oldIE && typeof ( e.number ) != "undefined" && e.number == -2147024891 ) {
|
||||
var oldIE = $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 10;
|
||||
if ( oldIE && typeof ( e.number ) !== "undefined" && e.number === -2147024891 ) {
|
||||
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',
|
||||
callback = options.callback;
|
||||
|
||||
url = url.replace( /(\=)\?(&|$)|\?\?/i, replace );
|
||||
url = url.replace( /(=)\?(&|$)|\?\?/i, replace );
|
||||
// Add callback manually
|
||||
url += (/\?/.test( url ) ? "&" : "?") + callbackParam + "=" + jsonpCallback;
|
||||
|
||||
@ -2534,12 +2534,12 @@ function OpenSeadragon( options ){
|
||||
|
||||
|
||||
var FILEFORMATS = {
|
||||
"bmp": false,
|
||||
"jpeg": true,
|
||||
"jpg": true,
|
||||
"png": true,
|
||||
"tif": false,
|
||||
"wdp": false
|
||||
bmp: false,
|
||||
jpeg: true,
|
||||
jpg: true,
|
||||
png: true,
|
||||
tif: false,
|
||||
wdp: false
|
||||
},
|
||||
URLPARAMS = {};
|
||||
|
||||
@ -2624,17 +2624,17 @@ function OpenSeadragon( options ){
|
||||
//determine if this browser supports image alpha transparency
|
||||
$.Browser.alpha = !(
|
||||
(
|
||||
$.Browser.vendor == $.BROWSERS.IE &&
|
||||
$.Browser.vendor === $.BROWSERS.IE &&
|
||||
$.Browser.version < 9
|
||||
) || (
|
||||
$.Browser.vendor == $.BROWSERS.CHROME &&
|
||||
$.Browser.vendor === $.BROWSERS.CHROME &&
|
||||
$.Browser.version < 2
|
||||
)
|
||||
);
|
||||
|
||||
//determine if this browser supports element.style.opacity
|
||||
$.Browser.opacity = !(
|
||||
$.Browser.vendor == $.BROWSERS.IE &&
|
||||
$.Browser.vendor === $.BROWSERS.IE &&
|
||||
$.Browser.version < 9
|
||||
);
|
||||
|
||||
@ -2736,7 +2736,7 @@ function OpenSeadragon( options ){
|
||||
* @returns {Element}
|
||||
*/
|
||||
function getOffsetParent( element, isFixed ) {
|
||||
if ( isFixed && element != document.body ) {
|
||||
if ( isFixed && element !== document.body ) {
|
||||
return document.body;
|
||||
} else {
|
||||
return element.offsetParent;
|
||||
|
@ -113,7 +113,7 @@ $.extend( $.OsmTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
|
||||
supports: function( data, url ){
|
||||
return (
|
||||
data.type &&
|
||||
"openstreetmaps" == data.type
|
||||
"openstreetmaps" === data.type
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -50,13 +50,13 @@ $.Point = function( x, y ) {
|
||||
* @member {Number} x
|
||||
* @memberof OpenSeadragon.Point#
|
||||
*/
|
||||
this.x = typeof ( x ) == "number" ? x : 0;
|
||||
this.x = typeof ( x ) === "number" ? x : 0;
|
||||
/**
|
||||
* The vector component 'y'.
|
||||
* @member {Number} y
|
||||
* @memberof OpenSeadragon.Point#
|
||||
*/
|
||||
this.y = typeof ( y ) == "number" ? y : 0;
|
||||
this.y = typeof ( y ) === "number" ? y : 0;
|
||||
};
|
||||
|
||||
/** @lends OpenSeadragon.Point.prototype */
|
||||
|
@ -98,7 +98,7 @@ $.ReferenceStrip = function ( options ) {
|
||||
$.extend( this, options );
|
||||
//Private state properties
|
||||
THIS[this.id] = {
|
||||
"animating": false
|
||||
animating: false
|
||||
};
|
||||
|
||||
this.minPixelRatio = this.viewer.minPixelRatio;
|
||||
@ -139,7 +139,7 @@ $.ReferenceStrip = function ( options ) {
|
||||
{ anchor: $.ControlAnchor.BOTTOM_LEFT }
|
||||
);
|
||||
} else {
|
||||
if ( "horizontal" == options.scroll ) {
|
||||
if ( "horizontal" === options.scroll ) {
|
||||
this.element.style.width = (
|
||||
viewerSize.x *
|
||||
options.sizeRatio *
|
||||
@ -225,7 +225,7 @@ $.ReferenceStrip = function ( options ) {
|
||||
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 );
|
||||
|
||||
};
|
||||
@ -251,7 +251,7 @@ $.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototyp
|
||||
this.currentSelected = element;
|
||||
this.currentSelected.style.background = '#999';
|
||||
|
||||
if ( 'horizontal' == this.scroll ) {
|
||||
if ( 'horizontal' === this.scroll ) {
|
||||
//right left
|
||||
offset = ( Number( page ) ) * ( this.panelWidth + 3 );
|
||||
if ( offset > offsetLeft + viewerSize.x - this.panelWidth ) {
|
||||
@ -324,7 +324,7 @@ function onStripDrag( event ) {
|
||||
viewerSize = $.getElementSize( this.viewer.canvas );
|
||||
this.dragging = true;
|
||||
if ( this.element ) {
|
||||
if ( 'horizontal' == this.scroll ) {
|
||||
if ( 'horizontal' === this.scroll ) {
|
||||
if ( -event.delta.x > 0 ) {
|
||||
//forward
|
||||
if ( offsetLeft > -( scrollWidth - viewerSize.x ) ) {
|
||||
@ -372,7 +372,7 @@ function onStripScroll( event ) {
|
||||
scrollHeight = Number( this.element.style.height.replace( 'px', '' ) ),
|
||||
viewerSize = $.getElementSize( this.viewer.canvas );
|
||||
if ( this.element ) {
|
||||
if ( 'horizontal' == this.scroll ) {
|
||||
if ( 'horizontal' === this.scroll ) {
|
||||
if ( event.scroll > 0 ) {
|
||||
//forward
|
||||
if ( offsetLeft > -( scrollWidth - viewerSize.x ) ) {
|
||||
@ -415,7 +415,7 @@ function loadPanels( strip, viewerSize, scroll ) {
|
||||
style,
|
||||
i,
|
||||
element;
|
||||
if ( 'horizontal' == strip.scroll ) {
|
||||
if ( 'horizontal' === strip.scroll ) {
|
||||
panelSize = strip.panelWidth;
|
||||
} else {
|
||||
panelSize = strip.panelHeight;
|
||||
@ -504,7 +504,7 @@ function onStripEnter( event ) {
|
||||
//element.style.border = '1px solid #555';
|
||||
//element.style.background = '#000';
|
||||
|
||||
if ( 'horizontal' == this.scroll ) {
|
||||
if ( 'horizontal' === this.scroll ) {
|
||||
|
||||
//element.style.paddingTop = "0px";
|
||||
element.style.marginBottom = "0px";
|
||||
@ -527,7 +527,7 @@ function onStripEnter( event ) {
|
||||
function onStripExit( event ) {
|
||||
var element = event.eventSource.element;
|
||||
|
||||
if ( 'horizontal' == this.scroll ) {
|
||||
if ( 'horizontal' === this.scroll ) {
|
||||
|
||||
//element.style.paddingTop = "10px";
|
||||
element.style.marginBottom = "-" + ( $.getElementSize( element ).y / 2 ) + "px";
|
||||
|
@ -50,11 +50,11 @@
|
||||
$.Spring = function( options ) {
|
||||
var args = arguments;
|
||||
|
||||
if( typeof ( options ) != 'object' ){
|
||||
if( typeof ( options ) !== 'object' ){
|
||||
//allows backward compatible use of ( initialValue, config ) as
|
||||
//constructor parameters
|
||||
options = {
|
||||
initial: args.length && typeof ( args[ 0 ] ) == "number" ?
|
||||
initial: args.length && typeof ( args[ 0 ] ) === "number" ?
|
||||
args[ 0 ] :
|
||||
undefined,
|
||||
/**
|
||||
@ -96,7 +96,7 @@ $.Spring = function( options ) {
|
||||
* @property {Number} time
|
||||
*/
|
||||
this.current = {
|
||||
value: typeof ( this.initial ) == "number" ?
|
||||
value: typeof ( this.initial ) === "number" ?
|
||||
this.initial :
|
||||
(this._exponential ? 0 : 1),
|
||||
time: $.now() // always work in milliseconds
|
||||
@ -237,7 +237,7 @@ $.Spring.prototype = {
|
||||
this.current.value = currentValue;
|
||||
}
|
||||
|
||||
return oldValue != this.current.value;
|
||||
return oldValue !== this.current.value;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -82,7 +82,7 @@ $.extend( $, /** @lends OpenSeadragon */{
|
||||
}
|
||||
string = container[ props[ i ] ];
|
||||
|
||||
if ( typeof ( string ) != "string" ) {
|
||||
if ( typeof ( string ) !== "string" ) {
|
||||
$.console.log( "Untranslated source string:", prop );
|
||||
string = ""; // FIXME: this breaks gettext()-style convention, which would return source
|
||||
}
|
||||
|
@ -284,10 +284,10 @@ $.Tile.prototype = {
|
||||
this.style = this.element.style;
|
||||
this.style.position = "absolute";
|
||||
}
|
||||
if ( this.element.parentNode != container ) {
|
||||
if ( this.element.parentNode !== container ) {
|
||||
container.appendChild( this.element );
|
||||
}
|
||||
if ( this.imgElement.parentNode != this.element ) {
|
||||
if ( this.imgElement.parentNode !== this.element ) {
|
||||
this.element.appendChild( this.imgElement );
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ $.TileCache.prototype = {
|
||||
worstLevel = worstTile.level;
|
||||
|
||||
if ( prevTime < worstTime ||
|
||||
( prevTime == worstTime && prevLevel > worstLevel ) ) {
|
||||
( prevTime === worstTime && prevLevel > worstLevel ) ) {
|
||||
worstTile = prevTile;
|
||||
worstTileIndex = i;
|
||||
worstTileRecord = prevTileRecord;
|
||||
|
@ -1874,7 +1874,7 @@ function compareTiles( previousBest, tile ) {
|
||||
|
||||
if ( tile.visibility > previousBest.visibility ) {
|
||||
return tile;
|
||||
} else if ( tile.visibility == previousBest.visibility ) {
|
||||
} else if ( tile.visibility === previousBest.visibility ) {
|
||||
if ( tile.squaredDistance < previousBest.squaredDistance ) {
|
||||
return tile;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
|
||||
* @memberof OpenSeadragon.TileSource#
|
||||
*/
|
||||
|
||||
if( 'string' == $.type( arguments[ 0 ] ) ){
|
||||
if( 'string' === $.type( arguments[ 0 ] ) ){
|
||||
this.url = arguments[0];
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ $.TileSource.prototype = {
|
||||
msg = "HTTP " + xhr.status + " attempting to load TileSource";
|
||||
} catch ( e ) {
|
||||
var formattedExc;
|
||||
if ( typeof ( exc ) == "undefined" || !exc.toString ) {
|
||||
if ( typeof ( exc ) === "undefined" || !exc.toString ) {
|
||||
formattedExc = "Unknown error";
|
||||
} else {
|
||||
formattedExc = exc.toString();
|
||||
@ -640,7 +640,7 @@ function processResponse( xhr ){
|
||||
throw new Error( $.getString( "Errors.Security" ) );
|
||||
} else if ( xhr.status !== 200 && xhr.status !== 0 ) {
|
||||
status = xhr.status;
|
||||
statusText = ( status == 404 ) ?
|
||||
statusText = ( status === 404 ) ?
|
||||
"Not Found" :
|
||||
xhr.statusText;
|
||||
throw new Error( $.getString( "Errors.Status", status, statusText ) );
|
||||
@ -654,6 +654,7 @@ function processResponse( xhr ){
|
||||
} catch (e){
|
||||
data = xhr.responseText;
|
||||
}
|
||||
/* eslint-disable no-useless-escape */
|
||||
}else if( responseText.match(/\s*[\{\[].*/) ){
|
||||
try{
|
||||
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 );
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@ $.extend( $.TmsTileSource.prototype, $.TileSource.prototype, /** @lends OpenSead
|
||||
* @param {String} optional - url
|
||||
*/
|
||||
supports: function( data, url ){
|
||||
return ( data.type && "tiledmapservice" == data.type );
|
||||
return ( data.type && "tiledmapservice" === data.type );
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -200,19 +200,19 @@ $.Viewer = function( options ) {
|
||||
|
||||
//Private state properties
|
||||
THIS[ this.hash ] = {
|
||||
"fsBoundsDelta": new $.Point( 1, 1 ),
|
||||
"prevContainerSize": null,
|
||||
"animating": false,
|
||||
"forceRedraw": false,
|
||||
"mouseInside": false,
|
||||
"group": null,
|
||||
fsBoundsDelta: new $.Point( 1, 1 ),
|
||||
prevContainerSize: null,
|
||||
animating: false,
|
||||
forceRedraw: false,
|
||||
mouseInside: false,
|
||||
group: null,
|
||||
// whether we should be continuously zooming
|
||||
"zooming": false,
|
||||
zooming: false,
|
||||
// how much we should be continuously zooming by
|
||||
"zoomFactor": null,
|
||||
"lastZoomTime": null,
|
||||
"fullPage": false,
|
||||
"onfullscreenchange": null
|
||||
zoomFactor: null,
|
||||
lastZoomTime: null,
|
||||
fullPage: false,
|
||||
onfullscreenchange: null
|
||||
};
|
||||
|
||||
this._sequenceIndex = 0;
|
||||
@ -521,7 +521,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
this.close();
|
||||
|
||||
if (!tileSources) {
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.sequenceMode && $.isArray(tileSources)) {
|
||||
@ -530,7 +530,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
this.referenceStrip = null;
|
||||
}
|
||||
|
||||
if (typeof initialPage != 'undefined' && !isNaN(initialPage)) {
|
||||
if (typeof initialPage !== 'undefined' && !isNaN(initialPage)) {
|
||||
this.initialPage = initialPage;
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
}
|
||||
|
||||
this._updateSequenceButtons( this._sequenceIndex );
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
if (!$.isArray(tileSources)) {
|
||||
@ -553,7 +553,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
}
|
||||
|
||||
if (!tileSources.length) {
|
||||
return;
|
||||
return this;
|
||||
}
|
||||
|
||||
this._opening = true;
|
||||
@ -931,7 +931,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
i;
|
||||
|
||||
//don't bother modifying the DOM if we are already in full page mode.
|
||||
if ( fullPage == this.isFullPage() ) {
|
||||
if ( fullPage === this.isFullPage() ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -1225,7 +1225,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
* @return {Boolean}
|
||||
*/
|
||||
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) {
|
||||
var newIndex = _this.world.getIndexOfItem(queueItem.options.replaceItem);
|
||||
if (newIndex != -1) {
|
||||
if (newIndex !== -1) {
|
||||
queueItem.options.index = newIndex;
|
||||
}
|
||||
_this.world.removeItem(queueItem.options.replaceItem);
|
||||
@ -2283,11 +2283,12 @@ function getTileSourceImplementation( viewer, tileSource, imgOptions, successCal
|
||||
var _this = viewer;
|
||||
|
||||
//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 ">"
|
||||
if ( tileSource.match( /^\s*<.*>\s*$/ ) ) {
|
||||
tileSource = $.parseXml( tileSource );
|
||||
//json should start with "{" or "[" and end with "}" or "]"
|
||||
/* eslint-disable no-useless-escape */
|
||||
} else if ( tileSource.match(/^\s*[\{\[].*[\}\]]\s*$/ ) ) {
|
||||
try {
|
||||
var tileSourceJ = $.parseJSON(tileSource);
|
||||
@ -2315,7 +2316,7 @@ function getTileSourceImplementation( viewer, tileSource, imgOptions, successCal
|
||||
}
|
||||
|
||||
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
|
||||
tileSource = new $.TileSource({
|
||||
url: tileSource,
|
||||
@ -2690,7 +2691,7 @@ function onCanvasKeyPress( event ) {
|
||||
function onCanvasClick( event ) {
|
||||
var gestureSettings;
|
||||
|
||||
var haveKeyboardFocus = document.activeElement == this.canvas;
|
||||
var haveKeyboardFocus = document.activeElement === this.canvas;
|
||||
|
||||
// If we don't have keyboard focus, request it.
|
||||
if ( !haveKeyboardFocus ) {
|
||||
@ -2834,11 +2835,11 @@ function onCanvasDrag( event ) {
|
||||
this.viewport.centerSpringX.target.value -= delta.x;
|
||||
this.viewport.centerSpringY.target.value -= delta.y;
|
||||
|
||||
if (bounds.x != constrainedBounds.x) {
|
||||
if (bounds.x !== constrainedBounds.x) {
|
||||
event.delta.x = 0;
|
||||
}
|
||||
|
||||
if (bounds.y != constrainedBounds.y) {
|
||||
if (bounds.y !== constrainedBounds.y) {
|
||||
event.delta.y = 0;
|
||||
}
|
||||
}
|
||||
@ -2927,7 +2928,7 @@ function onCanvasEnter( event ) {
|
||||
|
||||
function onCanvasExit( event ) {
|
||||
|
||||
if (window.location != window.parent.location){
|
||||
if (window.location !== window.parent.location){
|
||||
$.MouseTracker.resetAllMouseTrackers();
|
||||
}
|
||||
|
||||
@ -3193,6 +3194,8 @@ function onCanvasScroll( event ) {
|
||||
return false; // We are swallowing this event
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function onContainerEnter( event ) {
|
||||
|
@ -898,7 +898,7 @@ $.Viewport.prototype = {
|
||||
* @property {Number} degrees - The number of degrees the rotation was set to.
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
*/
|
||||
this.viewer.raiseEvent('rotate', {"degrees": degrees});
|
||||
this.viewer.raiseEvent('rotate', {degrees: degrees});
|
||||
return this;
|
||||
},
|
||||
|
||||
@ -1567,7 +1567,7 @@ $.Viewport.prototype = {
|
||||
* @property {Number} flipped - The flip state after this change.
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
*/
|
||||
this.viewer.raiseEvent('flip', {"flipped": state});
|
||||
this.viewer.raiseEvent('flip', {flipped: state});
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@
|
||||
* @param {String} optional - url
|
||||
*/
|
||||
supports: function(data, url) {
|
||||
return (data.type && "zoomifytileservice" == data.type);
|
||||
return (data.type && "zoomifytileservice" === data.type);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user