Large batch of jshint fixes.

This commit is contained in:
photonstorm 2016-08-25 13:03:41 +01:00
parent 325b3a2857
commit ad0e4aca2e
20 changed files with 138 additions and 135 deletions

View file

@ -1,3 +1,4 @@
Gruntfile.js
node_modules/*
build/*
dist/*

View file

@ -1,5 +1,5 @@
{
"globals" : { "Phaser": false, "PIXI": false, "p2": false, "CocoonJS": false, "process": false },
"globals" : { "Phaser": false, "PIXI": false, "p2": false, "CocoonJS": false, "process": false, "JSON": false },
// Ignore Environment Globals
"browser" : true, // Standard browser globals e.g. `window`, `document`.

View file

@ -36,7 +36,7 @@
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-connect": "^0.7.1",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-jshint": "^0.9.2",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-eslint": "^19.0.0",
"grunt-git": "^0.3.3",

View file

@ -1,4 +1,3 @@
/* global Phaser:true */
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2016 Photon Storm Ltd.
@ -8,7 +7,7 @@
/**
* @namespace Phaser
*/
var Phaser = Phaser || {
var Phaser = Phaser || { // jshint ignore:line
/**
* The Phaser version number.

View file

@ -160,15 +160,16 @@ Phaser.AnimationParser = {
signature.forEach( function(key) {
if (!json[key])
{
console.warn("Phaser.AnimationParser.JSONDataPyxel: Invalid Pyxel Tilemap JSON given, missing '" + key + "' key.");
console.warn('Phaser.AnimationParser.JSONDataPyxel: Invalid Pyxel Tilemap JSON given, missing "' + key + '" key.');
console.log(json);
return;
}
});
// For this purpose, I only care about parsing tilemaps with a single layer.
if(json['layers'].length != 1) {
console.warn("Phaser.AnimationParser.JSONDataPyxel: Too many layers, this parser only supports flat Tilemaps.");
if (json['layers'].length !== 1)
{
console.warn('Phaser.AnimationParser.JSONDataPyxel: Too many layers, this parser only supports flat Tilemaps.');
console.log(json);
return;
}

View file

@ -629,7 +629,7 @@ Phaser.Game.prototype = {
r = 'WebGL';
c++;
}
else if (this.renderType == Phaser.HEADLESS)
else if (this.renderType === Phaser.HEADLESS)
{
r = 'Headless';
}

View file

@ -1180,34 +1180,34 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation, for
if (len === 1)
{
if (operation === 0) { child[key[0]] = value; }
else if (operation == 1) { child[key[0]] += value; }
else if (operation == 2) { child[key[0]] -= value; }
else if (operation == 3) { child[key[0]] *= value; }
else if (operation == 4) { child[key[0]] /= value; }
else if (operation === 1) { child[key[0]] += value; }
else if (operation === 2) { child[key[0]] -= value; }
else if (operation === 3) { child[key[0]] *= value; }
else if (operation === 4) { child[key[0]] /= value; }
}
else if (len === 2)
{
if (operation === 0) { child[key[0]][key[1]] = value; }
else if (operation == 1) { child[key[0]][key[1]] += value; }
else if (operation == 2) { child[key[0]][key[1]] -= value; }
else if (operation == 3) { child[key[0]][key[1]] *= value; }
else if (operation == 4) { child[key[0]][key[1]] /= value; }
else if (operation === 1) { child[key[0]][key[1]] += value; }
else if (operation === 2) { child[key[0]][key[1]] -= value; }
else if (operation === 3) { child[key[0]][key[1]] *= value; }
else if (operation === 4) { child[key[0]][key[1]] /= value; }
}
else if (len === 3)
{
if (operation === 0) { child[key[0]][key[1]][key[2]] = value; }
else if (operation == 1) { child[key[0]][key[1]][key[2]] += value; }
else if (operation == 2) { child[key[0]][key[1]][key[2]] -= value; }
else if (operation == 3) { child[key[0]][key[1]][key[2]] *= value; }
else if (operation == 4) { child[key[0]][key[1]][key[2]] /= value; }
else if (operation === 1) { child[key[0]][key[1]][key[2]] += value; }
else if (operation === 2) { child[key[0]][key[1]][key[2]] -= value; }
else if (operation === 3) { child[key[0]][key[1]][key[2]] *= value; }
else if (operation === 4) { child[key[0]][key[1]][key[2]] /= value; }
}
else if (len === 4)
{
if (operation === 0) { child[key[0]][key[1]][key[2]][key[3]] = value; }
else if (operation == 1) { child[key[0]][key[1]][key[2]][key[3]] += value; }
else if (operation == 2) { child[key[0]][key[1]][key[2]][key[3]] -= value; }
else if (operation == 3) { child[key[0]][key[1]][key[2]][key[3]] *= value; }
else if (operation == 4) { child[key[0]][key[1]][key[2]][key[3]] /= value; }
else if (operation === 1) { child[key[0]][key[1]][key[2]][key[3]] += value; }
else if (operation === 2) { child[key[0]][key[1]][key[2]][key[3]] -= value; }
else if (operation === 3) { child[key[0]][key[1]][key[2]][key[3]] *= value; }
else if (operation === 4) { child[key[0]][key[1]][key[2]][key[3]] /= value; }
}
return true;
@ -1498,40 +1498,37 @@ Phaser.Group.prototype.callbackFromArray = function (child, callback, length) {
// Kinda looks like a Christmas tree
if (length == 1)
if (length === 1)
{
if (child[callback[0]])
{
return child[callback[0]];
}
}
else if (length == 2)
else if (length === 2)
{
if (child[callback[0]][callback[1]])
{
return child[callback[0]][callback[1]];
}
}
else if (length == 3)
else if (length === 3)
{
if (child[callback[0]][callback[1]][callback[2]])
{
return child[callback[0]][callback[1]][callback[2]];
}
}
else if (length == 4)
else if (length === 4)
{
if (child[callback[0]][callback[1]][callback[2]][callback[3]])
{
return child[callback[0]][callback[1]][callback[2]][callback[3]];
}
}
else
else if (child[callback])
{
if (child[callback])
{
return child[callback];
}
return child[callback];
}
return false;

View file

@ -488,7 +488,9 @@ Phaser.Circle.contains = function (a, x, y) {
* @return {boolean} A value of true if the object has exactly the same values for the x, y and diameter properties as this Circle object; otherwise false.
*/
Phaser.Circle.equals = function (a, b) {
return (a.x == b.x && a.y == b.y && a.diameter == b.diameter);
return (a.x === b.x && a.y === b.y && a.diameter === b.diameter);
};
/**
@ -500,7 +502,9 @@ Phaser.Circle.equals = function (a, b) {
* @return {boolean} A value of true if the specified object intersects with this Circle object; otherwise false.
*/
Phaser.Circle.intersects = function (a, b) {
return (Phaser.Math.distance(a.x, a.y, b.x, b.y) <= (a.radius + b.radius));
};
/**

View file

@ -304,7 +304,7 @@ Phaser.Line.prototype = {
var i = 1;
while (!((x1 == x2) && (y1 == y2)))
while (!((x1 === x2) && (y1 === y2)))
{
var e2 = err << 1;

View file

@ -913,7 +913,7 @@ Phaser.Rectangle.containsRect = function (a, b) {
*/
Phaser.Rectangle.equals = function (a, b) {
return (a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height);
return (a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height);
};

View file

@ -56,7 +56,7 @@ Phaser.Gamepad = function (game) {
* @property {boolean} _gamepadSupportAvailable - Are gamepads supported in this browser or not?
* @private
*/
this._gamepadSupportAvailable = !!navigator.webkitGetGamepads || !!navigator.webkitGamepads || (navigator.userAgent.indexOf('Firefox/') != -1) || !!navigator.getGamepads;
this._gamepadSupportAvailable = !!navigator.webkitGetGamepads || !!navigator.webkitGamepads || (navigator.userAgent.indexOf('Firefox/') !== -1) || !!navigator.getGamepads;
/**
* Used to check for differences between earlier polls and current state of gamepads.

View file

@ -2362,7 +2362,7 @@ Phaser.Loader.prototype = {
xhr.onload = function () {
try {
if (xhr.readyState == 4 && xhr.status >= 400 && xhr.status <= 599) { // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) { // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
return onerror.call(_this, file, xhr);
}
else {
@ -2476,7 +2476,7 @@ Phaser.Loader.prototype = {
xhr.onload = function () {
try {
if (xhr.readyState == 4 && xhr.status >= 400 && xhr.status <= 599) { // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) { // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
return onerror.call(_this, file, xhr);
}
else {
@ -2684,11 +2684,11 @@ Phaser.Loader.prototype = {
// Load the JSON or XML before carrying on with the next file
loadNext = false;
if (file.format == Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY || file.format == Phaser.Loader.TEXTURE_ATLAS_JSON_HASH || file.format == Phaser.Loader.TEXTURE_ATLAS_JSON_PYXEL)
if (file.format === Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY || file.format === Phaser.Loader.TEXTURE_ATLAS_JSON_HASH || file.format === Phaser.Loader.TEXTURE_ATLAS_JSON_PYXEL)
{
this.xhrLoad(file, this.transformUrl(file.atlasURL, file), 'text', this.jsonLoadComplete);
}
else if (file.format == Phaser.Loader.TEXTURE_ATLAS_XML_STARLING)
else if (file.format === Phaser.Loader.TEXTURE_ATLAS_XML_STARLING)
{
this.xhrLoad(file, this.transformUrl(file.atlasURL, file), 'text', this.xmlLoadComplete);
}

View file

@ -134,7 +134,7 @@ Phaser.Net.prototype = {
if (key.length > 1)
{
if (parameter && parameter == this.decodeURI(key[0]))
if (parameter && parameter === this.decodeURI(key[0]))
{
return this.decodeURI(key[1]);
}

View file

@ -347,28 +347,28 @@ Phaser.Physics.Ninja.Tile.prototype = {
// 45deg
this.type = Phaser.Physics.Ninja.Tile.TYPE_45DEG;
if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_45DEGpn)
if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_45DEGpn)
{
this.signx = 1;
this.signy = -1;
this.sx = this.signx / Math.SQRT2;//get slope _unit_ normal
this.sy = this.signy / Math.SQRT2;//since normal is (1,-1), length is sqrt(1*1 + -1*-1) = sqrt(2)
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_45DEGnn)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_45DEGnn)
{
this.signx = -1;
this.signy = -1;
this.sx = this.signx / Math.SQRT2;//get slope _unit_ normal
this.sy = this.signy / Math.SQRT2;//since normal is (1,-1), length is sqrt(1*1 + -1*-1) = sqrt(2)
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_45DEGnp)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_45DEGnp)
{
this.signx = -1;
this.signy = 1;
this.sx = this.signx / Math.SQRT2;//get slope _unit_ normal
this.sy = this.signy / Math.SQRT2;//since normal is (1,-1), length is sqrt(1*1 + -1*-1) = sqrt(2)
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_45DEGpp)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_45DEGpp)
{
this.signx = 1;
this.signy = 1;
@ -385,28 +385,28 @@ Phaser.Physics.Ninja.Tile.prototype = {
// Concave
this.type = Phaser.Physics.Ninja.Tile.TYPE_CONCAVE;
if (this.id == Phaser.Physics.Ninja.Tile.CONCAVEpn)
if (this.id === Phaser.Physics.Ninja.Tile.CONCAVEpn)
{
this.signx = 1;
this.signy = -1;
this.sx = 0;
this.sy = 0;
}
else if (this.id == Phaser.Physics.Ninja.Tile.CONCAVEnn)
else if (this.id === Phaser.Physics.Ninja.Tile.CONCAVEnn)
{
this.signx = -1;
this.signy = -1;
this.sx = 0;
this.sy = 0;
}
else if (this.id == Phaser.Physics.Ninja.Tile.CONCAVEnp)
else if (this.id === Phaser.Physics.Ninja.Tile.CONCAVEnp)
{
this.signx = -1;
this.signy = 1;
this.sx = 0;
this.sy = 0;
}
else if (this.id == Phaser.Physics.Ninja.Tile.CONCAVEpp)
else if (this.id === Phaser.Physics.Ninja.Tile.CONCAVEpp)
{
this.signx = 1;
this.signy = 1;
@ -423,28 +423,28 @@ Phaser.Physics.Ninja.Tile.prototype = {
// Convex
this.type = Phaser.Physics.Ninja.Tile.TYPE_CONVEX;
if (this.id == Phaser.Physics.Ninja.Tile.CONVEXpn)
if (this.id === Phaser.Physics.Ninja.Tile.CONVEXpn)
{
this.signx = 1;
this.signy = -1;
this.sx = 0;
this.sy = 0;
}
else if (this.id == Phaser.Physics.Ninja.Tile.CONVEXnn)
else if (this.id === Phaser.Physics.Ninja.Tile.CONVEXnn)
{
this.signx = -1;
this.signy = -1;
this.sx = 0;
this.sy = 0;
}
else if (this.id == Phaser.Physics.Ninja.Tile.CONVEXnp)
else if (this.id === Phaser.Physics.Ninja.Tile.CONVEXnp)
{
this.signx = -1;
this.signy = 1;
this.sx = 0;
this.sy = 0;
}
else if (this.id == Phaser.Physics.Ninja.Tile.CONVEXpp)
else if (this.id === Phaser.Physics.Ninja.Tile.CONVEXpp)
{
this.signx = 1;
this.signy = 1;
@ -461,7 +461,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
// 22deg small
this.type = Phaser.Physics.Ninja.Tile.TYPE_22DEGs;
if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_22DEGpnS)
if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_22DEGpnS)
{
this.signx = 1;
this.signy = -1;
@ -469,7 +469,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 1) / slen;
this.sy = (this.signy * 2) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_22DEGnnS)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_22DEGnnS)
{
this.signx = -1;
this.signy = -1;
@ -477,7 +477,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 1) / slen;
this.sy = (this.signy * 2) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_22DEGnpS)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_22DEGnpS)
{
this.signx = -1;
this.signy = 1;
@ -485,7 +485,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 1) / slen;
this.sy = (this.signy * 2) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_22DEGppS)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_22DEGppS)
{
this.signx = 1;
this.signy = 1;
@ -503,7 +503,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
// 22deg big
this.type = Phaser.Physics.Ninja.Tile.TYPE_22DEGb;
if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_22DEGpnB)
if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_22DEGpnB)
{
this.signx = 1;
this.signy = -1;
@ -511,7 +511,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 1) / slen;
this.sy = (this.signy * 2) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_22DEGnnB)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_22DEGnnB)
{
this.signx = -1;
this.signy = -1;
@ -519,7 +519,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 1) / slen;
this.sy = (this.signy * 2) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_22DEGnpB)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_22DEGnpB)
{
this.signx = -1;
this.signy = 1;
@ -527,7 +527,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 1) / slen;
this.sy = (this.signy * 2) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_22DEGppB)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_22DEGppB)
{
this.signx = 1;
this.signy = 1;
@ -545,7 +545,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
// 67deg small
this.type = Phaser.Physics.Ninja.Tile.TYPE_67DEGs;
if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_67DEGpnS)
if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_67DEGpnS)
{
this.signx = 1;
this.signy = -1;
@ -553,7 +553,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 2) / slen;
this.sy = (this.signy * 1) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_67DEGnnS)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_67DEGnnS)
{
this.signx = -1;
this.signy = -1;
@ -561,7 +561,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 2) / slen;
this.sy = (this.signy * 1) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_67DEGnpS)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_67DEGnpS)
{
this.signx = -1;
this.signy = 1;
@ -569,7 +569,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 2) / slen;
this.sy = (this.signy * 1) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_67DEGppS)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_67DEGppS)
{
this.signx = 1;
this.signy = 1;
@ -587,7 +587,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
// 67deg big
this.type = Phaser.Physics.Ninja.Tile.TYPE_67DEGb;
if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_67DEGpnB)
if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_67DEGpnB)
{
this.signx = 1;
this.signy = -1;
@ -595,7 +595,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 2) / slen;
this.sy = (this.signy * 1) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_67DEGnnB)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_67DEGnnB)
{
this.signx = -1;
this.signy = -1;
@ -603,7 +603,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 2) / slen;
this.sy = (this.signy * 1) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_67DEGnpB)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_67DEGnpB)
{
this.signx = -1;
this.signy = 1;
@ -611,7 +611,7 @@ Phaser.Physics.Ninja.Tile.prototype = {
this.sx = (this.signx * 2) / slen;
this.sy = (this.signy * 1) / slen;
}
else if (this.id == Phaser.Physics.Ninja.Tile.SLOPE_67DEGppB)
else if (this.id === Phaser.Physics.Ninja.Tile.SLOPE_67DEGppB)
{
this.signx = 1;
this.signy = 1;
@ -629,28 +629,28 @@ Phaser.Physics.Ninja.Tile.prototype = {
// Half-full tile
this.type = Phaser.Physics.Ninja.Tile.TYPE_HALF;
if (this.id == Phaser.Physics.Ninja.Tile.HALFd)
if (this.id === Phaser.Physics.Ninja.Tile.HALFd)
{
this.signx = 0;
this.signy = -1;
this.sx = this.signx;
this.sy = this.signy;
}
else if (this.id == Phaser.Physics.Ninja.Tile.HALFu)
else if (this.id === Phaser.Physics.Ninja.Tile.HALFu)
{
this.signx = 0;
this.signy = 1;
this.sx = this.signx;
this.sy = this.signy;
}
else if (this.id == Phaser.Physics.Ninja.Tile.HALFl)
else if (this.id === Phaser.Physics.Ninja.Tile.HALFl)
{
this.signx = 1;
this.signy = 0;
this.sx = this.signx;
this.sy = this.signy;
}
else if (this.id == Phaser.Physics.Ninja.Tile.HALFr)
else if (this.id === Phaser.Physics.Ninja.Tile.HALFr)
{
this.signx = -1;
this.signy = 0;

View file

@ -392,61 +392,61 @@ Phaser.Physics.Ninja.prototype = {
if (object1 && object2 && object1.exists && object2.exists)
{
// SPRITES
if (object1.type == Phaser.SPRITE || object1.type == Phaser.TILESPRITE)
if (object1.type === Phaser.SPRITE || object1.type === Phaser.TILESPRITE)
{
if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
if (object2.type === Phaser.SPRITE || object2.type === Phaser.TILESPRITE)
{
this.collideSpriteVsSprite(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
}
else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
else if (object2.type === Phaser.GROUP || object2.type === Phaser.EMITTER)
{
this.collideSpriteVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
}
else if (object2.type == Phaser.TILEMAPLAYER)
else if (object2.type === Phaser.TILEMAPLAYER)
{
this.collideSpriteVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
}
}
// GROUPS
else if (object1.type == Phaser.GROUP)
else if (object1.type === Phaser.GROUP)
{
if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
if (object2.type === Phaser.SPRITE || object2.type === Phaser.TILESPRITE)
{
this.collideSpriteVsGroup(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly);
}
else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
else if (object2.type === Phaser.GROUP || object2.type === Phaser.EMITTER)
{
this.collideGroupVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
}
else if (object2.type == Phaser.TILEMAPLAYER)
else if (object2.type === Phaser.TILEMAPLAYER)
{
this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
}
}
// TILEMAP LAYERS
else if (object1.type == Phaser.TILEMAPLAYER)
else if (object1.type === Phaser.TILEMAPLAYER)
{
if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
if (object2.type === Phaser.SPRITE || object2.type === Phaser.TILESPRITE)
{
this.collideSpriteVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext);
}
else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
else if (object2.type === Phaser.GROUP || object2.type === Phaser.EMITTER)
{
this.collideGroupVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext);
}
}
// EMITTER
else if (object1.type == Phaser.EMITTER)
else if (object1.type === Phaser.EMITTER)
{
if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
if (object2.type === Phaser.SPRITE || object2.type === Phaser.TILESPRITE)
{
this.collideSpriteVsGroup(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly);
}
else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
else if (object2.type === Phaser.GROUP || object2.type === Phaser.EMITTER)
{
this.collideGroupVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
}
else if (object2.type == Phaser.TILEMAPLAYER)
else if (object2.type === Phaser.TILEMAPLAYER)
{
this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
}

View file

@ -917,7 +917,7 @@ Phaser.Physics.P2.prototype = {
*/
removeBody: function (body) {
if (body.data.world == this.world)
if (body.data.world === this.world)
{
this.world.removeBody(body.data);

View file

@ -59,7 +59,7 @@ if (!Array.isArray)
{
Array.isArray = function (arg)
{
return Object.prototype.toString.call(arg) == '[object Array]';
return Object.prototype.toString.call(arg) === '[object Array]';
};
}

View file

@ -702,7 +702,8 @@ Phaser.Color = {
componentToHex: function (color) {
var hex = color.toString(16);
return hex.length == 1 ? "0" + hex : hex;
return (hex.length === 1) ? '0' + hex : hex;
},

View file

@ -947,12 +947,12 @@ Phaser.Device._initialize = function () {
device.webApp = true;
}
if (typeof window.cordova !== "undefined")
if (typeof window.cordova !== 'undefined')
{
device.cordova = true;
}
if (typeof process !== "undefined" && typeof require !== "undefined")
if (typeof process !== 'undefined' && typeof require !== 'undefined')
{
device.node = true;
}
@ -972,7 +972,7 @@ Phaser.Device._initialize = function () {
if (device.cocoonJS)
{
try {
device.cocoonJSApp = (typeof CocoonJS !== "undefined");
device.cocoonJSApp = (typeof CocoonJS !== 'undefined');
}
catch(error)
{
@ -980,7 +980,7 @@ Phaser.Device._initialize = function () {
}
}
if (typeof window.ejecta !== "undefined")
if (typeof window.ejecta !== 'undefined')
{
device.ejecta = true;
}
@ -1105,42 +1105,6 @@ Phaser.Device._initialize = function () {
}
/**
* Check PixelRatio, iOS device, Vibration API, ArrayBuffers and endianess.
*/
function _checkDevice () {
device.pixelRatio = window['devicePixelRatio'] || 1;
device.iPhone = navigator.userAgent.toLowerCase().indexOf('iphone') != -1;
device.iPhone4 = (device.pixelRatio == 2 && device.iPhone);
device.iPad = navigator.userAgent.toLowerCase().indexOf('ipad') != -1;
if (typeof Int8Array !== 'undefined')
{
device.typedArray = true;
}
else
{
device.typedArray = false;
}
if (typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint32Array !== 'undefined')
{
device.littleEndian = _checkIsLittleEndian();
device.LITTLE_ENDIAN = device.littleEndian;
}
device.support32bit = (typeof ArrayBuffer !== "undefined" && typeof Uint8ClampedArray !== "undefined" && typeof Int32Array !== "undefined" && device.littleEndian !== null && _checkIsUint8ClampedImageData());
navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
if (navigator.vibrate)
{
device.vibration = true;
}
}
/**
* Check Little or Big Endian system.
*
@ -1157,12 +1121,12 @@ Phaser.Device._initialize = function () {
b[2] = 0xc3;
b[3] = 0xd4;
if (c[0] == 0xd4c3b2a1)
if (c[0] === 0xd4c3b2a1)
{
return true;
}
if (c[0] == 0xa1b2c3d4)
if (c[0] === 0xa1b2c3d4)
{
return false;
}
@ -1202,6 +1166,42 @@ Phaser.Device._initialize = function () {
}
/**
* Check PixelRatio, iOS device, Vibration API, ArrayBuffers and endianess.
*/
function _checkDevice () {
device.pixelRatio = window['devicePixelRatio'] || 1;
device.iPhone = navigator.userAgent.toLowerCase().indexOf('iphone') !== -1;
device.iPhone4 = (device.pixelRatio === 2 && device.iPhone);
device.iPad = navigator.userAgent.toLowerCase().indexOf('ipad') !== -1;
if (typeof Int8Array !== 'undefined')
{
device.typedArray = true;
}
else
{
device.typedArray = false;
}
if (typeof ArrayBuffer !== 'undefined' && typeof Uint8Array !== 'undefined' && typeof Uint32Array !== 'undefined')
{
device.littleEndian = _checkIsLittleEndian();
device.LITTLE_ENDIAN = device.littleEndian;
}
device.support32bit = (typeof ArrayBuffer !== 'undefined' && typeof Uint8ClampedArray !== 'undefined' && typeof Int32Array !== 'undefined' && device.littleEndian !== null && _checkIsUint8ClampedImageData());
navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
if (navigator.vibrate)
{
device.vibration = true;
}
}
/**
* Check whether the host environment support 3D CSS.
*/

View file

@ -179,7 +179,7 @@ Phaser.LinkedList.prototype = {
entity = entity.next;
}
while(entity != this.last.next);
while (entity !== this.last.next);
}