More menu tweaks.
This commit is contained in:
@ -7,23 +7,26 @@
|
||||
</div>
|
||||
<script>
|
||||
(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');
|
||||
if (window.location.href.indexOf('file://') == 0) {
|
||||
for (var i = 0; i < anchors.length; ++i) {
|
||||
anchors[i].href = anchors[i].href.replace('https://eforth.appspot.com/', './');
|
||||
anchors[i].href = anchors[i].href.replace('https://esp32forth.appspot.com/', './');
|
||||
anchors[i].href = Behead(true, anchors[i].href);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < anchors.length; ++i) {
|
||||
var link = anchors[i].href;
|
||||
link = link.replace('https://eforth.appspot.com/', './');
|
||||
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]) {
|
||||
if (Behead(true, anchors[i].href) == Behead(true, window.location.href)) {
|
||||
if (Behead(false, anchors[i].href) == Behead(false, window.location.href)) {
|
||||
anchors[i].parentElement.classList.add('picked');
|
||||
} else {
|
||||
// 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