2022-01-11 12:18:46 +00:00
|
|
|
//document ready
|
|
|
|
(function($){
|
2021-12-31 14:15:51 +00:00
|
|
|
$(function() {
|
|
|
|
$("a").click(function(event) {
|
|
|
|
var link = $(this).attr("href");
|
2022-01-14 00:19:49 +00:00
|
|
|
emitClickedEvent(link);
|
2022-01-03 23:47:48 +00:00
|
|
|
if(link.indexOf(":")>=0){
|
2022-01-02 01:37:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-01 13:09:55 +00:00
|
|
|
var newLink;
|
2022-01-09 03:54:14 +00:00
|
|
|
var href = window.location.href;
|
2022-01-11 12:18:46 +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-01-09 03:54:14 +00:00
|
|
|
if(index>-1)
|
|
|
|
{
|
|
|
|
newLink = href.substring(0, index) + link;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
newLink= href+link;
|
|
|
|
}
|
2022-01-01 13:09:55 +00:00
|
|
|
} else {
|
2022-01-11 12:18:46 +00:00
|
|
|
index = href.indexOf("?");
|
2022-01-09 03:54:14 +00:00
|
|
|
if(index>-1)
|
|
|
|
{
|
|
|
|
newLink = href.substring(0, index) + "?word=" + link;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
newLink=href+"?word=" + link;
|
|
|
|
}
|
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-01-11 12:18:46 +00:00
|
|
|
});
|
|
|
|
})($_$);
|
2021-12-31 14:15:51 +00:00
|
|
|
|
2022-01-03 04:00:50 +00:00
|
|
|
function playSound(sound) {
|
2022-01-11 12:18:46 +00:00
|
|
|
var a = new Audio(sound);
|
|
|
|
a.play();
|
|
|
|
}
|
2022-01-14 00:19:49 +00:00
|
|
|
|
2022-01-31 01:36:52 +00:00
|
|
|
function emitClickedEvent(link) {
|
|
|
|
try {
|
2022-01-14 00:19:49 +00:00
|
|
|
articleview.linkClickedInHtml(link);
|
2022-01-31 01:36:52 +00:00
|
|
|
} catch (error) {
|
2022-01-20 12:43:42 +00:00
|
|
|
console.error(error);
|
2022-01-14 00:19:49 +00:00
|
|
|
}
|
2022-01-31 01:36:52 +00:00
|
|
|
}
|
2022-01-14 00:19:49 +00:00
|
|
|
|
2022-01-31 01:36:52 +00:00
|
|
|
function resizeIframe(obj) {
|
|
|
|
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
|
2022-01-14 00:19:49 +00:00
|
|
|
}
|