|
1 | | -//Loads custom icons |
2 | | - |
| 1 | +// Ads |
| 2 | +document.addEventListener('DOMContentLoaded', function () { |
| 3 | + if (localStorage.getItem('ad') === 'true') { |
| 4 | + var advDiv = document.getElementById('adv') |
| 5 | + if (advDiv) { |
| 6 | + var script = document.createElement('script') |
| 7 | + script.type = 'text/javascript' |
| 8 | + script.src = '//oysterscoldtiny.com/1c/c3/8a/1cc38a6899fdf8ba4dfe779bcc54627b.js' |
| 9 | + advDiv.appendChild(script) |
| 10 | + console.log('Script inserted inside the adv div.') |
| 11 | + } |
| 12 | + } |
| 13 | + if (localStorage.getItem('ad') === 'false') { |
| 14 | + var advDiv = document.getElementById('adv') |
| 15 | + if (advDiv) { |
| 16 | + advDiv.remove() |
| 17 | + console.log('The adv div has been removed.') |
| 18 | + } |
| 19 | + } |
| 20 | + var banner = localStorage.getItem('banner') === 'true' |
| 21 | + if (!banner) { |
| 22 | + var bannerDiv = document.getElementById('banner') |
| 23 | + if (bannerDiv) { |
| 24 | + bannerDiv.remove() |
| 25 | + console.log('The banner div has been removed.') |
| 26 | + } |
| 27 | + } |
| 28 | +}) |
| 29 | +// Themes |
| 30 | +var themeid = localStorage.getItem('theme') |
| 31 | +themeEle = document.createElement('link') |
| 32 | +themeEle.rel = 'stylesheet' |
| 33 | +if (themeid == 'catppuccinMocha') { |
| 34 | + themeEle.href = '/assets/styles/themes/catppuccin/mocha.css?v=1' |
| 35 | +} |
| 36 | +if (themeid == 'catppuccinMacchiato') { |
| 37 | + themeEle.href = '/assets/styles/themes/catppuccin/macchiato.css?v=1' |
| 38 | +} |
| 39 | +if (themeid == 'catppuccinFrappe') { |
| 40 | + themeEle.href = '/assets/styles/themes/catppuccin/frappe.css?v=1' |
| 41 | +} |
| 42 | +if (themeid == 'catppuccinLatte') { |
| 43 | + themeEle.href = '/assets/styles/themes/catppuccin/latte.css?v=1' |
| 44 | +} |
| 45 | +document.body.appendChild(themeEle) |
| 46 | +// Tab Cloaker |
3 | 47 | document.addEventListener('DOMContentLoaded', function (event) { |
4 | 48 | const icon = document.getElementById('tab-favicon') |
5 | 49 | const name = document.getElementById('tab-title') |
@@ -65,79 +109,22 @@ document.addEventListener('DOMContentLoaded', function (event) { |
65 | 109 | localStorage.setItem('name', 'Edpuzzle') |
66 | 110 | localStorage.setItem('icon', '/assets/media/favicon/edpuzzle.png') |
67 | 111 | } |
68 | | - |
69 | | - var themeid = localStorage.getItem('theme') |
70 | | - //Loads theme |
71 | | - themeEle = document.createElement('link') |
72 | | - themeEle.rel = 'stylesheet' |
73 | | - if (themeid == 'catppuccinMocha') { |
74 | | - themeEle.href = '/assets/styles/themes/catppuccin/mocha.css?v=1' |
75 | | - } |
76 | | - if (themeid == 'catppuccinMacchiato') { |
77 | | - themeEle.href = '/assets/styles/themes/catppuccin/macchiato.css?v=1' |
78 | | - } |
79 | | - if (themeid == 'catppuccinFrappe') { |
80 | | - themeEle.href = '/assets/styles/themes/catppuccin/frappe.css?v=1' |
81 | | - } |
82 | | - if (themeid == 'catppuccinLatte') { |
83 | | - themeEle.href = '/assets/styles/themes/catppuccin/latte.css?v=1' |
84 | | - } |
85 | | - document.body.appendChild(themeEle) |
86 | 112 | }) |
87 | | - |
| 113 | +// Key |
88 | 114 | document.addEventListener('DOMContentLoaded', function () { |
89 | | - var saveButton = document.getElementById('save-button') |
90 | | - saveButton.addEventListener('click', function () { |
91 | | - var backgroundInput = document.getElementById('background-input') |
92 | | - var imageURL = backgroundInput.value |
| 115 | + var eventKey = localStorage.getItem('eventKey') || '`' |
| 116 | + var pLink = localStorage.getItem('pLink') || 'https://classroom.google.com/' |
93 | 117 |
|
94 | | - if (imageURL !== '') { |
95 | | - localStorage.setItem('backgroundImage', imageURL) |
96 | | - document.body.style.backgroundImage = "url('" + imageURL + "')" |
97 | | - backgroundInput.value = '' |
98 | | - } else { |
| 118 | + document.addEventListener('keydown', function (event) { |
| 119 | + if (event.key === eventKey) { |
| 120 | + window.location.href = pLink |
99 | 121 | } |
100 | 122 | }) |
101 | | - |
102 | | - var resetButton = document.getElementById('reset-button') |
103 | | - resetButton.addEventListener('click', function () { |
104 | | - localStorage.removeItem('backgroundImage') |
105 | | - document.body.style.backgroundImage = "url('default-background.jpg')" |
106 | | - }) |
107 | | - |
108 | | - var savedBackgroundImage = localStorage.getItem('backgroundImage') |
109 | | - if (savedBackgroundImage) { |
110 | | - document.body.style.backgroundImage = "url('" + savedBackgroundImage + "')" |
111 | | - } |
112 | 123 | }) |
113 | | - |
| 124 | +// Background Image |
114 | 125 | document.addEventListener('DOMContentLoaded', function () { |
115 | 126 | var savedBackgroundImage = localStorage.getItem('backgroundImage') |
116 | 127 | if (savedBackgroundImage) { |
117 | 128 | document.body.style.backgroundImage = "url('" + savedBackgroundImage + "')" |
118 | 129 | } |
119 | 130 | }) |
120 | | - |
121 | | -document.addEventListener('DOMContentLoaded', function () { |
122 | | - var eventKey = localStorage.getItem('eventKey') || '`' |
123 | | - var pLink = localStorage.getItem('pLink') || 'https://classroom.google.com/' |
124 | | - |
125 | | - document.getElementById('eventKeyInput').value = eventKey |
126 | | - document.getElementById('linkInput').value = pLink |
127 | | - |
128 | | - const selectedOption = localStorage.getItem('selectedOption') |
129 | | - if (selectedOption) { |
130 | | - updateHeadSection(selectedOption) |
131 | | - } |
132 | | -}) |
133 | | - |
134 | | -function saveEventKey() { |
135 | | - var eventKey = document.getElementById('eventKeyInput').value |
136 | | - var pLink = document.getElementById('linkInput').value |
137 | | - |
138 | | - localStorage.setItem('eventKey', eventKey) |
139 | | - localStorage.setItem('pLink', pLink) |
140 | | - |
141 | | - document.getElementById('eventKeyInput').value = '' |
142 | | - document.getElementById('linkInput').value = '' |
143 | | -} |
0 commit comments