2024-03-02 23:19:48 +00:00
|
|
|
$(function () {
|
2024-02-26 17:55:08 +00:00
|
|
|
let quoted_post = window.localStorage.getItem("quoted_post");
|
2024-03-02 23:19:48 +00:00
|
|
|
|
2024-02-26 17:55:08 +00:00
|
|
|
if (quoted_post) {
|
|
|
|
$("#post-form").attr("data-visible", true);
|
|
|
|
$("#content").append(`>>${quoted_post}\n`);
|
|
|
|
window.localStorage.removeItem("quoted_post");
|
|
|
|
}
|
|
|
|
|
2024-03-02 23:19:48 +00:00
|
|
|
$(window).on("setup_post_events", function (event) {
|
|
|
|
setup_events($(`#${event.id}`).find(".quote-link"));
|
|
|
|
});
|
|
|
|
|
|
|
|
setup_events($(".quote-link"));
|
|
|
|
|
|
|
|
function setup_events(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`);
|
2024-02-26 17:55:08 +00:00
|
|
|
|
2024-02-26 18:17:36 +00:00
|
|
|
return false;
|
2024-03-02 23:19:48 +00:00
|
|
|
});
|
2024-02-26 18:17:36 +00:00
|
|
|
});
|
2024-03-02 23:19:48 +00:00
|
|
|
}
|
|
|
|
});
|