mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 19:08:32 +08:00
Merge branch 'joncampbell123:gh-pages' into gh-pages
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
let frame = document.querySelector("main").appendChild(document.querySelector("#empty-iframe").content.querySelector("iframe"));
|
let frame = document.querySelector("main").appendChild(
|
||||||
|
document.querySelector("#empty-iframe").content.querySelector("iframe"));
|
||||||
|
|
||||||
if (localStorage && localStorage.getItem("wiki_fake_spa_opt_out")) {
|
if (localStorage && localStorage.getItem("wiki_fake_spa_opt_out")) {
|
||||||
window.open("./Home", frame.name);
|
window.open("./Home", frame.name);
|
||||||
@@ -16,25 +17,32 @@
|
|||||||
let bottomLocation = frame.contentWindow.location;
|
let bottomLocation = frame.contentWindow.location;
|
||||||
if (bottomLocation.host != location.host || !bottomLocation.pathname.startsWith(contentDir))
|
if (bottomLocation.host != location.host || !bottomLocation.pathname.startsWith(contentDir))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let strippedPathname = bottomLocation.pathname.substring(contentDir.length)
|
let strippedPathname = bottomLocation.pathname.substring(contentDir.length)
|
||||||
.replace(/(?:.html)?(?:\/)?$/, "");
|
.replace(/(?:.html)?(?:\/)?$/, "");
|
||||||
|
|
||||||
|
// We can't go by the actual page title because they usually just contain the text of the top
|
||||||
|
// header
|
||||||
|
let title = decodeURIComponent(strippedPathname).replaceAll("-", " ") + " - DOSBox-X Wiki";
|
||||||
|
if (document.title != title)
|
||||||
|
document.title = title;
|
||||||
|
|
||||||
// FIXME: Is this even correct?
|
// FIXME: Is this even correct?
|
||||||
let relUrl = "#" + encodeURI(decodeURIComponent(
|
let relUrl = "#" + encodeURI(decodeURIComponent(
|
||||||
strippedPathname + bottomLocation.search + bottomLocation.hash
|
strippedPathname + bottomLocation.search + bottomLocation.hash
|
||||||
));
|
));
|
||||||
// We can't go by the actual page title because they usually just contain the text of the top
|
|
||||||
// header
|
|
||||||
document.title = decodeURIComponent(strippedPathname).replaceAll("-", " ") + " - DOSBox-X Wiki";
|
|
||||||
if (location.hash != relUrl) {
|
|
||||||
const url = new URL(location);
|
const url = new URL(location);
|
||||||
url.hash = relUrl;
|
url.hash = relUrl;
|
||||||
|
if (location.hash != url.hash) {
|
||||||
history.pushState({}, "", url);
|
history.pushState({}, "", url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeBottomUrl() {
|
function changeBottomUrl() {
|
||||||
let bottomLocation = frame.contentWindow.location;
|
let bottomLocation = frame.contentWindow.location;
|
||||||
let dest = contentDir + location.hash.substring(1);
|
let dest = contentDir + location.hash.substring(1);
|
||||||
let destUrl = new URL(dest, serverRoot), destUrlWithHtmlExt = destUrl;
|
let destUrl = new URL(dest, serverRoot);
|
||||||
|
let destUrlWithHtmlExt = new URL(destUrl);
|
||||||
if (destUrl.host != location.host || !destUrl.pathname.startsWith(contentDir)) {
|
if (destUrl.host != location.host || !destUrl.pathname.startsWith(contentDir)) {
|
||||||
console.error(`Did not navigate to ${dest} as it escapes ${serverRoot}${contentDir}.`);
|
console.error(`Did not navigate to ${dest} as it escapes ${serverRoot}${contentDir}.`);
|
||||||
return false;
|
return false;
|
||||||
@@ -43,7 +51,7 @@
|
|||||||
destUrlWithHtmlExt.pathname += ".html";
|
destUrlWithHtmlExt.pathname += ".html";
|
||||||
try {
|
try {
|
||||||
if (destUrl.href != bottomLocation.href && destUrlWithHtmlExt.href != bottomLocation.href)
|
if (destUrl.href != bottomLocation.href && destUrlWithHtmlExt.href != bottomLocation.href)
|
||||||
window.open(destUrl, frame.name);
|
bottomLocation.replace(destUrl.href);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`Could not navigate to ${dest}.`, err);
|
console.error(`Could not navigate to ${dest}.`, err);
|
||||||
return false;
|
return false;
|
||||||
@@ -55,12 +63,14 @@
|
|||||||
window.open("./Home", frame.name);
|
window.open("./Home", frame.name);
|
||||||
window.addEventListener("hashchange", changeBottomUrl);
|
window.addEventListener("hashchange", changeBottomUrl);
|
||||||
frame.addEventListener("load", () => {
|
frame.addEventListener("load", () => {
|
||||||
document.querySelector("#wiki-try-reloading").style.opacity = "0.25";
|
document.querySelector("#wiki-try-reloading").style.opacity = 0.25;
|
||||||
if (!frame.contentDocument)
|
if (!frame.contentDocument)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
changeHash();
|
changeHash();
|
||||||
frame.contentWindow.addEventListener("popstate", changeHash);
|
frame.contentWindow.addEventListener("popstate", changeHash);
|
||||||
if (frame.contentWindow.navigation)
|
|
||||||
|
if (frame.contentWindow.navigation) {
|
||||||
frame.contentWindow.navigation.addEventListener("navigate", (e) => {
|
frame.contentWindow.navigation.addEventListener("navigate", (e) => {
|
||||||
const url = new URL(e.destination.url);
|
const url = new URL(e.destination.url);
|
||||||
if (url.host != location.host || !url.pathname.startsWith(contentDir)) {
|
if (url.host != location.host || !url.pathname.startsWith(contentDir)) {
|
||||||
@@ -68,5 +78,6 @@
|
|||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
12
wiki/Guide:Regional-settings-in-DOSBox‐X.html
generated
12
wiki/Guide:Regional-settings-in-DOSBox‐X.html
generated
@@ -345,15 +345,27 @@ DOSBox-X will accept any other country code not listed above, but in that case w
|
|||||||
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/fr/fr_FR.lng?raw=true">fr_FR.lng</a></p>
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/fr/fr_FR.lng?raw=true">fr_FR.lng</a></p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/hu/hu_HU.lng?raw=true">hu_HU.lng</a></p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/it/it_IT.lng?raw=true">it_IT.lng</a></p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/ja/ja_JP.lng?raw=true">ja_JP.lng</a></p>
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/ja/ja_JP.lng?raw=true">ja_JP.lng</a></p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/ko/ko_KR.lng?raw=true">ko_KR.lng</a></p>
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/ko/ko_KR.lng?raw=true">ko_KR.lng</a></p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/nl/nl_NL.lng?raw=true">nl_NL.lng</a></p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/pt/pt_BR.lng?raw=true">pt_BR.lng</a></p>
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/pt/pt_BR.lng?raw=true">pt_BR.lng</a></p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/ru/ru_RU.lng?raw=true">ru_RU.lng</a></p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/tr/tr_TR.lng?raw=true">tr_TR.lng</a></p>
|
<p><a href="https://github.com/joncampbell123/dosbox-x/blob/master/contrib/translations/tr/tr_TR.lng?raw=true">tr_TR.lng</a></p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
Reference in New Issue
Block a user