diff --git a/src/AdvancedFlagging.ts b/src/AdvancedFlagging.ts index fe3e40e..5e7c7d4 100644 --- a/src/AdvancedFlagging.ts +++ b/src/AdvancedFlagging.ts @@ -165,7 +165,7 @@ function setupPostPage(): void { page = new Page(); - if (page.name && page.name !== 'Question') { + if (page.name && page.name !== 'Question' && page.name !== 'Staging Ground') { page.posts.forEach(post => post.addIcons()); return; diff --git a/src/UserscriptTools/Page.ts b/src/UserscriptTools/Page.ts index 06d145b..e296b4e 100644 --- a/src/UserscriptTools/Page.ts +++ b/src/UserscriptTools/Page.ts @@ -1,11 +1,12 @@ import Post from './Post'; -type Pages = 'Question' | 'NATO' | 'Flags' | 'Search' | 'Review'; +type Pages = 'Question' | 'NATO' | 'Flags' | 'Search' | 'Review' | 'Staging Ground'; export default class Page { public static readonly isStackOverflow = /^https:\/\/stackoverflow.com/.test(location.href); public static readonly isQuestionPage = /\/questions\/\d+.*/.test(location.href); public static readonly isLqpReviewPage = /\/review\/low-quality-posts(?:\/\d+)?(?:\/)?$/.test(location.href); + public static readonly isStagingGroundPage = /\/staging-ground\/\d+/.test(location.href); public readonly name: Pages | ''; public readonly posts: Post[] = []; @@ -52,16 +53,16 @@ export default class Page { } private getName(): Pages | '' { - const isQuestionPage = /\/questions\/\d+.*/.test(location.href); const isNatoPage = this.href.pathname.startsWith('/tools/new-answers-old-questions'); const isFlagsPage = /\/users\/flag-summary\/\d+/.test(location.href); const isSearch = this.href.pathname.startsWith('/search'); if (isFlagsPage) return 'Flags'; else if (isNatoPage) return 'NATO'; - else if (isQuestionPage) return 'Question'; + else if (Page.isQuestionPage) return 'Question'; else if (isSearch) return 'Search'; else if (Page.isLqpReviewPage) return 'Review'; + else if (Page.isStagingGroundPage) return 'Staging Ground'; else return ''; } @@ -72,6 +73,7 @@ export default class Page { case 'Flags': return '.flagged-post'; case 'Question': + case 'Staging Ground': return '.question, .answer'; case 'Search': return '.js-search-results .s-post-summary'; diff --git a/src/UserscriptTools/Reporter.ts b/src/UserscriptTools/Reporter.ts index 93f5e94..fd0670a 100644 --- a/src/UserscriptTools/Reporter.ts +++ b/src/UserscriptTools/Reporter.ts @@ -62,7 +62,7 @@ export default class Reporter { const iconWrapper = document.createElement('div'); iconWrapper.classList.add('flex--item', 'd-inline-block', 'advanced-flagging-icon'); - if (!Page.isQuestionPage && !Page.isLqpReviewPage) { + if (!Page.isQuestionPage && !Page.isLqpReviewPage && !Page.isStagingGroundPage) { iconWrapper.classList.add('ml8'); // flag pages }