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.
27 lines
946 B
27 lines
946 B
let watchList = new Set(JSON.parse(localStorage.getItem('watchlist')));
|
|
window.addEventListener('settingsReady', () => {
|
|
|
|
const watchListInput = document.getElementById('watchlist-setting');
|
|
watchListInput.value = [...watchList];
|
|
const watchListClearButton = document.getElementById('watchlist-clear');
|
|
|
|
/*
|
|
* todo: use compiled pug to create and/or update watchlist
|
|
* similar to live.js, have a separate pug function and the list container,
|
|
* and for each entry and add the listeners when inserting one
|
|
*/
|
|
//new Dragable('#watchlist', '#postform'); //make watch list draggable and maintains position
|
|
|
|
const removeWatchList = (board, thread) => {
|
|
watchList.delete(`${board}-${thread}`);
|
|
}
|
|
const clearWatchList = () => {
|
|
watchList = new Set();
|
|
watchListInput.value = '';
|
|
setLocalStorage('watchlist', '[]');
|
|
console.log('cleared watchlist');
|
|
}
|
|
watchListClearButton.addEventListener('click', clearWatchList, false);
|
|
|
|
|
|
});
|
|
|