Skip to content

Commit 4d332fa

Browse files
chore: linting things
1 parent 11b77dd commit 4d332fa

20 files changed

+246
-219
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
node_modules
12
!styles/*.css
23
*.css

README.md

+75-44
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Userscripts and Userstyles
22

33
### Notes
4+
45
My personal collection of userscripts. These can all be used independently of each other, so just grab the ones that sound interesting. I primarily use Safari, and haven't tested any of these in other browsers. If you run into issues, please open an issue.
56

67
From Sept. 2020 onwards, these are designed and being updated to work with [Userscripts](https://github.com/quoid/userscripts) instead of Tampermonkey.
@@ -12,100 +13,122 @@ Archived scripts are stored in archive folder.
1213
### Scripts
1314

1415
#### ban-hn
16+
1517
HN has really bad moderation, so this enables me to automatically hide cancerous people that I spot on there.
1618

1719
#### chess
20+
1821
Add button to analyze games on lichess.org on game-over screen for chess.com
1922

2023
#### cnbc
24+
2125
CNBC is removing the article because of my adblocking, so double the article, it won't remove both.
2226

2327
#### fakespot
28+
2429
Add fakespot link above buy box on amazon
2530

2631
#### fanfiction
32+
2733
Modify fanfiction.net to be better. There's a customizable cors proxy url that can be used on the profile page.
2834
If you change this to your own, you can view mobile favorites (without 500 limit) on the desktop.
2935

30-
#### google-placeholder
31-
Pulled in some uBlock scripts that have drop-in no-op replacements for google tracking, might cause less sites to break.
32-
3336
#### guardian
34-
Attempt to fix some of the annoyances I'm encountering on theguardian. This doesn't really work yet, but it's a first step towards pulling out content and replacing entire page.
3537

36-
#### imgur
37-
Bypass imgur login
38+
Attempt to fix some of the annoyances I'm encountering on theguardian. This doesn't really work yet, but it's a first step towards pulling out content and replacing entire page.
3839

3940
#### logic-immo
40-
Fix this site so it works with adblock
41-
42-
#### reddit-filter
43-
Adds a filter at end of tagline that has a popup to filter on subreddit, domain, or user (only on r/all). They're stored in the localStorage keys starting with 'filter'. Filtered items must be removed from localStorage manually.
44-
45-
![reddit-filter screenshot](./screenshots/reddit-filter.png)
4641

47-
#### reddit-load
48-
When you scroll to the bottom, load the next page of results. Compatible with reddit-filter.
49-
50-
#### reddit-nsfw
51-
Filter all NSFW tags from appearing on any page
52-
53-
#### reddit-override
54-
Override Reddit's official window.r functionality that *may* be interesting, I don't really know. The isMobile method stops video pinning though, which is useful.
42+
Fix this site so it works with adblock
5543

5644
#### reddit-redirect
57-
Redirects www calls to old.reddit.com
5845

59-
#### uBlock-Origin-dev-filter
60-
Hides the crappy domains from DuckDuckGo & Google. PR [here](https://github.com/quenhus/uBlock-Origin-dev-filter/pull/12) for userscript output support.
46+
Redirects www calls to old.reddit.com
6147

6248
#### wikipedia-chess
49+
6350
Fixes chessboards on Safari wikipedia
6451

6552
#### wikipedia-nag
53+
6654
Removes donation nag on wikipedia
6755

6856
#### xenforo-popular
57+
6958
Hides unpopular stories on spacebattles / sufficientvelocity, so it's easier to go through recently updated and find good stories.
7059

7160
#### xenforo-reactions
61+
7262
Adds first message reaction score on alternate-history, sufficientvelocity and spacebattles.
7363

7464
### Styles
75-
* amazon
76-
* bloomberg
77-
* chess
78-
* duckduckgo
79-
* fanfiction
80-
* gamepedia
81-
* hacker-news
82-
* guardian
83-
* lemonde
84-
* overflow (`overflow: auto` on body/html)
85-
* reddit
86-
* royalroad
87-
* speedrun
88-
* teddit
89-
* wormstorysearch
90-
* xenforo
91-
* youtube
65+
66+
- amazon
67+
- bloomberg
68+
- chess
69+
- duckduckgo
70+
- fanfiction
71+
- gamepedia
72+
- hacker-news
73+
- guardian
74+
- lemonde
75+
- overflow (`overflow: auto` on body/html)
76+
- reddit
77+
- royalroad
78+
- speedrun
79+
- teddit
80+
- wormstorysearch
81+
- xenforo
82+
- youtube
9283

9384
### Archived Scripts
94-
These scripts are ones I am not actively maintaining, they may continue to work. If you run into an issue with them, please open an issue and I will take a look.
85+
86+
#### imgur [archived]
87+
88+
Bypass imgur login
89+
90+
#### google-placeholder [archived]
91+
92+
Pulled in some uBlock scripts that have drop-in no-op replacements for google tracking, might cause less sites to break.
93+
94+
These scripts are ones I am not actively maintaining, they may continue to work.
9595

9696
#### facebook-marketplace [archived]
97+
9798
Sort facebook marketplace by date
9899

99100
#### facebook-marketplace-local-only [archived]
101+
100102
Remove 'Ships to you' items from marketplace. I'm not sure this does what I want, but it's somewhat useful at the moment.
101103

102104
#### outline [archived]
105+
103106
Open some outgoing links (mostly news) from HN and Reddit using the awesome [outline.com](https://outline.com) service.
104107

105108
#### paradoxwikis [archived]
109+
106110
Achievements page on EU4 wiki is using some new mobile style, so just delete it all and use no style. Tables are usable as-is.
107111

112+
#### reddit-filter [archived]
113+
114+
Adds a filter at end of tagline that has a popup to filter on subreddit, domain, or user (only on r/all). They're stored in the localStorage keys starting with 'filter'. Filtered items must be removed from localStorage manually.
115+
116+
![reddit-filter screenshot](./screenshots/reddit-filter.png)
117+
118+
#### reddit-load [archived]
119+
120+
When you scroll to the bottom, load the next page of results. Compatible with reddit-filter.
121+
122+
#### reddit-nsfw [archived]
123+
124+
Filter all NSFW tags from appearing on any page
125+
126+
#### reddit-override [archived]
127+
128+
Override Reddit's official window.r functionality that _may_ be interesting, I don't really know. The isMobile method stops video pinning though, which is useful.
129+
108130
#### stylize [archived]
131+
109132
Allows me to write custom styles for websites matching hosts by string or regex. Not very user friendly and you'd be best off copying the js directly into your tampermonkey extension and ignoring updates.
110133

111134
Replaced with styles in Cascadea.
@@ -118,27 +141,35 @@ const csses = {
118141
.subreddit {
119142
border: 1px solid blue;
120143
}
121-
`
144+
`,
122145
},
123146
'old.reddit.com': {
124147
type: 'string',
125148
css: `
126149
.subreddit {
127150
border: 1px solid red;
128151
}
129-
`
130-
}
152+
`,
153+
},
131154
};
132155
```
133156

157+
#### uBlock-Origin-dev-filter [archived]
158+
159+
Hides the crappy domains from DuckDuckGo & Google. PR [here](https://github.com/quenhus/uBlock-Origin-dev-filter/pull/12) for userscript output support.
160+
134161
#### xenforo-no-fanwork [archived]
162+
135163
Remove fanwork discussions from main user forum on sufficientvelocity
136164

137165
#### xenforo-no-worm [archived]
166+
138167
Remove worm stories, except from worm specific forums
139168

140169
#### xenforo-search [archived]
170+
141171
Remove posts from search results, only show threads
142172

143173
#### youtube [archived]
174+
144175
Disable youtube polymer
File renamed without changes.

imgur.js archive/imgur.js

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

ban-hn.js

+39-42
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
// @namespace https://github.com/dylanarmstrong/userscripts/
88
// @supportURL https://github.com/dylanarmstrong/userscripts/issues
99
// @updateURL https://raw.githubusercontent.com/dylanarmstrong/userscripts/main/ban-hn.js
10-
// @version 2
10+
// @version 3
1111
// ==/UserScript==
1212

1313
/**
1414
* HN has really bad moderation, so it's easier to just block the people who are cancer.
1515
*/
1616

