mirror of
https://github.com/lawrencehook/remove-youtube-suggestions.git
synced 2026-07-25 06:54:31 +00:00
chore: clean up dead code and fix naming
- Remove debug console.log statements in options/main.js - Remove unused TEMPLATE_FIELDSET variable - Fix SEC_IN_WEEK → MIN_IN_WEEK (it was actually minutes) - Remove dead setCookie/getCookie functions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -696,29 +696,6 @@ function handleNewPage() {
|
||||
requestRunDynamicSettings();
|
||||
}
|
||||
|
||||
function setCookie(cname, cvalue, exdays=370) {
|
||||
const d = new Date();
|
||||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||
let expires = "expires="+ d.toUTCString();
|
||||
document.cookie = cname + "=" + cvalue + ";" + expires + ";domain=.youtube.com;path=/";
|
||||
}
|
||||
|
||||
function getCookie(cname) {
|
||||
let name = cname + "=";
|
||||
let decodedCookie = decodeURIComponent(document.cookie);
|
||||
let ca = decodedCookie.split(';');
|
||||
for (let i = 0; i < ca.length; i++) {
|
||||
let c = ca[i];
|
||||
while (c.charAt(0) == ' ') {
|
||||
c = c.substring(1);
|
||||
}
|
||||
if (c.indexOf(name) == 0) {
|
||||
return c.substring(name.length, c.length);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function updateSetting(id, value) {
|
||||
HTML.setAttribute(id, value);
|
||||
cache[id] = value;
|
||||
|
||||
@@ -5,7 +5,6 @@ const HTML = document.documentElement;
|
||||
const SIDEBAR = document.getElementById('sidebar');
|
||||
const TEMPLATE_SIDEBAR_SECTION = document.getElementById('template_sidebar_section');
|
||||
const OPTIONS_LIST = document.getElementById('primary_options');
|
||||
const TEMPLATE_FIELDSET = document.getElementById('template_fieldset');
|
||||
const TEMPLATE_SECTION = document.getElementById('template_section');
|
||||
const TEMPLATE_OPTION = document.getElementById('template_option');
|
||||
const TIMER_CONTAINER = document.getElementById('timer_container');
|
||||
@@ -195,8 +194,6 @@ function populateOptions(SECTIONS, headerSettings, SETTING_VALUES) {
|
||||
const input = qs('input', LOCK_CODE_CONTAINER);
|
||||
qs('div#code', LOCK_CODE_CONTAINER).innerText = code;
|
||||
input.addEventListener('input', e => {
|
||||
console.log(input.value);
|
||||
console.log();
|
||||
if (input.value === code) {
|
||||
HTML.removeAttribute('entering_lock_code', '');
|
||||
}
|
||||
|
||||
+2
-2
@@ -66,12 +66,12 @@ function nextScheduleChange(times, days) {
|
||||
if (!times || !days) return;
|
||||
|
||||
const current = checkSchedule(times, days);
|
||||
const SEC_IN_WEEK = 10_080;
|
||||
const MIN_IN_WEEK = 10_080;
|
||||
let testDate = new Date();
|
||||
testDate.setSeconds(0);
|
||||
let next = checkSchedule(times, days, testDate);
|
||||
let i = 0;
|
||||
while (current === next && i < SEC_IN_WEEK) {
|
||||
while (current === next && i < MIN_IN_WEEK) {
|
||||
i += 1;
|
||||
testDate = new Date(testDate.getTime() + 60_000);
|
||||
next = checkSchedule(times, days, testDate);
|
||||
|
||||
Reference in New Issue
Block a user