jschan - Anonymous imageboard software. Classic look, modern features and feel. Works without JavaScript and supports Tor, I2P, Lokinet, etc.
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.
 
 
 
 
 

29 lines
868 B

/* globals Tegaki */
function showTegakiReplay(e){
e.preventDefault(); //prevent nojs download fallback
Tegaki.open({
replayMode: true,
replayURL: e.target.href,
});
/* set color palette to same as what the replay should start at (not a recorded event because we
set it programmatically when calling tegaki.open for drawing). It looks like the replay uses colors
from the wrong palette otherwise. */
Tegaki.setColorPalette(2);
}
function addReplayListeners(elem) {
const replayLinks = Array.from(elem.getElementsByClassName('replay-tegaki'));
replayLinks.forEach(replayLink => {
replayLink.addEventListener('click', showTegakiReplay, false);
});
}
window.addEventListener('DOMContentLoaded', () => {
addReplayListeners(document);
});
window.addEventListener('addPost', e => {
if (!e.detail.hover) {
addReplayListeners(e.detail.post);
}
});