HOTFIX for scripts

v1.18.x
Julian Lam 12 years ago
parent d6dd74b50a
commit 0d9958afe7

@ -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) === "#";
}

@ -10,7 +10,7 @@
</script>
<script src="{relative_path}/socket.io/socket.io.js"></script>
<!-- BEGIN clientScripts -->
<script src="{relative_path}{clientScripts.script}"></script>
<script src="{relative_path}/{clientScripts.script}"></script>
<!-- END clientScripts -->
<script>
require.config({

@ -149,17 +149,17 @@ var utils = require('./../public/src/utils.js'),
Meta.js = {
scripts: [
'/vendor/jquery/js/jquery.js',
'/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js',
'/vendor/jquery/js/jquery.timeago.js',
'/vendor/bootstrap/js/bootstrap.min.js',
'/src/app.js',
'/vendor/requirejs/require.js',
'/vendor/bootbox/bootbox.min.js',
'/src/templates.js',
'/src/ajaxify.js',
'/src/jquery.form.js',
'/src/utils.js'
'vendor/jquery/js/jquery.js',
'vendor/jquery/js/jquery-ui-1.10.3.custom.min.js',
'vendor/jquery/js/jquery.timeago.js',
'vendor/bootstrap/js/bootstrap.min.js',
'src/app.js',
'vendor/requirejs/require.js',
'vendor/bootbox/bootbox.min.js',
'src/templates.js',
'src/ajaxify.js',
'src/jquery.form.js',
'src/utils.js'
],
minFile: path.join(__dirname, '..', 'public/src/nodebb.min.js'),
get: function (callback) {

Loading…
Cancel
Save