diff options
author | Ajay <[email protected]> | 2022-09-16 22:41:39 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2022-09-16 22:41:39 -0400 |
commit | 4804c7f43974087e42d61913222d5ef9711b087d (patch) | |
tree | eee0ab2c9b0479388732f35c4584b3df2eeab084 | |
parent | 47f685bcdda19a14957a388ca6c27832173128da (diff) | |
download | SponsorBlock-4804c7f43974087e42d61913222d5ef9711b087d.tar.gz SponsorBlock-4804c7f43974087e42d61913222d5ef9711b087d.zip |
Add option to show categories you don't have permission to submit
-rw-r--r-- | public/_locales/en/messages.json | 6 | ||||
-rw-r--r-- | public/options/options.html | 14 | ||||
-rw-r--r-- | src/components/SponsorTimeEditComponent.tsx | 6 | ||||
-rw-r--r-- | src/config.ts | 2 |
4 files changed, 26 insertions, 2 deletions
diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 3984695f..8863c703 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -246,6 +246,12 @@ "whatRefetchWhenNotFound": { "message": "If the video is new, and there are no segments found, it will keep refetching every few minutes while you watch." }, + "enableShowCategoryWithoutPermission": { + "message": "Show categories in submission menu even without submission permission" + }, + "whatShowCategoryWithoutPermission": { + "message": "Some categories require permission to submit due to minimum reputation requirements" + }, "showNotice": { "message": "Show Notice Again" }, diff --git a/public/options/options.html b/public/options/options.html index 31a60cb1..91112941 100644 --- a/public/options/options.html +++ b/public/options/options.html @@ -141,6 +141,20 @@ <div class="small-description">__MSG_whatRefetchWhenNotFound__</div> </div> + <div data-type="toggle" data-sync="showCategoryWithoutPermission"> + <div class="switch-container"> + <label class="switch"> + <input id="showCategoryWithoutPermission" type="checkbox" checked> + <span class="slider round"></span> + </label> + <label class="switch-label" for="showCategoryWithoutPermission"> + __MSG_enableShowCategoryWithoutPermission__ + </label> + </div> + + <div class="small-description">__MSG_whatShowCategoryWithoutPermission__</div> + </div> + </div> <div id="interface" class="option-group hidden"> diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx index 61ee83b9..74ad57fd 100644 --- a/src/components/SponsorTimeEditComponent.tsx +++ b/src/components/SponsorTimeEditComponent.tsx @@ -404,8 +404,10 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo for (const category of (this.props.categoryList ?? CompileConfig.categoryList)) { // If permission not loaded, treat it like we have permission except chapter const defaultBlockCategories = ["chapter"]; - const permission = Config.config.permissions[category as Category] && (category !== "chapter" || noRefreshFetchingChaptersAllowed()); - if ((defaultBlockCategories.includes(category) || permission !== undefined) && !permission) continue; + const permission = (Config.config.showCategoryWithoutPermission + || Config.config.permissions[category as Category]) && (category !== "chapter" || noRefreshFetchingChaptersAllowed()); + if ((defaultBlockCategories.includes(category) + || (permission !== undefined && !Config.config.showCategoryWithoutPermission)) && !permission) continue; elements.push( <option value={category} diff --git a/src/config.ts b/src/config.ts index 51f3c09d..eda7ed63 100644 --- a/src/config.ts +++ b/src/config.ts @@ -65,6 +65,7 @@ interface SBConfig { darkMode: boolean, showCategoryGuidelines: boolean, chaptersAvailable: boolean, + showCategoryWithoutPermission: boolean, // Used to cache calculated text color info categoryPillColors: { @@ -195,6 +196,7 @@ const Config: SBObject = { darkMode: true, showCategoryGuidelines: true, chaptersAvailable: true, + showCategoryWithoutPermission: false, categoryPillColors: {}, |