Skip to content

Commit 070d243

Browse files
committed
Fix jsonp
1 parent b899da0 commit 070d243

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

background.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ function func(rand, opts, op, msg) {
360360
}
361361

362362
function draw(str, to, first, box) {
363-
var afterColon
363+
var afterColon, tmp
364364
, spaces = ""
365365
, node = div.cloneNode()
366366
, link = el("a", 0, "l")
@@ -394,7 +394,7 @@ function func(rand, opts, op, msg) {
394394
if (nav.serverTiming && nav.serverTiming.length) el("div", node, "p").textContent = "// serverTiming: " + JSON.stringify(nav.serverTiming)
395395
} catch(e) {}
396396
try {
397-
window.data = str ? JSON.parse(str) : Error("Empty JSON")
397+
window.data = str ? JSON.parse(jsonp ? jsonp[2] : str) : Error("Empty JSON")
398398
} catch(e) {
399399
el("div", node, "e").textContent = e
400400
}
@@ -430,7 +430,8 @@ function func(rand, opts, op, msg) {
430430
}
431431
loop(jsonp ? jsonp[2] : str, re)
432432
if (jsonp) {
433-
body.lastChild.firstChild.firstChild.textContent = jsonp[1] + body.lastChild.firstChild.firstChild.textContent
433+
tmp = body.querySelector("i")
434+
tmp.textContent = jsonp[1] + tmp.textContent
434435
body.lastChild.lastChild.textContent += jsonp[3]
435436
}
436437

0 commit comments

Comments
 (0)