瀏覽代碼

jslint/jshint fixes

Mr.doob 9 年之前
父節點
當前提交
611efcba7f

+ 16 - 4
editor/js/Menubar.File.js

@@ -88,10 +88,14 @@ Menubar.File = function ( editor ) {
 		var output = geometry.toJSON();
 
 		try {
+
 			output = JSON.stringify( output, null, '\t' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+
 		} catch ( e ) {
+
 			output = JSON.stringify( output );
+
 		}
 
 		exportString( output, 'geometry.json' );
@@ -118,10 +122,14 @@ Menubar.File = function ( editor ) {
 		var output = object.toJSON();
 
 		try {
+
 			output = JSON.stringify( output, null, '\t' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+
 		} catch ( e ) {
+
 			output = JSON.stringify( output );
+
 		}
 
 		exportString( output, 'model.json' );
@@ -139,10 +147,14 @@ Menubar.File = function ( editor ) {
 		var output = editor.scene.toJSON();
 
 		try {
+
 			output = JSON.stringify( output, null, '\t' );
 			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+
 		} catch ( e ) {
+
 			output = JSON.stringify( output );
+
 		}
 
 		exportString( output, 'scene.json' );
@@ -294,12 +306,12 @@ Menubar.File = function ( editor ) {
 		link.download = filename || 'data.json';
 		link.target = '_blank';
 
-		var event = document.createEvent("MouseEvents");
+		var event = document.createEvent( 'MouseEvents' );
 		event.initMouseEvent(
-			"click", true, false, window, 0, 0, 0, 0, 0
-			, false, false, false, false, 0, null
+			'click', true, false, window, 0, 0, 0, 0, 0,
+			false, false, false, false, 0, null
 		);
-		link.dispatchEvent(event);
+		link.dispatchEvent( event );
 
 	};
 

+ 4 - 4
examples/js/renderers/CanvasRenderer.js

@@ -116,7 +116,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 	if ( _context.setLineDash === undefined ) {
 
-		_context.setLineDash = function () {}
+		_context.setLineDash = function () {};
 
 	}
 
@@ -821,7 +821,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 			return {
 				canvas: undefined,
 				version: texture.version
-			}
+			};
 
 		}
 
@@ -832,7 +832,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 			return {
 				canvas: undefined,
 				version: 0
-			}
+			};
 
 		}
 
@@ -866,7 +866,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 		return {
 			canvas: _context.createPattern( canvas, repeat ),
 			version: texture.version
-		}
+		};
 
 	}
 

+ 4 - 2
src/audio/Audio.js

@@ -62,11 +62,13 @@ THREE.Audio.prototype.setBuffer = function ( audioBuffer ) {
 
 	var scope = this;
 
-	audioBuffer.onReady(function(buffer) {
+	audioBuffer.onReady( function( buffer ) {
+
 		scope.source.buffer = buffer;
 		scope.sourceType = 'buffer';
 		if ( scope.autoplay ) scope.play();
-	});
+
+	} );
 
 	return this;
 

+ 1 - 1
src/audio/AudioBuffer.js

@@ -26,7 +26,7 @@ THREE.AudioBuffer.prototype.load = function ( file ) {
 
 			for ( var i = 0; i < scope.readyCallbacks.length; i ++ ) {
 
-				scope.readyCallbacks[i](scope.buffer);
+				scope.readyCallbacks[ i ]( scope.buffer );
 
 			}
 

+ 1 - 1
src/audio/AudioListener.js

@@ -37,7 +37,7 @@ THREE.AudioListener.prototype.removeFilter = function ( ) {
 
 	}
 
-}
+};
 
 THREE.AudioListener.prototype.setFilter = function ( value ) {
 

+ 0 - 2
src/audio/PositionalAudio.js

@@ -20,7 +20,6 @@ THREE.PositionalAudio.prototype.getOutput = function () {
 
 };
 
-
 THREE.PositionalAudio.prototype.setRefDistance = function ( value ) {
 
 	this.panner.refDistance = value;
@@ -69,7 +68,6 @@ THREE.PositionalAudio.prototype.getMaxDistance = function () {
 
 };
 
-
 THREE.PositionalAudio.prototype.updateMatrixWorld = ( function () {
 
 	var position = new THREE.Vector3();

+ 5 - 5
src/cameras/OrthographicCamera.js

@@ -37,20 +37,20 @@ THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {
 };
 
 THREE.OrthographicCamera.prototype.copy = function ( source ) {
-	
+
 	THREE.Camera.prototype.copy.call( this, source );
-	
+
 	this.left = source.left;
 	this.right = source.right;
 	this.top = source.top;
 	this.bottom = source.bottom;
 	this.near = source.near;
 	this.far = source.far;
-	
+
 	this.zoom = source.zoom;
-	
+
 	return this;
-		
+
 };
 
 THREE.OrthographicCamera.prototype.toJSON = function ( meta ) {

+ 5 - 5
src/cameras/PerspectiveCamera.js

@@ -123,18 +123,18 @@ THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {
 };
 
 THREE.PerspectiveCamera.prototype.copy = function ( source ) {
-	
+
 	THREE.Camera.prototype.copy.call( this, source );
-	
+
 	this.fov = source.fov;
 	this.aspect = source.aspect;
 	this.near = source.near;
 	this.far = source.far;
-	
+
 	this.zoom = source.zoom;
-	
+
 	return this;
-		
+
 };
 
 THREE.PerspectiveCamera.prototype.toJSON = function ( meta ) {

+ 10 - 10
src/core/BufferGeometry.js

@@ -436,16 +436,16 @@ THREE.BufferGeometry.prototype = {
 
 		if ( geometry.uvsNeedUpdate ) {
 
-				var attribute = this.attributes.uv;
+			var attribute = this.attributes.uv;
 
-				if ( attribute !== undefined ) {
+			if ( attribute !== undefined ) {
 
-						attribute.copyVector2sArray( geometry.uvs );
-						attribute.needsUpdate = true;
+				attribute.copyVector2sArray( geometry.uvs );
+				attribute.needsUpdate = true;
 
-				}
+			}
 
-				geometry.uvsNeedUpdate = false;
+			geometry.uvsNeedUpdate = false;
 
 		}
 
@@ -710,11 +710,11 @@ THREE.BufferGeometry.prototype = {
 
 				// reset existing normals to zero
 
-				var normals = attributes.normal.array;
+				var array = attributes.normal.array;
 
-				for ( var i = 0, il = normals.length; i < il; i ++ ) {
+				for ( var i = 0, il = array.length; i < il; i ++ ) {
 
-					normals[ i ] = 0;
+					array[ i ] = 0;
 
 				}
 
@@ -826,7 +826,7 @@ THREE.BufferGeometry.prototype = {
 
 	computeOffsets: function ( size ) {
 
-		console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.');
+		console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );
 
 	},
 

+ 1 - 1
src/core/Geometry.js

@@ -226,7 +226,7 @@ THREE.Geometry.prototype = {
 		var tempUVs = [];
 		var tempUVs2 = [];
 
-		for ( var i = 0, j = 0; i < vertices.length; i += 3, j += 2) {
+		for ( var i = 0, j = 0; i < vertices.length; i += 3, j += 2 ) {
 
 			scope.vertices.push( new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) );