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:
Andrew Gerrand 2016-07-17 00:15:30 -07:00
parent 6d32be89d5
commit 681db090d9
2 changed files with 9 additions and 9 deletions

View File

@ -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