mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +01:00
updated ajaxify to do a callback after page change, added toaster style notifications (app.alert), changes to webserver to update automatically
This commit is contained in:
@@ -3,16 +3,18 @@ var ajaxify = {};
|
||||
|
||||
(function($) {
|
||||
|
||||
var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host) + (document.location.port ? ':'+document.location.port : ''),
|
||||
var location = document.location || window.location,
|
||||
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : ''),
|
||||
content = null;
|
||||
|
||||
var current_state = '';
|
||||
var current_state = null;
|
||||
|
||||
ajaxify.go = function(url) {
|
||||
ajaxify.go = function(url, callback) {
|
||||
var url = url.replace(/\/$/, "");
|
||||
var tpl_url = (url === '') ? 'home' : url;
|
||||
|
||||
if (templates[tpl_url]) {
|
||||
if (current_state != url) {
|
||||
if (current_state === null || current_state != url) {
|
||||
current_state = url;
|
||||
|
||||
window.history.pushState({}, url, "/" + url);
|
||||
@@ -20,6 +22,9 @@ var ajaxify = {};
|
||||
exec_body_scripts(content);
|
||||
|
||||
ajaxify.enable();
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user