17-
(function () {
18-
'use strict';
19-
17+
(function main() {
2018
// Store the version # in localStorage
2119
// this will be useful for possible breaking changes
2220
// How many ? can you fit on one line?
@@ -48,15 +46,15 @@
4846
localStorage.setItem(keys.version, version);
4947

5048
// Make a (x) button next to subhn
51-
let button = document.createElement('button');
49+
const button = document.createElement('button');
5250
button.classList.add('hn-filter-block');
5351

54-
let nodes = null;
52+
let nodes;
5553

5654
const updateNodes = () => {
57-
nodes = Array.from(
58-
document.querySelectorAll('.comment-tree .comhead'),
59-
).filter((node) => node !== null && typeof node !== 'undefined');
55+
nodes = [...document.querySelectorAll('.comment-tree .comhead')].filter(
56+
(node) => node !== null && node !== undefined,
57+
);
6058
};
6159

6260
const getUser = (node) =>
@@ -70,27 +68,38 @@
7068

7169
// Remove all blocked subhns
7270
const hide = () => {
73-
for (let i = 0, len = nodes.length; i < len; i++) {
74-
const node = nodes[i];
71+
for (let index = 0, length_ = nodes.length; index < length_; index++) {
72+
const node = nodes[index];
7573
const user = getUser(node);
76-
if (isBanned(user)) {
77-
// Check if already hidden
78-
if (
79-
!node.parentNode.parentNode.parentNode.parentNode.querySelector(
80-
'.noshow',
81-
)
82-
) {
83-
node.parentNode.parentNode.querySelector('a.togg.clicky').click();
84-
}
74+
if (
75+
isBanned(user) && // Check if already hidden
76+
!node.parentNode.parentNode.parentNode.parentNode.querySelector(
77+
'.noshow',
78+
)
79+
) {
80+
node.parentNode.parentNode.querySelector('a.togg.clicky').click();
81+
}
82+
}
83+
};
84+
85+
const updateButtons = () => {
86+
for (let index = 0, length_ = nodes.length; index < length_; index++) {
87+
const node = nodes[index];
88+
const a = node.querySelector('.hn-filter-span a');
89+
const user = getUser(node);
90+
const reason = getData()[user];
91+
if (reason !== undefined) {
92+
a.title = reason;
8593
}
94+
a.textContent = isBanned(user) ? 'unban' : 'ban';
8695
}
8796
};
8897

89-
const click = (e) => {
90-
e.preventDefault();
91-
e.stopPropagation();
98+
const click = (event) => {
99+
event.preventDefault();
100+
event.stopPropagation();
92101

93-
const { target } = e;
102+
const { target } = event;
94103
const title =
95104
target.parentNode.parentNode.parentNode.parentNode.querySelector(
96105
'.commtext',
@@ -102,6 +111,7 @@
102111
const data = getData();
103112

104113
if (
114+
// eslint-disable-next-line no-alert
105115
confirm(
106116
`Are you sure you want to ${banned ? 'unblock' : 'block'} '${user}'?`,
107117
)
@@ -118,22 +128,9 @@
118128
}
119129
};
120130

121-
const updateButtons = () => {
122-
for (let i = 0, len = nodes.length; i < len; i++) {
123-
const node = nodes[i];
124-
const a = node.querySelector('.hn-filter-span a');
125-
const user = getUser(node);
126-
const reason = getData()[user];
127-
if (reason !== undefined) {
128-
a.title = reason;
129-
}
130-
a.textContent = isBanned(user) ? 'unban' : 'ban';
131-
}
132-
};
133-
134131
const addButtons = () => {
135-
for (let i = 0, len = nodes.length; i < len; i++) {
136-
const node = nodes[i];
132+
for (let index = 0, length_ = nodes.length; index < length_; index++) {
133+
const node = nodes[index];
137134
if (!node.querySelector('.hn-filter-span')) {
138135
const span = document.createElement('span');
139136
span.classList.add('hn-filter-span');
@@ -145,9 +142,9 @@
145142
}
146143
a.textContent = isBanned(user) ? 'unban' : 'ban';
147144
a.addEventListener('click', click);
148-
span.insertAdjacentText('afterbegin', ' | ');
149-
span.appendChild(a);
150-
node.appendChild(span);
145+
span.prepend(' | ');
146+
span.append(a);
147+
node.append(span);
151148
}
152149
}
153150
};

cnbc.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
// ==UserScript==
22
// @name cnbc
33
// @namespace https://github.com/dylanarmstrong/userscripts/
4-
// @version 2
4+
// @version 3
55
// @description cnbc is accidentally unloading the article b/c of adblocking
66
// @author dylanarmstrong
77
// @match https://www.cnbc.com/*
8-
// @updateURL https://raw.githubusercontent.com/dylanarmstrong/userscripts/master/cnbc.js
8+
// @updateURL https://raw.githubusercontent.com/dylanarmstrong/userscripts/main/cnbc.js
99
// @supportURL https://github.com/dylanarmstrong/userscripts/issues
1010
// @grant none
1111
// @run-at document-end
1212
// ==/UserScript==
1313

14-
'use strict';
15-
1614
/*
1715
* CNBC keeps breaking their site.
1816
* I really need to just ditch the whole site and pull out the text for their articles.
1917
*/
2018

21-
(function() {
19+
(function main() {
2220
const copy = () => {
23-
const art = document.getElementById('MainContent');
21+
const art = document.querySelector('#MainContent');
2422
if (art && art.querySelector('.Article.PageBuilder-page')) {
2523
const clone = art.cloneNode(true);
2624
clone.id = 'FakeMainContent';

0 commit comments

Comments
 (0)