File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ function init() {
2626 const runButtons = document . querySelectorAll ( '.run-button' ) ;
2727 const linkButtons = document . querySelectorAll ( '.link-button' ) ;
2828 const resultBlock = document . querySelector ( '.result' ) ;
29+ const backLinkBlock = document . querySelector ( '.back-link' ) ;
30+ const backLink = document . querySelector ( '.back-link a' ) ;
2931
3032 if ( ! codeInput ) return ;
3133
@@ -255,6 +257,14 @@ function init() {
255257 codeInput . dispatchEvent ( event ) ;
256258 }
257259 }
260+
261+ if ( document . referrer !== '' ) {
262+ backLinkBlock . style . display = 'block' ;
263+ backLink . addEventListener ( 'click' , e => {
264+ e . preventDefault ( ) ;
265+ history . back ( ) ;
266+ } ) ;
267+ }
258268}
259269
260270if ( document . readyState === 'loading' ) {
Original file line number Diff line number Diff line change 1+ < div class ="back-link ">
2+ < a href ="# ">
3+ < span class ="icon ">
4+ < svg data-slot ="icon " fill ="none " stroke-width ="1.5 " stroke ="currentColor " viewBox ="0 0 24 24 " xmlns ="http://www.w3.org/2000/svg " aria-hidden ="true ">
5+ < path stroke-linecap ="round " stroke-linejoin ="round " d ="M12 9.75 14.25 12m0 0 2.25 2.25M14.25 12l2.25-2.25M14.25 12 12 14.25m-2.58 4.92-6.374-6.375a1.125 1.125 0 0 1 0-1.59L9.42 4.83c.21-.211.497-.33.795-.33H19.5a2.25 2.25 0 0 1 2.25 2.25v10.5a2.25 2.25 0 0 1-2.25 2.25h-9.284c-.298 0-.585-.119-.795-.33Z "> </ path >
6+ </ svg >
7+ </ span >
8+ Back
9+ </ a >
10+ </ div >
111< h1 > Playground</ h1 >
212< div class ="playground-versions "> {versions-menu}</ div >
313< div class ="sandbox-wrapper ">
Original file line number Diff line number Diff line change 156156 z-index : 3 ;
157157 }
158158}
159+
160+ .back-link {
161+ display : none ;
162+
163+ a {
164+ display : flex ;
165+ align-items : center ;
166+ gap : 0.5rem ;
167+ }
168+ }
You can’t perform that action at this time.
0 commit comments