Skip to content

Commit d6b30d3

Browse files
committed
Lint client-side sandbox code
1 parent 76d471a commit d6b30d3

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

html/js/code.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ addEventListener("load", () => {
4949
return chapterData[i]
5050
}
5151

52-
function getURL(url, callback) {
53-
let req = new XMLHttpRequest()
54-
req.open("GET", url, true)
55-
req.addEventListener("load", () => {
56-
if (req.status < 400)
57-
callback(null, req.responseText)
58-
else
59-
callback(new Error("Request failed: " + req.statusText))
60-
})
61-
req.addEventListener("error", () => {
62-
callback(new Error("Network error"))
63-
})
64-
req.send(null)
65-
}
66-
6752
let per = document.querySelector("#per_chapter")
6853
per.addEventListener("change", () => {
6954
selectContext(per.value)

html/js/ejs.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ window.addEventListener("load", () => {
148148
function runCode(data) {
149149
data.output.clear()
150150
let val = data.editor.getValue()
151-
let sb = data.sandbox
152151
getSandbox(data.sandbox, data.isHTML, box => {
153152
if (data.isHTML)
154153
box.setHTML(val, data.output, () => {
@@ -208,9 +207,9 @@ window.addEventListener("load", () => {
208207
}
209208

210209
function placeFrame(frame, snippet) {
211-
let wrap = snippet.previousSibling
210+
let wrap = snippet.previousSibling, bot
212211
if (!wrap || wrap.className != "editor-wrap") {
213-
let bot = snippet.getBoundingClientRect().bottom
212+
bot = snippet.getBoundingClientRect().bottom
214213
activateCode(snippet, null, "text/html")
215214
wrap = snippet.previousSibling
216215
} else {

html/js/sandbox.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
function loaded() {
3333
frame.removeEventListener("load", loaded)
34-
let box = new SandBox(options, frame)
34+
let box = new SandBox(frame)
3535

3636
promiseChain((options.loadFiles || []).map(file => () => {
3737
let script = box.win.document.createElement("script")
@@ -43,7 +43,7 @@
4343
})
4444
}
4545

46-
constructor(options, frame) {
46+
constructor(frame) {
4747
this.startedAt = null
4848
this.extraSecs = 2
4949
this.output = null
@@ -387,7 +387,7 @@
387387
return known || resp.text().then(code => resolved.store(found, {name: found, code}))
388388
}))
389389

390-
let Output = SandBox.Output = class {
390+
SandBox.Output = class {
391391
constructor(div) { this.div = div }
392392

393393
clear() {

0 commit comments

Comments
 (0)