2
0

Compare commits

..

No commits in common. "4bd54f096ddecacaacb061e74eb4766bc9152848" and "6d0fcc13fb2b7d6abe041983453758f520c33787" have entirely different histories.

2 changed files with 12 additions and 24 deletions

View File

@ -68,7 +68,6 @@
Pandemic love comedy! Pandemic love comedy!
</publication-description> </publication-description>
<publication-delete>Delete Task ❌</publication-delete> <publication-delete>Delete Task ❌</publication-delete>
<publication-add>Add Task </publication-add>
</publication-information> </publication-information>
</publication-viewer> </publication-viewer>
</popup> </popup>

View File

@ -20,7 +20,7 @@ const slideOutRightTiming = {
let publications = []; let publications = [];
let tasks = []; let tasks = [];
let toEditId; let toRemoveId;
const taskTypesSelect = document.querySelector("#taskTypes") const taskTypesSelect = document.querySelector("#taskTypes")
const searchPublicationQuery = document.querySelector("#searchPublicationQuery"); const searchPublicationQuery = document.querySelector("#searchPublicationQuery");
@ -38,14 +38,12 @@ const publicationViewerName = document.querySelector("#publicationViewerName");
const publicationViewerAuthor = document.querySelector("#publicationViewerAuthor"); const publicationViewerAuthor = document.querySelector("#publicationViewerAuthor");
const pubviewcover = document.querySelector("#pubviewcover"); const pubviewcover = document.querySelector("#pubviewcover");
const publicationDelete = document.querySelector("publication-delete"); const publicationDelete = document.querySelector("publication-delete");
const publicationAdd = document.querySelector("publication-add");
const closetaskpopup = document.querySelector("#closePopupImg"); const closetaskpopup = document.querySelector("#closePopupImg");
settingsCog.addEventListener("click", () => slide()); settingsCog.addEventListener("click", () => slide());
closetaskpopup.addEventListener("click", () => HidePopup()); closetaskpopup.addEventListener("click", () => HidePopup());
document.querySelector("blur-background").addEventListener("click", () => HidePopup()); document.querySelector("blur-background").addEventListener("click", () => HidePopup());
publicationDelete.addEventListener("click", () => DeleteTaskClick()); publicationDelete.addEventListener("click", () => DeleteTaskClick());
publicationAdd.addEventListener("click", () => CreateTask("DownloadNewChapters", selectRecurrence.value, connectorSelect.value, toEditId, "en"));
/* /*
let availableTaskTypes; let availableTaskTypes;
@ -81,7 +79,9 @@ searchPublicationQuery.addEventListener("keypress", (event) => {
json.forEach(publication => { json.forEach(publication => {
var option = CreatePublication(publication, connectorSelect.value); var option = CreatePublication(publication, connectorSelect.value);
option.addEventListener("click", () => { option.addEventListener("click", () => {
ShowPublicationViewerWindow(publication.internalId, event, true); CreateTask("DownloadNewChapters", selectRecurrence.value, connectorSelect.value, publication.internalId, "en");
HidePopup();
selectPublication.replaceChildren();
}); });
selectPublication.appendChild(option); selectPublication.appendChild(option);
} }
@ -110,8 +110,8 @@ function CreatePublication(publication, connector){
} }
function DeleteTaskClick(){ function DeleteTaskClick(){
taskToDelete = tasks.filter(tTask => tTask.publication.internalId === toEditId)[0]; taskToDelete = tasks.filter(tTask => tTask.publication.internalId === toRemoveId)[0];
DeleteTask("DownloadNewChapters", taskToDelete.connectorName, toEditId); DeleteTask("DownloadNewChapters", taskToDelete.connectorName, toRemoveId);
HidePopup(); HidePopup();
} }
@ -140,7 +140,7 @@ function ShowPopup(){
generalPopup.animate(fadeIn, fadeInTiming); generalPopup.animate(fadeIn, fadeInTiming);
} }
function ShowPublicationViewerWindow(publicationId, event, add){ function ShowPublicationViewerWindow(publicationId, event){
publicationViewer.style.top = `${event.clientY - 60}px`; publicationViewer.style.top = `${event.clientY - 60}px`;
publicationViewer.style.left = `${event.clientX}px`; publicationViewer.style.left = `${event.clientX}px`;
var publication = publications.filter(pub => pub.internalId === publicationId)[0]; var publication = publications.filter(pub => pub.internalId === publicationId)[0];
@ -149,18 +149,9 @@ function ShowPublicationViewerWindow(publicationId, event, add){
publicationViewerDescription.innerText = publication.description; publicationViewerDescription.innerText = publication.description;
publicationViewerAuthor.innerText = publication.author; publicationViewerAuthor.innerText = publication.author;
pubviewcover.src = publication.posterUrl; pubviewcover.src = publication.posterUrl;
toEditId = publicationId; toRemoveId = publicationId;
if(add){ toRemoveId = publicationId;
publicationAdd.style.display = "none";
publicationDelete.style.display = "block";
}
else{
publicationAdd.style.display = "block";
publicationDelete.style.display = "none";
}
toEditId = publicationId;
publicationViewer.style.display = "block"; publicationViewer.style.display = "block";
ShowPopup(); ShowPopup();
} }
@ -205,11 +196,9 @@ setInterval(() => {
.then(() => { .then(() => {
if(tasks.length != cTasks.length) { if(tasks.length != cTasks.length) {
ResetContent(); ResetContent();
cTasks.forEach(task => { var publication = CreatePublication(task.publication, task.connectorName);
var publication = CreatePublication(task.publication, task.connectorName); publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event));
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event, true)); tasksContent.appendChild(publication);
tasksContent.appendChild(publication);
})
tasks = cTasks; tasks = cTasks;
} }