瀏覽代碼

Set up the basic blocker -- removes blacklisted words

master
Fen Dweller 5 年之前
當前提交
7dc21d9d5f
共有 2 個文件被更改,包括 34 次插入0 次删除
  1. +20
    -0
      filter.js
  2. +14
    -0
      manifest.json

+ 20
- 0
filter.js 查看文件

@@ -0,0 +1,20 @@
"use strict";

const gallery = document.querySelector("#gallery-frontpage-submissions");
const submissions = gallery.querySelectorAll("figure");

const blacklist = [
"ych",
"adopt",
"reminder",
"auction"
]

submissions.forEach(sub => {
const title = sub.querySelector("figcaption > p > a").title.toLowerCase();
console.log(title);

if (blacklist.some(word => title.indexOf(word) != -1)) {
gallery.removeChild(sub);
}
});

+ 14
- 0
manifest.json 查看文件

@@ -0,0 +1,14 @@
{
"name": "FurAffinity Filter",
"version": "0.1",
"description": "Filters out reminder/YCH/adopt spam from the front page",
"permissions": ["tabs", "*://www.furaffinity.net/"],
"content_scripts": [
{
"run_at": "document_idle",
"matches": ["*://www.furaffinity.net/"],
"js": ["filter.js"]
}
],
"manifest_version": 2
}

Loading…
取消
儲存