Skip to content

Commit

Permalink
Merge pull request #189 from rthaut/release/v6.2.0
Browse files Browse the repository at this point in the history
Version 6.2.0
  • Loading branch information
rthaut authored Sep 18, 2021
2 parents a47774a + d8016f1 commit 15185e0
Show file tree
Hide file tree
Showing 56 changed files with 182 additions and 745 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# DeviantArt Filter

> This browser extension allows you to filter/block/hide deviations by user, keyword, and/or category on DeviantArt
> This browser extension allows you to filter/block/hide deviations by user and/or keyword on DeviantArt
## Overview

Have you ever want to block/filter deviations (a.k.a. submissions) while browsing [DeviantArt](https://www.deviantart.com)? **Well now you can!** Simply [install DeviantArt Filter](#installation) in your web browser of choice and start filtering by user, keyword, and/or category.
Have you ever want to block/filter deviations (a.k.a. submissions) while browsing [DeviantArt](https://www.deviantart.com)? **Well now you can!** Simply [install DeviantArt Filter](#installation) in your web browser of choice and start filtering by user and/or keyword.

![DeviantArt Filter Promotional Image](/promo/Screenshot_1280x800.png?raw=true)

Expand All @@ -13,7 +13,6 @@ Have you ever want to block/filter deviations (a.k.a. submissions) while browsin
* Fully-featured management panel for maintaining your filters and controlling functionality.
* Quickly create filters from any deviation thumbnail or link.
* Filter deviations by keywords in titles and/or tags (with wildcard support).
* Filter all deviations from specific categories.
* Import and export filter lists for easy backup and migration.

#### For more information, head to the [DeviantArt Filter website](https://rthaut.github.io/deviantART-Filter/).
Expand Down
58 changes: 24 additions & 34 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"description": "The short_name (maximum of 12 characters recommended) is a short version of the app's name"
},
"ExtensionDescription": {
"message": "Allows configurable filtering/removal of deviations by user, keyword, and/or category on DeviantArt.",
"message": "Allows configurable filtering/removal of deviations by user and/or keyword on DeviantArt.",
"description": "The description of the application"
},
"BrowserActionTitle": {
Expand Down Expand Up @@ -132,6 +132,18 @@
"Options_EnabledPages_PageLabel_Notifications": {
"message": "Notifications Page"
},
"Options_PlaceholderFunctionality_Header": {
"message": "Placeholder Appearance/Behavior"
},
"Options_PlaceholderFunctionality_HelpText": {
"message": "Use these to control the behavior and appearance of the placeholder thumbnails that are shown for filtered deviations."
},
"Options_PlaceholderFunctionality_OptionLabel_PreventClick": {
"message": "Prevent clicking on thumbnails for filtered deviations"
},
"Options_PlaceholderFunctionality_OptionLabel_ShowFilterText": {
"message": "Show the filter type/value on filtered deviations"
},
"Options_ShowUpdatedPage_Header": {
"message": "Show Release Notes for Updates"
},
Expand Down Expand Up @@ -165,45 +177,30 @@
"SidebarLink_ImportExport": {
"message": "Import/Export"
},
"SidebarLink_Categories": {
"message": "Category Filters"
},
"SidebarLink_Keywords": {
"message": "Keyword Filters"
},
"SidebarLink_Users": {
"message": "User Filters"
},
"FilterTitle_Category": {
"message": "Category"
},
"FilterTitle_Keyword": {
"message": "Keyword"
},
"FilterTitle_User": {
"message": "User"
},
"FilterTitle_Categories": {
"message": "Categories"
},
"FilterTitle_Keywords": {
"message": "Keywords"
},
"FilterTitle_Users": {
"message": "Users"
},
"FilteredTitle_Categories": {
"message": "Filtered Categories"
},
"FilteredTitle_Keywords": {
"message": "Filtered Keywords"
},
"FilteredTitle_Users": {
"message": "Filtered Users"
},
"Filter_Categories_PropTitle_Name": {
"message": "Category"
},
"Filter_Keywords_PropTitle_Keyword": {
"message": "Keyword"
},
Expand All @@ -225,25 +222,10 @@
"UnsupportedFilterError": {
"message": "Unsupported filter type"
},
"CategoriesMenuLabel": {
"message": "Select a category (type to search)",
"description": "The label shown on the categories autocomplete menu"
},
"CategoriesMenuNoOptionsText": {
"message": "No matching categories",
"description": "The text shown on the categories autocomplete menu when no options match the entered value"
},
"CategoriesMenuErrorOption": {
"message": "Failed to load category data",
"description": "The option shown (disabled) when category data cannot be loaded"
},
"DarkModeSwitchLabel": {
"message": "Dark Mode",
"description": "The message displayed on the switch for toggling Dark Mode"
},
"Placeholder_Category": {
"message": "Filtered Category"
},
"Placeholder_Keyword": {
"message": "Filtered Keyword"
},
Expand Down Expand Up @@ -306,9 +288,6 @@
"CreateFiltersFromDeviation_Username_Help": {
"message": "Toggle the switch to create a new user filter."
},
"CreateFiltersFromDeviation_Category_Help": {
"message": "Click on sections of the following category hierarchy to create a new category filter. (You can click on a selected section to unselect it.)"
},
"CreateFiltersFromDeviation_Tags_Help": {
"message": "Select one or more of the following tags to create new keyword filters."
},
Expand Down Expand Up @@ -356,5 +335,16 @@
"content": "$1"
}
}
},
"CreateUserFilterFromDeviation_ContextMenuLabel": {
"message": "Create Filter for this User"
},
"CreateUserFilterForUsername_ContextMenuLabel": {
"message": "Create User Filter for \"$USERNAME$\"",
"placeholders": {
"username": {
"content": "$1"
}
}
}
}
155 changes: 0 additions & 155 deletions app/scripts/background/categories.js

