From b1bd8544acd02eb9a1a5b43c0d04fdd3d5add58f Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 8 Mar 2022 19:12:09 +0300 Subject: [PATCH] Added pixivMoe #84 --- src/assets/images/pixiv-icon.png | Bin 0 -> 4920 bytes src/assets/images/pixiv-icon.svg | 56 ++++++ src/assets/javascripts/helpers/pixiv.js | 181 ++++++++++++++++++ src/assets/javascripts/helpers/tiktok.js | 2 +- src/pages/background/background.js | 4 + src/pages/options/general/general.html | 4 + src/pages/options/imgur/imgur.html | 4 + src/pages/options/instagram/instagram.html | 4 + src/pages/options/maps/maps.html | 4 + src/pages/options/medium/medium.html | 4 + src/pages/options/pixiv/pixiv.html | 161 ++++++++++++++++ src/pages/options/pixiv/pixiv.js | 59 ++++++ src/pages/options/reddit/reddit.html | 4 + src/pages/options/search/search.html | 4 + src/pages/options/tiktok/tiktok.html | 4 + src/pages/options/translate/translate.html | 4 + src/pages/options/twitter/twitter.html | 4 + src/pages/options/wikipedia/wikipedia.html | 4 + src/pages/options/youtube/youtube.html | 4 + .../options/youtubeMusic/youtubeMusic.html | 4 + src/pages/popup/popup.html | 9 + src/pages/popup/popup.js | 32 ++-- 22 files changed, 543 insertions(+), 13 deletions(-) create mode 100644 src/assets/images/pixiv-icon.png create mode 100644 src/assets/images/pixiv-icon.svg create mode 100644 src/assets/javascripts/helpers/pixiv.js create mode 100644 src/pages/options/pixiv/pixiv.html create mode 100644 src/pages/options/pixiv/pixiv.js diff --git a/src/assets/images/pixiv-icon.png b/src/assets/images/pixiv-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3dd6e660dc99798f69aaac8f942741f388eb95e0 GIT binary patch literal 4920 zcmV-86UXd{P)W zt~%dWb$)f~tltq1G*pGjp(>8zbVE$D8LDxeCa z0(2d)2CVNP@(o3~s}a$ZT$dpv)ea=g*;ufuRV;0&NUg+YT&2Sb*vrqLDfL zs?`sMZ23aw31F(`Q4={6^a6yDz)>mo=v!bqA~OgF|G{_(rPv=&W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R!FlwsS$`A^xDXhO+}u`os|k?2TZWm3}1(i|&sqUR(d z^C8(Yf1lDqtnfR)DM?K?OAO@;Ec+sgq#{{KCO68;IH^MI^FU`NHQg)#vx(a0Bs25D z)ZG74&7m^<0&umF^bb1Z4f2E6aii>R`B-n5iL-R2)KXzzhv*|@dkhmnK_8+bc!i0~ z2R~N-l!VVk^(BPP#%&!~RAN~-@LxfrQ}WD5S}V3cAR0Ll_{_Mi1BdxYbg1df2fsq? zjW1YFg?$#P_mf@G)f|fQBmw(0it^X^VbK2>l_lXbKqmpm_-;F$5tg7bwy707rtm-5 zX0iP-74{&MTL2FmsUNV^pn5-r_KALHKBPM0`k!_lM!^09aD7VsNE!ML0cR{@@>8~F zLwZcAe=2+qmi`v_S*l&}iO&(ar=>+3evlplsN<>d=~&L)2k`Lnd@SpJKWg`GNiPA^ z@pSD#9Bv1$1(FceC#5LxA?iHI*u1w>?My?`Qvh{LsyPC&uLUgzx~JM5Z|DZ#MFRRP zWAe&U?M+jpw*cyxpg}rD&c)KJP(}gmQ|(d{{0RIXBCoP3_#qP{?UyQLh5+hQsyS?l zoPnbwfsw#~6nnG`Wd4V@%%F6Se!JPA^1zf^-Ku0fiuipasN2D qu0v!sj;ux_-!LwJZAz}kApZ|6-QyvAiSGyi0000 + + + + + + + + + + diff --git a/src/assets/javascripts/helpers/pixiv.js b/src/assets/javascripts/helpers/pixiv.js new file mode 100644 index 0000000..2fedb45 --- /dev/null +++ b/src/assets/javascripts/helpers/pixiv.js @@ -0,0 +1,181 @@ +window.browser = window.browser || window.chrome; + +import commonHelper from './common.js' + +const targets = [ + /^https?:\/\/(www\.|)pixiv\.net.*/ +]; + +let redirects = { + "pixivMoe": { + "normal": [ + "https://pixiv.moe" + ], + "tor": [] + } +} + +const getRedirects = () => redirects; +const getCustomRedirects = function () { + return { + "pixivMoe": { + "normal": [...pixivMoeNormalRedirectsChecks, ...pixivMoeNormalCustomRedirects], + "tor": [] + }, + }; +}; + +function setRedirects(val) { + redirects.pixivMoe = val; + browser.storage.local.set({ pixivRedirects: redirects }) + console.log("pixivRedirects: ", val) + for (const item of pixivMoeNormalRedirectsChecks) + if (!redirects.pixivMoe.normal.includes(item)) { + var index = pixivMoeNormalRedirectsChecks.indexOf(item); + if (index !== -1) pixivMoeNormalRedirectsChecks.splice(index, 1); + } + setPixivMoeNormalRedirectsChecks(pixivMoeNormalRedirectsChecks); + + for (const item of pixivMoeTorRedirectsChecks) + if (!redirects.pixivMoe.normal.includes(item)) { + var index = pixivMoeTorRedirectsChecks.indexOf(item); + if (index !== -1) pixivMoeTorRedirectsChecks.splice(index, 1); + } + setPixivMoeTorRedirectsChecks(pixivMoeTorRedirectsChecks); +} + +let pixivMoeNormalRedirectsChecks; +const getPixivMoeNormalRedirectsChecks = () => pixivMoeNormalRedirectsChecks; +function setPixivMoeNormalRedirectsChecks(val) { + pixivMoeNormalRedirectsChecks = val; + browser.storage.local.set({ pixivMoeNormalRedirectsChecks }) + console.log("pixivMoeNormalRedirectsChecks: ", val) +} + +let pixivMoeTorRedirectsChecks; +const getPixivMoeTorRedirectsChecks = () => pixivMoeTorRedirectsChecks; +function setPixivMoeTorRedirectsChecks(val) { + pixivMoeTorRedirectsChecks = val; + browser.storage.local.set({ pixivMoeTorRedirectsChecks }) + console.log("pixivMoeTorRedirectsChecks: ", val) +} + +let pixivMoeNormalCustomRedirects = []; +const getPixivMoeNormalCustomRedirects = () => pixivMoeNormalCustomRedirects; +function setPixivMoeNormalCustomRedirects(val) { + pixivMoeNormalCustomRedirects = val; + browser.storage.local.set({ pixivMoeNormalCustomRedirects }) + console.log("pixivMoeNormalCustomRedirects: ", val) +} + +let pixivMoeTorCustomRedirects = []; +const getPixivMoeTorCustomRedirects = () => pixivMoeTorCustomRedirects; +function setPixivMoeTorCustomRedirects(val) { + pixivMoeTorCustomRedirects = val; + browser.storage.local.set({ pixivMoeTorCustomRedirects }) + console.log("pixivMoeTorCustomRedirects: ", val) +} + +let disable; +const getDisable = () => disable; +function setDisable(val) { + disable = val; + browser.storage.local.set({ disablePixiv: disable }) + console.log("disablePixiv", val); +} + +let protocol; +const getProtocol = () => protocol; +function setProtocol(val) { + protocol = val; + browser.storage.local.set({ pixivProtocol: val }) + console.log("pixivProtocol: ", val) +} + +function redirect(url, type, initiator) { + // https://www.pixiv.net/artworks/96572356 + // https://www.pixiv.net/en/artworks/96572356 + // https://pixiv.moe/illust/96572356 + + if (disable) return null; + if (initiator && ([...redirects.pixivMoe.normal, ...pixivMoeNormalCustomRedirects].includes(initiator.origin) || targets.includes(initiator.host))) return null; + if (!targets.some((rx) => rx.test(url.href))) return null; + console.log("PixivMoe!!"); + + if (type != "main_frame" && type != "sub_frame") return null; + + let instancesList; + if (protocol == 'normal') instancesList = [...pixivMoeNormalRedirectsChecks, ...pixivMoeNormalCustomRedirects]; + if (protocol == 'tor') instancesList = [...pixivMoeTorRedirectsChecks, ...pixivMoeTorCustomRedirects]; + if (instancesList.length === 0) return null; + let randomInstance = commonHelper.getRandomInstance(instancesList); + + let pathName = url.pathname + .replace('/artworks/', '/illust/') + .replace(/\/..\//, '/') + + return `${randomInstance}${pathName}`; +} + +async function init() { + return new Promise((resolve) => { + fetch('/instances/data.json').then(response => response.text()).then(data => { + let dataJson = JSON.parse(data); + browser.storage.local.get( + [ + "disablePixiv", + "pixivRedirects", + + "pixivMoeNormalRedirectsChecks", + "pixivMoeNormalCustomRedirects", + + "pixivMoeTorRedirectsChecks", + "pixivMoeTorCustomRedirects", + + "pixivProtocol" + ], + r => { + disable = r.disablePixiv ?? false; + + protocol = r.pixivProtocol ?? "normal"; + + if (r.pixivRedirects) redirects = r.pixivRedirects; + + pixivMoeNormalRedirectsChecks = r.pixivMoeNormalRedirectsChecks ?? [...redirects.pixivMoe.normal]; + pixivMoeNormalCustomRedirects = r.pixivMoeNormalCustomRedirects ?? []; + + pixivMoeTorRedirectsChecks = r.pixivMoeTorRedirectsChecks ?? [...redirects.pixivMoe.tor]; + pixivMoeTorCustomRedirects = r.pixivMoeTorCustomRedirects ?? []; + + resolve(); + } + ) + }); + }); +} + +export default { + + getRedirects, + getCustomRedirects, + setRedirects, + + getDisable, + setDisable, + + getProtocol, + setProtocol, + + getPixivMoeNormalRedirectsChecks, + setPixivMoeNormalRedirectsChecks, + getPixivMoeTorRedirectsChecks, + setPixivMoeTorRedirectsChecks, + + getPixivMoeTorCustomRedirects, + setPixivMoeTorCustomRedirects, + getPixivMoeNormalCustomRedirects, + setPixivMoeNormalCustomRedirects, + + redirect, + init, +}; diff --git a/src/assets/javascripts/helpers/tiktok.js b/src/assets/javascripts/helpers/tiktok.js index fe0c31e..2edc437 100644 --- a/src/assets/javascripts/helpers/tiktok.js +++ b/src/assets/javascripts/helpers/tiktok.js @@ -100,7 +100,7 @@ function redirect(url, type) { // https://www.tiktok.com/@keysikaspol/video/7061265241887345946 // https://www.tiktok.com/@keysikaspol - if (type != "main_frame" && "sub_frame" && "xmlhttprequest") return null; + if (type != "main_frame" && type != "sub_frame" && type != "xmlhttprequest") return null; let instancesList; if (protocol == 'normal') instancesList = [...proxiTokNormalRedirectsChecks, ...proxiTokNormalCustomRedirects]; diff --git a/src/pages/background/background.js b/src/pages/background/background.js index c494b78..0d47b3d 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -11,6 +11,7 @@ import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js"; import mediumHelper from "../../assets/javascripts/helpers/medium.js"; import imgurHelper from "../../assets/javascripts/helpers/imgur.js"; import tiktokHelper from "../../assets/javascripts/helpers/tiktok.js"; +import pixivHelper from "../../assets/javascripts/helpers/pixiv.js"; import generalHelper from "../../assets/javascripts/helpers/general.js"; import youtubeMusicHelper from "../../assets/javascripts/helpers/youtubeMusic.js"; @@ -29,6 +30,7 @@ async function wholeInit() { wikipediaHelper.init() imgurHelper.init() tiktokHelper.init() + pixivHelper.init() generalHelper.init() } @@ -68,6 +70,8 @@ browser.webRequest.onBeforeRequest.addListener( if (tiktokHelper.isTiktok(url, initiator)) newUrl = tiktokHelper.redirect(url, details.type); + if (!newUrl) newUrl = pixivHelper.redirect(url, details.type, initiator); + if (translateHelper.isTranslate(url, initiator)) newUrl = translateHelper.redirect(url); if (searchHelper.isSearch(url)) newUrl = searchHelper.redirect(url) diff --git a/src/pages/options/general/general.html b/src/pages/options/general/general.html index cf9615e..19e8e94 100644 --- a/src/pages/options/general/general.html +++ b/src/pages/options/general/general.html @@ -47,6 +47,10 @@ Imgur +
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/imgur/imgur.html b/src/pages/options/imgur/imgur.html index 347aac6..8f611ca 100644 --- a/src/pages/options/imgur/imgur.html +++ b/src/pages/options/imgur/imgur.html @@ -48,6 +48,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/instagram/instagram.html b/src/pages/options/instagram/instagram.html index e030b46..fe99d12 100644 --- a/src/pages/options/instagram/instagram.html +++ b/src/pages/options/instagram/instagram.html @@ -49,6 +49,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/maps/maps.html b/src/pages/options/maps/maps.html index f571b4e..c0a9b7d 100644 --- a/src/pages/options/maps/maps.html +++ b/src/pages/options/maps/maps.html @@ -49,6 +49,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/medium/medium.html b/src/pages/options/medium/medium.html index b8ef47c..89d7302 100644 --- a/src/pages/options/medium/medium.html +++ b/src/pages/options/medium/medium.html @@ -48,6 +48,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/pixiv/pixiv.html b/src/pages/options/pixiv/pixiv.html new file mode 100644 index 0000000..c768fdd --- /dev/null +++ b/src/pages/options/pixiv/pixiv.html @@ -0,0 +1,161 @@ + + + + + + + + + + LibRedirect Options: TikTok + + + + + +
+
+

