From 49a53ce555ae2a6c6918cae711b8e26a8b9833e8 Mon Sep 17 00:00:00 2001 From: passionSeven Date: Tue, 30 Nov 2021 15:42:36 -0500 Subject: [PATCH] _content: fix go.dev/play share not to reload page Mainly the JS invocation was set up wrong. Also add the display box for the share URL back, and style the share URL box and the Go release box the same as the example selector box. Also hide the example box when sharing. This used to happen somewhat accidentally on play.golang.org. Make it intentional. Fixes golang/go#49766. Change-Id: Ib297feff123f6fdabebe24cf868a54874c5afc83 Reviewed-on: https://go-review.googlesource.com/c/website/+/368014 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Jamal Carvalho --- _content/css/styles.css | 4 ++-- _content/js/playground.js | 3 +++ _content/js/playsite.js | 2 +- _content/play.tmpl | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/_content/css/styles.css b/_content/css/styles.css index b478ee55..77695f92 100644 --- a/_content/css/styles.css +++ b/_content/css/styles.css @@ -3832,7 +3832,7 @@ a.error { gap: 0.5rem; justify-content: flex-end; } -.Playground-selectExample { +.Playground-selectExample, .Playground-selectGoVersion, .Playground-shareURL { background-color: white; border-radius: 3px; border: 0.0625rem solid #979797; @@ -3857,7 +3857,7 @@ a.error { .Playground-controls { flex-wrap: nowrap; } - .Playground-selectExample { + .Playground-selectExample, .Playground-selectGoVersion, .Playground-shareURL { margin: 0 0.4375rem 0 0; width: auto; } diff --git a/_content/js/playground.js b/_content/js/playground.js index 6f02e598..eb42c718 100644 --- a/_content/js/playground.js +++ b/_content/js/playground.js @@ -529,6 +529,9 @@ function PlaygroundOutput(el) { .focus() .select(); + if (opts.toysEl !== null) { + $(opts.toysEl).hide(); + } if (rewriteHistory) { var historyData = { code: sharingData }; window.history.pushState(historyData, '', path); diff --git a/_content/js/playsite.js b/_content/js/playsite.js index bd3dbab8..b43b3ff7 100644 --- a/_content/js/playsite.js +++ b/_content/js/playsite.js @@ -13,7 +13,7 @@ window.addEventListener('DOMContentLoaded', () => { "runEl": ".js-playgroundRunEl", "fmtEl": ".js-playgroundFmtEl", "shareEl": ".js-playgroundShareEl", - "shareRedirect": "/play/p/", + "shareURLEl": ".js-playgroundShareURLEl", "toysEl": ".js-playgroundToysEl", "versionEl": ".js-playgroundVersionEl", 'enableHistory': true, diff --git a/_content/play.tmpl b/_content/play.tmpl index 6900d026..f7abe78d 100644 --- a/_content/play.tmpl +++ b/_content/play.tmpl @@ -20,6 +20,7 @@ {{- end}} +