diff --git a/emhttp/plugins/dynamix/include/DefaultPageLayout.php b/emhttp/plugins/dynamix/include/DefaultPageLayout.php
index 755d268a1..9e7edbd31 100644
--- a/emhttp/plugins/dynamix/include/DefaultPageLayout.php
+++ b/emhttp/plugins/dynamix/include/DefaultPageLayout.php
@@ -1122,24 +1122,35 @@ var gui_pages_available = [];
function isValidURL(url) {
try {
- new URL(url);
- return true;
+ var ret = new URL(url);
+ return ret;
} catch (err) {
return false;
}
}
-$('body').on("click","a", function(e) {
- var href = $(this).attr("href");
- var target = $(this).attr("target");
+$('body').on("click","a,.ca_href", function(e) {
+ if ($(this).hasClass("ca_href") ) {
+ var ca_href = true;
+ var href=$(this).attr("data-href");
+ var target=$(this).attr("data-target");
+ } else {
+ var ca_href = false;
+ var href = $(this).attr("href");
+ var target = $(this).attr("target");
+ }
if ( href ) {
href = href.trim();
if ( href.match('https?://[^\.]*.(my)?unraid.net/') || href.indexOf("https://unraid.net/") == 0 || href == "https://unraid.net" || href.indexOf("http://lime-technology.com") == 0) {
+ if ( ca_href ) {
+ window.open(href,target);
+ }
return;
}
if (href !== "#" && href.indexOf("javascript") !== 0) {
- if ( ! isValidURL(href) ) {
+ var dom = isValidURL(href);
+ if ( dom == false ) {
if ( href.indexOf("/") == 0 ) { // all internal links start with "/"
return;
}
@@ -1151,10 +1162,22 @@ $('body').on("click","a", function(e) {
if ( $(this).hasClass("localURL") ) {
return;
}
+
+ try {
+ var domainsAllowed = JSON.parse($.cookie("allowedDomains"));
+ } catch(e) {
+ var domainsAllowed = new Object();
+ }
+ $.cookie("allowedDomains",JSON.stringify(domainsAllowed),{expires:3650}); // rewrite cookie to further extend expiration by 400 days
+
+ if ( domainsAllowed[dom.hostname] ) {
+ return;
+ }
+
e.preventDefault();
swal({
title: "=_('External Link')?>",
- text: "=_('Clicking OK will take you to a 3rd party website not associated with Limetech')?>
"+href+"",
+ text: "=_('Clicking OK will take you to a 3rd party website not associated with Limetech')?>
"+href+"
=_('Always Allow')?> "+dom.hostname+"",
html: true,
type: 'warning',
showCancelButton: true,
@@ -1163,6 +1186,10 @@ $('body').on("click","a", function(e) {
confirmButtonText: "=_('OK')?>"
},function(isConfirm) {
if (isConfirm) {
+ if ( $("#Link_Always_Allow").is(":checked") ) {
+ domainsAllowed[dom.hostname] = true;
+ $.cookie("allowedDomains",JSON.stringify(domainsAllowed),{expires:3650});
+ }
var popupOpen = window.open(href,target);
if ( !popupOpen || popupOpen.closed || typeof popupOpen == "undefined" ) {
var popupWarning = addBannerWarning("=_('Popup Blocked.');?>");