diff --git a/JS/browser.js b/JS/browser.js index e5678c8..33d5150 100644 --- a/JS/browser.js +++ b/JS/browser.js @@ -1035,6 +1035,18 @@ function askClearBrowserHistory() { ]) } +// Right Click On Comic +function LinkClick(tindex, lindex) { + const e = window.event, key = e.which + e.preventDefault() + if (tabs[tindex] == null) return + if (key == 1) tabs[tindex].Clicked(lindex) + else if (key == 2) tabs[tindex].Clicked(lindex, true) + else if (key == 3) { + + } +} + // Key Event function BrowserKeyEvents(ctrl, shift, key) { if (ctrl) { diff --git a/JS/classes.js b/JS/classes.js index f02920e..15fe27b 100644 --- a/JS/classes.js +++ b/JS/classes.js @@ -228,9 +228,44 @@ class Tab { this.icon = element.children[0] this.span = element.children[1] this.page = pageElement + this.linksIndex = [] + this.linksValue = [] this.options = null } + ClearLinks() { + this.linksIndex = [] + this.linksValue = [] + } + + AddLink(index, value = null) { + this.linksIndex.push(index) + this.linksValue.push(value) + return this.linksIndex.length - 1 + } + + Clicked(index, newTab = false) { + const site = this.site + if (site == 0) { + switch(this.linksIndex[index]) { + case 0: + xlecxOpenAllTags(newTab) + break + case 1: + xlecxOpenCategory(this.linksValue[index][0], 1, this.linksValue[index][1], newTab) + break + case 2: + xlecxOpenPost(newTab, this.linksValue[index]) + break + case 3: + xlecxChangePage(this.linksValue[index], newTab) + break + } + } else if (site == 1) { + + } + } + addHistory(text) { if (this.activeHistory < this.history.length - 1) { let ind = this.activeHistory @@ -269,9 +304,7 @@ class Tab { this.tab.setAttribute('title', name) } - changeIcon(url) { - this.icon.setAttribute('src', url) - } + changeIcon(url) { this.icon.setAttribute('src', url) } } class Download { diff --git a/JS/sites/xlecx.js b/JS/sites/xlecx.js index 69722a9..b31bcdf 100644 --- a/JS/sites/xlecx.js +++ b/JS/sites/xlecx.js @@ -1,9 +1,6 @@ const xlecx = new XlecxAPI() -function xlecxChangePage(page, whitchbutton, updateTabIndex) { - if (whitchbutton == 3) return - let makeNewPage = false - if (whitchbutton == 2) makeNewPage = true +function xlecxChangePage(page, makeNewPage, updateTabIndex) { page = page || 1 if (updateTabIndex == null) updateTabIndex = true let id @@ -55,9 +52,8 @@ function createNewXlecxTab(id, pageNumber) { } tabs[thisTabIndex].rename(`Page ${pageNumber}`) tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') - let container = document.createElement('div') - container.classList.add("xlecx-container") - let elementContainerContainer, elementContainer, element, miniElement, html, valueStorage + tabs[thisTabIndex].ClearLinks() + let valueStorage, html = '
' if (result.pagination[result.pagination.length - 1][1] > result.pagination[result.pagination.length - 2][1]) valueStorage = result.pagination[result.pagination.length - 1][1] else valueStorage = result.pagination[result.pagination.length - 2][1] @@ -75,112 +71,30 @@ function createNewXlecxTab(id, pageNumber) { } // Categories - elementContainer = document.createElement('div') - element = document.createElement('button') - element.textContent = 'All Tags' - element.onmousedown = e => { - e.preventDefault() - xlecxOpenAllTags(WhichMouseButton(e)) - } - elementContainer.appendChild(element) - for (let i = 0; i < result.categories.length; i++) { - element = document.createElement('button') - element.setAttribute('c', result.categories[i].url) - element.textContent = result.categories[i].name - element.onmousedown = e => { - e.preventDefault() - xlecxOpenCategory(e.target.getAttribute('c'), 1, e.target.textContent, WhichMouseButton(e)) - } - elementContainer.appendChild(element) - } - container.appendChild(elementContainer) + html += `
` + for (let i = 0; i < result.categories.length; i++) html += `` + html += '
' // Content - elementContainerContainer = document.createElement('div') - elementContainer = document.createElement('div') - elementContainer.classList.add("xlecx-post-container") - for (let i = 0; i < result.content.length; i++) { - element = document.createElement('div') - valueStorage = '' - if (setting.lazy_loading == true) valueStorage = ' loading="lazy"' - html = `` - - if (result.content[i].pages == null) valueStorage = '' - else valueStorage = `${result.content[i].pages}` - - html += `${valueStorage}

${result.content[i].title}

