mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-15 12:50:01 -04:00
Tab Cloak Cleanup
This commit is contained in:
parent
5eed912727
commit
cf5a5b5be7
1 changed files with 17 additions and 0 deletions
|
@ -6,14 +6,17 @@ function randInt(min, max) {
|
||||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Title Presets*/
|
||||||
var titles = [
|
var titles = [
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/* Icon Presets*/
|
||||||
var icons = [
|
var icons = [
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/* Settings Menu Variables*/
|
||||||
var psel, prss;
|
var psel, prss;
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', function() {
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
|
@ -26,6 +29,8 @@ window.addEventListener('DOMContentLoaded', function() {
|
||||||
psel.innerHTML += '<img title="' + titles[i] + '" src="' + icons[i] + '">';
|
psel.innerHTML += '<img title="' + titles[i] + '" src="' + icons[i] + '">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Title Submit*/
|
||||||
document.getElementById('titleform').addEventListener('submit', function(e) {
|
document.getElementById('titleform').addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (this.firstChild.value) {
|
if (this.firstChild.value) {
|
||||||
|
@ -35,6 +40,7 @@ window.addEventListener('DOMContentLoaded', function() {
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
/* Icon Submit*/
|
||||||
document.getElementById('iconform').addEventListener('submit', function(e) {
|
document.getElementById('iconform').addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (this.firstChild.value) {
|
if (this.firstChild.value) {
|
||||||
|
@ -44,6 +50,7 @@ window.addEventListener('DOMContentLoaded', function() {
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
/* Settings Submit*/
|
||||||
psel.addEventListener('click', function(e) {
|
psel.addEventListener('click', function(e) {
|
||||||
prss = Array.from(psel.children).indexOf(e.target);
|
prss = Array.from(psel.children).indexOf(e.target);
|
||||||
if (prss != -1) {
|
if (prss != -1) {
|
||||||
|
@ -52,6 +59,7 @@ window.addEventListener('DOMContentLoaded', function() {
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
/* Settings Menu Event*/
|
||||||
document.getElementById('csel').addEventListener('click', function(e) {
|
document.getElementById('csel').addEventListener('click', function(e) {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
window.onbeforeunload = function(e) {
|
window.onbeforeunload = function(e) {
|
||||||
|
@ -64,6 +72,7 @@ window.addEventListener('DOMContentLoaded', function() {
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
/* Fullscreen Feature Addition*/
|
||||||
/* document.getElementById('fullscreen').addEventListener('click', function(e) {
|
/* document.getElementById('fullscreen').addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.getElementById('theframe').requestFullscreen()
|
document.getElementById('theframe').requestFullscreen()
|
||||||
|
@ -71,6 +80,7 @@ window.addEventListener('DOMContentLoaded', function() {
|
||||||
}, false); */
|
}, false); */
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
/* Title and Icon Cookies... and yes this is cookie based*/
|
||||||
function setPreferences() {
|
function setPreferences() {
|
||||||
if (readCookie('HBTitle') != 'undefined') {
|
if (readCookie('HBTitle') != 'undefined') {
|
||||||
pageTitle(readCookie('HBTitle'));
|
pageTitle(readCookie('HBTitle'));
|
||||||
|
@ -80,10 +90,12 @@ function setPreferences() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set Cookie Secure*/
|
||||||
function setCookie(name, value) {
|
function setCookie(name, value) {
|
||||||
document.cookie = name + '=' + encodeURIComponent(value) + '; expires=' + date + '; SameSite=None; Secure';
|
document.cookie = name + '=' + encodeURIComponent(value) + '; expires=' + date + '; SameSite=None; Secure';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read Cookie*/
|
||||||
function readCookie(name) {
|
function readCookie(name) {
|
||||||
var cookie = document.cookie.split('; ');
|
var cookie = document.cookie.split('; ');
|
||||||
var cookies = {};
|
var cookies = {};
|
||||||
|
@ -94,16 +106,19 @@ function readCookie(name) {
|
||||||
return decodeURIComponent(cookies[name]);
|
return decodeURIComponent(cookies[name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set Title from Input Value*/
|
||||||
function setTitle(value) {
|
function setTitle(value) {
|
||||||
pageTitle(value);
|
pageTitle(value);
|
||||||
setCookie('HBTitle', value);
|
setCookie('HBTitle', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set Icon from Input Value*/
|
||||||
function setIcon(value) {
|
function setIcon(value) {
|
||||||
pageIcon(value);
|
pageIcon(value);
|
||||||
setCookie('HBIcon', value);
|
setCookie('HBIcon', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Title Attach*/
|
||||||
function pageTitle(value) {
|
function pageTitle(value) {
|
||||||
document.getElementsByTagName('title')[0].innerHTML = value;
|
document.getElementsByTagName('title')[0].innerHTML = value;
|
||||||
try {
|
try {
|
||||||
|
@ -111,6 +126,7 @@ function pageTitle(value) {
|
||||||
} catch (e) { console.log(e); }
|
} catch (e) { console.log(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Icon Attach*/
|
||||||
function pageIcon(value) {
|
function pageIcon(value) {
|
||||||
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
|
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
|
||||||
link.rel = 'icon';
|
link.rel = 'icon';
|
||||||
|
@ -124,6 +140,7 @@ function pageIcon(value) {
|
||||||
} catch (e) { console.log(e); }
|
} catch (e) { console.log(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tab Cloak*/
|
||||||
function autoChange() {
|
function autoChange() {
|
||||||
if (document.getElementById('csel').checked) {
|
if (document.getElementById('csel').checked) {
|
||||||
var atci = randInt(1, 5);
|
var atci = randInt(1, 5);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue