Skip to content

Commit

Permalink
toggling works
Browse files Browse the repository at this point in the history
Signed-off-by: hanbollar <[email protected]>
  • Loading branch information
hanbollar committed May 22, 2024
1 parent a11bb7b commit 1fa09e8
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 6 deletions.
33 changes: 33 additions & 0 deletions source/_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@

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

<script>
function changeVersion(version) {
var currentUrl = window.location.href;

// Identify the part of the URL before the version (assumed to end with '/v/')
var prefixEndIndex = currentUrl.indexOf('/v/') + 3;
var urlPrefix = currentUrl.substring(0, prefixEndIndex);
var remainingUrl = currentUrl.substring(prefixEndIndex);

// Find where the current version info ends (first slash after the version)
var versionEndIndex = remainingUrl.indexOf('/');
var urlSuffix = '';

// Check if there is any suffix
if (versionEndIndex !== -1) {
urlSuffix = remainingUrl.substring(versionEndIndex);
}
var newUrl = urlPrefix + version + urlSuffix;

// Redirect to the new URL
window.location.href = newUrl;
}
</script>

<!-- Sidebar selection -->
<style>
[data-slug="$slug$"] {
Expand All @@ -65,6 +89,15 @@
<img src="$base-url$/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
</a>

<section>
<select id="versionSelect" onchange="changeVersion(this.value)">
<option value="main" selected>main</option>
<option value="v0.6.4">v0.6.4 - latest</option>
<option value="v0.6.3">v0.6.3</option>
<option value="v0.6.2">v0.6.2</option>
</select>
</section>

<section>
<div class="section-title">General</div>
$for(pages)$
Expand Down
33 changes: 33 additions & 0 deletions v-saved/all-saved/main/source/_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@

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

<script>
function changeVersion(version) {
var currentUrl = window.location.href;

// Identify the part of the URL before the version (assumed to end with '/v/')
var prefixEndIndex = currentUrl.indexOf('/v/') + 3;
var urlPrefix = currentUrl.substring(0, prefixEndIndex);
var remainingUrl = currentUrl.substring(prefixEndIndex);

// Find where the current version info ends (first slash after the version)
var versionEndIndex = remainingUrl.indexOf('/');
var urlSuffix = '';

// Check if there is any suffix
if (versionEndIndex !== -1) {
urlSuffix = remainingUrl.substring(versionEndIndex);
}
var newUrl = urlPrefix + version + urlSuffix;

// Redirect to the new URL
window.location.href = newUrl;
}
</script>

<!-- Sidebar selection -->
<style>
[data-slug="$slug$"] {
Expand All @@ -65,6 +89,15 @@
<img src="$base-url$/static/mrjs-logo.svg" alt="The MRjs logo, an indigo and purple bowtie." width="110" height="30" />
</a>

<section>
<select id="versionSelect" onchange="changeVersion(this.value)">
<option value="main" selected>main</option>
<option value="v0.6.4">v0.6.4 - latest</option>
<option value="v0.6.3">v0.6.3</option>
<option value="v0.6.2">v0.6.2</option>
</select>
</section>

<section>
<div class="section-title">General</div>
$for(pages)$
Expand Down
11 changes: 10 additions & 1 deletion v-saved/all-saved/v0.6.2/source/_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-html.min.js"></script>

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

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

<section>
<select id="versionSelect" onchange="changeVersion(this.value)">
<option value="main">main</option>
<option value="v0.6.4">v0.6.4 - latest</option>
<option value="v0.6.3">v0.6.3</option>
<option value="v0.6.2" selected>v0.6.2</option>
</select>
</section>

<section>
<div class="section-title">General</div>
$for(pages)$
Expand Down
37 changes: 35 additions & 2 deletions v-saved/all-saved/v0.6.3/source/_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,31 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-html.min.js"></script>

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

<script>
function changeVersion(version) {
var currentUrl = window.location.href;

// Identify the part of the URL before the version (assumed to end with '/v/')
var prefixEndIndex = currentUrl.indexOf('/v/') + 3;
var urlPrefix = currentUrl.substring(0, prefixEndIndex);
var remainingUrl = currentUrl.substring(prefixEndIndex);

// Find where the current version info ends (first slash after the version)
var versionEndIndex = remainingUrl.indexOf('/');
var urlSuffix = '';

// Check if there is any suffix
if (versionEndIndex !== -1) {
urlSuffix = remainingUrl.substring(versionEndIndex);
}
var newUrl = urlPrefix + version + urlSuffix;

// Redirect to the new URL
window.location.href = newUrl;
}
</script>

<!-- Sidebar selection -->
<style>
Expand All @@ -62,9 +86,18 @@

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

<section>
<select id="versionSelect" onchange="changeVersion(this.value)">
<option value="main">main</option>
<option value="v0.6.4">v0.6.4 - latest</option>
<option value="v0.6.3" selected>v0.6.3</option>
<option value="v0.6.2">v0.6.2</option>
</select>
</section>

<section>
<div class="section-title">General</div>
$for(pages)$
Expand Down
39 changes: 36 additions & 3 deletions v-saved/all-saved/v0.6.4/source/_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,31 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.14.11/beautify-html.min.js"></script>

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

<script>
function changeVersion(version) {
var currentUrl = window.location.href;

// Identify the part of the URL before the version (assumed to end with '/v/')
var prefixEndIndex = currentUrl.indexOf('/v/') + 3;
var urlPrefix = currentUrl.substring(0, prefixEndIndex);
var remainingUrl = currentUrl.substring(prefixEndIndex);

// Find where the current version info ends (first slash after the version)
var versionEndIndex = remainingUrl.indexOf('/');
var urlSuffix = '';

// Check if there is any suffix
if (versionEndIndex !== -1) {
urlSuffix = remainingUrl.substring(versionEndIndex);
}
var newUrl = urlPrefix + version + urlSuffix;

// Redirect to the new URL
window.location.href = newUrl;
}
</script>

<!-- Sidebar selection -->
<style>
Expand All @@ -61,10 +85,19 @@
<div id="dim_layer"></div>

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

<section>
<select id="versionSelect" onchange="changeVersion(this.value)">
<option value="main">main</option>
<option value="v0.6.4" selected>v0.6.4 - latest</option>
<option value="v0.6.3">v0.6.3</option>
<option value="v0.6.2">v0.6.2</option>
</select>
</section>

<section>
<div class="section-title">General</div>
$for(pages)$
Expand Down

0 comments on commit 1fa09e8

Please sign in to comment.