` - if (Downloader.IsDownloading(0, result.content[i].id)) html += `` - else html += `` - element.innerHTML = html - miniElement = document.createElement('div') - miniElement.setAttribute('id', result.content[i].id) - miniElement.onmousedown = e => { - e.preventDefault() - xlecxOpenPost(WhichMouseButton(e), e.target.getAttribute('id')) - } - element.appendChild(miniElement) - elementContainer.appendChild(element) - } - elementContainerContainer.appendChild(elementContainer) - + html += '
' + for (let i = 0; i < result.content.length; i++) html += `
${result.content[i].pages != null ? ''+result.content[i].pages+'' : ''}

${result.content[i].title}

${Downloader.IsDownloading(0, result.content[i].id) ? '' : ''}
` + // Pagination - elementContainer = document.createElement('div') - elementContainer.classList.add("xlecx-pagination") - for (let i = 0; i < result.pagination.length; i++) { - element = document.createElement('button') - if (result.pagination[i][1] == null) { - element.setAttribute('disable', true) - element.textContent = result.pagination[i][0] - } else { - element.textContent = result.pagination[i][0] - element.setAttribute('p', result.pagination[i][1]) - element.onmousedown = e => { - e.preventDefault() - xlecxChangePage(Number(e.target.getAttribute('p')), WhichMouseButton(e)) - } - } - - elementContainer.appendChild(element) - } - elementContainerContainer.appendChild(elementContainer) - + html += '
' + for (let i = 0; i < result.pagination.length; i++) html += `` + // Random - elementContainer = document.createElement('div') - elementContainer.classList.add("xlecx-post-container") - for (let i = 0; i < result.random.length; i++) { - element = document.createElement('div') - valueStorage = '' - if (setting.lazy_loading == true) valueStorage = ' loading="lazy"' - html = `` - - if (result.random[i].pages == null) valueStorage = '' - else valueStorage = `${result.random[i].pages}` + html += '
' + for (let i = 0; i < result.random.length; i++) html += `
${result.random[i].pages != null ? ''+result.random[i].pages+'' : ''}

${result.random[i].title}

${Downloader.IsDownloading(0, result.random[i].id) ? '' : ''}
` - html += `${valueStorage}

${result.random[i].title}

