mirror of https://gitgud.io/fatchan/jschan.git
start on thread watchlist ref #292
parent
11aeb8a1ac
commit
0402fd9c56
7 changed files with 35 additions and 7 deletions
@ -0,0 +1,27 @@ |
|||||||
|
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); |
||||||
|
|
||||||
|
|
||||||
|
}); |
Loading…
Reference in new issue