More menu tweaks.
This commit is contained in:
@ -7,23 +7,26 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
|
function Behead(full, link) {
|
||||||
|
if (full) {
|
||||||
|
link = link.replace('https://eforth.appspot.com/', './');
|
||||||
|
link = link.replace('https://esp32forth.appspot.com/', './');
|
||||||
|
}
|
||||||
|
return link.split('?')[0];
|
||||||
|
}
|
||||||
var anchors = document.getElementsByTagName('a');
|
var anchors = document.getElementsByTagName('a');
|
||||||
if (window.location.href.indexOf('file://') == 0) {
|
if (window.location.href.indexOf('file://') == 0) {
|
||||||
for (var i = 0; i < anchors.length; ++i) {
|
for (var i = 0; i < anchors.length; ++i) {
|
||||||
anchors[i].href = anchors[i].href.replace('https://eforth.appspot.com/', './');
|
anchors[i].href = Behead(true, anchors[i].href);
|
||||||
anchors[i].href = anchors[i].href.replace('https://esp32forth.appspot.com/', './');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i = 0; i < anchors.length; ++i) {
|
for (var i = 0; i < anchors.length; ++i) {
|
||||||
var link = anchors[i].href;
|
if (Behead(true, anchors[i].href) == Behead(true, window.location.href)) {
|
||||||
link = link.replace('https://eforth.appspot.com/', './');
|
if (Behead(false, anchors[i].href) == Behead(false, window.location.href)) {
|
||||||
link = link.replace('https://esp32forth.appspot.com/', './');
|
|
||||||
if (link.split('?')[0] == window.location.href.split('?')[0]) {
|
|
||||||
if (anchors[i].href.split('?')[0] == window.location.href.split('?')[0]) {
|
|
||||||
anchors[i].parentElement.classList.add('picked');
|
anchors[i].parentElement.classList.add('picked');
|
||||||
} else {
|
} else {
|
||||||
// Redirect if on the wrong host.
|
// Redirect if on the wrong host.
|
||||||
window.location.replace(anchors[i].ref);
|
window.location.replace(anchors[i].href);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user