updating all templates.get to ajaxify.variables.get

v1.18.x
psychobunny 11 years ago
parent 113eb38f9a
commit 7217954078

@ -4,9 +4,9 @@ define(['forum/accountheader'], function(header) {
Account.init = function() {
header.init();
var yourid = templates.get('yourid'),
theirid = templates.get('theirid'),
isFollowing = templates.get('isFollowing');
var yourid = ajaxify.variables.get('yourid'),
theirid = ajaxify.variables.get('theirid'),
isFollowing = ajaxify.variables.get('isFollowing');
$(document).ready(function() {
var username = $('.account-username').html();
@ -79,7 +79,7 @@ define(['forum/accountheader'], function(header) {
Account.handleUserOnline = function(err, data) {
var onlineStatus = $('.account-online-status');
if(parseInt(templates.get('theirid'), 10) !== parseInt(data.uid, 10)) {
if(parseInt(ajaxify.variables.get('theirid'), 10) !== parseInt(data.uid, 10)) {
return;
}

@ -6,8 +6,8 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
AccountEdit.init = function() {
header.init();
gravatarPicture = templates.get('gravatarpicture');
uploadedPicture = templates.get('uploadedpicture');
gravatarPicture = ajaxify.variables.get('gravatarpicture');
uploadedPicture = ajaxify.variables.get('uploadedpicture');
var selectedImageType = '';
@ -117,7 +117,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
$('#uploadPictureBtn').on('click', function() {
$('#change-picture-modal').modal('hide');
uploader.open(RELATIVE_PATH + '/user/uploadpicture', {uid: templates.get('theirid')}, config.maximumProfileImageSize, function(imageUrlOnServer) {
uploader.open(RELATIVE_PATH + '/user/uploadpicture', {uid: ajaxify.variables.get('theirid')}, config.maximumProfileImageSize, function(imageUrlOnServer) {
imageUrlOnServer = imageUrlOnServer + '?' + new Date().getTime();
$('#user-current-picture').attr('src', imageUrlOnServer);
@ -193,7 +193,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
socket.emit('user.changePassword', {
'currentPassword': currentPassword.val(),
'newPassword': password.val(),
'uid': templates.get('theirid')
'uid': ajaxify.variables.get('theirid')
}, function(err) {
currentPassword.val('');
@ -219,7 +219,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
AccountEdit.changeUserPicture = function(type) {
var userData = {
type: type,
uid: templates.get('theirid')
uid: ajaxify.variables.get('theirid')
};
socket.emit('user.changePicture', userData, function(err) {

@ -33,8 +33,8 @@ define(function() {
};
function hideLinks() {
var yourid = templates.get('yourid'),
theirid = templates.get('theirid');
var yourid = ajaxify.variables.get('yourid'),
theirid = ajaxify.variables.get('theirid');
var editLink = $('#editLink');
var settingsLink = $('#settingsLink');

@ -5,7 +5,7 @@ define(function() {
var Groups = {};
Groups.init = function() {
var yourid = templates.get('yourid'),
var yourid = ajaxify.variables.get('yourid'),
createEl = $('#create'),
createModal = $('#create-modal'),
createSubmitBtn = $('#create-modal-go'),

@ -4,7 +4,7 @@ define(function() {
var Users = {};
Users.init = function() {
var yourid = templates.get('yourid');
var yourid = ajaxify.variables.get('yourid');
function isUserAdmin(element) {
var parent = $(element).parents('.users-box');

@ -6,12 +6,12 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
loadingMoreTopics = false;
Category.init = function() {
var cid = templates.get('category_id');
var cid = ajaxify.variables.get('category_id');
app.enterRoom('category_' + cid);
$('#twitter-share').on('click', function () {
window.open('https://twitter.com/intent/tweet?url=' + encodeURIComponent(window.location.href) + '&text=' + encodeURIComponent(templates.get('category_name')), '_blank', 'width=550,height=420,scrollbars=no,status=no');
window.open('https://twitter.com/intent/tweet?url=' + encodeURIComponent(window.location.href) + '&text=' + encodeURIComponent(ajaxify.variables.get('category_name')), '_blank', 'width=550,height=420,scrollbars=no,status=no');
return false;
});
@ -86,7 +86,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
$('#topics-container').empty();
loadingMoreTopics = false;
Category.loadMoreTopics(templates.get('category_id'), index, function() {
Category.loadMoreTopics(ajaxify.variables.get('category_id'), index, function() {
Category.scrollToTopic(bookmark, clicked, 0);
});
});
@ -115,7 +115,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
}
if($('#topics-container li.category-item[data-tid="' + tid + '"]').length) {
var cid = templates.get('category_id');
var cid = ajaxify.variables.get('category_id');
var scrollTo = $('#topics-container li.category-item[data-tid="' + tid + '"]');
if (cid && scrollTo.length) {
@ -151,7 +151,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
offset = el.offset().top - $('#header-menu').offset().top + $('#header-menu').height();
}
Category.loadMoreTopics(templates.get('category_id'), after, function() {
Category.loadMoreTopics(ajaxify.variables.get('category_id'), after, function() {
if(direction < 0 && el) {
Category.scrollToTopic(el.attr('data-tid'), null, 0, offset);
}
@ -159,7 +159,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
}
});
} else {
pagination.init(templates.get('currentPage'), templates.get('pageCount'));
pagination.init(ajaxify.variables.get('currentPage'), ajaxify.variables.get('pageCount'));
}
}
@ -202,7 +202,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
topic.hide().fadeIn('slow');
socket.emit('categories.getPageCount', templates.get('category_id'), function(err, newPageCount) {
socket.emit('categories.getPageCount', ajaxify.variables.get('category_id'), function(err, newPageCount) {
pagination.recreatePaginationLinks(newPageCount);
});

@ -4,9 +4,9 @@ define(['forum/accountheader'], function(header) {
Followers.init = function() {
header.init();
var yourid = templates.get('yourid'),
theirid = templates.get('theirid'),
followersCount = templates.get('followersCount');
var yourid = ajaxify.variables.get('yourid'),
theirid = ajaxify.variables.get('theirid'),
followersCount = ajaxify.variables.get('followersCount');
if (parseInt(followersCount, 10) === 0) {

@ -4,7 +4,7 @@ define(['forum/accountheader'], function(header) {
Following.init = function() {
header.init();
var followingCount = templates.get('followingCount');
var followingCount = ajaxify.variables.get('followingCount');
if (parseInt(followingCount, 10) === 0) {
$('#no-following-notice').removeClass('hide');

@ -2,7 +2,7 @@ define(function() {
var ResetCode = {};
ResetCode.init = function() {
var reset_code = templates.get('reset_code');
var reset_code = ajaxify.variables.get('reset_code');
var resetEl = $('#reset'),
password = $('#password'),

@ -24,16 +24,16 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
});
Topic.init = function() {
var tid = templates.get('topic_id'),
var tid = ajaxify.variables.get('topic_id'),
thread_state = {
locked: templates.get('locked'),
deleted: templates.get('deleted'),
pinned: templates.get('pinned')
locked: ajaxify.variables.get('locked'),
deleted: ajaxify.variables.get('deleted'),
pinned: ajaxify.variables.get('pinned')
},
currentPage = parseInt(templates.get('currentPage'), 10),
pageCount = parseInt(templates.get('pageCount'), 10);
currentPage = parseInt(ajaxify.variables.get('currentPage'), 10),
pageCount = parseInt(ajaxify.variables.get('pageCount'), 10);
Topic.postCount = templates.get('postcount');
Topic.postCount = ajaxify.variables.get('postcount');
$(window).trigger('action:topic.loading');
@ -228,7 +228,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
}
// Get users who are currently replying to the topic entered
socket.emit('modules.composer.getUsersByTid', templates.get('topic_id'), function(err, uids) {
socket.emit('modules.composer.getUsersByTid', ajaxify.variables.get('topic_id'), function(err, uids) {
if (uids && uids.length) {
for(var x=0;x<uids.length;x++) {
activeEl.find('[data-uid="' + uids[x] + '"]').addClass('replying');
@ -261,7 +261,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
});
socket.on('event:new_post', function(data) {
if(data && data.posts && data.posts.length && data.posts[0].tid !== templates.get('topic_id')) {
if(data && data.posts && data.posts.length && data.posts[0].tid !== ajaxify.variables.get('topic_id')) {
return;
}
@ -528,7 +528,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
});
if($(window).scrollTop() > 50) {
$('.header-topic-title').find('span').text(templates.get('topic_name')).show();
$('.header-topic-title').find('span').text(ajaxify.variables.get('topic_name')).show();
} else {
$('.header-topic-title').find('span').text('').hide();
}
@ -544,9 +544,9 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
updatePaginationTextAndProgressBar(index);
var currentBookmark = localStorage.getItem('topic:' + templates.get('topic_id') + ':bookmark');
var currentBookmark = localStorage.getItem('topic:' + ajaxify.variables.get('topic_id') + ':bookmark');
if (!currentBookmark || parseInt(el.attr('data-pid'), 10) >= parseInt(currentBookmark, 10)) {
localStorage.setItem('topic:' + templates.get('topic_id') + ':bookmark', el.attr('data-pid'));
localStorage.setItem('topic:' + ajaxify.variables.get('topic_id') + ':bookmark', el.attr('data-pid'));
app.removeAlert('bookmark');
}
@ -666,7 +666,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
function onNewPostPagination(data) {
var posts = data.posts;
socket.emit('topics.getPageCount', templates.get('topic_id'), function(err, newPageCount) {
socket.emit('topics.getPageCount', ajaxify.variables.get('topic_id'), function(err, newPageCount) {
pagination.recreatePaginationLinks(newPageCount);
@ -721,8 +721,8 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
findInsertionPoint();
data.title = templates.get('topic_name');
data.viewcount = templates.get('viewcount');
data.title = ajaxify.variables.get('topic_name');
data.viewcount = ajaxify.variables.get('viewcount');
parseAndTranslatePosts(data, function(translatedHTML) {
var translated = $(translatedHTML);
@ -777,7 +777,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
}
function updatePostCount() {
socket.emit('topics.postcount', templates.get('topic_id'), function(err, postcount) {
socket.emit('topics.postcount', ajaxify.variables.get('topic_id'), function(err, postcount) {
if(!err) {
Topic.postCount = postcount;
$('#topic-post-count').html(Topic.postCount);

@ -1,6 +1,6 @@
'use strict';
/* globals define, app, translator, templates, socket, bootbox */
/* globals define, app, translator, ajaxify, socket, bootbox */
define(['composer'], function(composer) {
@ -8,7 +8,7 @@ define(['composer'], function(composer) {
topicName;
PostTools.init = function(tid, threadState) {
topicName = templates.get('topic_name');
topicName = ajaxify.variables.get('topic_name');
addPostHandlers(tid, threadState);

@ -1,6 +1,6 @@
'use strict';
/* globals define, app, translator, templates, socket, bootbox */
/* globals define, app, translator, ajaxify, socket, bootbox */
define(['forum/topic/fork', 'forum/topic/move'], function(fork, move) {
@ -8,7 +8,7 @@ define(['forum/topic/fork', 'forum/topic/move'], function(fork, move) {
ThreadTools.init = function(tid, threadState) {
if (templates.get('expose_tools') === '1') {
if (ajaxify.variables.get('expose_tools') === '1') {
$('.thread-tools').removeClass('hide');

Loading…
Cancel
Save