mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 07:25:46 +01:00
closed #321, removed cheerio use altogether, and made changes to the
client side to ajaxify the user to /outgoing when an external link is clicked
This commit is contained in:
@@ -102,26 +102,29 @@ var ajaxify = {};
|
|||||||
|
|
||||||
// Enhancing all anchors to ajaxify...
|
// Enhancing all anchors to ajaxify...
|
||||||
$(document.body).on('click', 'a', function(e) {
|
$(document.body).on('click', 'a', function(e) {
|
||||||
|
|
||||||
function hrefEmpty(href) {
|
function hrefEmpty(href) {
|
||||||
return href == 'javascript:;' || href == window.location.href + "#" || href.slice(-1) === "#";
|
return href == 'javascript:;' || href == window.location.href + "#" || href.slice(-1) === "#";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hrefEmpty(this.href)) return;
|
if (hrefEmpty(this.href)) return;
|
||||||
|
|
||||||
var url = this.href.replace(rootUrl + '/', '');
|
|
||||||
|
|
||||||
if (this.target !== '') return;
|
if (this.target !== '') return;
|
||||||
|
if (this.protocol === 'javascript:') return;
|
||||||
|
|
||||||
if (!e.ctrlKey && e.which === 1) {
|
if (!e.ctrlKey && e.which === 1) {
|
||||||
|
if (this.host === window.location.host) {
|
||||||
|
var url = this.href.replace(rootUrl + '/', '');
|
||||||
|
|
||||||
if (ajaxify.go(url)) {
|
if (ajaxify.go(url)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ajaxify.go('outgoing?url=' + encodeURIComponent(this.href));
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function exec_body_scripts(body_el) {
|
function exec_body_scripts(body_el) {
|
||||||
// modified from http://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml
|
// modified from http://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user