mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-09-20 04:53:43 +02:00
Added colored text if a category is locked for submitting and changing category
This commit is contained in:
parent
b927ebbbf7
commit
aa8ee02277
4 changed files with 24 additions and 7 deletions
|
@ -559,4 +559,8 @@ input::-webkit-inner-spin-button {
|
|||
border-width: 15px;
|
||||
border-style: solid;
|
||||
border-color: rgba(28, 28, 28, 0.7) transparent transparent transparent;
|
||||
}
|
||||
|
||||
.SponsorBlockLockedColor {
|
||||
color: #ffc83d;
|
||||
}
|
|
@ -557,16 +557,17 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||
for (const category of categories) {
|
||||
elements.push(
|
||||
<option value={category}
|
||||
key={category}>
|
||||
{this.categoryVoteButtonLockIcon(category) + chrome.i18n.getMessage("category_" + category)}
|
||||
key={category}
|
||||
className={this.categoryLockedClass(category)}>
|
||||
{chrome.i18n.getMessage("category_" + category)}
|
||||
</option>
|
||||
);
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
categoryVoteButtonLockIcon(category: Category): string {
|
||||
return (this.contentContainer().lockedCategories.includes(category)) ? "🔒" : " ";
|
||||
categoryLockedClass(category: string): string {
|
||||
return(this.props.contentContainer().lockedCategories.includes(category)) ? "SponsorBlockLockedColor" : ""
|
||||
}
|
||||
|
||||
unskip(index: number): void {
|
||||
|
|
|
@ -23,6 +23,7 @@ export interface SponsorTimeEditProps {
|
|||
export interface SponsorTimeEditState {
|
||||
editing: boolean;
|
||||
sponsorTimeEdits: [string, string];
|
||||
selectedCategory: Category;
|
||||
}
|
||||
|
||||
const DEFAULT_CATEGORY = "chooseACategory";
|
||||
|
@ -46,7 +47,8 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||
|
||||
this.state = {
|
||||
editing: false,
|
||||
sponsorTimeEdits: [null, null]
|
||||
sponsorTimeEdits: [null, null],
|
||||
selectedCategory: DEFAULT_CATEGORY as Category
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -251,7 +253,8 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||
for (const category of (this.props.categoryList ?? CompileConfig.categoryList)) {
|
||||
elements.push(
|
||||
<option value={category}
|
||||
key={category}>
|
||||
key={category}
|
||||
className={this.categoryLockedClass(category)}>
|
||||
{chrome.i18n.getMessage("category_" + category)}
|
||||
</option>
|
||||
);
|
||||
|
@ -260,6 +263,10 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||
return elements;
|
||||
}
|
||||
|
||||
categoryLockedClass(category: string): string {
|
||||
return(this.props.contentContainer().lockedCategories.includes(category)) ? "SponsorBlockLockedColor" : ""
|
||||
}
|
||||
|
||||
categorySelectionChange(event: React.ChangeEvent<HTMLSelectElement>): void {
|
||||
// See if show more categories was pressed
|
||||
if (event.target.value !== DEFAULT_CATEGORY && !Config.config.categorySelections.some((category) => category.name === event.target.value)) {
|
||||
|
|
|
@ -755,6 +755,11 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) {
|
|||
|
||||
sponsorLookupRetries++;
|
||||
}
|
||||
|
||||
getVipSegmentsWarnings(id);
|
||||
}
|
||||
|
||||
function getVipSegmentsWarnings(id: string): void {
|
||||
// Look up locked status if the user is a vip
|
||||
isVipLookup();
|
||||
const isVip = Config.config.isVip;
|
||||
|
@ -767,7 +772,7 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) {
|
|||
async function isVipLookup() {
|
||||
const currentTime = Date.now();
|
||||
const lastUpdate = Config.config.lastIsVipUpdate;
|
||||
if (currentTime - lastUpdate > 1000*60*60*24) { //max every 24 hours 1000*60*60*24
|
||||
if (currentTime - lastUpdate > 1) { //max every 24 hours 1000*60*60*24
|
||||
Config.config.lastIsVipUpdate = currentTime;
|
||||
utils.sendRequestToServer("GET", "/api/isUserVIP?userID=" + Config.config.userID,
|
||||
(response) => {
|
||||
|
|
Loading…
Reference in a new issue