Skip to content

Commit 1fa09e8

Browse files
committed
toggling works
Signed-off-by: hanbollar <[email protected]>
1 parent a11bb7b commit 1fa09e8

File tree

5 files changed

+147
-6
lines changed

5 files changed

+147
-6
lines changed

source/_template.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,30 @@
4646

4747
<script type="module" src="$base-url$/static/inline-repl.js"></script>
4848

49+
<script>
50+
function changeVersion(version) {
51+
var currentUrl = window.location.href;
52+
53+
// Identify the part of the URL before the version (assumed to end with '/v/')
54+
var prefixEndIndex = currentUrl.indexOf('/v/') + 3;
55+
var urlPrefix = currentUrl.substring(0, prefixEndIndex);
56+
var remainingUrl = currentUrl.substring(prefixEndIndex);
57+
58+
// Find where the current version info ends (first slash after the version)
59+
var versionEndIndex = remainingUrl.indexOf('/');
60+
var urlSuffix = '';
61+
62+
// Check if there is any suffix
63+
if (versionEndIndex !== -1) {
64+
urlSuffix = remainingUrl.substring(versionEndIndex);
65+
}
66+
var newUrl = urlPrefix + version + urlSuffix;
67+
68+
// Redirect to the new URL
69+
window.location.href = newUrl;
70+
}
71+
</script>
72+
4973
<!-- Sidebar selection -->
5074
<style>
5175
[data-slug="$slug$"] {
@@ -65,6 +89,15 @@
6589
<img src="$base-url$/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
6690
</a>
6791

92+
<section>
93+
<select id="versionSelect" onchange="changeVersion(this.value)">
94+
<option value="main" selected>main</option>
95+
<option value="v0.6.4">v0.6.4 - latest</option>
96+
<option value="v0.6.3">v0.6.3</option>
97+
<option value="v0.6.2">v0.6.2</option>
98+
</select>
99+
</section>
100+
68101
<section>
69102
<div class="section-title">General</div>
70103
$for(pages)$

v-saved/all-saved/main/source/_template.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,30 @@
4646

4747
<script type="module" src="$base-url$/static/inline-repl.js"></script>
4848

49+
<script>
50+
function changeVersion(version) {
51+
var currentUrl = window.location.href;
52+
53+
// Identify the part of the URL before the version (assumed to end with '/v/')
54+
var prefixEndIndex = currentUrl.indexOf('/v/') + 3;
55+
var urlPrefix = currentUrl.substring(0, prefixEndIndex);
56+
var remainingUrl = currentUrl.substring(prefixEndIndex);
57+
58+
// Find where the current version info ends (first slash after the version)
59+
var versionEndIndex = remainingUrl.indexOf('/');
60+
var urlSuffix = '';
61+
62+
// Check if there is any suffix
63+
if (versionEndIndex !== -1) {
64+
urlSuffix = remainingUrl.substring(versionEndIndex);
65+
}
66+
var newUrl = urlPrefix + version + urlSuffix;
67+
68+
// Redirect to the new URL
69+
window.location.href = newUrl;
70+
}
71+
</script>
72+
4973
<!-- Sidebar selection -->
5074
<style>
5175
[data-slug="$slug$"] {
@@ -65,6 +89,15 @@
6589
<img src="$base-url$/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
6690
</a>
6791

92+
<section>
93+
<select id="versionSelect" onchange="changeVersion(this.value)">
94+
<option value="main" selected>main</option>
95+
<option value="v0.6.4">v0.6.4 - latest</option>
96+
<option value="v0.6.3">v0.6.3</option>
97+
<option value="v0.6.2">v0.6.2</option>
98+
</select>
99+
</section>
100+
68101
<section>
69102
<div class="section-title">General</div>
70103
$for(pages)$

v-saved/all-saved/v0.6.2/source/_template.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-css.min.js"></script>
4545
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-html.min.js"></script>
4646

47-
<script type="module" src="/static/inline-repl.js"></script>
47+
<script type="module" src="$base-url$/static/inline-repl.js"></script>
4848

4949
<!-- Sidebar selection -->
5050
<style>
@@ -65,6 +65,15 @@
6565
<img src="$base-url$/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
6666
</a>
6767

68+
<section>
69+
<select id="versionSelect" onchange="changeVersion(this.value)">
70+
<option value="main">main</option>
71+
<option value="v0.6.4">v0.6.4 - latest</option>
72+
<option value="v0.6.3">v0.6.3</option>
73+
<option value="v0.6.2" selected>v0.6.2</option>
74+
</select>
75+
</section>
76+
6877
<section>
6978
<div class="section-title">General</div>
7079
$for(pages)$

v-saved/all-saved/v0.6.3/source/_template.html

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,31 @@
4444
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-css.min.js"></script>
4545
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-html.min.js"></script>
4646

47-
<script type="module" src="/static/inline-repl.js"></script>
47+
<script type="module" src="$base-url$/static/inline-repl.js"></script>
48+
49+
<script>
50+
function changeVersion(version) {
51+
var currentUrl = window.location.href;
52+
53+
// Identify the part of the URL before the version (assumed to end with '/v/')
54+
var prefixEndIndex = currentUrl.indexOf('/v/') + 3;
55+
var urlPrefix = currentUrl.substring(0, prefixEndIndex);
56+
var remainingUrl = currentUrl.substring(prefixEndIndex);
57+
58+
// Find where the current version info ends (first slash after the version)
59+
var versionEndIndex = remainingUrl.indexOf('/');
60+
var urlSuffix = '';
61+
62+
// Check if there is any suffix
63+
if (versionEndIndex !== -1) {
64+
urlSuffix = remainingUrl.substring(versionEndIndex);
65+
}
66+
var newUrl = urlPrefix + version + urlSuffix;
67+
68+
// Redirect to the new URL
69+
window.location.href = newUrl;
70+
}
71+
</script>
4872

4973
<!-- Sidebar selection -->
5074
<style>
@@ -62,9 +86,18 @@
6286

6387
<aside id="sidebar">
6488
<a href="/" class="main-logo">
65-
<img src="/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
89+
<img src="$base-url$/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
6690
</a>
6791

92+
<section>
93+
<select id="versionSelect" onchange="changeVersion(this.value)">
94+
<option value="main">main</option>
95+
<option value="v0.6.4">v0.6.4 - latest</option>
96+
<option value="v0.6.3" selected>v0.6.3</option>
97+
<option value="v0.6.2">v0.6.2</option>
98+
</select>
99+
</section>
100+
68101
<section>
69102
<div class="section-title">General</div>
70103
$for(pages)$

v-saved/all-saved/v0.6.4/source/_template.html

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,31 @@
4444
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-css.min.js"></script>
4545
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-html.min.js"></script>
4646

47-
<script type="module" src="/static/inline-repl.js"></script>
47+
<script type="module" src="$base-url$/static/inline-repl.js"></script>
48+
49+
<script>
50+
function changeVersion(version) {
51+
var currentUrl = window.location.href;
52+
53+
// Identify the part of the URL before the version (assumed to end with '/v/')
54+
var prefixEndIndex = currentUrl.indexOf('/v/') + 3;
55+
var urlPrefix = currentUrl.substring(0, prefixEndIndex);
56+
var remainingUrl = currentUrl.substring(prefixEndIndex);
57+
58+
// Find where the current version info ends (first slash after the version)
59+
var versionEndIndex = remainingUrl.indexOf('/');
60+
var urlSuffix = '';
61+
62+
// Check if there is any suffix
63+
if (versionEndIndex !== -1) {
64+
urlSuffix = remainingUrl.substring(versionEndIndex);
65+
}
66+
var newUrl = urlPrefix + version + urlSuffix;
67+
68+
// Redirect to the new URL
69+
window.location.href = newUrl;
70+
}
71+
</script>
4872

4973
<!-- Sidebar selection -->
5074
<style>
@@ -61,10 +85,19 @@
6185
<div id="dim_layer"></div>
6286

6387
<aside id="sidebar">
64-
<a href="/" class="main-logo">
65-
<img src="/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
88+
<a href="$base-url$/" class="main-logo">
89+
<img src="$base-url$/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
6690
</a>
6791

92+
<section>
93+
<select id="versionSelect" onchange="changeVersion(this.value)">
94+
<option value="main">main</option>
95+
<option value="v0.6.4" selected>v0.6.4 - latest</option>
96+
<option value="v0.6.3">v0.6.3</option>
97+
<option value="v0.6.2">v0.6.2</option>
98+
</select>
99+
</section>
100+
68101
<section>
69102
<div class="section-title">General</div>
70103
$for(pages)$

0 commit comments

Comments
 (0)