@@ -36,9 +36,9 @@ async function init(path) {
3636 document . getElementById ( "plaintext" ) . value ,
3737 ) ;
3838 } ;
39- var content = [ ] ;
39+ const content = [ ] ;
4040 console . debug ( "Fetching index" ) ;
41- var index = await fetch (
41+ const index = await fetch (
4242 "https://raw.githubusercontent.com/" +
4343 path +
4444 "/main/javascripts/index.json" ,
@@ -49,17 +49,17 @@ async function init(path) {
4949 . catch ( console . error ) ;
5050 console . debug ( "Fetched index" ) ;
5151 content . push ( document . createElement ( "hr" ) ) ;
52- var toc = document . createElement ( "section" ) ;
52+ const toc = document . createElement ( "section" ) ;
5353 content . push ( toc ) ;
5454 toc . id = "toc" ;
55- var ttoc = document . createElement ( "h3" ) ;
55+ const ttoc = document . createElement ( "h3" ) ;
5656 toc . appendChild ( ttoc ) ;
5757 ttoc . textContent = "Examples (" + index . length + ")" ;
58- var ul = document . createElement ( "ul" ) ;
58+ const ul = document . createElement ( "ul" ) ;
5959 toc . appendChild ( ul ) ;
60- var i ;
60+ let i ;
6161 for ( i = 0 ; i < index . length ; i ++ ) {
62- var li = document . createElement ( "li" ) ;
62+ const li = document . createElement ( "li" ) ;
6363 ul . appendChild ( li ) ;
6464 li . innerHTML =
6565 '<a href="#' +
@@ -68,30 +68,30 @@ async function init(path) {
6868 index [ i ] . name +
6969 "</a>" ;
7070 }
71- var loading = document . getElementById ( "loading" ) ;
72- var j ;
71+ const loading = document . getElementById ( "loading" ) ;
72+ let j ;
7373 for ( j = 0 ; j < index . length ; j ++ ) {
7474 loading . textContent += "." ;
7575 content . push ( document . createElement ( "hr" ) ) ;
7676 console . debug ( "Adding " + index [ j ] . name ) ;
77- var bookmarklet = document . createElement ( "section" ) ;
77+ const bookmarklet = document . createElement ( "section" ) ;
7878 content . push ( bookmarklet ) ;
7979 bookmarklet . className = "bookmarklet" ;
80- var title = document . createElement ( "h3" ) ;
80+ const title = document . createElement ( "h3" ) ;
8181 bookmarklet . appendChild ( title ) ;
82- var tlink = document . createElement ( "a" ) ;
82+ const tlink = document . createElement ( "a" ) ;
8383 title . appendChild ( tlink ) ;
8484 tlink . className = "name" ;
8585 tlink . id = normalize ( index [ j ] . name ) ;
8686 tlink . textContent = index [ j ] . name ;
87- var desc = document . createElement ( "h4" ) ;
87+ const desc = document . createElement ( "h4" ) ;
8888 bookmarklet . appendChild ( desc ) ;
8989 desc . textContent = "Description" ;
90- var description = document . createElement ( "p" ) ;
90+ const description = document . createElement ( "p" ) ;
9191 bookmarklet . appendChild ( description ) ;
9292 description . textContent = index [ j ] . description ;
9393 console . debug ( "Fetching source code for " + index [ j ] . name ) ;
94- var js = await fetch (
94+ const js = await fetch (
9595 "https://raw.githubusercontent.com/" +
9696 path +
9797 "/main/javascripts/" +
@@ -103,36 +103,36 @@ async function init(path) {
103103 } )
104104 . catch ( console . error ) ;
105105 console . debug ( "Fetched source code for " + index [ j ] . name ) ;
106- var book = document . createElement ( "h4" ) ;
106+ const book = document . createElement ( "h4" ) ;
107107 bookmarklet . appendChild ( book ) ;
108108 book . textContent = "Bookmarklet" ;
109- var instructions = document . createElement ( "p" ) ;
109+ const instructions = document . createElement ( "p" ) ;
110110 bookmarklet . appendChild ( instructions ) ;
111111 instructions . innerHTML =
112112 'Drag and drop or bookmark this link: <a href="' +
113113 minify ( js ) +
114114 '">' +
115115 index [ j ] . name +
116116 "</a>" ;
117- var code = document . createElement ( "h4" ) ;
117+ const code = document . createElement ( "h4" ) ;
118118 bookmarklet . appendChild ( code ) ;
119119 code . textContent = "Source code" ;
120- var pre = document . createElement ( "pre" ) ;
120+ const pre = document . createElement ( "pre" ) ;
121121 bookmarklet . appendChild ( pre ) ;
122122 pre . className = "highlight" ;
123- var source = document . createElement ( "code" ) ;
123+ const source = document . createElement ( "code" ) ;
124124 pre . appendChild ( source ) ;
125125 source . textContent = js . trim ( ) ;
126- var edit = document . createElement ( "a" ) ;
126+ const edit = document . createElement ( "a" ) ;
127127 bookmarklet . appendChild ( edit ) ;
128128 edit . textContent = "Edit it!" ;
129129 edit . href = "#editor" ;
130130 edit . onclick = ( function ( a1 , a2 ) {
131131 return function ( ) {
132- var e1 = document . getElementById ( "plaintext" ) ;
132+ const e1 = document . getElementById ( "plaintext" ) ;
133133 e1 . value = a1 ;
134134 e1 . dispatchEvent ( new Event ( "input" ) ) ;
135- var e2 = document . getElementById ( "mininame" ) ;
135+ const e2 = document . getElementById ( "mininame" ) ;
136136 e2 . value = a2 ;
137137 e2 . dispatchEvent ( new Event ( "input" ) ) ;
138138 } ;
0 commit comments