diff options
author | Ajay <[email protected]> | 2022-03-27 18:23:19 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2022-03-27 18:23:19 -0400 |
commit | 46c5b5897ebc9c6b48ab4b3e7a7623f3f2622732 (patch) | |
tree | c80e7f88e6573bf8af9fe5fb96ecaf0a75d7f94d | |
parent | d2c50d2562b8154267f316803f8b4ebab69856c3 (diff) | |
download | SponsorBlock-46c5b5897ebc9c6b48ab4b3e7a7623f3f2622732.tar.gz SponsorBlock-46c5b5897ebc9c6b48ab4b3e7a7623f3f2622732.zip |
more implementation
-rw-r--r-- | manifest/manifest.json | 12 | ||||
-rw-r--r-- | public/_locales/en/messages.json | 2 | ||||
-rw-r--r-- | public/help/index.html | 89 | ||||
-rw-r--r-- | public/icons/IconSponsorBlocker256px.png | bin | 6891 -> 6967 bytes | |||
-rw-r--r-- | public/icons/LogoSponsorBlocker1024px.png | bin | 80531 -> 32614 bytes | |||
-rw-r--r-- | public/icons/LogoSponsorBlocker128px.png | bin | 7453 -> 3448 bytes | |||
-rw-r--r-- | public/icons/LogoSponsorBlocker256px.png | bin | 17313 -> 6967 bytes | |||
-rw-r--r-- | public/icons/LogoSponsorBlocker512px.png | bin | 37217 -> 14869 bytes | |||
-rw-r--r-- | public/icons/LogoSponsorBlocker64px.png | bin | 3454 -> 1778 bytes | |||
-rw-r--r-- | public/icons/PlayerStartIconSponsorBlocker.svg | 47 | ||||
-rw-r--r-- | public/options/lock-options.html | 41 | ||||
-rw-r--r-- | public/options/options.html | 2 | ||||
-rw-r--r-- | public/popup.html | 5 | ||||
-rw-r--r-- | src/background.ts | 2 | ||||
-rw-r--r-- | src/components/SkipNoticeComponent.tsx | 19 | ||||
-rw-r--r-- | src/config.ts | 100 | ||||
-rw-r--r-- | src/content.ts | 91 | ||||
-rw-r--r-- | src/popup.ts | 8 |
18 files changed, 109 insertions, 309 deletions
diff --git a/manifest/manifest.json b/manifest/manifest.json index e2a79254..8fa712e4 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,9 +1,9 @@ { - "name": "__MSG_fullName__", - "short_name": "SponsorBlock", + "name": "SponsorLock - The Solution", + "short_name": "SponsorLlock", "version": "4.2.1", "default_locale": "en", - "description": "__MSG_Description__", + "description": "SponsorLock only shows you promotion, and skips all useful informaton.", "homepage_url": "https://sponsor.ajay.app", "content_scripts": [{ "run_at": "document_start", @@ -73,8 +73,8 @@ ] }, "icons": { - "16": "icons/IconSponsorBlocker16px.png", - "32": "icons/IconSponsorBlocker32px.png", + "16": "icons/LogoSponsorBlocker64px.png", + "32": "icons/LogoSponsorBlocker64px.png", "64": "icons/LogoSponsorBlocker64px.png", "128": "icons/LogoSponsorBlocker128px.png", "256": "icons/LogoSponsorBlocker256px.png", @@ -82,7 +82,7 @@ "1024": "icons/LogoSponsorBlocker1024px.png" }, "options_ui": { - "page": "options/options.html", + "page": "options/lock-options.html", "open_in_tab": true }, "manifest_version": 2 diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 1d3e9f15..116d0217 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -540,7 +540,7 @@ "description": "Used between segments. Example: 1:20 to 1:30" }, "category_sponsor": { - "message": "Sponsor" + "message": "Useful Content" }, "category_sponsor_description": { "message": "Paid promotion, paid referrals and direct advertisements. Not for self-promotion or free shoutouts to causes/creators/websites/products they like." diff --git a/public/help/index.html b/public/help/index.html index ee886089..bbce1855 100644 --- a/public/help/index.html +++ b/public/help/index.html @@ -4,7 +4,7 @@ <title> SponsorBlock </title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1" /> - <link rel="icon" href="../icons/IconSponsorBlocker32px.png" type="image/png"> + <link rel="icon" href="../icons/LogoSponsorBlocker64px.png" type="image/png"> <link href="styles.css" rel="stylesheet"/> @@ -16,97 +16,28 @@ <div id="title"> <img src="../icons/LogoSponsorBlocker256px.png" height="80" class="profilepic"/> - SponsorBlock + SponsorLock </div> <div class="container sponsorBlockPageBody"> - <p class="createdBy"> - <img src="https://ajay.app/newprofilepic.jpg" height="30" class="profilepiccircle"/> - Created By <a href="https://ajay.app">Ajay Ramachandran</a> - <a href="https://sponsor.ajay.app/donate" target="_blank" rel="noopener" id="sbDonate">(Donate)</a> - </p> - <p> __MSG_helpPageThanksForInstalling__ By using this extension, you agree to the <a href="https://gist.github.com/ajayyy/aa9f8ded2b573d4f73a3ffa0ef74f796">Privacy Policy</a> and <a href="https://gist.github.com/ajayyy/9e8100f069348e0bc062641f34d6af12">Terms of Use</a>. </p> <p> - Come contribute, make some suggestions and help out on <a href="https://discord.gg/SponsorBlock">Discord</a> or on <a href="https://matrix.to/#/#sponsor:ajay.app?via=ajay.app&via=matrix.org&via=mozilla.org">Matrix</a>. + Good luck! This extension was created for April 1st 2022. </p> <p style="margin-bottom: 0; margin-top: 0" class="bigText center">__MSG_helpPageReviewOptions__</p> - <p class="smallText"> - __MSG_helpPageFeatureDisclaimer__ - </p> - - <iframe class="optionsFrame" src="../options/options.html#embed" style="border: none"></iframe> - - <h1>__MSG_helpPageHowSkippingWorks__</h1> - - <p class="projectPreview"> - <span class="projectPreviewImageLarge"> - <img src="images/popup.png"> - </span> - - __MSG_helpPageHowSkippingWorks1__ - - <br/> - <br/> - - __MSG_helpPageHowSkippingWorks2__ - </p> - - <div class="center"><img src="images/voting on notice.gif"></div> - - <h1>__MSG_Submitting__</h1> - - <p class="projectPreview"> - <img class="projectPreviewImageLarge" src="https://i.imgur.com/A1ilk6x.gif"> - - __MSG_helpPageSubmitting1__ - - <br/> - <br/> - - __MSG_helpPageSubmitting2__ - </p> - - <h1>__MSG_Editing__</h1> - - <p class="projectPreview"> - <span class="projectPreviewImageLarge"> - <img src="https://wiki.sponsor.ajay.app/images/6/6a/Popup_only.png"> - </span> - - __MSG_helpPageEditing1__ - - </p> - - <h1>__MSG_helpPageTooSlow__</h1> - - <p> - __MSG_helpPageTooSlow1__ - </p> - - <h1>__MSG_helpPageCopyOfDatabase__</h1> - - <p> - __MSG_helpPageCopyOfDatabase1__ <a href="https://sponsor.ajay.app/database">https://sponsor.ajay.app/database</a>. __MSG_helpPageCopyOfDatabase2__ - </p> - - <h1>__MSG_helpPageNews__</h1> - - <p> - See <a href="https://sponsor.ajay.app/news">https://sponsor.ajay.app/news</a>. - </p> + <iframe class="optionsFrame" src="../options/lock-options.html#embed" style="border: none"></iframe> <h1>__MSG_helpPageSourceCode__</h1> <h4 style="display: inline">Client:</h4> <!-- Github logo --> - <a href="https://github.com/ajayyy/SponsorBlock"><svg aria-hidden="true" version="1.1" viewBox="0 0 16 16" height="58px" style="padding-left: 15px"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a> + <a href="https://github.com/ajayyy/SponsorBlock/tree/april-fools-2022"><svg aria-hidden="true" version="1.1" viewBox="0 0 16 16" height="58px" style="padding-left: 15px"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a> <h4 style="display: inline; padding-left: 20px">Server:</h4> <!-- Github logo --> @@ -114,16 +45,6 @@ <h1>__MSG_Credits__</h1> - <p> - Thanks to all <a href="https://github.com/ajayyy/SponsorBlock/graphs/contributors">SponsorBlock contributors</a>, - <a href="https://github.com/ajayyy/SponsorBlockServer/graphs/contributors">SponsorBlockServer contributors</a> and - <a href="https://github.com/ajayyy/SponsorBlockSite/graphs/contributors">SponsorBlockSite contributors</a> such - as <a href="https://github.com/NDevTK">NDev</a>, <a href="https://github.com/Joe-Dowd">Joe Dowd</a>, - <a href="https://mchang.name/">Michael Chang</a> and more. - </p> - - <p>The awesome <a href="https://github.com/omarroth/invidious/wiki/API">Invidious API</a> is used to grab the time the video was published.</p> - <p>Some icons made by <a href="https://www.flaticon.com/authors/gregor-cresnar" title="Gregor Cresnar">Gregor Cresnar</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> and are licensed by <a href="https://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></p> <p>Some icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> and are licensed by <a href="https://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></p> diff --git a/public/icons/IconSponsorBlocker256px.png b/public/icons/IconSponsorBlocker256px.png Binary files differindex 9870f586..a11035bc 100644 --- a/public/icons/IconSponsorBlocker256px.png +++ b/public/icons/IconSponsorBlocker256px.png diff --git a/public/icons/LogoSponsorBlocker1024px.png b/public/icons/LogoSponsorBlocker1024px.png Binary files differindex 2b15e3f8..c8ce9318 100644 --- a/public/icons/LogoSponsorBlocker1024px.png +++ b/public/icons/LogoSponsorBlocker1024px.png diff --git a/public/icons/LogoSponsorBlocker128px.png b/public/icons/LogoSponsorBlocker128px.png Binary files differindex 1126f907..0974c2cd 100644 --- a/public/icons/LogoSponsorBlocker128px.png +++ b/public/icons/LogoSponsorBlocker128px.png diff --git a/public/icons/LogoSponsorBlocker256px.png b/public/icons/LogoSponsorBlocker256px.png Binary files differindex 71602e23..a11035bc 100644 --- a/public/icons/LogoSponsorBlocker256px.png +++ b/public/icons/LogoSponsorBlocker256px.png diff --git a/public/icons/LogoSponsorBlocker512px.png b/public/icons/LogoSponsorBlocker512px.png Binary files differindex 5445bd6a..9392b12e 100644 --- a/public/icons/LogoSponsorBlocker512px.png +++ b/public/icons/LogoSponsorBlocker512px.png diff --git a/public/icons/LogoSponsorBlocker64px.png b/public/icons/LogoSponsorBlocker64px.png Binary files differindex 31094742..cae7a568 100644 --- a/public/icons/LogoSponsorBlocker64px.png +++ b/public/icons/LogoSponsorBlocker64px.png diff --git a/public/icons/PlayerStartIconSponsorBlocker.svg b/public/icons/PlayerStartIconSponsorBlocker.svg index d31c673a..d1803efc 100644 --- a/public/icons/PlayerStartIconSponsorBlocker.svg +++ b/public/icons/PlayerStartIconSponsorBlocker.svg @@ -1,17 +1,20 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" viewBox="0 0 565.15 568" version="1.1" id="svg16" sodipodi:docname="PlayerStartIconSponsorBlocker.svg" - inkscape:version="0.92.4 (5da689c313, 2019-01-14)"> + inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)" + inkscape:export-filename="/home/ajay/projects/sb-extension/public/icons/LogoSponsorBlocker1024px.png" + inkscape:export-xdpi="173.9155" + inkscape:export-ydpi="173.9155" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> <metadata id="metadata20"> <rdf:RDF> @@ -33,16 +36,17 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1920" - inkscape:window-height="1001" + inkscape:window-height="983" id="namedview18" showgrid="false" inkscape:zoom="0.83098592" - inkscape:cx="-0.3618106" - inkscape:cy="322.44266" - inkscape:window-x="477" - inkscape:window-y="961" + inkscape:cx="444.69697" + inkscape:cy="271.26356" + inkscape:window-x="380" + inkscape:window-y="768" inkscape:window-maximized="1" - inkscape:current-layer="Layer_1-2" /> + inkscape:current-layer="Layer_1-2" + inkscape:pagecheckerboard="0" /> <defs id="defs4"> <style @@ -58,14 +62,15 @@ data-name="Layer 1" style="fill:#ffffff"> <path - class="cls-1" - d="M282.58,568a65,65,0,0,1-34.14-9.66C95.41,463.94,2.54,300.46,0,121A64.91,64.91,0,0,1,34,62.91a522.56,522.56,0,0,1,497.16,0,64.91,64.91,0,0,1,34,58.12c-2.53,179.43-95.4,342.91-248.42,437.3A65,65,0,0,1,282.58,568Zm0-548.31A502.24,502.24,0,0,0,43.4,80.22a45.27,45.27,0,0,0-23.7,40.53c2.44,172.67,91.81,330,239.07,420.83a46.19,46.19,0,0,0,47.61,0C453.64,450.73,543,293.42,545.45,120.75a45.26,45.26,0,0,0-23.7-40.54A502.26,502.26,0,0,0,282.58,19.69Z" - id="path8" - style="fill:#ffffff" /> + id="path953" + style="fill:none;stroke:#07a500;stroke-width:40" + d="M 279.39062,24.197266 C 179.21701,24.603169 98.318528,101.48391 98.605469,196.00391 c 0.159023,40.69515 15.666041,80.00792 43.744141,110.89843 V 147.87891 l 16.75935,97.00627 C 164.72335,211.06602 65.553309,180.55346 92.112522,170.56303 L 193.6089,410.46016 435.49163,328.41259 443.41016,147.87891 v 46.7539 l 18.32422,-0.0996 C 461.16135,100.01356 379.56507,23.790617 279.39062,24.197266 Z M 443.41016,195.51367 v 74.92188 c 12.04625,-23.34115 18.3128,-48.96032 18.32617,-74.92188 z" + sodipodi:nodetypes="cccccccccccccccc" /> <path - style="fill:#ffffff" - d="M 284.70508 42.693359 A 479.9 479.9 0 0 0 54.369141 100.41992 A 22.53 22.53 0 0 0 42.669922 120.41992 C 45.069922 290.25992 135.67008 438.63977 270.83008 522.00977 A 22.48 22.48 0 0 0 294.32031 522.00977 C 429.48031 438.63977 520.08047 290.25992 522.48047 120.41992 A 22.53 22.53 0 0 0 510.7793 100.41992 A 479.9 479.9 0 0 0 284.70508 42.693359 z M 220.41016 145.74023 L 411.2793 255.93945 L 220.41016 366.14062 L 220.41016 145.74023 z " - id="path10" /> + style="fill:#008000" + d="m 281.94584,119.65312 -239.275918,0.7668 c 0,0 -0.08983,-8.3148 0,0 2.4,169.84 93.000158,318.21985 228.160158,401.58985 7.20735,4.41633 16.28288,4.41633 23.49023,0 135.16,-83.37 225.76016,-231.74985 228.16016,-401.58985 v 0 z M 220.41016,145.74023 411.2793,255.93945 220.41016,366.14062 Z" + id="path10" + sodipodi:nodetypes="cccccccccccc" /> </g> </g> </svg> diff --git a/public/options/lock-options.html b/public/options/lock-options.html new file mode 100644 index 00000000..0cb8c528 --- /dev/null +++ b/public/options/lock-options.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- Link to specific tabs by using their ID in the URL like: options.html#keybinds --> + +<head> + <title>__MSG_Options__ - SponsorBlock</title> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <link rel="icon" href="../icons/LogoSponsorBlocker64px.png" type="image/png"> + + <link href="options.css" rel="stylesheet"/> + + <script src="../js/vendor.js"></script> + <script src="../js/options.js"></script> +</head> + +<body class="sponsorBlockPageBody"> + + <div id="options-container"> + + <div id="menubar" class="center"> + + <div id="title" class="titleBar"> + <img src="../icons/LogoSponsorBlocker256px.png" class="profilepic" alt="SponsorBlock logo"/> + SponsorLock + <div id="version"></div> + </div> + </div> + + </div> + + <div id="options"> + <div style="font-size: 75px;"> + With SponsorLock, <b>we</b> decide for <b>you</b>! + </div> + + Would you want it any other way? + </div> + + </div> + +</body> diff --git a/public/options/options.html b/public/options/options.html index 4f2bd730..662dbdce 100644 --- a/public/options/options.html +++ b/public/options/options.html @@ -5,7 +5,7 @@ <title>__MSG_Options__ - SponsorBlock</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1" /> - <link rel="icon" href="../icons/IconSponsorBlocker32px.png" type="image/png"> + <link rel="icon" href="../icons/LogoSponsorBlocker64px.png" type="image/png"> <link href="options.css" rel="stylesheet"/> diff --git a/public/popup.html b/public/popup.html index 78001e86..ca056eb8 100644 --- a/public/popup.html +++ b/public/popup.html @@ -13,7 +13,7 @@ <header class="sbPopupLogo"> <img src="icons/IconSponsorBlocker256px.png" alt="SponsorBlock" width="40" height="40" id="sponsorBlockPopupLogo"> - <p class="u-mZ">SponsorBlock</p> + <p class="u-mZ">SponsorLock</p> </header> <div id="videoInfo"> @@ -147,8 +147,7 @@ <br/> <a href="https://discord.gg/SponsorBlock" target="_blank" rel="noopener">Discord</a> | <a href="https://matrix.to/#/#sponsor:ajay.app?via=ajay.app&via=matrix.org&via=mozilla.org" target="_blank" rel="noopener">Matrix</a> | - <a id="helpButton">__MSG_help__</a> | - <a href="https://sponsor.ajay.app/donate" target="_blank" rel="noopener" id="sbDonate">$</a> + <a id="helpButton">__MSG_help__</a> </footer> <button id="showNoticeAgain" style="display: none">__MSG_showNotice__</button> diff --git a/src/background.ts b/src/background.ts index 5a7bacd5..3b0aa097 100644 --- a/src/background.ts +++ b/src/background.ts @@ -32,7 +32,7 @@ chrome.tabs.onUpdated.addListener(function(tabId) { chrome.runtime.onMessage.addListener(function (request, sender, callback) { switch(request.message) { case "openConfig": - chrome.tabs.create({url: chrome.runtime.getURL('options/options.html' + (request.hash ? '#' + request.hash : ''))}); + chrome.tabs.create({url: chrome.runtime.getURL('options/lock-options.html' + (request.hash ? '#' + request.hash : ''))}); return; case "openHelp": chrome.tabs.create({url: chrome.runtime.getURL('help/index.html')}); diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx index 6b3246d3..ab43ed09 100644 --- a/src/components/SkipNoticeComponent.tsx +++ b/src/components/SkipNoticeComponent.tsx @@ -152,12 +152,6 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta noticeStyle.transform = "scale(0.8) translate(10%, 10%)"; } - // If it started out as smaller, always keep the - // skip button there - const firstColumn = this.props.smaller ? ( - this.getSkipButton() - ) : null; - return ( <NoticeComponent noticeTitle={this.state.noticeTitle} amountOfPreviousNotices={this.amountOfPreviousNotices} @@ -174,8 +168,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta closeListener={() => this.closeListener()} smaller={this.state.smaller} limitWidth={true} - firstColumn={firstColumn} - bottomRow={[...this.getMessageBoxes(), ...this.getBottomRow() ]} + bottomRow={[...this.getMessageBoxes()]} onMouseEnter={() => this.onMouseEnter() } > </NoticeComponent> ); @@ -388,11 +381,11 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta } onMouseEnter(): void { - if (this.state.smaller) { - this.setState({ - smaller: false - }); - } + // if (this.state.smaller) { + // this.setState({ + // smaller: false + // }); + // } } getMessageBoxes(): JSX.Element[] { diff --git a/src/config.ts b/src/config.ts index 64ef44ca..4fd1d5b4 100644 --- a/src/config.ts +++ b/src/config.ts @@ -186,11 +186,11 @@ const Config: SBObject = { name: "sponsor" as Category, option: CategorySkipOption.AutoSkip }, { - name: "poi_highlight" as Category, - option: CategorySkipOption.ManualSkip + name: "interaction" as Category, + option: CategorySkipOption.AutoSkip }, { - name: "exclusive_access" as Category, - option: CategorySkipOption.ShowOverlay + name: "selfpromo" as Category, + option: CategorySkipOption.AutoSkip }], colorPalette: { @@ -396,97 +396,7 @@ async function fetchConfig(): Promise<void> { } function migrateOldSyncFormats(config: SBConfig) { - if (config["segmentTimes"]) { - const unsubmittedSegments = {}; - for (const item of config["segmentTimes"]) { - unsubmittedSegments[item[0]] = item[1]; - } - - chrome.storage.sync.remove("segmentTimes", () => config.unsubmittedSegments = unsubmittedSegments); - } - - if (!config["exclusive_accessCategoryAdded"] && !config.categorySelections.some((s) => s.name === "exclusive_access")) { - config["exclusive_accessCategoryAdded"] = true; - - config.categorySelections.push({ - name: "exclusive_access" as Category, - option: CategorySkipOption.ShowOverlay - }); - - config.categorySelections = config.categorySelections; - } - - if (config["fillerUpdate"] !== undefined) { - chrome.storage.sync.remove("fillerUpdate"); - } - if (config["highlightCategoryAdded"] !== undefined) { - chrome.storage.sync.remove("highlightCategoryAdded"); - } - if (config["highlightCategoryUpdate"] !== undefined) { - chrome.storage.sync.remove("highlightCategoryUpdate"); - } - - if (config["askAboutUnlistedVideos"]) { - chrome.storage.sync.remove("askAboutUnlistedVideos"); - } - - if (!config["autoSkipOnMusicVideosUpdate"]) { - config["autoSkipOnMusicVideosUpdate"] = true; - for (const selection of config.categorySelections) { - if (selection.name === "music_offtopic" - && selection.option === CategorySkipOption.AutoSkip) { - - config.autoSkipOnMusicVideos = true; - break; - } - } - } - - if (config["disableAutoSkip"]) { - for (const selection of config.categorySelections) { - if (selection.name === "sponsor") { - selection.option = CategorySkipOption.ManualSkip; - - chrome.storage.sync.remove("disableAutoSkip"); - } - } - } - - if (typeof config["skipKeybind"] == "string") { - config["skipKeybind"] = {key: config["skipKeybind"]}; - } - - if (typeof config["startSponsorKeybind"] == "string") { - config["startSponsorKeybind"] = {key: config["startSponsorKeybind"]}; - } - - if (typeof config["submitKeybind"] == "string") { - config["submitKeybind"] = {key: config["submitKeybind"]}; - } - - // Unbind key if it matches a previous one set by the user (should be ordered oldest to newest) - const keybinds = ["skipKeybind", "startSponsorKeybind", "submitKeybind"]; - for (let i = keybinds.length-1; i >= 0; i--) { - for (let j = 0; j < keybinds.length; j++) { - if (i == j) - continue; - if (keybindEquals(config[keybinds[i]], config[keybinds[j]])) - config[keybinds[i]] = null; - } - } - - // Remove some old unused options - if (config["sponsorVideoID"] !== undefined) { - chrome.storage.sync.remove("sponsorVideoID"); - } - if (config["previousVideoID"] !== undefined) { - chrome.storage.sync.remove("previousVideoID"); - } - - // populate invidiousInstances with new instances if 3p support is **DISABLED** - if (!config["supportInvidious"] && config["invidiousInstances"].length !== invidiousList.length) { - config["invidiousInstances"] = invidiousList; - } + // } async function setupConfig() { diff --git a/src/content.ts b/src/content.ts index f591a83b..3eb4a78d 100644 --- a/src/content.ts +++ b/src/content.ts @@ -442,7 +442,7 @@ function cancelSponsorSchedule(): void { /** * @param currentTime Optional if you don't want to use the actual current time */ -function startSponsorSchedule(includeIntersectingSegments = false, currentTime?: number, includeNonIntersectingSegments = true): void { +function startSponsorSchedule(includeIntersectingSegments = true, currentTime?: number, includeNonIntersectingSegments = true): void { cancelSponsorSchedule(); // Don't skip if advert playing and reset last checked time @@ -807,40 +807,18 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) { cursor = Math.max(cursor, time.segment[1]); } - sponsorTimes = newTimes; - } - // Hide all submissions smaller than the minimum duration - if (Config.config.minDuration !== 0) { - for (const segment of sponsorTimes) { - const duration = segment.segment[1] - segment.segment[0]; - if (duration > 0 && duration < Config.config.minDuration) { - segment.hidden = SponsorHideType.MinimumDuration; - } - } - } - - if (keepOldSubmissions) { - for (const segment of oldSegments) { - const otherSegment = sponsorTimes.find((other) => segment.UUID === other.UUID); - if (otherSegment) { - // If they downvoted it, or changed the category, keep it - otherSegment.hidden = segment.hidden; - otherSegment.category = segment.category; - } + if (cursor < video.duration) { + newTimes.push({ + segment: [cursor, video.duration], + source: SponsorSourceType.Local, + actionType: ActionType.Skip, + category: "sponsor" as Category, + UUID: null + }); } - } - // See if some segments should be hidden - const downvotedData = Config.local.downvotedSegments[hashPrefix]; - if (downvotedData) { - for (const segment of sponsorTimes) { - const hashedUUID = await utils.getHash(segment.UUID, 1); - const segmentDownvoteData = downvotedData.segments.find((downvote) => downvote.uuid === hashedUUID); - if (segmentDownvoteData) { - segment.hidden = segmentDownvoteData.hidden; - } - } + sponsorTimes = newTimes; } startSkipScheduleCheckingForStartSponsors(); @@ -860,14 +838,7 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) { } function getEnabledActionTypes(): ActionType[] { - const actionTypes = [ActionType.Skip, ActionType.Poi]; - if (Config.config.muteSegments) { - actionTypes.push(ActionType.Mute); - } - if (Config.config.fullVideoSegments) { - actionTypes.push(ActionType.Full); - } - + const actionTypes = [ActionType.Skip, ActionType.Mute]; return actionTypes; } @@ -1521,40 +1492,6 @@ async function updateVisibilityOfPlayerControlsButton(): Promise<void> { function updateEditButtonsOnPlayer(): void { // Don't try to update the buttons if we aren't on a YouTube video page if (!sponsorVideoID || onMobileYouTube) return; - - const buttonsEnabled = !Config.config.hideVideoPlayerControls && !onInvidious; - - let creatingSegment = false; - let submitButtonVisible = false; - let deleteButtonVisible = false; - - // Only check if buttons should be visible if they're enabled - if (buttonsEnabled) { - creatingSegment = isSegmentCreationInProgress(); - - // Show only if there are any segments to submit - submitButtonVisible = sponsorTimesSubmitting.length > 0; - - // Show only if there are any segments to delete - deleteButtonVisible = sponsorTimesSubmitting.length > 1 || (sponsorTimesSubmitting.length > 0 && !creatingSegment); - } - - // Update the elements - playerButtons.startSegment.button.style.display = buttonsEnabled ? "unset" : "none"; - playerButtons.cancelSegment.button.style.display = buttonsEnabled && creatingSegment ? "unset" : "none"; - - if (buttonsEnabled) { - if (creatingSegment) { - playerButtons.startSegment.image.src = chrome.extension.getURL("icons/PlayerStopIconSponsorBlocker.svg"); - playerButtons.startSegment.button.setAttribute("title", chrome.i18n.getMessage("sponsorEnd")); - } else { - playerButtons.startSegment.image.src = chrome.extension.getURL("icons/PlayerStartIconSponsorBlocker.svg"); - playerButtons.startSegment.button.setAttribute("title", chrome.i18n.getMessage("sponsorStart")); - } - } - - playerButtons.submit.button.style.display = submitButtonVisible && !Config.config.hideUploadButtonPlayerControls ? "unset" : "none"; - playerButtons.delete.button.style.display = deleteButtonVisible && !Config.config.hideDeleteButtonPlayerControls ? "unset" : "none"; } /** @@ -1900,9 +1837,9 @@ function submitSponsorTimes() { return; } - if (sponsorTimesSubmitting !== undefined && sponsorTimesSubmitting.length > 0) { - submissionNotice = new SubmissionNotice(skipNoticeContentContainer, sendSubmitMessage); - } + // if (sponsorTimesSubmitting !== undefined && sponsorTimesSubmitting.length > 0) { + // submissionNotice = new SubmissionNotice(skipNoticeContentContainer, sendSubmitMessage); + // } } diff --git a/src/popup.ts b/src/popup.ts index cbf92917..33dbeb54 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -114,12 +114,6 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { "sbCloseDonate" ].forEach(id => PageElements[id] = document.getElementById(id)); - // Hide donate button if wanted (Safari, or user choice) - if (!showDonationLink()) { - PageElements.sbDonate.style.display = "none"; - } - PageElements.sbDonate.addEventListener("click", () => Config.config.donateClicked = Config.config.donateClicked + 1); - //setup click listeners PageElements.sponsorStart.addEventListener("click", sendSponsorStartMessage); PageElements.whitelistToggle.addEventListener("change", function () { @@ -297,7 +291,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { if (request != undefined) { //remove loading text PageElements.mainControls.style.display = "flex"; - if (request.onMobileYouTube) PageElements.mainControls.classList.add("hidden"); + PageElements.mainControls.classList.add("hidden"); PageElements.whitelistButton.classList.remove("hidden"); PageElements.loadingIndicator.style.display = "none"; |