Enable

+ +
+ +
+

Protocol

+ +
+ +
+ +
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+
+

Default Instances

+
+
+
+
+

Custom Instances

+
+
+
+ + +
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/pages/options/pixiv/pixiv.js b/src/pages/options/pixiv/pixiv.js new file mode 100644 index 0000000..0cefd1d --- /dev/null +++ b/src/pages/options/pixiv/pixiv.js @@ -0,0 +1,59 @@ +import pixivHelper from "../../../assets/javascripts/helpers/pixiv.js"; +import commonHelper from "../../../assets/javascripts/helpers/common.js"; + +let disablePixivElement = document.getElementById("disable-pixiv"); +disablePixivElement.addEventListener("change", + (event) => pixivHelper.setDisable(!event.target.checked) +); + +let protocolElement = document.getElementById("protocol") +protocolElement.addEventListener("change", + (event) => { + let protocol = event.target.options[protocolElement.selectedIndex].value + pixivHelper.setProtocol(protocol); + changeProtocolSettings(protocol); + } +); + +function changeProtocolSettings(protocol) { + let normalDiv = document.getElementById("normal"); + let torDiv = document.getElementById("tor"); + if (protocol == 'normal') { + normalDiv.style.display = 'block'; + torDiv.style.display = 'none'; + } + else if (protocol == 'tor') { + normalDiv.style.display = 'none'; + torDiv.style.display = 'block'; + } +} + +pixivHelper.init().then(() => { + disablePixivElement.checked = !pixivHelper.getDisable(); + + let protocol = pixivHelper.getProtocol(); + protocolElement.value = protocol; + changeProtocolSettings(protocol); + + commonHelper.processDefaultCustomInstances( + 'pixivMoe', + 'normal', + pixivHelper, + document, + pixivHelper.getPixivMoeNormalRedirectsChecks, + pixivHelper.setPixivMoeNormalRedirectsChecks, + pixivHelper.getPixivMoeNormalCustomRedirects, + pixivHelper.setPixivMoeNormalCustomRedirects + ); + + commonHelper.processDefaultCustomInstances( + 'pixivMoe', + 'tor', + pixivHelper, + document, + pixivHelper.getPixivMoeTorRedirectsChecks, + pixivHelper.setPixivMoeTorRedirectsChecks, + pixivHelper.getPixivMoeTorCustomRedirects, + pixivHelper.setPixivMoeTorCustomRedirects + ) +}) \ No newline at end of file diff --git a/src/pages/options/reddit/reddit.html b/src/pages/options/reddit/reddit.html index a7229d0..ce83f0c 100644 --- a/src/pages/options/reddit/reddit.html +++ b/src/pages/options/reddit/reddit.html @@ -48,6 +48,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html index 4f23273..6f2bc64 100644 --- a/src/pages/options/search/search.html +++ b/src/pages/options/search/search.html @@ -48,6 +48,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/tiktok/tiktok.html b/src/pages/options/tiktok/tiktok.html index b8b9544..0e003f3 100644 --- a/src/pages/options/tiktok/tiktok.html +++ b/src/pages/options/tiktok/tiktok.html @@ -48,6 +48,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/translate/translate.html b/src/pages/options/translate/translate.html index 701d54e..01b0224 100644 --- a/src/pages/options/translate/translate.html +++ b/src/pages/options/translate/translate.html @@ -48,6 +48,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/twitter/twitter.html b/src/pages/options/twitter/twitter.html index 3e9f228..00ae8e9 100644 --- a/src/pages/options/twitter/twitter.html +++ b/src/pages/options/twitter/twitter.html @@ -49,6 +49,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/wikipedia/wikipedia.html b/src/pages/options/wikipedia/wikipedia.html index cbf418f..c38def3 100644 --- a/src/pages/options/wikipedia/wikipedia.html +++ b/src/pages/options/wikipedia/wikipedia.html @@ -48,6 +48,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/youtube/youtube.html b/src/pages/options/youtube/youtube.html index 347e922..7ef7f96 100644 --- a/src/pages/options/youtube/youtube.html +++ b/src/pages/options/youtube/youtube.html @@ -49,6 +49,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/options/youtubeMusic/youtubeMusic.html b/src/pages/options/youtubeMusic/youtubeMusic.html index 687764b..e327ba3 100644 --- a/src/pages/options/youtubeMusic/youtubeMusic.html +++ b/src/pages/options/youtubeMusic/youtubeMusic.html @@ -49,6 +49,10 @@ Imgur
+
+ + Pixiv +
Wikipedia diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index 5e75b79..d62420f 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -68,6 +68,15 @@
+
+
+ + +

