浏览代码

Examples: Clean up. (#22835)

linbingquan 3 年之前
父节点
当前提交
f730e730ad
共有 1 个文件被更改,包括 22 次插入22 次删除
  1. 22 22
      examples/webgl_geometry_text.html

+ 22 - 22
examples/webgl_geometry_text.html

@@ -37,14 +37,14 @@
 
 
 			let firstLetter = true;
 			let firstLetter = true;
 
 
-			let text = "three.js",
+			let text = 'three.js',
 
 
 				bevelEnabled = true,
 				bevelEnabled = true,
 
 
 				font = undefined,
 				font = undefined,
 
 
-				fontName = "optimer", // helvetiker, optimer, gentilis, droid sans, droid serif
-				fontWeight = "bold"; // normal bold
+				fontName = 'optimer', // helvetiker, optimer, gentilis, droid sans, droid serif
+				fontWeight = 'bold'; // normal bold
 
 
 			const height = 20,
 			const height = 20,
 				size = 70,
 				size = 70,
@@ -59,18 +59,18 @@
 
 
 			const fontMap = {
 			const fontMap = {
 
 
-				"helvetiker": 0,
-				"optimer": 1,
-				"gentilis": 2,
-				"droid/droid_sans": 3,
-				"droid/droid_serif": 4
+				'helvetiker': 0,
+				'optimer': 1,
+				'gentilis': 2,
+				'droid/droid_sans': 3,
+				'droid/droid_serif': 4
 
 
 			};
 			};
 
 
 			const weightMap = {
 			const weightMap = {
 
 
-				"regular": 0,
-				"bold": 1
+				'regular': 0,
+				'bold': 1
 
 
 			};
 			};
 
 
@@ -96,7 +96,7 @@
 			function decimalToHex( d ) {
 			function decimalToHex( d ) {
 
 
 				let hex = Number( d ).toString( 16 );
 				let hex = Number( d ).toString( 16 );
-				hex = "000000".substr( 0, 6 - hex.length ) + hex;
+				hex = '000000'.substr( 0, 6 - hex.length ) + hex;
 				return hex.toUpperCase();
 				return hex.toUpperCase();
 
 
 			}
 			}
@@ -106,7 +106,7 @@
 				container = document.createElement( 'div' );
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 				document.body.appendChild( container );
 
 
-				permalink = document.getElementById( "permalink" );
+				permalink = document.getElementById( 'permalink' );
 
 
 				// CAMERA
 				// CAMERA
 
 
@@ -202,7 +202,7 @@
 				document.addEventListener( 'keypress', onDocumentKeyPress );
 				document.addEventListener( 'keypress', onDocumentKeyPress );
 				document.addEventListener( 'keydown', onDocumentKeyDown );
 				document.addEventListener( 'keydown', onDocumentKeyDown );
 
 
-				document.getElementById( "color" ).addEventListener( 'click', function () {
+				document.getElementById( 'color' ).addEventListener( 'click', function () {
 
 
 					pointLight.color.setHSL( Math.random(), 1, 0.5 );
 					pointLight.color.setHSL( Math.random(), 1, 0.5 );
 					hex = decimalToHex( pointLight.color.getHex() );
 					hex = decimalToHex( pointLight.color.getHex() );
@@ -211,7 +211,7 @@
 
 
 				} );
 				} );
 
 
-				document.getElementById( "font" ).addEventListener( 'click', function () {
+				document.getElementById( 'font' ).addEventListener( 'click', function () {
 
 
 					fontIndex ++;
 					fontIndex ++;
 
 
@@ -222,15 +222,15 @@
 				} );
 				} );
 
 
 
 
-				document.getElementById( "weight" ).addEventListener( 'click', function () {
+				document.getElementById( 'weight' ).addEventListener( 'click', function () {
 
 
-					if ( fontWeight === "bold" ) {
+					if ( fontWeight === 'bold' ) {
 
 
-						fontWeight = "regular";
+						fontWeight = 'regular';
 
 
 					} else {
 					} else {
 
 
-						fontWeight = "bold";
+						fontWeight = 'bold';
 
 
 					}
 					}
 
 
@@ -238,7 +238,7 @@
 
 
 				} );
 				} );
 
 
-				document.getElementById( "bevel" ).addEventListener( 'click', function () {
+				document.getElementById( 'bevel' ).addEventListener( 'click', function () {
 
 
 					bevelEnabled = ! bevelEnabled;
 					bevelEnabled = ! bevelEnabled;
 
 
@@ -273,9 +273,9 @@
 
 
 			function updatePermalink() {
 			function updatePermalink() {
 
 
-				const link = hex + fontMap[ fontName ] + weightMap[ fontWeight ] + boolToNum( bevelEnabled ) + "#" + encodeURI( text );
+				const link = hex + fontMap[ fontName ] + weightMap[ fontWeight ] + boolToNum( bevelEnabled ) + '#' + encodeURI( text );
 
 
-				permalink.href = "#" + link;
+				permalink.href = '#' + link;
 				window.location.hash = link;
 				window.location.hash = link;
 
 
 			}
 			}
@@ -285,7 +285,7 @@
 				if ( firstLetter ) {
 				if ( firstLetter ) {
 
 
 					firstLetter = false;
 					firstLetter = false;
-					text = "";
+					text = '';
 
 
 				}
 				}