mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
improve:footnote url(#fragment) navigation
This commit is contained in:
parent
3f11826918
commit
29bd94b8a7
|
@ -7,13 +7,28 @@ $(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var newLink;
|
var newLink;
|
||||||
if (link.startsWith("#")) {
|
|
||||||
newLink = window.location.href + link;
|
|
||||||
} else {
|
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
|
|
||||||
|
if (link.startsWith("#")) {
|
||||||
|
//the href may contain # fragment already.remove them before append the new #fragment
|
||||||
|
var index = href.indexOf("#");
|
||||||
|
if(index>-1)
|
||||||
|
{
|
||||||
|
newLink = href.substring(0, index) + link;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
newLink= href+link;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
var index = href.indexOf("?");
|
var index = href.indexOf("?");
|
||||||
|
if(index>-1)
|
||||||
|
{
|
||||||
newLink = href.substring(0, index) + "?word=" + link;
|
newLink = href.substring(0, index) + "?word=" + link;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
newLink=href+"?word=" + link;
|
||||||
|
}
|
||||||
|
}
|
||||||
$(this).attr("href", newLink);
|
$(this).attr("href", newLink);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue