docs: API Reference now presents _index.html_ instead of _full.hml_

This commit is contained in:
Mateusz Pusz
2024-10-30 13:07:55 +01:00
parent 1aac89f412
commit 574dfd133d

View File

@ -37,17 +37,12 @@ apiIframe = document.getElementById('apiIframe');
hash = window.location.hash; hash = window.location.hash;
if (hash.length == 0) { if (hash.length == 0) {
// sets default hash for the API Reference // sets default hash for the API Reference
hash = "#full"; hash = "#index.html";
history.pushState(null, "", hash); history.pushState(null, "", hash);
} }
// set the iframe source based on the hash in the URL // set the iframe source based on the hash in the URL
if (hash.startsWith("#wg21.link/")) { apiIframe.src = "gen/" + hash.slice(1);
apiIframe.src = "https://" + hash.slice(1);
apiIframe.height = 900;
}
else
apiIframe.src = "gen/" + hash.slice(1) + ".html";
// receives content height from the subpage displayed in the iframe // receives content height from the subpage displayed in the iframe
// works only for the pages in the same domain as the main docs // works only for the pages in the same domain as the main docs
@ -57,18 +52,15 @@ iFrameResize({
// obtains the link URL clicked in the subpage // obtains the link URL clicked in the subpage
onMessage: function(messageData) { onMessage: function(messageData) {
url = messageData.message; url = messageData.message;
if (url.startsWith("https://wg21.link/")) { if (url.search("api_reference/gen") == -1) {
hash = '#' + messageData.message.replace("https://", ""); window.open(url);
} }
else { else {
pos = messageData.message.indexOf('#'); pos_start = messageData.message.lastIndexOf('/');
if(pos == -1) { hash = '#' + messageData.message.slice(pos_start + 1)
pos = messageData.message.lastIndexOf('/'); history.pushState(null, "", hash);
} window.location.reload();
hash = '#' + messageData.message.slice(pos + 1);
} }
history.pushState(null, "", hash);
window.location.reload();
} }
},'#apiIframe') },'#apiIframe')
</script> </script>