Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle percent-escaped hash in target URL fragment #199

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions pgidocgen/gen/data/index/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
function applyHash() {
// takes the current hash loads the path into the content frame

var hash = window.location.hash;
var hash = window.location.hash.substring(1);
var elm = document.getElementById('Content');
var new_src;

if(hash) {
// needed for webkit
if(!endsWith(hash, ".html") && !endsWith(hash, "/") && hash.indexOf("#", 1) < 0)
hash += "/";

new_src = hash.substring(1);
} else {
new_src= main_page;
var new_src = main_page;

if (hash) {
if (hash.indexOf("#") < 0) {
if (hash.indexOf("%23") > 0)
// unescape only first percent-escaped hash
hash = hash.replace("%23", "#");
else if (!endsWith(hash, ".html") && !endsWith(hash, "/"))
hash += "/"; // needed for webkit
}
new_src = hash;
}

// create a dummy element so we can compare the URLs; prevents
Expand Down