Skip to content

Commit 6ac7ac8

Browse files
committed
Update fill.js
1 parent ce954c2 commit 6ac7ac8

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

javascripts/fill.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ async function init(path) {
5555
ttoc.textContent = "Examples (" + index.length + ")";
5656
var ul = document.createElement("ul");
5757
toc.appendChild(ul);
58-
for (var i = 0; i < index.length; i++) {
58+
var i;
59+
for (i = 0; i < index.length; i++) {
5960
var li = document.createElement("li");
6061
ul.appendChild(li);
6162
li.innerHTML =
@@ -66,10 +67,11 @@ async function init(path) {
6667
"</a>";
6768
}
6869
var loading = document.getElementById("loading");
69-
for (var i = 0; i < index.length; i++) {
70+
var j;
71+
for (j = 0; j < index.length; j++) {
7072
loading.textContent += ".";
7173
content.push(document.createElement("hr"));
72-
console.debug("Adding " + index[i].name);
74+
console.debug("Adding " + index[j].name);
7375
var bookmarklet = document.createElement("section");
7476
content.push(bookmarklet);
7577
bookmarklet.className = "bookmarklet";
@@ -78,27 +80,27 @@ async function init(path) {
7880
var tlink = document.createElement("a");
7981
title.appendChild(tlink);
8082
tlink.className = "name";
81-
tlink.id = normalize(index[i].name);
82-
tlink.textContent = index[i].name;
83+
tlink.id = normalize(index[j].name);
84+
tlink.textContent = index[j].name;
8385
var desc = document.createElement("h4");
8486
bookmarklet.appendChild(desc);
8587
desc.textContent = "Description";
8688
var description = document.createElement("p");
8789
bookmarklet.appendChild(description);
88-
description.textContent = index[i].description;
89-
console.debug("Fetching source code for " + index[i].name);
90+
description.textContent = index[j].description;
91+
console.debug("Fetching source code for " + index[j].name);
9092
var js = await fetch(
9193
"https://raw.githubusercontent.com/" +
9294
path +
9395
"/main/javascripts/" +
94-
encodeURIComponent(index[i].name) +
96+
encodeURIComponent(index[j].name) +
9597
".js"
9698
)
9799
.then(function (response) {
98100
return response.text();
99101
})
100102
.catch(console.error);
101-
console.debug("Fetched source code for " + index[i].name);
103+
console.debug("Fetched source code for " + index[j].name);
102104
var book = document.createElement("h4");
103105
bookmarklet.appendChild(book);
104106
book.textContent = "Bookmarklet";
@@ -108,7 +110,7 @@ async function init(path) {
108110
'Drag and drop or bookmark this link: <a href="' +
109111
minify(js) +
110112
'">' +
111-
index[i].name +
113+
index[j].name +
112114
"</a>";
113115
var code = document.createElement("h4");
114116
bookmarklet.appendChild(code);
@@ -132,7 +134,7 @@ async function init(path) {
132134
e2.value = a2;
133135
e2.dispatchEvent(new Event("input"));
134136
};
135-
})(js, index[i].name);
137+
})(js, index[j].name);
136138
}
137139
content.push(document.createElement("hr"));
138140
document.getElementById("bookmarklets").replaceChildren(...content);

0 commit comments

Comments
 (0)