2022-01-11 12:18:46 +00:00
|
|
|
//document ready
|
2022-07-09 04:52:33 +00:00
|
|
|
(function ($) {
|
|
|
|
$(function () {
|
|
|
|
$(document).on("click", "a", function (event) {
|
2021-12-31 14:15:51 +00:00
|
|
|
var link = $(this).attr("href");
|
2022-07-09 04:52:33 +00:00
|
|
|
if ('string' != typeof (link)) {
|
2022-03-26 02:36:19 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-06-07 13:22:37 +00:00
|
|
|
|
2022-07-09 04:52:33 +00:00
|
|
|
if (link.indexOf("javascript:") >= 0) {
|
2022-06-07 13:22:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-04-09 03:21:32 +00:00
|
|
|
//return if the link is like gdlookup:// or other valid url.
|
2022-07-09 04:52:33 +00:00
|
|
|
if (link.indexOf(":") >= 0) {
|
2022-03-16 14:29:04 +00:00
|
|
|
emitClickedEvent(link);
|
|
|
|
return false;
|
2022-01-02 01:37:43 +00:00
|
|
|
}
|
2022-03-16 14:29:04 +00:00
|
|
|
emitClickedEvent("");
|
2022-01-02 01:37:43 +00:00
|
|
|
|
2022-01-01 13:09:55 +00:00
|
|
|
var newLink;
|
2022-01-09 03:54:14 +00:00
|
|
|
var href = window.location.href;
|
2022-07-09 04:52:33 +00:00
|
|
|
var index = -1;
|
2022-01-01 13:09:55 +00:00
|
|
|
if (link.startsWith("#")) {
|
2022-01-09 03:54:14 +00:00
|
|
|
//the href may contain # fragment already.remove them before append the new #fragment
|
2022-01-11 12:18:46 +00:00
|
|
|
index = href.indexOf("#");
|
2022-07-09 04:52:33 +00:00
|
|
|
if (index > -1) {
|
2022-01-09 03:54:14 +00:00
|
|
|
newLink = href.substring(0, index) + link;
|
2022-07-09 04:52:33 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
newLink = href + link;
|
2022-01-09 03:54:14 +00:00
|
|
|
}
|
2023-04-09 03:21:32 +00:00
|
|
|
}
|
|
|
|
//if hashtag # is not in the start position,it must greater than 0
|
|
|
|
else if (link.indexOf("#")>0) {
|
|
|
|
index = link.indexOf("#");
|
|
|
|
newLink = "gdlookup://localhost/"+link.substring(0,index)+"?gdanchor="+link.substring(index+1);
|
|
|
|
}
|
|
|
|
else {
|
2022-01-11 12:18:46 +00:00
|
|
|
index = href.indexOf("?");
|
2022-03-29 16:20:49 +00:00
|
|
|
|
|
|
|
if (link.indexOf("?gdanchor") > -1) {
|
|
|
|
newLink = "gdlookup://localhost/" + link;
|
2022-01-09 03:54:14 +00:00
|
|
|
}
|
2022-03-29 16:20:49 +00:00
|
|
|
else {
|
|
|
|
if (index > -1) {
|
|
|
|
newLink = href.substring(0, index) + "?word=" + link;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
newLink = href + "?word=" + link;
|
|
|
|
}
|
2022-01-09 03:54:14 +00:00
|
|
|
}
|
2021-12-31 14:15:51 +00:00
|
|
|
}
|
2022-01-01 13:09:55 +00:00
|
|
|
$(this).attr("href", newLink);
|
|
|
|
|
2021-12-31 14:15:51 +00:00
|
|
|
});
|
|
|
|
|
2022-07-09 04:52:33 +00:00
|
|
|
//monitor iframe height.
|
2022-09-04 11:03:27 +00:00
|
|
|
$('iframe').iFrameResize({ checkOrigin:false,maxHeight :800,scrolling:true,warningTimeout:0,minHeight :250,log:true,autoResize:false});
|
2022-01-11 12:18:46 +00:00
|
|
|
});
|
|
|
|
})($_$);
|
2021-12-31 14:15:51 +00:00
|
|
|
|
2022-04-17 14:28:14 +00:00
|
|
|
|