diff --git a/static/js/live.js b/static/js/live.js index e6155ca..66489f7 100644 --- a/static/js/live.js +++ b/static/js/live.js @@ -35,11 +35,13 @@ $(function () { $(".thread").append(data.html + "
"); update_expandable($(`#${data.id} .expandable`)); update_reltimes($(`#${data.id}`).find("time")); + update_quote_links($(`#${data.id}`).find(".quote-link")); break; case "updated": $(`#${data.id}`).replaceWith(data.html); update_expandable($(`#${data.id} .expandable`)); update_reltimes($(`#${data.id}`).find("time")); + update_quote_links($(`#${data.id}`)).find(".quote-link"); break; case "removed": if (data.id === parseInt(thread[1])) { diff --git a/static/js/quote.js b/static/js/quote.js index b502241..ec07d72 100644 --- a/static/js/quote.js +++ b/static/js/quote.js @@ -7,20 +7,26 @@ $(function() { window.localStorage.removeItem("quoted_post"); } - $(".quote-link").click(function () { - let post_id = $(this).text(); - let thread_url = $(this).attr("data-thread-url"); - let current_url = window.location.pathname; + update_quote_links($(".quote-link")); +}); - if (current_url !== thread_url) { - window.localStorage.setItem("quoted_post", post_id); - window.location.href = `${thread_url}#${post_id}`; +function update_quote_links(elements) { + elements.each(function() { + $(this).click(function () { + let post_id = $(this).text(); + let thread_url = $(this).attr("data-thread-url"); + let current_url = window.location.pathname; + + if (current_url !== thread_url) { + window.localStorage.setItem("quoted_post", post_id); + window.location.href = `${thread_url}#${post_id}`; + return false; + } + + $("#post-form").attr("data-visible", true); + $("#content").append(`>>${post_id}\n`); + return false; - } - - $("#post-form").attr("data-visible", true); - $("#content").append(`>>${post_id}\n`); - - return false; - }); -}); \ No newline at end of file + }); + }) +} diff --git a/static/style.css b/static/style.css index 255b1df..6ca6e84 100755 --- a/static/style.css +++ b/static/style.css @@ -71,7 +71,7 @@ summary { visibility: visible; } -.draggable { +#post-form-handle { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; diff --git a/templates/macros/post-form.html b/templates/macros/post-form.html index 2be0b1d..14c9be9 100644 --- a/templates/macros/post-form.html +++ b/templates/macros/post-form.html @@ -6,7 +6,7 @@ {% endif %} -
+ {% if reply %} Nová odpověď {% else %}