mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
fix:relative url redirect
This commit is contained in:
parent
aaea8d8e04
commit
47faab5a52
|
@ -2,12 +2,18 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
$("a").click(function(event) {
|
$("a").click(function(event) {
|
||||||
var link = $(this).attr("href");
|
var link = $(this).attr("href");
|
||||||
if (link.indexOf("://") < 0) {
|
var newLink;
|
||||||
var newLink = window.location.href + "/" + link;
|
if (link.startsWith("#")) {
|
||||||
$(this).attr("href", newLink);
|
newLink = window.location.href + link;
|
||||||
|
} else {
|
||||||
|
var href = window.location.href;
|
||||||
|
var index = href.indexOf("?");
|
||||||
|
newLink = href.substring(0, index) + "?word=" + link;
|
||||||
}
|
}
|
||||||
|
$(this).attr("href", newLink);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue