Skip to content

Commit 90f8f78

Browse files
committed
_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 <[email protected]> Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]>
1 parent 4c75404 commit 90f8f78

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

_content/css/styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3832,7 +3832,7 @@ a.error {
38323832
gap: 0.5rem;
38333833
justify-content: flex-end;
38343834
}
3835-
.Playground-selectExample {
3835+
.Playground-selectExample, .Playground-selectGoVersion, .Playground-shareURL {
38363836
background-color: white;
38373837
border-radius: 3px;
38383838
border: 0.0625rem solid #979797;
@@ -3857,7 +3857,7 @@ a.error {
38573857
.Playground-controls {
38583858
flex-wrap: nowrap;
38593859
}
3860-
.Playground-selectExample {
3860+
.Playground-selectExample, .Playground-selectGoVersion, .Playground-shareURL {
38613861
margin: 0 0.4375rem 0 0;
38623862
width: auto;
38633863
}

_content/js/playground.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,9 @@ function PlaygroundOutput(el) {
529529
.focus()
530530
.select();
531531

532+
if (opts.toysEl !== null) {
533+
$(opts.toysEl).hide();
534+
}
532535
if (rewriteHistory) {
533536
var historyData = { code: sharingData };
534537
window.history.pushState(historyData, '', path);

_content/js/playsite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ window.addEventListener('DOMContentLoaded', () => {
1313
"runEl": ".js-playgroundRunEl",
1414
"fmtEl": ".js-playgroundFmtEl",
1515
"shareEl": ".js-playgroundShareEl",
16-
"shareRedirect": "/play/p/",
16+
"shareURLEl": ".js-playgroundShareURLEl",
1717
"toysEl": ".js-playgroundToysEl",
1818
"versionEl": ".js-playgroundVersionEl",
1919
'enableHistory': true,

_content/play.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<button id="share" class="Button js-playgroundShareEl" title="Share this code">Share</button>
2121
{{- end}}
2222
</div>
23+
<input type="text" class="Playground-shareURL js-playgroundShareURLEl" title="Sharing URL" style="display: none;"></input>
2324
<select class="Playground-selectExample js-playgroundToysEl" aria-label="Code examples">
2425
<option value="hello.go">Hello, World!</option>
2526
<option value="life.go">Conway's Game of Life</option>

0 commit comments

Comments
 (0)