mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
804 B
28 lines
804 B
window.addEventListener('DOMContentLoaded', (event) => {
|
|
|
|
const links = document.getElementsByClassName('post-quoters');
|
|
const messageBox = document.getElementById('message');
|
|
|
|
const addQuote = function(number) {
|
|
messageBox.value += `>>${number}\n`;
|
|
messageBox.scrollTop = messageBox.scrollHeight;
|
|
}
|
|
|
|
const quote = function(e) {
|
|
const quoteNum = this.textContent.replace('[Reply]', '').split(' ')[0].trim();
|
|
addQuote(quoteNum);
|
|
};
|
|
|
|
for (let i = 0; i < links.length; i++) {
|
|
links[i].addEventListener('click', quote, false);
|
|
}
|
|
|
|
window.addEventListener('addPost', function(e) {
|
|
const post = e.detail.post;
|
|
const newlinks = post.getElementsByClassName('post-quoters');
|
|
for (let i = 0; i < newlinks.length; i++) {
|
|
newlinks[i].addEventListener('click', quote, false);
|
|
}
|
|
});
|
|
|
|
});
|
|
|