2
0
Эх сурвалжийг харах

Merge remote-tracking branch 'LarryBattle/patch-2' into dev

Mr.doob 13 жил өмнө
parent
commit
eced65448e
1 өөрчлөгдсөн 21 нэмэгдсэн , 39 устгасан
  1. 21 39
      src/Three.js

+ 21 - 39
src/Three.js

@@ -1,22 +1,20 @@
 /**
  * @author mrdoob / http://mrdoob.com/
+ * @modified by Larry Battle / http://bateru.com/news
  */
 
 var THREE = THREE || { REVISION: '52dev' };
 
-if ( self.console === undefined ) {
+self.console = self.console || {
 
-	self.console = {
+	info: function () {},
+	log: function () {},
+	debug: function () {},
+	warn: function () {},
+	error: function () {}
 
-		info: function () {},
-		log: function () {},
-		debug: function () {},
-		warn: function () {},
-		error: function () {}
+};
 
-	};
-
-}
 
 if ( self.Int32Array === undefined ) {
 
@@ -32,37 +30,26 @@ if ( self.Int32Array === undefined ) {
 // http://stackoverflow.com/questions/498970/how-do-i-trim-a-string-in-javascript
 // http://wiki.ecmascript.org/doku.php?id=harmony%3astring_extras
 
-if ( String.prototype.startsWith === undefined ) {
-
-	String.prototype.startsWith = function ( str ) {
-
-		return this.slice( 0, str.length ) === str;
+String.prototype.startsWith = String.prototype.startsWith || function ( str ) {
 
-	};
+	return this.slice( 0, str.length ) === str;
 
-}
-
-if ( String.prototype.endsWith === undefined ) {
+};
 
-	String.prototype.endsWith = function ( str ) {
+String.prototype.endsWith = String.prototype.endsWith || function ( str ) {
 
-		var t = String( str );
-		var index = this.lastIndexOf( t );
-		return index >= 0 && index === this.length - t.length;
+	var t = String( str );
+	var index = this.lastIndexOf( t );
+	return ( -1 < index && index ) === (this.length - t.length);
 
-	};
-
-}
+};
 
-if ( ! String.prototype.trim === undefined ) {
+String.prototype.trim = String.prototype.trim || function () {
 
-	String.prototype.trim = function () {
+	return this.replace( /^\s+|\s+$/g, '' );
 
-		return this.replace( /^\s+|\s+$/g, '' );
+};
 
-	};
-
-}
 
 // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
 // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
@@ -94,13 +81,8 @@ if ( ! String.prototype.trim === undefined ) {
 		};
 
 	}
-
-
-	if ( window.cancelAnimationFrame === undefined ) {
-
-		window.cancelAnimationFrame = function ( id ) { clearTimeout( id ); };
-
-	}
+	
+	window.cancelAnimationFrame = window.cancelAnimationFrame || function ( id ) { window.clearTimeout( id ); };
 
 }() );