diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 77b91d5d25..20198d7151 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -1,7 +1,7 @@
var ajaxify = {};
-(function($) {
+(function ($) {
var location = document.location || window.location,
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : ''),
@@ -11,7 +11,7 @@ var ajaxify = {};
var executed = {};
var events = [];
- ajaxify.register_events = function(new_page_events) {
+ ajaxify.register_events = function (new_page_events) {
for (var i = 0, ii = events.length; i < ii; i++) {
socket.removeAllListeners(events[i]); // optimize this to user removeListener(event, listener) instead.
}
@@ -20,14 +20,14 @@ var ajaxify = {};
};
- window.onpopstate = function(event) {
+ window.onpopstate = function (event) {
// "quiet": If set to true, will not call pushState
if (event !== null && event.state && event.state.url !== undefined) ajaxify.go(event.state.url, null, null, true);
};
var pagination;
- ajaxify.go = function(url, callback, template, quiet) {
+ ajaxify.go = function (url, callback, template, quiet) {
// start: the following should be set like so: ajaxify.onchange(function(){}); where the code actually belongs
$(window).off('scroll');
app.enter_room('global');
@@ -61,15 +61,17 @@ var ajaxify = {};
if (templates.is_available(tpl_url) && !templates.force_refresh(tpl_url)) {
if (quiet !== true) {
- window.history.pushState({
- "url": url
- }, url, RELATIVE_PATH + "/" + url);
+ if (window.history && window.history.pushState) {
+ window.history.pushState({
+ "url": url
+ }, url, RELATIVE_PATH + "/" + url);
+ }
}
jQuery('#footer, #content').fadeOut(100);
templates.flush();
- templates.load_template(function() {
+ templates.load_template(function () {
exec_body_scripts(content);
if (callback) {
@@ -78,7 +80,7 @@ var ajaxify = {};
app.process_page();
- jQuery('#content, #footer').stop(true, true).fadeIn(200, function() {
+ jQuery('#content, #footer').stop(true, true).fadeIn(200, function () {
if (window.location.hash)
hash = window.location.hash;
if (hash)
@@ -95,13 +97,13 @@ var ajaxify = {};
return false;
}
- $('document').ready(function() {
+ $('document').ready(function () {
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers
content = content || document.getElementById('content');
// Enhancing all anchors to ajaxify...
- $(document.body).on('click', 'a', function(e) {
+ $(document.body).on('click', 'a', function (e) {
function hrefEmpty(href) {
return href == 'javascript:;' || href == window.location.href + "#" || href.slice(-1) === "#";
}
diff --git a/public/templates/header.tpl b/public/templates/header.tpl
index 2277b6328f..e4934d0a3c 100644
--- a/public/templates/header.tpl
+++ b/public/templates/header.tpl
@@ -10,7 +10,7 @@
-
+