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,10 +2,16 @@
|
|||
$(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