This file was deleted.

10 changes: 2 additions & 8 deletions app/scripts/background/filters.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { differenceBy, find, findIndex, mapKeys, uniqBy } from "lodash-es";

export const SUPPORTED_FILTERS = ["users", "keywords", "categories"];
export const SUPPORTED_FILTERS = ["users", "keywords"];

export const MIGRATED_FILTERS = {
// tags were changed to keywords in v6, so we need to change the storage key and the property names
Expand Down Expand Up @@ -29,13 +29,7 @@ export const FILTER_METHODS = {
uniq: (array) => uniqBy(array, "keyword"),
find: (array, value) => find(array, ["keyword", value.keyword]),
findIndex: (array, value) => findIndex(array, ["keyword", value.keyword]),
},
categories: {
diff: (array, values) => differenceBy(array, values, "name"),
uniq: (array) => uniqBy(array, "name"),
find: (array, value) => find(array, ["name", value.name]),
findIndex: (array, value) => findIndex(array, ["name", value.name]),
},
}
};

export const GetAllFilters = async () => {
Expand Down
30 changes: 29 additions & 1 deletion app/scripts/background/menus.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AddFilter } from "./filters";
import { SHOW_FILTER_DEVIATION_MODAL } from "../constants/messages";
import { TAG_URL_REGEX } from "../constants/url";
import { TAG_URL_REGEX, USER_URL_REGEX } from "../constants/url";

export const MENUS = [
{
Expand All @@ -11,6 +11,17 @@ export const MENUS = [
contexts: ["link"],
targetUrlPatterns: ["*://*.deviantart.com/tag/*"],
},
{
id: "filter-user",
title: browser.i18n.getMessage(
"CreateUserFilterFromDeviation_ContextMenuLabel"
),
contexts: ["link"],
targetUrlPatterns: [
"*://*.deviantart.com/*/art/*",
"*://*.deviantart.com/*/journal/*",
],
},
{
id: "show-filter-modal-deviation",
title: browser.i18n.getMessage(
Expand Down Expand Up @@ -60,6 +71,14 @@ export const OnMenuClicked = (info, tab) => {
}
break;

case "filter-user":
if (USER_URL_REGEX.test(info.linkUrl)) {
// eslint-disable-next-line no-case-declarations
const username = USER_URL_REGEX.exec(info.linkUrl)[1];
AddFilter("users", { username });
}
break;

case "show-filter-modal-deviation":
browser.tabs.sendMessage(tab.id, {
action: SHOW_FILTER_DEVIATION_MODAL,
Expand Down Expand Up @@ -90,6 +109,15 @@ export const OnMenuShown = (info, tab) => {
keyword
),
});
} else if (USER_URL_REGEX.test(info.linkUrl)) {
// filter-user menu
const username = USER_URL_REGEX.exec(info.linkUrl)[1];
UpdateMenuItem("filter-user", {
title: browser.i18n.getMessage(
"CreateUserFilterForUsername_ContextMenuLabel",
username
),
});
}
};

Expand Down
Loading

0 comments on commit 15185e0

Please sign in to comment.