Node.js based forum software built for the modern web
removed the rest of the .post-row selectors in favour for components system
psychobunny51745568dfea
diff --git a/public/src/client/topic/fork.js b/public/src/client/topic/fork.jsindex 582c5f9a62..4c955889d9 100644--- a/public/src/client/topic/fork.js+++ b/public/src/client/topic/fork.js@@ -18,11 +18,11 @@ define('forum/topic/fork', function() {}function disableClicksOnPosts() {- $('.post-row').on('click', 'button,a', disableClicks);+ components.get('post').on('click', 'button,a', disableClicks);}function enableClicksOnPosts() {- $('.post-row').off('click', 'button,a', disableClicks);+ components.get('post').off('click', 'button,a', disableClicks);}function onForkThreadClicked() {diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.jsindex 46c9df18e7..f61fe4834f 100644--- a/public/src/client/topic/postTools.js+++ b/public/src/client/topic/postTools.js@@ -38,13 +38,13 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com};function addVoteHandler() {- components.get('topic').on('mouseenter', '.post-row .votes', function() {+ components.get('topic').on('mouseenter', '[data-pid] .votes', function() {loadDataAndCreateTooltip($(this));});}function loadDataAndCreateTooltip(el) {- var pid = el.parents('.post-row').attr('data-pid');+ var pid = el.parents('[data-pid]').attr('data-pid');socket.emit('posts.getUpvoters', [pid], function(err, data) {if (!err && data.length) {createTooltip(el, data[0]);@@ -185,7 +185,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com}function toggleVote(button, className, method) {- var post = button.parents('.post-row'),+ var post = button.parents('[data-pid]'),currentState = post.find(className).length;socket.emit(currentState ? 'posts.unvote' : method , {@@ -222,7 +222,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com}function getData(button, data) {- return button.parents('.post-row').attr(data);+ return button.parents('[data-pid]').attr(data);}function getUserName(button) {@@ -290,7 +290,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com});moveBtn.on('click', function() {- movePost(button.parents('.post-row'), getData(button, 'data-pid'), topicId.val());+ movePost(button.parents('[data-pid]'), getData(button, 'data-pid'), topicId.val());});}@@ -338,7 +338,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com}function openChat(button) {- var post = button.parents('li.post-row');+ var post = button.parents('data-pid');app.openChat(post.attr('data-username'), post.attr('data-uid'));button.parents('.btn-group').find('.dropdown-toggle').click();diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.jsindex 49284b0cf3..5b22ceb3df 100644--- a/public/src/client/topic/posts.js+++ b/public/src/client/topic/posts.js@@ -26,7 +26,7 @@ define('forum/topic/posts', [postcount.html(parseInt(postcount.html(), 10) + 1);}- createNewPosts(data, '.post-row[data-index!="0"]', function(html) {+ createNewPosts(data, components.get('post').not('[data-index=0]'), function(html) {if (html) {html.addClass('new');}@@ -43,7 +43,7 @@ define('forum/topic/posts', [pagination.pageCount = Math.max(1, Math.ceil((posts[0].topic.postcount - 1) / config.postsPerPage));if (pagination.currentPage === pagination.pageCount) {- createNewPosts(data, '.post-row[data-index!="0"]', scrollToPost);+ createNewPosts(data, components.get('post').not('[data-index=0]'), scrollToPost);} else if (parseInt(posts[0].uid, 10) === parseInt(app.user.uid, 10)) {pagination.loadPage(pagination.pageCount, scrollToPost);}@@ -116,7 +116,7 @@ define('forum/topic/posts', [// Save document height and position for future reference (about 5 lines down)var height = $(document).height(),scrollTop = $(document).scrollTop(),- originalPostEl = $('.post-row[data-index="0"]');+ originalPostEl = components.get('post', 'index', 0);// Insert the new posthtml.insertBefore(before);@@ -164,7 +164,7 @@ define('forum/topic/posts', [}function toggleModTools(pid, privileges) {- var postEl = $('.post-row[data-pid="' + pid + '"]');+ var postEl = components.get('post', 'pid', pid);if (!privileges.editable) {postEl.find('.edit, .delete, .purge').remove();@@ -208,7 +208,7 @@ define('forum/topic/posts', [indicatorEl.fadeOut();if (data && data.posts && data.posts.length) {- createNewPosts(data, '.post-row[data-index!="0"]:not(.new)', done);+ createNewPosts(data, components.get('post').not('[data-index=0]').not('.new'), done);} else {if (app.user.uid) {socket.emit('topics.markAsRead', [tid]);@@ -244,7 +244,7 @@ define('forum/topic/posts', [}function hidePostToolsForDeletedPosts(element) {- element.find('.post-row.deleted').each(function() {+ element.find('[data-pid].deleted').each(function() {postTools.toggle($(this).attr('data-pid'), true);});}diff --git a/public/src/modules/share.js b/public/src/modules/share.jsindex 3f26ebb9f8..83c2dce041 100644--- a/public/src/modules/share.js+++ b/public/src/modules/share.js@@ -50,7 +50,7 @@ define('share', function() {function getPostUrl(clickedElement) {var parts = window.location.pathname.split('/');- var postIndex = parseInt(clickedElement.parents('.post-row').attr('data-index'), 10);+ var postIndex = parseInt(clickedElement.parents('data-index').attr('data-index'), 10);return '/' + parts[1] + '/' + parts[2] + (parts[3] ? '/' + parts[3] : '') + (postIndex ? '/' + (postIndex + 1) : '');}