-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinkhandler.js
More file actions
29 lines (25 loc) · 785 Bytes
/
linkhandler.js
File metadata and controls
29 lines (25 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var nicam_ch = nicam_ch || {};
nicam_ch.linkHandler = (function ($) {
var init = function () {
if (('standalone' in window.navigator) && window.navigator.standalone) {
$("body").delegate("a", "click", clickHandler);
}
};
var clickHandler = function (e) {
if ($(this).attr('href').indexOf('http') == 0 && $(this).attr('href').indexOf(document.location.host) == -1 && !$(this).hasClass("dont-open-safari")
|| $(this).hasClass("open-safari")) {
return;
}
e.preventDefault();
var href = $(this).attr('href');
if (href) {
location.href = href;
}
};
return {
init: init
};
})(jQuery);
jQuery(function($) {
nicam_ch.linkHandler.init();
});