nekrochan/static/js/quote.js

26 řádky
818 B
JavaScript
Surový Normální zobrazení Historie

$(function() {
let quoted_post = window.localStorage.getItem("quoted_post");
if (quoted_post) {
$("#post-form").attr("data-visible", true);
$("#content").append(`>>${quoted_post}\n`);
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;
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;
});
});