-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
executable file
·59 lines (55 loc) · 1.43 KB
/
content.js
File metadata and controls
executable file
·59 lines (55 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// select element via class
const select = function(selector) {
if (selector !== null) {
return document.querySelector(selector)
}
}
//hide element
const hide = function(el) {
if (el !== null) {
el.style.visibility = 'hidden'
}
}
const destroy = arr => arr.map(x => select(x)).map(x => hide(x))
window.onload = function() {
let currentState = localStorage.currentState
const isMedium =
document.location.hostname.includes('medium.') ||
document.location.hostname.includes('blog.medium.com') ||
document.referrer.includes('medium.')
const shit = [
'.js-postShareWidget',
'.js-elevatePostActions',
'.postActionsBar',
'.promoCardWrapper',
'.js-stickyFooter',
'.js-upgradeMembershipAction',
'.meterThumbnail',
'.postMeterBar',
'.butterBar',
]
const toggleRefinement = () => {
if (isMedium) {
let time = 0
const refineMedium = setInterval(() => {
time++
if (time > 9) {
clearInterval(refineMedium)
}
destroy(shit)
const overlay = select('.overlay')
if (overlay) {
overlay.style.display = 'none'
}
const showResponses = select('.responsesStream-showOtherResponses')
if (showResponses) {
showResponses.click()
}
}, 1000)
}
}
if (currentState == undefined || currentState == 'start') {
localStorage.currentState = 'start'
toggleRefinement()
}
}