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.
68 lines
1.9 KiB
68 lines
1.9 KiB
<div class="shortcutWrapper">
|
|
<div>
|
|
<p> First:</p>
|
|
<%- include('chapterButton.ejs', {chapter:List[0], scanlator, title, shortCut:true}) %>
|
|
</div>
|
|
|
|
<%for(let i = 0; i<List.length; i++){if(List[i].continue) { %>
|
|
<div id="continueWrapper">
|
|
<p> Continue:</p>
|
|
<%- include('chapterButton.ejs', {chapter:List[i], scanlator, title,shortCut:true}) %>
|
|
</div>
|
|
<%}}%>
|
|
<div>
|
|
<p>Last:</p>
|
|
<%- include('chapterButton.ejs', {chapter:List[List.length-1], scanlator, title,shortCut:true}) %>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
clearVariablesChapterShortCut();
|
|
|
|
function clearVariablesChapterShortCut()
|
|
{
|
|
[
|
|
'classList',
|
|
'classListIndex',
|
|
'chapterNum'
|
|
].forEach((variable) =>
|
|
{
|
|
if (window.hasOwnProperty(variable))
|
|
{
|
|
delete window[variable];
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
function createListener()
|
|
{
|
|
document.getElementById('List').addEventListener('htmx:afterSwap', event=>
|
|
{
|
|
let classList = event.target.classList;
|
|
for(let i = 0; i<classList.length; i++)
|
|
{
|
|
if(classList[i].includes('chapterButton_'))
|
|
{
|
|
let classListIndex = Array.from(document.getElementById('continueWrapper').childNodes[3].classList).indexOf(classList[i]+'shortCut');
|
|
if(classListIndex!=-1)
|
|
{
|
|
// let chapterNum = classList[i].split('_')[1].split('shortCut')[0];
|
|
htmx.ajax('GET', `/chaptertocontinue/<%=scanlator%>/<%= encodeURIComponent(List[0].mangaLink)%>/<%=title%>`,'.'+classList[i]+'shortCut');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
try {
|
|
createListener();
|
|
} catch (error) {
|
|
clearVariablesChapterShortCut();
|
|
createListener();
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|