Pixiv

+
+ +
+
diff --git a/src/pages/popup/popup.js b/src/pages/popup/popup.js index fe90715..c4e61df 100644 --- a/src/pages/popup/popup.js +++ b/src/pages/popup/popup.js @@ -14,6 +14,7 @@ import wikipediaHelper from "../../assets/javascripts/helpers/wikipedia.js"; import mediumHelper from "../../assets/javascripts/helpers/medium.js"; import imgurHelper from "../../assets/javascripts/helpers/imgur.js"; import tiktokHelper from "../../assets/javascripts/helpers/tiktok.js"; +import pixivHelper from "../../assets/javascripts/helpers/pixiv.js"; let disableTwitterElement = document.getElementById("disable-nitter"); let disableYoutubeElement = document.getElementById("disable-youtube"); @@ -27,20 +28,22 @@ let disableWikipediaElement = document.getElementById("disable-wikipedia"); let disableMediumElement = document.getElementById("disable-medium"); let disableImgurElement = document.getElementById("disable-imgur"); let disableTiktokElement = document.getElementById("disable-tiktok"); +let disablePixivElement = document.getElementById("disable-pixiv"); async function wholeInit() { - await youtubeHelper.init(); - await youtubeMusicHelper.init(); - await twitterHelper.init(); - await instagramHelper.init(); - await mapsHelper.init(); - await redditHelper.init(); - await searchHelper.init(); - await translateHelper.init(); - await wikipediaHelper.init(); - await imgurHelper.init(); - await tiktokHelper.init(); - await mediumHelper.init(); + await youtubeHelper.init() + await youtubeMusicHelper.init() + await twitterHelper.init() + await instagramHelper.init() + await mapsHelper.init() + await redditHelper.init() + await searchHelper.init() + await translateHelper.init() + await wikipediaHelper.init() + await imgurHelper.init() + await tiktokHelper.init() + await pixivHelper.init() + await mediumHelper.init() }; wholeInit().then(() => { @@ -55,6 +58,7 @@ wholeInit().then(() => { disableWikipediaElement.checked = !wikipediaHelper.getDisable(); disableImgurElement.checked = !imgurHelper.getDisable(); disableTiktokElement.checked = !tiktokHelper.getDisable(); + disablePixivElement.checked = !pixivHelper.getDisable(); disableMediumElement.checked = !mediumHelper.getDisable(); }) @@ -102,6 +106,10 @@ disableTiktokElement.addEventListener("change", event => tiktokHelper.setDisable(!event.target.checked) ); +disablePixivElement.addEventListener("change", + event => pixivHelper.setDisable(!event.target.checked) +); + disableMediumElement.addEventListener("change", event => mediumHelper.setDisable(!event.target.checked) );