Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
trych committed Nov 22, 2022
1 parent 5386de8 commit baeec0e
Show file tree
Hide file tree
Showing 18 changed files with 195 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# System files
# ------------

.DS_Store

# CSS files
# ---------------

*.css
5 changes: 5 additions & 0 deletions css/faz.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.wm-boycott,
section[data-ct-context="dossier-fussball-wm"]
{
display: none !important;
}
9 changes: 9 additions & 0 deletions css/spiegel.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.wm-boycott,
section[data-area="block>widget>WM 2022 Widget"],
div[data-area="block>topic:fußball-wm_in_katar"],
section[data-area="block>topic:fußball-wm_in_katar"],
section[data-area="block>topic:weltmeisterschaft_in_katar"],
div[data-area="block>sportdaten"]
{
display: none !important;
}
1 change: 1 addition & 0 deletions css/sz.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.wm-boycott{display:none !important}
5 changes: 5 additions & 0 deletions css/tagesspiegel.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.wm-boycott,
div[data-pym-src^="https://embed.dpa-sportslive.com"]
{
display: none !important;
}
6 changes: 6 additions & 0 deletions css/zeit.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.wm-boycott,
section[data-ct-context="dossier-fussball-wm"],
.wm-ticker,
{
display: none !important;
}
Binary file added images/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions js/faz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const selectors = [
'article',
'.o-ModuleWrapper',
'.lay-MegaMenu_SubsectionItem'
]

searchAndHide(selectors, regex);
34 changes: 34 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const keywords = [
'WM',
'WM-Auftakt',
'WM-Premiere',
'Weltmeisterschaft',
'Fußball-WM',
'Fußball-Weltmeisterschaft',
'FIFA',
'Katar',
'Qatar',
'Katars',
'Qatars',
'Katarer',
'Qatarer',
'Infantino',
'Nationalmannschaft',
'DFB-Elf'
];

const regexPattern = '(^|\\W)(' + keywords.join('|') + ')($|\\W)';
const regex = new RegExp(regexPattern);

function searchAndHide(selectors, regex) {

const nodes = document.querySelectorAll(selectors.join(','));
nodes.forEach(node => {
const found = node.innerText.match(regex);

if(found) {
node.classList.add('wm-boycott');
}
});

}
11 changes: 11 additions & 0 deletions js/spiegel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const selectors = [
'article',
'div[data-component="SwiperBar"] .swiper-slide',
'.swiper-wrapper .swiper-slide',
'div[data-area^="block>podlove"]',
'div[data-component="AudioPlayerPlaceholderOmny"]',
'div[data-area="block>margin_column_top"] li',
'div[data-area="block>shortnews:nachrichten_in_kürze"] li'
];

searchAndHide(selectors, regex);
10 changes: 10 additions & 0 deletions js/sz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const selectors = [
'nav li',
'#sz-newspilot .newsscannermodule__item',
'.sz-pilot li',
'.sz-teaserlist-element',
'.mediabanderole__swiper-wrapper .teaser-item',
'.related-links__container .related-links__item'
];

searchAndHide(selectors, regex);
8 changes: 8 additions & 0 deletions js/tagesspiegel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const selectors = [
'article',
'section',
'#mainMenuPanel li',
'footer ul li'
]

searchAndHide(selectors, regex);
13 changes: 13 additions & 0 deletions js/zeit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const selectors = [
'.zon-teaser-lead__kicker',
'.zon-teaser-standard',
'.zon-teaser-wide',
'section[data-ct-context="headed-sport"] li',
'section[data-ct-context="newsticker"] .newsteaser',
'.nav__tags a',
'.sticky-nav__list li',
'.newsletter-signup',
'.zon-teaser-kpi-table',
]

searchAndHide(selectors, regex);
77 changes: 77 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"manifest_version": 3,
"name": "WM-Boykott",
"version": "1.0",
"description": "Verbirgt News-Artikel über die Fußballweltmeisterschaft 2022 in Katar auf deutschen News-Websites.",

"content_scripts": [
{
"js": [
"js/main.js",
"js/faz.js"
],
"css": [
"css/faz.css"
],
"matches": [
"https://*.faz.net/*"
]
},
{
"js": [
"js/main.js",
"js/spiegel.js"
],
"css": [
"css/spiegel.css"
],
"matches": [
"https://*.spiegel.de/*"
]
},
{
"js": [
"js/main.js",
"js/sz.js"
],
"css": [
"css/sz.css"
],
"matches": [
"https://*.sueddeutsche.de/*"
]
},
{
"js": [
"js/main.js",
"js/tagesspiegel.js"
],
"css": [
"css/tagesspiegel.css"
],
"matches": [
"https://*.tagesspiegel.de/*"
]
},
{
"js": [
"js/main.js",
"js/zeit.js"
],
"css": [
"css/zeit.css"
],
"matches": [
"https://*.zeit.de/*"
]
}
],

"icons": {
"16": "images/icon-16.png",
"32": "images/icon-32.png",
"48": "images/icon-48.png",
"64": "images/icon-64.png",
"128": "images/icon-128.png"
}
}

0 comments on commit baeec0e

Please sign in to comment.