aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/static
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-07 14:53:23 +0300
committerGravatar Vitaly Takmazov2018-03-13 08:12:18 +0300
commit1f5869fcfe8c537d223b750754025cb2937d4bad (patch)
treeadb9e8f12e41eb4f2659ea4079c05729d42f33c1 /juick-www/src/main/static
parentc25f908aa587a60912f7350806e54de2b7f3dc04 (diff)
drop replies tree
Diffstat (limited to 'juick-www/src/main/static')
-rw-r--r--juick-www/src/main/static/scripts.js60
1 files changed, 1 insertions, 59 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index 588e4fdb..c6293266 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -187,11 +187,6 @@ function wsShutdown() {
}
}
-function isTreeMode() {
- // relies on UserThread.printReplies implementation TODO keep this in cookie or something
- return document.querySelector('.title2-right > a').href.match(/\?view=(\w+)/)[1] == 'list';
-}
-
function wsIncomingReply(msg) {
let content = document.getElementById('content');
if (!content) { return; }
@@ -234,15 +229,7 @@ function wsIncomingReply(msg) {
killy.embedLinksToX(li.querySelector('.msg-cont'), '.msg-links', '.msg-txt a');
- if (isTreeMode() && (msg.replyto > 0)) {
- let p = document.getElementById(msg.replyto);
- let m = parseInt(p.style.marginLeft) + 20;
- while (p.nextElementSibling && (parseInt(p.nextElementSibling.style.marginLeft) >= m)) { p = p.nextElementSibling; }
- li.style.marginLeft = m + 'px';
- p.parentNode.insertBefore(li, p.nextSibling);
- } else {
- document.getElementById('replies').appendChild(li);
- }
+ document.getElementById('replies').appendChild(li);
updateRepliesCounter();
}
@@ -309,29 +296,6 @@ function newMessage(evt) {
}
}
-function showMoreReplies(el, id) {
- var foldedReplies = el.closest('li').querySelector('.msg-comments');
- if (!foldedReplies) { return; }
- foldedReplies.style.display = 'none';
-
- var replies = document.querySelectorAll('#replies>li'),
- flagshow = 0,
- i = 0;
- for (; i < replies.length; i += 1) {
- if (flagshow == 1) {
- if (replies[i].style.display == 'none') {
- replies[i].style.display = 'block';
- } else {
- break;
- }
- }
- if (replies[i].id == id) {
- flagshow = 1;
- }
- }
- return false;
-}
-
function showCommentForm(mid, rid) {
let reply = document.getElementById(rid);
let formTarget = reply.querySelector('div.msg-cont .msg-comment-target');
@@ -422,19 +386,6 @@ function attachMessagePhoto(div) {
}
}
-function unfoldReply() {
- var anchor = window.location.hash.substring(1);
- if ((0 + anchor) > 0) {
- var el = document.getElementById(anchor);
- if (!el) { return; }
- while (el.style.display === 'none') {
- el = el.previousElementSibling;
- }
- showMoreReplies(el, el.getAttribute('id'));
- window.location.replace(window.location.hash);
- }
-}
-
function showMessageLinksDialog(mid, rid) {
let hlink = window.location.protocol + '//juick.com/' + mid;
let mlink = '#' + mid;
@@ -667,13 +618,6 @@ ready(function () {
var pageMID = content.getAttribute('data-mid');
if (pageMID > 0) {
document.querySelectorAll('li.msg').forEach(li => {
- let showMoreBtn = li.querySelector('.msg-comments');
- if (showMoreBtn) {
- showMoreBtn.addEventListener('click', function (e) {
- showMoreReplies(e.target, li.id);
- e.preventDefault();
- });
- }
let showReplyFormBtn = li.querySelector('.a-thread-comment');
if (showReplyFormBtn) {
showReplyFormBtn.addEventListener('click', function (e) {
@@ -784,9 +728,7 @@ ready(function () {
article.classList.add('nsfw');
}
});
- unfoldReply();
initWS();
- window.addEventListener('hashchange', unfoldReply);
window.addEventListener('pagehide', wsShutdown);