mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
godoc/static: use window scope for checking notesEnabled
This prevents a JS error when the notes are not present. Change-Id: Ib8875306027b7e43441310d4228c690e2249056e Reviewed-on: https://go-review.googlesource.com/24963 Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
parent
6d32be89d5
commit
681db090d9
@ -44,7 +44,7 @@ function initPlayground(transport) {
|
|||||||
|
|
||||||
function onKill() {
|
function onKill() {
|
||||||
if (running) running.Kill();
|
if (running) running.Kill();
|
||||||
if (notesEnabled) updatePlayStorage('onKill', index);
|
if (window.notesEnabled) updatePlayStorage('onKill', index);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRun(e) {
|
function onRun(e) {
|
||||||
@ -55,17 +55,17 @@ function initPlayground(transport) {
|
|||||||
run1.style.display = 'none';
|
run1.style.display = 'none';
|
||||||
var options = {Race: sk};
|
var options = {Race: sk};
|
||||||
running = transport.Run(text(code), PlaygroundOutput(outpre), options);
|
running = transport.Run(text(code), PlaygroundOutput(outpre), options);
|
||||||
if (notesEnabled) updatePlayStorage('onRun', index, e);
|
if (window.notesEnabled) updatePlayStorage('onRun', index, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClose() {
|
function onClose() {
|
||||||
if (running) running.Kill();
|
if (running) running.Kill();
|
||||||
output.style.display = 'none';
|
output.style.display = 'none';
|
||||||
run1.style.display = 'inline-block';
|
run1.style.display = 'inline-block';
|
||||||
if (notesEnabled) updatePlayStorage('onClose', index);
|
if (window.notesEnabled) updatePlayStorage('onClose', index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notesEnabled) {
|
if (window.notesEnabled) {
|
||||||
playgroundHandlers.onRun.push(onRun);
|
playgroundHandlers.onRun.push(onRun);
|
||||||
playgroundHandlers.onClose.push(onClose);
|
playgroundHandlers.onClose.push(onClose);
|
||||||
playgroundHandlers.onKill.push(onKill);
|
playgroundHandlers.onKill.push(onKill);
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user