mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-18 03:14:06 +00:00
fix:relative url redirect
This commit is contained in:
parent
aaea8d8e04
commit
47faab5a52
|
@ -2,12 +2,18 @@
|
|||
$(function() {
|
||||
$("a").click(function(event) {
|
||||
var link = $(this).attr("href");
|
||||
if (link.indexOf("://") < 0) {
|
||||
var newLink = window.location.href + "/" + link;
|
||||
$(this).attr("href", newLink);
|
||||
var newLink;
|
||||
if (link.startsWith("#")) {
|
||||
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