mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
fixes #3338
This commit is contained in:
@@ -258,14 +258,14 @@ $(document).ready(function() {
|
||||
templates.registerLoader(ajaxify.loadTemplate);
|
||||
|
||||
function hrefEmpty(href) {
|
||||
return href === undefined || href === '' || href === 'javascript:;' || href === window.location.href + "#" || href.slice(0, 1) === "#";
|
||||
return href === undefined || href === '' || href === 'javascript:;';
|
||||
}
|
||||
|
||||
// Enhancing all anchors to ajaxify...
|
||||
$(document.body).on('click', 'a', function (e) {
|
||||
if (this.target !== '') {
|
||||
return;
|
||||
} else if (hrefEmpty(this.href) || this.protocol === 'javascript:' || $(this).attr('data-ajaxify') === 'false') {
|
||||
} else if (hrefEmpty(this.href) || this.protocol === 'javascript:' || $(this).attr('data-ajaxify') === 'false' || $(this).attr('href') === '#') {
|
||||
return e.preventDefault();
|
||||
}
|
||||
|
||||
@@ -276,15 +276,16 @@ $(document).ready(function() {
|
||||
(RELATIVE_PATH.length > 0 ? this.pathname.indexOf(RELATIVE_PATH) === 0 : true)) // Subfolder installs need this additional check
|
||||
) {
|
||||
// Internal link
|
||||
var url = this.href.replace(rootUrl + RELATIVE_PATH + '/', '');
|
||||
var url = this.pathname.replace(RELATIVE_PATH + '/', '');
|
||||
|
||||
// Special handling for urls with hashes
|
||||
if (this.hash !== window.location.hash) {
|
||||
if (window.location.pathname === this.pathname && this.hash.length) {
|
||||
window.location.hash = this.hash;
|
||||
}
|
||||
|
||||
if (ajaxify.go(url)) {
|
||||
e.preventDefault();
|
||||
} else {
|
||||
window.location.hash = '';
|
||||
if (ajaxify.go(url)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
} else if (window.location.pathname !== '/outgoing') {
|
||||
// External Link
|
||||
|
||||
Reference in New Issue
Block a user