mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 07:55:46 +01:00
HOTFIX for scripts
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
var ajaxify = {};
|
var ajaxify = {};
|
||||||
|
|
||||||
|
|
||||||
(function($) {
|
(function ($) {
|
||||||
|
|
||||||
var location = document.location || window.location,
|
var location = document.location || window.location,
|
||||||
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : ''),
|
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : ''),
|
||||||
@@ -11,7 +11,7 @@ var ajaxify = {};
|
|||||||
var executed = {};
|
var executed = {};
|
||||||
|
|
||||||
var events = [];
|
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++) {
|
for (var i = 0, ii = events.length; i < ii; i++) {
|
||||||
socket.removeAllListeners(events[i]); // optimize this to user removeListener(event, listener) instead.
|
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
|
// "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);
|
if (event !== null && event.state && event.state.url !== undefined) ajaxify.go(event.state.url, null, null, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
var pagination;
|
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
|
// start: the following should be set like so: ajaxify.onchange(function(){}); where the code actually belongs
|
||||||
$(window).off('scroll');
|
$(window).off('scroll');
|
||||||
app.enter_room('global');
|
app.enter_room('global');
|
||||||
@@ -61,15 +61,17 @@ var ajaxify = {};
|
|||||||
|
|
||||||
if (templates.is_available(tpl_url) && !templates.force_refresh(tpl_url)) {
|
if (templates.is_available(tpl_url) && !templates.force_refresh(tpl_url)) {
|
||||||
if (quiet !== true) {
|
if (quiet !== true) {
|
||||||
window.history.pushState({
|
if (window.history && window.history.pushState) {
|
||||||
"url": url
|
window.history.pushState({
|
||||||
}, url, RELATIVE_PATH + "/" + url);
|
"url": url
|
||||||
|
}, url, RELATIVE_PATH + "/" + url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery('#footer, #content').fadeOut(100);
|
jQuery('#footer, #content').fadeOut(100);
|
||||||
|
|
||||||
templates.flush();
|
templates.flush();
|
||||||
templates.load_template(function() {
|
templates.load_template(function () {
|
||||||
exec_body_scripts(content);
|
exec_body_scripts(content);
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
@@ -78,7 +80,7 @@ var ajaxify = {};
|
|||||||
|
|
||||||
app.process_page();
|
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)
|
if (window.location.hash)
|
||||||
hash = window.location.hash;
|
hash = window.location.hash;
|
||||||
if (hash)
|
if (hash)
|
||||||
@@ -95,13 +97,13 @@ var ajaxify = {};
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('document').ready(function() {
|
$('document').ready(function () {
|
||||||
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers
|
if (!window.history || !window.history.pushState) return; // no ajaxification for old browsers
|
||||||
|
|
||||||
content = content || document.getElementById('content');
|
content = content || document.getElementById('content');
|
||||||
|
|
||||||
// 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) === "#";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<script src="{relative_path}/socket.io/socket.io.js"></script>
|
<script src="{relative_path}/socket.io/socket.io.js"></script>
|
||||||
<!-- BEGIN clientScripts -->
|
<!-- BEGIN clientScripts -->
|
||||||
<script src="{relative_path}{clientScripts.script}"></script>
|
<script src="{relative_path}/{clientScripts.script}"></script>
|
||||||
<!-- END clientScripts -->
|
<!-- END clientScripts -->
|
||||||
<script>
|
<script>
|
||||||
require.config({
|
require.config({
|
||||||
|
|||||||
22
src/meta.js
22
src/meta.js
@@ -149,17 +149,17 @@ var utils = require('./../public/src/utils.js'),
|
|||||||
|
|
||||||
Meta.js = {
|
Meta.js = {
|
||||||
scripts: [
|
scripts: [
|
||||||
'/vendor/jquery/js/jquery.js',
|
'vendor/jquery/js/jquery.js',
|
||||||
'/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js',
|
'vendor/jquery/js/jquery-ui-1.10.3.custom.min.js',
|
||||||
'/vendor/jquery/js/jquery.timeago.js',
|
'vendor/jquery/js/jquery.timeago.js',
|
||||||
'/vendor/bootstrap/js/bootstrap.min.js',
|
'vendor/bootstrap/js/bootstrap.min.js',
|
||||||
'/src/app.js',
|
'src/app.js',
|
||||||
'/vendor/requirejs/require.js',
|
'vendor/requirejs/require.js',
|
||||||
'/vendor/bootbox/bootbox.min.js',
|
'vendor/bootbox/bootbox.min.js',
|
||||||
'/src/templates.js',
|
'src/templates.js',
|
||||||
'/src/ajaxify.js',
|
'src/ajaxify.js',
|
||||||
'/src/jquery.form.js',
|
'src/jquery.form.js',
|
||||||
'/src/utils.js'
|
'src/utils.js'
|
||||||
],
|
],
|
||||||
minFile: path.join(__dirname, '..', 'public/src/nodebb.min.js'),
|
minFile: path.join(__dirname, '..', 'public/src/nodebb.min.js'),
|
||||||
get: function (callback) {
|
get: function (callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user