-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontent.js
108 lines (83 loc) · 4.54 KB
/
content.js
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
var browser = browser || chrome;
// CREATE STYLE
var styleEl = document.createElement("style");
// Append <style> element to <head>
document.head.appendChild(styleEl);
// Grab style element's sheet
var styleSheet = styleEl.sheet;
browser.storage.sync.get(null, function (storageData) {
let storageArray = storageData.rules;
let reklamlar = storageArray[storageArray.findIndex((e) => e.id === "reklamlar")];
let pena = storageArray[storageArray.findIndex((e) => e.id === "pena")];
let favori = storageArray[storageArray.findIndex((e) => e.id === "favori")];
let eksiseyler = storageArray[storageArray.findIndex((e) => e.id === "eksiseyler")];
let karma = storageArray[storageArray.findIndex((e) => e.id === "karma")];
let avatar = storageArray[storageArray.findIndex((e) => e.id === "avatar")];
// REKLAMLAR REFERENCES
if (reklamlar.isChecked) {
console.log("🍋 Reklamlar siliniyor...");
// under top ad
styleSheet.insertRule(`.under-top-ad {display: none !important}`, styleSheet.cssRules.length);
// other ads
// sidebar and footer
styleSheet.insertRule(`.bottom-ads { display: none !important }`, styleSheet.cssRules.length);
styleSheet.insertRule(`.stick-ad { display: none !important }`, styleSheet.cssRules.length);
styleSheet.insertRule(`#sticky-ad { display: none !important }`, styleSheet.cssRules.length);
styleSheet.insertRule(`.ad-double-click { display: none !important }`, styleSheet.cssRules.length);
styleSheet.insertRule(`.ad-banner { display: none !important }`, styleSheet.cssRules.length);
styleSheet.insertRule(`.ad-1x1 { display: none !important }`, styleSheet.cssRules.length);
styleSheet.insertRule(`#ad_unit { display: none !important }`, styleSheet.cssRules.length);
// sol frame sponsorlu reklam basliklarini kaldir
styleSheet.insertRule(`.sponsored { display: none !important }`, styleSheet.cssRules.length);
}
// PENA REFERENCES
if (pena.isChecked === true) {
console.log("🍋 Pena referanslari kaldiriliyor...");
// Hides pena video
styleSheet.insertRule(`#video { display: none !important }`, styleSheet.cssRules.length);
// removes pena logo from the navigation
styleSheet.insertRule(`.pena-logo-container { display: none !important; }`, styleSheet.cssRules.length);
}
// FAVORILERI GIZLE
if (favori.isChecked === true) {
console.log("🍋 Favori butonlari degistiriliyor...");
/* hides the favorite count */
styleSheet.insertRule(`.favorite-count { display: none !important }`, styleSheet.cssRules.length);
// favori buton lokasyonunu ayarla
styleSheet.insertRule(
`.favorite-link { margin-right: 0.5rem !important; opacity: 0.6 !important; text-decoration: none !important; }`,
styleSheet.cssRules.length
);
// Favori limonuna opasite ver favorilenmis entrylerde.
styleSheet.insertRule(`.favorited { opacity: 1 !important }`, styleSheet.cssRules.length);
// Favorinin hover state'i
styleSheet.insertRule(`.favorite-link:hover { opacity: 1 !important; text-decoration: none !important }`, styleSheet.cssRules.length);
// Fav butonunu limon yap.
const favButonlari = document.querySelectorAll(`.favorite-link`);
favButonlari.forEach((favButonu) => (favButonu.textContent = `🍋`));
}
// EKSISEYLER REFERENCES
if (eksiseyler.isChecked === true) {
console.log("🍋 EksiSeyler referanslari kaldiriliyor...");
// Hides eksiseyler related articles on the sidebar (right)
styleSheet.insertRule(`iframe[title="ekşi şeyler"] { display: none !important; }`, styleSheet.cssRules.length);
// Hides eksiseyler video on sagframe
styleSheet.insertRule(`#aside > iframe { display: none !important; }`, styleSheet.cssRules.length);
// removes eksiseyler logo from header
styleSheet.insertRule(`div.eksiseyler-logo-container { display: none !important; }`, styleSheet.cssRules.length);
}
// KARMA REFERENCES
if (karma.isChecked === true) {
console.log("🍋 Karma ile ilgili belirtecler kaldiriliyor...");
// hides karma information and entry count badge (i.e "azimli") on profile page
styleSheet.insertRule(`#user-badges { display: none; }`, styleSheet.cssRules.length);
}
// AVATAR REFERENCES
if (avatar.isChecked === true) {
console.log("🍋 Avatarlar kaldiriliyor...");
// Removes avatars from baslik page
styleSheet.insertRule(`.avatar-container { display: none !important; }`, styleSheet.cssRules.length);
// Removes avatars from profile page
styleSheet.insertRule(`#profile-logo { display: none !important; }`, styleSheet.cssRules.length);
}
});