mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
Merge branch 'joncampbell123:gh-pages' into gh-pages
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
"use strict";
|
||||
|
||||
(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")) {
|
||||
window.open("./Home", frame.name);
|
||||
@@ -16,25 +17,32 @@
|
||||
let bottomLocation = frame.contentWindow.location;
|
||||
if (bottomLocation.host != location.host || !bottomLocation.pathname.startsWith(contentDir))
|
||||
return;
|
||||
|
||||
let strippedPathname = bottomLocation.pathname.substring(contentDir.length)
|
||||
.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?
|
||||
let relUrl = "#" + encodeURI(decodeURIComponent(
|
||||
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);
|
||||
url.hash = relUrl;
|
||||
const url = new URL(location);
|
||||
url.hash = relUrl;
|
||||
if (location.hash != url.hash) {
|
||||
history.pushState({}, "", url);
|
||||
}
|
||||
}
|
||||
|
||||
function changeBottomUrl() {
|
||||
let bottomLocation = frame.contentWindow.location;
|
||||
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)) {
|
||||
console.error(`Did not navigate to ${dest} as it escapes ${serverRoot}${contentDir}.`);
|
||||
return false;
|
||||
@@ -43,7 +51,7 @@
|
||||
destUrlWithHtmlExt.pathname += ".html";
|
||||
try {
|
||||
if (destUrl.href != bottomLocation.href && destUrlWithHtmlExt.href != bottomLocation.href)
|
||||
window.open(destUrl, frame.name);
|
||||
bottomLocation.replace(destUrl.href);
|
||||
} catch (err) {
|
||||
console.error(`Could not navigate to ${dest}.`, err);
|
||||
return false;
|
||||
@@ -55,12 +63,14 @@
|
||||
window.open("./Home", frame.name);
|
||||
window.addEventListener("hashchange", changeBottomUrl);
|
||||
frame.addEventListener("load", () => {
|
||||
document.querySelector("#wiki-try-reloading").style.opacity = "0.25";
|
||||
document.querySelector("#wiki-try-reloading").style.opacity = 0.25;
|
||||
if (!frame.contentDocument)
|
||||
return;
|
||||
|
||||
changeHash();
|
||||
frame.contentWindow.addEventListener("popstate", changeHash);
|
||||
if (frame.contentWindow.navigation)
|
||||
|
||||
if (frame.contentWindow.navigation) {
|
||||
frame.contentWindow.navigation.addEventListener("navigate", (e) => {
|
||||
const url = new URL(e.destination.url);
|
||||
if (url.host != location.host || !url.pathname.startsWith(contentDir)) {
|
||||
@@ -68,5 +78,6 @@
|
||||
window.open(url, "_blank");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
14
wiki/Guide:Regional-settings-in-DOSBox‐X.html
generated
14
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>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</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>
|
||||
</li>
|
||||
<li>
|
||||
@@ -992,4 +1004,4 @@ As such when using the SDL1 version, DOSBox-X will automatically decide whether
|
||||
</div>
|
||||
<script src="./docinfo/copy-to-clipboard.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user