` - if (Downloader.IsDownloading(0, result.random[i].id)) html += `` - else html += `` - element.innerHTML = html - miniElement = document.createElement('div') - miniElement.setAttribute('id', result.random[i].id) - miniElement.onmousedown = e => { - e.preventDefault() - xlecxOpenPost(WhichMouseButton(e), e.target.getAttribute('id')) - } - element.appendChild(miniElement) - elementContainer.appendChild(element) - } - elementContainerContainer.appendChild(elementContainer) - container.appendChild(elementContainerContainer) - - tabs[thisTabIndex].page.appendChild(container) + html += '
' + tabs[thisTabIndex].page.innerHTML = html clearDownloadedComics(tabs[thisTabIndex].page, 0) }) } -function xlecxOpenPost(whitchbutton, id, updateTabIndex) { - if (whitchbutton == 3) return - let makeNewPage = false, pageId, thisTabIndex - if (whitchbutton == 2) makeNewPage = true +function xlecxOpenPost(makeNewPage, id, updateTabIndex) { + let pageId, thisTabIndex if (updateTabIndex == null) updateTabIndex = true if (makeNewPage) { pageId = createNewTab(`xlecxOpenPost(0, '${id}', false)`, true, 0) @@ -230,6 +144,7 @@ function xlecxOpenPost(whitchbutton, id, updateTabIndex) { } tabs[thisTabIndex].rename(result.title) tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') + tabs[thisTabIndex].ClearLinks() let image_container = document.createElement('div') image_container.classList.add('xlecx-image-container-1x1') let containerContainer = document.createElement('div') @@ -420,10 +335,7 @@ function xlecxOpenPost(whitchbutton, id, updateTabIndex) { }) } -function xlecxOpenCategory(name, page, shortName, whitchbutton, updateTabIndex) { - if (whitchbutton == 3) return - let makeNewPage = false - if (whitchbutton == 2) makeNewPage = true +function xlecxOpenCategory(name, page, shortName, makeNewPage, updateTabIndex) { name = name || null page = page || 1 shortName = shortName || null @@ -431,8 +343,6 @@ function xlecxOpenCategory(name, page, shortName, whitchbutton, updateTabIndex) if (updateTabIndex == null) updateTabIndex = true let pageId = activeTabComicId, thisTabIndex - - if (makeNewPage) { pageId = createNewTab(`xlecxOpenCategory('${name}', ${page}, '${shortName}', 0, false)`, true, 0) if (pageId == null) { PopAlert(defaultSettingLang.tab_at_limit, 'danger'); return } @@ -474,6 +384,7 @@ function xlecxOpenCategory(name, page, shortName, whitchbutton, updateTabIndex) } tabs[thisTabIndex].rename(`${shortName} - ${page}`) tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') + tabs[thisTabIndex].ClearLinks() let container = document.createElement('div') container.classList.add("xlecx-container") let elementContainerContainer, elementContainer, element, miniElement, html, valueStorage @@ -724,6 +635,7 @@ function xlecxOpenTag(name, page, whitch, whitchbutton, updateTabIndex) { } tabs[thisTabIndex].rename(`${name} - ${page}`) tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') + tabs[thisTabIndex].ClearLinks() let valueStorage if (result.pagination == undefined) valueStorage = 0 @@ -756,6 +668,7 @@ function xlecxOpenTag(name, page, whitch, whitchbutton, updateTabIndex) { } tabs[thisTabIndex].rename(`${name} - ${page}`) tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') + tabs[thisTabIndex].ClearLinks() let valueStorage if (result.pagination == undefined) valueStorage = 0 @@ -788,6 +701,7 @@ function xlecxOpenTag(name, page, whitch, whitchbutton, updateTabIndex) { } tabs[thisTabIndex].rename(`${name} - ${page}`) tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') + tabs[thisTabIndex].ClearLinks() let valueStorage if (result.pagination == undefined) valueStorage = 0 @@ -820,6 +734,7 @@ function xlecxOpenTag(name, page, whitch, whitchbutton, updateTabIndex) { } tabs[thisTabIndex].rename(`${name} - ${page}`) tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') + tabs[thisTabIndex].ClearLinks() let valueStorage if (result.pagination == undefined) valueStorage = 0 @@ -893,6 +808,7 @@ function xlecxSearch(text, page, whitchbutton, updateTabIndex) { } tabs[thisTabIndex].rename(`S: ${convertToURL(text, true)} - ${page}`) tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') + tabs[thisTabIndex].ClearLinks() let container = document.createElement('div') container.classList.add("xlecx-container") let elementContainerContainer = document.createElement('div') @@ -993,10 +909,8 @@ function xlecxSearch(text, page, whitchbutton, updateTabIndex) { }) } -function xlecxOpenAllTags(whitchbutton, updateTabIndex) { - if (whitchbutton == 3) return - let makeNewPage = false, pageId, thisTabIndex - if (whitchbutton == 2) makeNewPage = true +function xlecxOpenAllTags(makeNewPage, updateTabIndex) { + let pageId, thisTabIndex if (updateTabIndex == null) updateTabIndex = true if (makeNewPage) { pageId = createNewTab('xlecxOpenAllTags(0, false)', true, 0) @@ -1034,6 +948,7 @@ function xlecxOpenAllTags(whitchbutton, updateTabIndex) { } tabs[thisTabIndex].rename('All Tags') tabs[thisTabIndex].icon.setAttribute('src', 'Image/sites/xlecx-30x30.jpg') + tabs[thisTabIndex].ClearLinks() let container = document.createElement('div') container.classList.add("xlecx-container") let elementContainerContainer, elementContainer, element, miniElement, html, valueStorage @@ -1088,22 +1003,22 @@ function xlecxJumpPage(index, page) { switch (index) { case 0: searchTimer = setTimeout(() => { - xlecxSearch(tabs[activeTabIndex].s.replace("'", "\\'"), page, 0) + xlecxSearch(tabs[activeTabIndex].s.replace("'", "\\'"), page, false) }, 185) break case 1: searchTimer = setTimeout(() => { - xlecxChangePage(page, 0) + xlecxChangePage(page, false) }, 185) break case 2: searchTimer = setTimeout(() => { - xlecxOpenCategory(tabs[activeTabIndex].options[0], page, tabs[activeTabIndex].options[1], 0) + xlecxOpenCategory(tabs[activeTabIndex].options[0], page, tabs[activeTabIndex].options[1], false) }, 185) break case 3: searchTimer = setTimeout(() => { - xlecxOpenTag(tabs[activeTabIndex].options[0], page, tabs[activeTabIndex].options[1], 0) + xlecxOpenTag(tabs[activeTabIndex].options[0], page, tabs[activeTabIndex].options[1], false) }, 185) break } diff --git a/task.txt b/task.txt index 5b4a799..75442dd 100644 --- a/task.txt +++ b/task.txt @@ -40,10 +40,9 @@ DB => { ] ] have 1 => { - site = s - comic_real_id = i - downloaded = d - _id + s: [SiteIndex...], + i: [Indexs...], => * + c: [IsComicDownloaded...] => 0 || 1 } characters => [ 'name' @@ -94,6 +93,7 @@ Added To Version { Fix Bug: When renaming still can use hotkeys Fix Some Database Optimization Bugs Fix Some Right Click Menu Bugs + Optimize Have Database and its System Merge Collections To Normal Gallery View Change Slider System and Fix Some Bugs Make Image Stop Loading System Work Better