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() { Account.init = function() {
header.init(); header.init();
var yourid = templates.get('yourid'), var yourid = ajaxify.variables.get('yourid'),
theirid = templates.get('theirid'), theirid = ajaxify.variables.get('theirid'),
isFollowing = templates.get('isFollowing'); isFollowing = ajaxify.variables.get('isFollowing');
$(document).ready(function() { $(document).ready(function() {
var username = $('.account-username').html(); var username = $('.account-username').html();
@ -79,7 +79,7 @@ define(['forum/accountheader'], function(header) {
Account.handleUserOnline = function(err, data) { Account.handleUserOnline = function(err, data) {
var onlineStatus = $('.account-online-status'); 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; return;
} }

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

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

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

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

@ -6,12 +6,12 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
loadingMoreTopics = false; loadingMoreTopics = false;
Category.init = function() { Category.init = function() {
var cid = templates.get('category_id'); var cid = ajaxify.variables.get('category_id');
app.enterRoom('category_' + cid); app.enterRoom('category_' + cid);
$('#twitter-share').on('click', function () { $('#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; return false;
}); });
@ -86,7 +86,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
$('#topics-container').empty(); $('#topics-container').empty();
loadingMoreTopics = false; loadingMoreTopics = false;
Category.loadMoreTopics(templates.get('category_id'), index, function() { Category.loadMoreTopics(ajaxify.variables.get('category_id'), index, function() {
Category.scrollToTopic(bookmark, clicked, 0); 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) { 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 + '"]'); var scrollTo = $('#topics-container li.category-item[data-tid="' + tid + '"]');
if (cid && scrollTo.length) { 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(); 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) { if(direction < 0 && el) {
Category.scrollToTopic(el.attr('data-tid'), null, 0, offset); Category.scrollToTopic(el.attr('data-tid'), null, 0, offset);
} }
@ -159,7 +159,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
} }
}); });
} else { } 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'); 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); pagination.recreatePaginationLinks(newPageCount);
}); });

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

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

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

@ -24,16 +24,16 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
}); });
Topic.init = function() { Topic.init = function() {
var tid = templates.get('topic_id'), var tid = ajaxify.variables.get('topic_id'),
thread_state = { thread_state = {
locked: templates.get('locked'), locked: ajaxify.variables.get('locked'),
deleted: templates.get('deleted'), deleted: ajaxify.variables.get('deleted'),
pinned: templates.get('pinned') pinned: ajaxify.variables.get('pinned')
}, },
currentPage = parseInt(templates.get('currentPage'), 10), currentPage = parseInt(ajaxify.variables.get('currentPage'), 10),
pageCount = parseInt(templates.get('pageCount'), 10); pageCount = parseInt(ajaxify.variables.get('pageCount'), 10);
Topic.postCount = templates.get('postcount'); Topic.postCount = ajaxify.variables.get('postcount');
$(window).trigger('action:topic.loading'); $(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 // 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) { if (uids && uids.length) {
for(var x=0;x<uids.length;x++) { for(var x=0;x<uids.length;x++) {
activeEl.find('[data-uid="' + uids[x] + '"]').addClass('replying'); 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) { 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; return;
} }
@ -528,7 +528,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
}); });
if($(window).scrollTop() > 50) { 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 { } else {
$('.header-topic-title').find('span').text('').hide(); $('.header-topic-title').find('span').text('').hide();
} }
@ -544,9 +544,9 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
updatePaginationTextAndProgressBar(index); 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)) { 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'); app.removeAlert('bookmark');
} }
@ -666,7 +666,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
function onNewPostPagination(data) { function onNewPostPagination(data) {
var posts = data.posts; 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); pagination.recreatePaginationLinks(newPageCount);
@ -721,8 +721,8 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
findInsertionPoint(); findInsertionPoint();
data.title = templates.get('topic_name'); data.title = ajaxify.variables.get('topic_name');
data.viewcount = templates.get('viewcount'); data.viewcount = ajaxify.variables.get('viewcount');
parseAndTranslatePosts(data, function(translatedHTML) { parseAndTranslatePosts(data, function(translatedHTML) {
var translated = $(translatedHTML); var translated = $(translatedHTML);
@ -777,7 +777,7 @@ define(['forum/pagination', 'forum/topic/threadTools', 'forum/topic/postTools'],
} }
function updatePostCount() { 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) { if(!err) {
Topic.postCount = postcount; Topic.postCount = postcount;
$('#topic-post-count').html(Topic.postCount); $('#topic-post-count').html(Topic.postCount);

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

@ -1,6 +1,6 @@
'use strict'; '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) { 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) { ThreadTools.init = function(tid, threadState) {
if (templates.get('expose_tools') === '1') { if (ajaxify.variables.get('expose_tools') === '1') {
$('.thread-tools').removeClass('hide'); $('.thread-tools').removeClass('hide');

Loading…
Cancel
Save