mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
closes #1999
This commit is contained in:
@@ -75,15 +75,6 @@
|
|||||||
socket.emit('admin.restart');
|
socket.emit('admin.restart');
|
||||||
});
|
});
|
||||||
|
|
||||||
Mousetrap.bind('ctrl+shift+a d', function() {
|
|
||||||
var tid = ajaxify.variables.get('topic_id'),
|
|
||||||
cid = ajaxify.variables.get('category_id');
|
|
||||||
|
|
||||||
if (tid && cid) {
|
|
||||||
socket.emit('topics.delete', { tids: [tid], cid: cid });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Mousetrap.bind('/', function(e) {
|
Mousetrap.bind('/', function(e) {
|
||||||
$('#acp-search input').focus();
|
$('#acp-search input').focus();
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ define('admin/extend/rewards', function() {
|
|||||||
conditionals;
|
conditionals;
|
||||||
|
|
||||||
rewards.init = function() {
|
rewards.init = function() {
|
||||||
available = JSON.parse(ajaxify.variables.get('rewards'));
|
available = ajaxify.data.rewards;
|
||||||
active = JSON.parse(ajaxify.variables.get('active'));
|
active = ajaxify.data.active;
|
||||||
conditions = JSON.parse(ajaxify.variables.get('conditions'));
|
conditions = ajaxify.data.conditions;
|
||||||
conditionals = JSON.parse(ajaxify.variables.get('conditionals'));
|
conditionals = ajaxify.data.conditionals;
|
||||||
|
|
||||||
$('[data-selected]').each(function() {
|
$('[data-selected]').each(function() {
|
||||||
select($(this));
|
select($(this));
|
||||||
@@ -96,7 +96,7 @@ define('admin/extend/rewards', function() {
|
|||||||
inputs.forEach(function(input) {
|
inputs.forEach(function(input) {
|
||||||
html += '<label for="' + input.name + '">' + input.label + '<br />';
|
html += '<label for="' + input.name + '">' + input.label + '<br />';
|
||||||
switch (input.type) {
|
switch (input.type) {
|
||||||
case 'select':
|
case 'select':
|
||||||
html += '<select name="' + input.name + '">';
|
html += '<select name="' + input.name + '">';
|
||||||
input.values.forEach(function(value) {
|
input.values.forEach(function(value) {
|
||||||
html += '<option value="' + value.value + '">' + value.name + '</option>';
|
html += '<option value="' + value.value + '">' + value.name + '</option>';
|
||||||
@@ -119,7 +119,7 @@ define('admin/extend/rewards', function() {
|
|||||||
|
|
||||||
for (var reward in rewards) {
|
for (var reward in rewards) {
|
||||||
if (rewards.hasOwnProperty(reward)) {
|
if (rewards.hasOwnProperty(reward)) {
|
||||||
div.find('[name="' + reward + '"]').val(rewards[reward]);
|
div.find('[name="' + reward + '"]').val(rewards[reward]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -155,7 +155,7 @@ define('admin/extend/rewards', function() {
|
|||||||
var data = {rewards: {}},
|
var data = {rewards: {}},
|
||||||
main = $(this).find('form.main').serializeArray(),
|
main = $(this).find('form.main').serializeArray(),
|
||||||
rewards = $(this).find('form.rewards').serializeArray();
|
rewards = $(this).find('form.rewards').serializeArray();
|
||||||
|
|
||||||
main.forEach(function(obj) {
|
main.forEach(function(obj) {
|
||||||
data[obj.name] = obj.value;
|
data[obj.name] = obj.value;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ define('admin/general/navigation', ['translator'], function(translator) {
|
|||||||
available;
|
available;
|
||||||
|
|
||||||
navigation.init = function() {
|
navigation.init = function() {
|
||||||
available = JSON.parse(ajaxify.variables.get('available'));
|
available = ajaxify.data.available;
|
||||||
|
|
||||||
$('#enabled').html(translator.unescape($('#enabled').html()));
|
$('#enabled').html(translator.unescape($('#enabled').html()));
|
||||||
translator.translate(translator.unescape($('#available').html()), function(html) {
|
translator.translate(translator.unescape($('#available').html()), function(html) {
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ define('admin/manage/category', [
|
|||||||
if (!confirm) {
|
if (!confirm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket.emit('admin.categories.purge', ajaxify.variables.get('cid'), function(err) {
|
socket.emit('admin.categories.purge', ajaxify.data.category.cid, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ define('admin/manage/category', [
|
|||||||
$('button[data-action="setParent"]').on('click', Category.launchParentSelector);
|
$('button[data-action="setParent"]').on('click', Category.launchParentSelector);
|
||||||
$('button[data-action="removeParent"]').on('click', function() {
|
$('button[data-action="removeParent"]').on('click', function() {
|
||||||
var payload= {};
|
var payload= {};
|
||||||
payload[ajaxify.variables.get('cid')] = {
|
payload[ajaxify.data.category.cid] = {
|
||||||
parentCid: 0
|
parentCid: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ define('admin/manage/category', [
|
|||||||
};
|
};
|
||||||
|
|
||||||
Category.refreshPrivilegeTable = function() {
|
Category.refreshPrivilegeTable = function() {
|
||||||
socket.emit('admin.categories.getPrivilegeSettings', ajaxify.variables.get('cid'), function(err, privileges) {
|
socket.emit('admin.categories.getPrivilegeSettings', ajaxify.data.category.cid, function(err, privileges) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ define('admin/manage/category', [
|
|||||||
|
|
||||||
Category.setPrivilege = function(member, privilege, state, checkboxEl) {
|
Category.setPrivilege = function(member, privilege, state, checkboxEl) {
|
||||||
socket.emit('admin.categories.setPrivilege', {
|
socket.emit('admin.categories.setPrivilege', {
|
||||||
cid: ajaxify.variables.get('cid'),
|
cid: ajaxify.data.category.cid,
|
||||||
privilege: privilege,
|
privilege: privilege,
|
||||||
set: state,
|
set: state,
|
||||||
member: member
|
member: member
|
||||||
@@ -258,7 +258,7 @@ define('admin/manage/category', [
|
|||||||
var parentCid = $(this).attr('data-cid'),
|
var parentCid = $(this).attr('data-cid'),
|
||||||
payload = {};
|
payload = {};
|
||||||
|
|
||||||
payload[ajaxify.variables.get('cid')] = {
|
payload[ajaxify.data.category.cid] = {
|
||||||
parentCid: parentCid
|
parentCid: parentCid
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ define('admin/manage/category', [
|
|||||||
|
|
||||||
autocomplete.user(inputEl, function(ev, ui) {
|
autocomplete.user(inputEl, function(ev, ui) {
|
||||||
socket.emit('admin.categories.setPrivilege', {
|
socket.emit('admin.categories.setPrivilege', {
|
||||||
cid: ajaxify.variables.get('cid'),
|
cid: ajaxify.data.category.cid,
|
||||||
privilege: ['find', 'read'],
|
privilege: ['find', 'read'],
|
||||||
set: true,
|
set: true,
|
||||||
member: ui.item.user.uid
|
member: ui.item.user.uid
|
||||||
@@ -315,7 +315,7 @@ define('admin/manage/category', [
|
|||||||
|
|
||||||
autocomplete.group(inputEl, function(ev, ui) {
|
autocomplete.group(inputEl, function(ev, ui) {
|
||||||
socket.emit('admin.categories.setPrivilege', {
|
socket.emit('admin.categories.setPrivilege', {
|
||||||
cid: ajaxify.variables.get('cid'),
|
cid: ajaxify.data.category.cid,
|
||||||
privilege: ['groups:find', 'groups:read'],
|
privilege: ['groups:find', 'groups:read'],
|
||||||
set: true,
|
set: true,
|
||||||
member: ui.item.group.name
|
member: ui.item.group.name
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ define('admin/manage/group', [
|
|||||||
searchDelay;
|
searchDelay;
|
||||||
|
|
||||||
|
|
||||||
var groupName = ajaxify.variables.get('groupName');
|
var groupName = ajaxify.data.group.name;
|
||||||
|
|
||||||
changeGroupUserTitle.keyup(function() {
|
changeGroupUserTitle.keyup(function() {
|
||||||
groupLabelPreview.text(changeGroupUserTitle.val());
|
groupLabelPreview.text(changeGroupUserTitle.val());
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ define('admin/manage/users', ['admin/modules/selectable'], function(selectable)
|
|||||||
var Users = {};
|
var Users = {};
|
||||||
|
|
||||||
Users.init = function() {
|
Users.init = function() {
|
||||||
var yourid = ajaxify.variables.get('yourid');
|
var yourid = ajaxify.data.yourid;
|
||||||
|
|
||||||
selectable.enable('#users-container', '.user-selectable');
|
selectable.enable('#users-container', '.user-selectable');
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ $(document).ready(function() {
|
|||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ajaxify.data = data;
|
||||||
data.relative_path = RELATIVE_PATH;
|
data.relative_path = RELATIVE_PATH;
|
||||||
$(window).trigger('action:ajaxify.dataLoaded', {url: url, data: data});
|
$(window).trigger('action:ajaxify.dataLoaded', {url: url, data: data});
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ app.cacheBuster = null;
|
|||||||
|
|
||||||
switch(url_parts[0]) {
|
switch(url_parts[0]) {
|
||||||
case 'user':
|
case 'user':
|
||||||
room = 'user/' + ajaxify.variables.get('theirid');
|
room = 'user/' + ajaxify.data.theirid;
|
||||||
break;
|
break;
|
||||||
case 'topic':
|
case 'topic':
|
||||||
room = 'topic_' + url_parts[1];
|
room = 'topic_' + url_parts[1];
|
||||||
@@ -466,7 +466,7 @@ app.cacheBuster = null;
|
|||||||
|
|
||||||
function handleNewTopic() {
|
function handleNewTopic() {
|
||||||
$('#content').on('click', '#new_topic', function() {
|
$('#content').on('click', '#new_topic', function() {
|
||||||
var cid = ajaxify.variables.get('category_id');
|
var cid = ajaxify.data.cid;
|
||||||
if (cid) {
|
if (cid) {
|
||||||
$(window).trigger('action:composer.topic.new', {
|
$(window).trigger('action:composer.topic.new', {
|
||||||
cid: cid
|
cid: cid
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
currentEmail;
|
currentEmail;
|
||||||
|
|
||||||
AccountEdit.init = function() {
|
AccountEdit.init = function() {
|
||||||
gravatarPicture = ajaxify.variables.get('gravatarpicture');
|
gravatarPicture = ajaxify.data.gravatarpicture;
|
||||||
uploadedPicture = ajaxify.variables.get('uploadedpicture');
|
uploadedPicture = ajaxify.data.uploadedpicture;
|
||||||
|
|
||||||
header.init();
|
header.init();
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateHeader(picture, username, userslug) {
|
function updateHeader(picture, username, userslug) {
|
||||||
if (parseInt(ajaxify.variables.get('theirid'), 10) !== parseInt(ajaxify.variables.get('yourid'), 10)) {
|
if (parseInt(ajaxify.data.theirid, 10) !== parseInt(ajaxify.data.yourid, 10)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
$('#uploadPictureBtn').on('click', function() {
|
$('#uploadPictureBtn').on('click', function() {
|
||||||
|
|
||||||
$('#change-picture-modal').modal('hide');
|
$('#change-picture-modal').modal('hide');
|
||||||
uploader.open(config.relative_path + '/api/user/' + ajaxify.variables.get('userslug') + '/uploadpicture', {}, config.maximumProfileImageSize, function(imageUrlOnServer) {
|
uploader.open(config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadpicture', {}, config.maximumProfileImageSize, function(imageUrlOnServer) {
|
||||||
onUploadComplete(imageUrlOnServer);
|
onUploadComplete(imageUrlOnServer);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
if (!url) {
|
if (!url) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket.emit('user.uploadProfileImageFromUrl', {url: url, uid: ajaxify.variables.get('theirid')}, function(err, imageUrlOnServer) {
|
socket.emit('user.uploadProfileImageFromUrl', {url: url, uid: ajaxify.data.theirid}, function(err, imageUrlOnServer) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
socket.emit('user.changePassword', {
|
socket.emit('user.changePassword', {
|
||||||
'currentPassword': currentPassword.val(),
|
'currentPassword': currentPassword.val(),
|
||||||
'newPassword': password.val(),
|
'newPassword': password.val(),
|
||||||
'uid': ajaxify.variables.get('theirid')
|
'uid': ajaxify.data.theirid
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
btn.removeClass('disabled').find('i').addClass('hide');
|
btn.removeClass('disabled').find('i').addClass('hide');
|
||||||
currentPassword.val('');
|
currentPassword.val('');
|
||||||
@@ -319,7 +319,7 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
|||||||
function changeUserPicture(type, callback) {
|
function changeUserPicture(type, callback) {
|
||||||
socket.emit('user.changePicture', {
|
socket.emit('user.changePicture', {
|
||||||
type: type,
|
type: type,
|
||||||
uid: ajaxify.variables.get('theirid')
|
uid: ajaxify.data.theirid
|
||||||
}, callback);
|
}, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ define('forum/account/header', function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function hidePrivateLinks() {
|
function hidePrivateLinks() {
|
||||||
if (!app.user.uid || app.user.uid !== parseInt(ajaxify.variables.get('theirid'), 10)) {
|
if (!app.user.uid || app.user.uid !== parseInt(ajaxify.data.theirid, 10)) {
|
||||||
$('.account-sub-links .plugin-link.private').addClass('hide');
|
$('.account-sub-links .plugin-link.private').addClass('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ define('forum/account/posts', ['forum/account/header', 'forum/infinitescroll'],
|
|||||||
}
|
}
|
||||||
|
|
||||||
infinitescroll.loadMore(method, {
|
infinitescroll.loadMore(method, {
|
||||||
uid: ajaxify.variables.get('theirid'),
|
uid: ajaxify.data.theirid,
|
||||||
after: $('[component="posts"]').attr('data-nextstart')
|
after: $('[component="posts"]').attr('data-nextstart')
|
||||||
}, function(data, done) {
|
}, function(data, done) {
|
||||||
if (data.posts && data.posts.length) {
|
if (data.posts && data.posts.length) {
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll',
|
|||||||
Account.init = function() {
|
Account.init = function() {
|
||||||
header.init();
|
header.init();
|
||||||
|
|
||||||
yourid = ajaxify.variables.get('yourid');
|
yourid = ajaxify.data.yourid;
|
||||||
theirid = ajaxify.variables.get('theirid');
|
theirid = ajaxify.data.theirid;
|
||||||
isFollowing = ajaxify.variables.get('isFollowing');
|
isFollowing = ajaxify.data.isFollowing;
|
||||||
|
|
||||||
app.enterRoom('user/' + theirid);
|
app.enterRoom('user/' + theirid);
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll',
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onUserStatusChange(data) {
|
function onUserStatusChange(data) {
|
||||||
if (parseInt(ajaxify.variables.get('theirid'), 10) !== parseInt(data.uid, 10)) {
|
if (parseInt(ajaxify.data.theirid, 10) !== parseInt(data.uid, 10)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll',
|
|||||||
if (!confirm) {
|
if (!confirm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
socket.emit('admin.user.banUsers', [ajaxify.variables.get('theirid')], function(err) {
|
socket.emit('admin.user.banUsers', [ajaxify.data.theirid], function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll',
|
|||||||
}
|
}
|
||||||
|
|
||||||
function unbanAccount() {
|
function unbanAccount() {
|
||||||
socket.emit('admin.user.unbanUsers', [ajaxify.variables.get('theirid')], function(err) {
|
socket.emit('admin.user.unbanUsers', [ajaxify.data.theirid], function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll',
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.emit('admin.user.deleteUsers', [ajaxify.variables.get('theirid')], function(err) {
|
socket.emit('admin.user.deleteUsers', [ajaxify.data.theirid], function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ define('forum/account/settings', ['forum/account/header'], function(header) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.emit('user.saveSettings', {uid: ajaxify.variables.get('theirid'), settings: settings}, function(err, newSettings) {
|
socket.emit('user.saveSettings', {uid: ajaxify.data.theirid, settings: settings}, function(err, newSettings) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ define('forum/account/settings', ['forum/account/header'], function(header) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.exposeConfigToTemplates();
|
app.exposeConfigToTemplates();
|
||||||
if (requireReload && parseInt(app.user.uid, 10) === parseInt(ajaxify.variables.get('theirid'), 10)) {
|
if (requireReload && parseInt(app.user.uid, 10) === parseInt(ajaxify.data.theirid, 10)) {
|
||||||
app.alert({
|
app.alert({
|
||||||
id: 'setting-change',
|
id: 'setting-change',
|
||||||
message: '[[user:settings-require-reload]]',
|
message: '[[user:settings-require-reload]]',
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ define('forum/account/topics', ['forum/account/header', 'forum/infinitescroll'],
|
|||||||
AccountTopics.init = function() {
|
AccountTopics.init = function() {
|
||||||
header.init();
|
header.init();
|
||||||
|
|
||||||
AccountTopics.handleInfiniteScroll('account/topics', 'uid:' + ajaxify.variables.get('theirid') + ':topics');
|
AccountTopics.handleInfiniteScroll('account/topics', 'uid:' + ajaxify.data.theirid + ':topics');
|
||||||
};
|
};
|
||||||
|
|
||||||
AccountTopics.handleInfiniteScroll = function(_template, _set) {
|
AccountTopics.handleInfiniteScroll = function(_template, _set) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ define('forum/account/watched', ['forum/account/header', 'forum/account/topics']
|
|||||||
AccountWatched.init = function() {
|
AccountWatched.init = function() {
|
||||||
header.init();
|
header.init();
|
||||||
|
|
||||||
topics.handleInfiniteScroll('account/watched', 'uid:' + ajaxify.variables.get('theirid') + ':followed_tids');
|
topics.handleInfiniteScroll('account/watched', 'uid:' + ajaxify.data.theirid + ':followed_tids');
|
||||||
};
|
};
|
||||||
|
|
||||||
return AccountWatched;
|
return AccountWatched;
|
||||||
|
|||||||
@@ -27,23 +27,23 @@ define('forum/category', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
Category.init = function() {
|
Category.init = function() {
|
||||||
var cid = ajaxify.variables.get('category_id');
|
var cid = ajaxify.data.cid;
|
||||||
|
|
||||||
app.enterRoom('category_' + cid);
|
app.enterRoom('category_' + cid);
|
||||||
|
|
||||||
share.addShareHandlers(ajaxify.variables.get('category_name'));
|
share.addShareHandlers(ajaxify.data.name);
|
||||||
|
|
||||||
socket.removeListener('event:new_topic', Category.onNewTopic);
|
socket.removeListener('event:new_topic', Category.onNewTopic);
|
||||||
socket.on('event:new_topic', Category.onNewTopic);
|
socket.on('event:new_topic', Category.onNewTopic);
|
||||||
|
|
||||||
categoryTools.init(cid);
|
categoryTools.init(cid);
|
||||||
|
|
||||||
sort.handleSort('categoryTopicSort', 'user.setCategorySort', 'category/' + ajaxify.variables.get('category_slug'));
|
sort.handleSort('categoryTopicSort', 'user.setCategorySort', 'category/' + ajaxify.data.slug);
|
||||||
|
|
||||||
enableInfiniteLoadingOrPagination();
|
enableInfiniteLoadingOrPagination();
|
||||||
|
|
||||||
if (!config.usePagination) {
|
if (!config.usePagination) {
|
||||||
navigator.init('[component="category/topic"]', ajaxify.variables.get('topic_count'), Category.toTop, Category.toBottom, Category.navigatorCallback);
|
navigator.init('[component="category/topic"]', ajaxify.data.topic_count, Category.toTop, Category.toBottom, Category.navigatorCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('[component="category"]').on('click', '[component="topic/header"]', function() {
|
$('[component="category"]').on('click', '[component="topic/header"]', function() {
|
||||||
@@ -83,7 +83,7 @@ define('forum/category', [
|
|||||||
};
|
};
|
||||||
|
|
||||||
Category.toBottom = function() {
|
Category.toBottom = function() {
|
||||||
socket.emit('categories.getTopicCount', ajaxify.variables.get('category_id'), function(err, count) {
|
socket.emit('categories.getTopicCount', ajaxify.data.cid, function(err, count) {
|
||||||
navigator.scrollBottom(count - 1);
|
navigator.scrollBottom(count - 1);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -157,7 +157,7 @@ define('forum/category', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
var scrollTo = components.get('category/topic', 'index', bookmarkIndex);
|
var scrollTo = components.get('category/topic', 'index', bookmarkIndex);
|
||||||
var cid = ajaxify.variables.get('category_id');
|
var cid = ajaxify.data.cid;
|
||||||
if (scrollTo.length && cid) {
|
if (scrollTo.length && cid) {
|
||||||
$('html, body').animate({
|
$('html, body').animate({
|
||||||
scrollTop: (scrollTo.offset().top - $('#header-menu').height() - offset) + 'px'
|
scrollTop: (scrollTo.offset().top - $('#header-menu').height() - offset) + 'px'
|
||||||
@@ -173,12 +173,12 @@ define('forum/category', [
|
|||||||
infinitescroll.init(Category.loadMoreTopics);
|
infinitescroll.init(Category.loadMoreTopics);
|
||||||
} else {
|
} else {
|
||||||
navigator.hide();
|
navigator.hide();
|
||||||
pagination.init(ajaxify.variables.get('currentPage'), ajaxify.variables.get('pageCount'));
|
pagination.init(ajaxify.data.currentPage, ajaxify.data.pageCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Category.onNewTopic = function(topic) {
|
Category.onNewTopic = function(topic) {
|
||||||
var cid = ajaxify.variables.get('category_id');
|
var cid = ajaxify.data.cid;
|
||||||
if (!topic || parseInt(topic.cid, 10) !== parseInt(cid, 10)) {
|
if (!topic || parseInt(topic.cid, 10) !== parseInt(cid, 10)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ define('forum/category', [
|
|||||||
};
|
};
|
||||||
|
|
||||||
function updateTopicCount() {
|
function updateTopicCount() {
|
||||||
socket.emit('categories.getTopicCount', ajaxify.variables.get('category_id'), function(err, topicCount) {
|
socket.emit('categories.getTopicCount', ajaxify.data.cid, function(err, topicCount) {
|
||||||
if(err) {
|
if(err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -337,7 +337,7 @@ define('forum/category', [
|
|||||||
|
|
||||||
$(window).trigger('action:categories.loading');
|
$(window).trigger('action:categories.loading');
|
||||||
infinitescroll.loadMore('categories.loadMore', {
|
infinitescroll.loadMore('categories.loadMore', {
|
||||||
cid: ajaxify.variables.get('category_id'),
|
cid: ajaxify.data.cid,
|
||||||
after: after,
|
after: after,
|
||||||
author: utils.params().author
|
author: utils.params().author
|
||||||
}, function (data, done) {
|
}, function (data, done) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
var detailsPage = components.get('groups/container'),
|
var detailsPage = components.get('groups/container'),
|
||||||
settingsFormEl = detailsPage.find('form');
|
settingsFormEl = detailsPage.find('form');
|
||||||
|
|
||||||
if (ajaxify.variables.get('is_owner') === 'true') {
|
if (ajaxify.data.group.isOwner) {
|
||||||
Details.prepareSettings();
|
Details.prepareSettings();
|
||||||
Details.initialiseCover();
|
Details.initialiseCover();
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
case 'toggleOwnership':
|
case 'toggleOwnership':
|
||||||
socket.emit('groups.' + (isOwner ? 'rescind' : 'grant'), {
|
socket.emit('groups.' + (isOwner ? 'rescind' : 'grant'), {
|
||||||
toUid: uid,
|
toUid: uid,
|
||||||
groupName: ajaxify.variables.get('group_name')
|
groupName: ajaxify.data.group.name
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
ownerFlagEl.toggleClass('invisible');
|
ownerFlagEl.toggleClass('invisible');
|
||||||
@@ -47,7 +47,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
case 'kick':
|
case 'kick':
|
||||||
socket.emit('groups.kick', {
|
socket.emit('groups.kick', {
|
||||||
uid: uid,
|
uid: uid,
|
||||||
groupName: ajaxify.variables.get('group_name')
|
groupName: ajaxify.data.group.name
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
userRow.slideUp().remove();
|
userRow.slideUp().remove();
|
||||||
@@ -75,7 +75,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
case 'rejectAll':
|
case 'rejectAll':
|
||||||
socket.emit('groups.' + action, {
|
socket.emit('groups.' + action, {
|
||||||
toUid: uid,
|
toUid: uid,
|
||||||
groupName: ajaxify.variables.get('group_name')
|
groupName: ajaxify.data.group.name
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
ajaxify.refresh();
|
ajaxify.refresh();
|
||||||
@@ -156,7 +156,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.emit('groups.update', {
|
socket.emit('groups.update', {
|
||||||
groupName: ajaxify.variables.get('group_name'),
|
groupName: ajaxify.data.group.name,
|
||||||
values: settings
|
values: settings
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -178,15 +178,15 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
};
|
};
|
||||||
|
|
||||||
Details.deleteGroup = function() {
|
Details.deleteGroup = function() {
|
||||||
bootbox.confirm('Are you sure you want to delete the group: ' + utils.escapeHTML(ajaxify.variables.get('group_name')), function(confirm) {
|
bootbox.confirm('Are you sure you want to delete the group: ' + utils.escapeHTML(ajaxify.data.group.name), function(confirm) {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
bootbox.prompt('Please enter the name of this group in order to delete it:', function(response) {
|
bootbox.prompt('Please enter the name of this group in order to delete it:', function(response) {
|
||||||
if (response === ajaxify.variables.get('group_name')) {
|
if (response === ajaxify.data.group.name) {
|
||||||
socket.emit('groups.delete', {
|
socket.emit('groups.delete', {
|
||||||
groupName: ajaxify.variables.get('group_name')
|
groupName: ajaxify.data.group.name
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
app.alertSuccess('[[groups:event.deleted, ' + utils.escapeHTML(ajaxify.variables.get('group_name')) + ']]');
|
app.alertSuccess('[[groups:event.deleted, ' + utils.escapeHTML(ajaxify.data.group.name) + ']]');
|
||||||
ajaxify.go('groups');
|
ajaxify.go('groups');
|
||||||
} else {
|
} else {
|
||||||
app.alertError(err.message);
|
app.alertError(err.message);
|
||||||
@@ -218,7 +218,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
|
|
||||||
Details.cover.load = function() {
|
Details.cover.load = function() {
|
||||||
socket.emit('groups.cover.get', {
|
socket.emit('groups.cover.get', {
|
||||||
groupName: ajaxify.variables.get('group_name')
|
groupName: ajaxify.data.group.name
|
||||||
}, function(err, data) {
|
}, function(err, data) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
var coverEl = components.get('groups/cover');
|
var coverEl = components.get('groups/cover');
|
||||||
@@ -267,7 +267,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
coverEl.addClass('saving');
|
coverEl.addClass('saving');
|
||||||
|
|
||||||
socket.emit('groups.cover.update', {
|
socket.emit('groups.cover.update', {
|
||||||
groupName: ajaxify.variables.get('group_name'),
|
groupName: ajaxify.data.group.name,
|
||||||
imageData: Details.cover.newCover || undefined,
|
imageData: Details.cover.newCover || undefined,
|
||||||
position: components.get('groups/cover').css('background-position')
|
position: components.get('groups/cover').css('background-position')
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
@@ -294,7 +294,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
}
|
}
|
||||||
|
|
||||||
searchInterval = setTimeout(function() {
|
searchInterval = setTimeout(function() {
|
||||||
socket.emit('groups.searchMembers', {groupName: ajaxify.variables.get('group_name'), query: query}, function(err, results) {
|
socket.emit('groups.searchMembers', {groupName: ajaxify.data.group.name, query: query}, function(err, results) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
@@ -302,7 +302,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
infinitescroll.parseAndTranslate('groups/details', 'members', {
|
infinitescroll.parseAndTranslate('groups/details', 'members', {
|
||||||
group: {
|
group: {
|
||||||
members: results.users,
|
members: results.users,
|
||||||
isOwner: ajaxify.variables.get('is_owner') === 'true'
|
isOwner: ajaxify.data.group.isOwner
|
||||||
}
|
}
|
||||||
}, function(html) {
|
}, function(html) {
|
||||||
$('[component="groups/members"] tbody').html(html);
|
$('[component="groups/members"] tbody').html(html);
|
||||||
@@ -310,7 +310,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, 250);
|
}, 250);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMemberInfiniteScroll() {
|
function handleMemberInfiniteScroll() {
|
||||||
@@ -330,7 +330,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
}
|
}
|
||||||
members.attr('loading', 1);
|
members.attr('loading', 1);
|
||||||
socket.emit('groups.loadMoreMembers', {
|
socket.emit('groups.loadMoreMembers', {
|
||||||
groupName: ajaxify.variables.get('group_name'),
|
groupName: ajaxify.data.group.name,
|
||||||
after: members.attr('data-nextstart')
|
after: members.attr('data-nextstart')
|
||||||
}, function(err, data) {
|
}, function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -356,7 +356,7 @@ define('forum/groups/details', ['iconSelect', 'components', 'forum/infinitescrol
|
|||||||
infinitescroll.parseAndTranslate('groups/details', 'members', {
|
infinitescroll.parseAndTranslate('groups/details', 'members', {
|
||||||
group: {
|
group: {
|
||||||
members: users,
|
members: users,
|
||||||
isOwner: ajaxify.variables.get('is_owner') === 'true'
|
isOwner: ajaxify.data.group.isOwner
|
||||||
}
|
}
|
||||||
}, function(html) {
|
}, function(html) {
|
||||||
$('[component="groups/members"] tbody').append(html);
|
$('[component="groups/members"] tbody').append(html);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ define('forum/reset_code', function() {
|
|||||||
var ResetCode = {};
|
var ResetCode = {};
|
||||||
|
|
||||||
ResetCode.init = function() {
|
ResetCode.init = function() {
|
||||||
var reset_code = ajaxify.variables.get('reset_code');
|
var reset_code = ajaxify.data.code;
|
||||||
|
|
||||||
var resetEl = $('#reset'),
|
var resetEl = $('#reset'),
|
||||||
password = $('#password'),
|
password = $('#password'),
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ define('forum/tag', ['forum/recent', 'forum/infinitescroll'], function(recent, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
infinitescroll.loadMore('topics.loadMoreFromSet', {
|
infinitescroll.loadMore('topics.loadMoreFromSet', {
|
||||||
set: 'tag:' + ajaxify.variables.get('tag') + ':topics',
|
set: 'tag:' + ajaxify.data.tag + ':topics',
|
||||||
after: $('[component="category"]').attr('data-nextstart')
|
after: $('[component="category"]').attr('data-nextstart')
|
||||||
}, function(data, done) {
|
}, function(data, done) {
|
||||||
if (data.topics && data.topics.length) {
|
if (data.topics && data.topics.length) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ define('forum/topic', [
|
|||||||
});
|
});
|
||||||
|
|
||||||
Topic.init = function() {
|
Topic.init = function() {
|
||||||
var tid = ajaxify.variables.get('topic_id');
|
var tid = ajaxify.data.tid;
|
||||||
|
|
||||||
$(window).trigger('action:topic.loading');
|
$(window).trigger('action:topic.loading');
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ define('forum/topic', [
|
|||||||
threadTools.init(tid);
|
threadTools.init(tid);
|
||||||
events.init();
|
events.init();
|
||||||
|
|
||||||
sort.handleSort('topicPostSort', 'user.setTopicSort', 'topic/' + ajaxify.variables.get('topic_slug'));
|
sort.handleSort('topicPostSort', 'user.setTopicSort', 'topic/' + ajaxify.data.slug);
|
||||||
|
|
||||||
enableInfiniteLoadingOrPagination();
|
enableInfiniteLoadingOrPagination();
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ define('forum/topic', [
|
|||||||
|
|
||||||
handleBookmark(tid);
|
handleBookmark(tid);
|
||||||
|
|
||||||
navigator.init('[component="post"]', ajaxify.variables.get('postcount'), Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex);
|
navigator.init('[component="post"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex);
|
||||||
|
|
||||||
$(window).on('scroll', updateTopicTitle);
|
$(window).on('scroll', updateTopicTitle);
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ define('forum/topic', [
|
|||||||
};
|
};
|
||||||
|
|
||||||
Topic.toBottom = function() {
|
Topic.toBottom = function() {
|
||||||
socket.emit('topics.postcount', ajaxify.variables.get('topic_id'), function(err, postCount) {
|
socket.emit('topics.postcount', ajaxify.data.tid, function(err, postCount) {
|
||||||
if (config.topicPostSort !== 'oldest_to_newest') {
|
if (config.topicPostSort !== 'oldest_to_newest') {
|
||||||
postCount = 2;
|
postCount = 2;
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ define('forum/topic', [
|
|||||||
|
|
||||||
if (postIndex && window.location.search.indexOf('page=') === -1) {
|
if (postIndex && window.location.search.indexOf('page=') === -1) {
|
||||||
navigator.scrollToPost(postIndex - 1, true);
|
navigator.scrollToPost(postIndex - 1, true);
|
||||||
} else if (bookmark && (!config.usePagination || (config.usePagination && pagination.currentPage === 1)) && ajaxify.variables.get('postcount') > 1) {
|
} else if (bookmark && (!config.usePagination || (config.usePagination && pagination.currentPage === 1)) && ajaxify.data.postcount > 1) {
|
||||||
app.alert({
|
app.alert({
|
||||||
alert_id: 'bookmark',
|
alert_id: 'bookmark',
|
||||||
message: '[[topic:bookmark_instructions]]',
|
message: '[[topic:bookmark_instructions]]',
|
||||||
@@ -162,14 +162,14 @@ define('forum/topic', [
|
|||||||
} else {
|
} else {
|
||||||
navigator.hide();
|
navigator.hide();
|
||||||
|
|
||||||
pagination.init(parseInt(ajaxify.variables.get('currentPage'), 10), parseInt(ajaxify.variables.get('pageCount'), 10));
|
pagination.init(parseInt(ajaxify.data.currentPage, 10), parseInt(ajaxify.data.pageCount, 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateTopicTitle() {
|
function updateTopicTitle() {
|
||||||
if($(window).scrollTop() > 50) {
|
if($(window).scrollTop() > 50) {
|
||||||
components.get('navbar/title').find('span').text(ajaxify.variables.get('topic_name')).show();
|
components.get('navbar/title').find('span').text(ajaxify.data.title).show();
|
||||||
} else {
|
} else {
|
||||||
components.get('navbar/title').find('span').text('').hide();
|
components.get('navbar/title').find('span').text('').hide();
|
||||||
}
|
}
|
||||||
@@ -197,10 +197,10 @@ define('forum/topic', [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentBookmark = localStorage.getItem('topic:' + ajaxify.variables.get('topic_id') + ':bookmark');
|
var currentBookmark = localStorage.getItem('topic:' + ajaxify.data.tid + ':bookmark');
|
||||||
|
|
||||||
if (!currentBookmark || parseInt(postIndex, 10) >= parseInt(currentBookmark, 10)) {
|
if (!currentBookmark || parseInt(postIndex, 10) >= parseInt(currentBookmark, 10)) {
|
||||||
localStorage.setItem('topic:' + ajaxify.variables.get('topic_id') + ':bookmark', postIndex);
|
localStorage.setItem('topic:' + ajaxify.data.tid + ':bookmark', postIndex);
|
||||||
app.removeAlert('bookmark');
|
app.removeAlert('bookmark');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ define('forum/topic/browsing', ['translator'], function(translator) {
|
|||||||
var Browsing = {};
|
var Browsing = {};
|
||||||
|
|
||||||
Browsing.onUpdateUsersInRoom = function(data) {
|
Browsing.onUpdateUsersInRoom = function(data) {
|
||||||
if (data && data.room.indexOf('topic_' + ajaxify.variables.get('topic_id')) !== -1) {
|
if (data && data.room.indexOf('topic_' + ajaxify.data.tid) !== -1) {
|
||||||
$('[component="topic/browsing/list"]').parent().toggleClass('hidden', !data.users.length);
|
$('[component="topic/browsing/list"]').parent().toggleClass('hidden', !data.users.length);
|
||||||
for(var i=0; i<data.users.length; ++i) {
|
for(var i=0; i<data.users.length; ++i) {
|
||||||
addUserIcon(data.users[i]);
|
addUserIcon(data.users[i]);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ define('forum/topic/events', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTopicPurged(data) {
|
function onTopicPurged(data) {
|
||||||
ajaxify.go('category/' + ajaxify.variables.get('category_id'));
|
ajaxify.go('category/' + ajaxify.data.cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTopicMoved(data) {
|
function onTopicMoved(data) {
|
||||||
@@ -202,7 +202,7 @@ define('forum/topic/events', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onNewNotification(data) {
|
function onNewNotification(data) {
|
||||||
var tid = ajaxify.variables.get('topic_id');
|
var tid = ajaxify.data.tid;
|
||||||
if (data && data.tid && parseInt(data.tid, 10) === parseInt(tid, 10)) {
|
if (data && data.tid && parseInt(data.tid, 10) === parseInt(tid, 10)) {
|
||||||
socket.emit('topics.markTopicNotificationsRead', tid);
|
socket.emit('topics.markTopicNotificationsRead', tid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
|||||||
topicName;
|
topicName;
|
||||||
|
|
||||||
PostTools.init = function(tid) {
|
PostTools.init = function(tid) {
|
||||||
topicName = ajaxify.variables.get('topic_name');
|
topicName = ajaxify.data.title;
|
||||||
|
|
||||||
addPostHandlers(tid);
|
addPostHandlers(tid);
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
|||||||
};
|
};
|
||||||
|
|
||||||
PostTools.updatePostCount = function() {
|
PostTools.updatePostCount = function() {
|
||||||
socket.emit('topics.postcount', ajaxify.variables.get('topic_id'), function(err, postCount) {
|
socket.emit('topics.postcount', ajaxify.data.tid, function(err, postCount) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
var postCountEl = components.get('topic/post-count');
|
var postCountEl = components.get('topic/post-count');
|
||||||
postCountEl.html(postCount).attr('title', postCount);
|
postCountEl.html(postCount).attr('title', postCount);
|
||||||
@@ -110,7 +110,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
|||||||
var btn = $(this);
|
var btn = $(this);
|
||||||
$(window).trigger('action:composer.post.edit', {
|
$(window).trigger('action:composer.post.edit', {
|
||||||
pid: getData(btn, 'data-pid')
|
pid: getData(btn, 'data-pid')
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
postContainer.on('click', '[component="post/delete"]', function(e) {
|
postContainer.on('click', '[component="post/delete"]', function(e) {
|
||||||
@@ -152,7 +152,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
|||||||
if (selectionText.length) {
|
if (selectionText.length) {
|
||||||
$(window).trigger('action:composer.addQuote', {
|
$(window).trigger('action:composer.addQuote', {
|
||||||
tid: tid,
|
tid: tid,
|
||||||
slug: ajaxify.variables.get('topic_slug'),
|
slug: ajaxify.data.slug,
|
||||||
index: getData(button, 'data-index'),
|
index: getData(button, 'data-index'),
|
||||||
pid: getData(button, 'data-pid'),
|
pid: getData(button, 'data-pid'),
|
||||||
topicName: topicName,
|
topicName: topicName,
|
||||||
@@ -162,7 +162,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
|||||||
} else {
|
} else {
|
||||||
$(window).trigger('action:composer.post.new', {
|
$(window).trigger('action:composer.post.new', {
|
||||||
tid: tid,
|
tid: tid,
|
||||||
pid: ajaxify.variables.get('pid'),
|
pid: getData(button, 'data-pid'),
|
||||||
topicName: topicName,
|
topicName: topicName,
|
||||||
text: username + ' ' || ''
|
text: username + ' ' || ''
|
||||||
});
|
});
|
||||||
@@ -184,7 +184,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
|||||||
|
|
||||||
$(window).trigger('action:composer.addQuote', {
|
$(window).trigger('action:composer.addQuote', {
|
||||||
tid: tid,
|
tid: tid,
|
||||||
slug: ajaxify.variables.get('topic_slug'),
|
slug: ajaxify.data.slug,
|
||||||
index: getData(button, 'data-index'),
|
index: getData(button, 'data-index'),
|
||||||
pid: pid,
|
pid: pid,
|
||||||
username: username,
|
username: username,
|
||||||
@@ -226,7 +226,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showVotes(pid) {
|
function showVotes(pid) {
|
||||||
socket.emit('posts.getVoters', {pid: pid, cid: ajaxify.variables.get('category_id')}, function(err, data) {
|
socket.emit('posts.getVoters', {pid: pid, cid: ajaxify.data.cid}, function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ define('forum/topic/posts', [
|
|||||||
var Posts = {};
|
var Posts = {};
|
||||||
|
|
||||||
Posts.onNewPost = function(data) {
|
Posts.onNewPost = function(data) {
|
||||||
var tid = ajaxify.variables.get('topic_id');
|
var tid = ajaxify.data.tid;
|
||||||
if (data && data.posts && data.posts.length && parseInt(data.posts[0].tid, 10) !== parseInt(tid, 10)) {
|
if (data && data.posts && data.posts.length && parseInt(data.posts[0].tid, 10) !== parseInt(tid, 10)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -133,9 +133,9 @@ define('forum/topic/posts', [
|
|||||||
|
|
||||||
findInsertionPoint();
|
findInsertionPoint();
|
||||||
|
|
||||||
data.title = $('<div></div>').text(ajaxify.variables.get('topic_name')).html();
|
data.title = $('<div></div>').text(ajaxify.data.title).html();
|
||||||
data.slug = ajaxify.variables.get('topic_slug');
|
data.slug = ajaxify.data.slug;
|
||||||
data.viewcount = ajaxify.variables.get('viewcount');
|
data.viewcount = ajaxify.data.viewcount;
|
||||||
|
|
||||||
infinitescroll.parseAndTranslate('topic', 'posts', data, function(html) {
|
infinitescroll.parseAndTranslate('topic', 'posts', data, function(html) {
|
||||||
if (after) {
|
if (after) {
|
||||||
@@ -219,7 +219,7 @@ define('forum/topic/posts', [
|
|||||||
};
|
};
|
||||||
|
|
||||||
function loadPostsAfter(after) {
|
function loadPostsAfter(after) {
|
||||||
var tid = ajaxify.variables.get('topic_id');
|
var tid = ajaxify.data.tid;
|
||||||
if (!utils.isNumber(tid) || !utils.isNumber(after) || (after === 0 && components.get('post', 'index', 1).length)) {
|
if (!utils.isNumber(tid) || !utils.isNumber(after) || (after === 0 && components.get('post', 'index', 1).length)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,22 +23,22 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
|
|||||||
});
|
});
|
||||||
|
|
||||||
components.get('topic/lock').on('click', function() {
|
components.get('topic/lock').on('click', function() {
|
||||||
socket.emit('topics.lock', {tids: [tid], cid: ajaxify.variables.get('category_id')});
|
socket.emit('topics.lock', {tids: [tid], cid: ajaxify.data.cid});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
components.get('topic/unlock').on('click', function() {
|
components.get('topic/unlock').on('click', function() {
|
||||||
socket.emit('topics.unlock', {tids: [tid], cid: ajaxify.variables.get('category_id')});
|
socket.emit('topics.unlock', {tids: [tid], cid: ajaxify.data.cid});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
components.get('topic/pin').on('click', function() {
|
components.get('topic/pin').on('click', function() {
|
||||||
socket.emit('topics.pin', {tids: [tid], cid: ajaxify.variables.get('category_id')});
|
socket.emit('topics.pin', {tids: [tid], cid: ajaxify.data.cid});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
components.get('topic/unpin').on('click', function() {
|
components.get('topic/unpin').on('click', function() {
|
||||||
socket.emit('topics.unpin', {tids: [tid], cid: ajaxify.variables.get('category_id')});
|
socket.emit('topics.unpin', {tids: [tid], cid: ajaxify.data.cid});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
|
|||||||
});
|
});
|
||||||
|
|
||||||
components.get('topic/move').on('click', function(e) {
|
components.get('topic/move').on('click', function(e) {
|
||||||
move.init([tid], ajaxify.variables.get('category_id'));
|
move.init([tid], ajaxify.data.cid);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ define('forum/topic/threadTools', ['forum/topic/fork', 'forum/topic/move', 'comp
|
|||||||
translator.translate('[[topic:thread_tools.' + command + '_confirm]]', function(msg) {
|
translator.translate('[[topic:thread_tools.' + command + '_confirm]]', function(msg) {
|
||||||
bootbox.confirm(msg, function(confirm) {
|
bootbox.confirm(msg, function(confirm) {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
socket.emit('topics.' + command, {tids: [tid], cid: ajaxify.variables.get('category_id')});
|
socket.emit('topics.' + command, {tids: [tid], cid: ajaxify.data.cid});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Search.checkPagePresence = function(tid, callback) {
|
Search.checkPagePresence = function(tid, callback) {
|
||||||
if (parseInt(ajaxify.variables.get('topic_id'), 10) !== parseInt(tid, 10)) {
|
if (parseInt(ajaxify.data.tid, 10) !== parseInt(tid, 10)) {
|
||||||
ajaxify.go('topic/' + tid, callback);
|
ajaxify.go('topic/' + tid, callback);
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
@@ -7,10 +7,16 @@
|
|||||||
ajaxify.variables = {};
|
ajaxify.variables = {};
|
||||||
|
|
||||||
ajaxify.variables.set = function(key, value) {
|
ajaxify.variables.set = function(key, value) {
|
||||||
|
if (console && console.warn) {
|
||||||
|
console.warn('[deprecated] variables.set is deprecated, please use ajaxify.data, key=' + key);
|
||||||
|
}
|
||||||
parsedVariables[key] = value;
|
parsedVariables[key] = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
ajaxify.variables.get = function(key) {
|
ajaxify.variables.get = function(key) {
|
||||||
|
if (console && console.warn) {
|
||||||
|
console.warn('[deprecated] variables.get is deprecated, please use ajaxify.data, key=' + key);
|
||||||
|
}
|
||||||
return parsedVariables[key];
|
return parsedVariables[key];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -37,5 +43,9 @@
|
|||||||
|
|
||||||
ajaxify.variables.set($(element).attr('template-variable'), value);
|
ajaxify.variables.set($(element).attr('template-variable'), value);
|
||||||
});
|
});
|
||||||
|
var dataEl = $('#content [ajaxify-data]');
|
||||||
|
if (dataEl.length) {
|
||||||
|
ajaxify.data = JSON.parse(decodeURIComponent(dataEl.attr('ajaxify-data')));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}(ajaxify || {}));
|
}(ajaxify || {}));
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ middleware.buildHeader = function(req, res, next) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
middleware.renderHeader = function(req, res, callback) {
|
middleware.renderHeader = function(req, res, callback) {
|
||||||
var registrationType = meta.config.registrationType || 'normal'
|
var registrationType = meta.config.registrationType || 'normal';
|
||||||
var templateValues = {
|
var templateValues = {
|
||||||
bootswatchCSS: meta.config['theme:src'],
|
bootswatchCSS: meta.config['theme:src'],
|
||||||
title: meta.config.title || '',
|
title: meta.config.title || '',
|
||||||
@@ -327,7 +327,7 @@ middleware.processRender = function(req, res, next) {
|
|||||||
return fn(err);
|
return fn(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// str = str + '<input type="hidden" ajaxify-data="' + encodeURIComponent(JSON.stringify(options)) + '" />';
|
str = str + '<input type="hidden" ajaxify-data="' + encodeURIComponent(JSON.stringify(options)) + '" />';
|
||||||
str = (res.locals.postHeader ? res.locals.postHeader : '') + str + (res.locals.preFooter ? res.locals.preFooter : '');
|
str = (res.locals.postHeader ? res.locals.postHeader : '') + str + (res.locals.preFooter ? res.locals.preFooter : '');
|
||||||
|
|
||||||
if (res.locals.footer) {
|
if (res.locals.footer) {
|
||||||
|
|||||||
Reference in New Issue
Block a user