mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-12 19:40:02 -04:00
Code optimization and commenting
This commit is contained in:
parent
1299d4314f
commit
6a2adf9209
7 changed files with 54 additions and 52 deletions
|
@ -1483,17 +1483,17 @@ iner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pr-form {
|
.pr-form {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pr-form > input {
|
.pr-form > input {
|
||||||
background-color: var(--nord0);
|
background-color: var(--nord0);
|
||||||
border: 1px solid var(--nord0);
|
border: 1px solid var(--nord0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pr-form > input,
|
.pr-form > input,
|
||||||
#pr-form > a {
|
.pr-form > a {
|
||||||
vertical-align: baseline;
|
vertical-align: baseline;
|
||||||
outline: none;
|
outline: none;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
@ -1504,16 +1504,16 @@ iner
|
||||||
margin: 3px;
|
margin: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pr-url {
|
.pr-form > input[type=text] {
|
||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
width: calc(100% - 44px);
|
width: calc(100% - 44px);
|
||||||
}
|
}
|
||||||
|
|
||||||
#pr-url:focus {
|
.pr-form > input[type=text]:focus {
|
||||||
animation: glowshadow 2s linear infinite;
|
animation: glowshadow 2s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pr-url::placeholder {
|
.pr-form > input[type=text]::placeholder {
|
||||||
color: var(--gray);
|
color: var(--gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ const urlHandler = parser => typeof parser === "function"
|
||||||
// Return different functions based on whether a URL has already been set.
|
// Return different functions based on whether a URL has already been set.
|
||||||
// Should help avoid confusion when using or adding to the goProx object.
|
// Should help avoid confusion when using or adding to the goProx object.
|
||||||
? (url, mode) => {
|
? (url, mode) => {
|
||||||
|
if (!url) return;
|
||||||
url = parser(url);
|
url = parser(url);
|
||||||
mode = `${mode}`.toLowerCase();
|
mode = `${mode}`.toLowerCase();
|
||||||
if (mode === "stealth" || mode == 1) goFrame(url);
|
if (mode === "stealth" || mode == 1) goFrame(url);
|
||||||
|
@ -37,6 +38,7 @@ const urlHandler = parser => typeof parser === "function"
|
||||||
|
|
||||||
// An asynchronous version of the function above, just in case.
|
// An asynchronous version of the function above, just in case.
|
||||||
const asyncUrlHandler = parser => async (url, mode) => {
|
const asyncUrlHandler = parser => async (url, mode) => {
|
||||||
|
if (!url) return;
|
||||||
if (typeof parser === "function") url = await parser(url);
|
if (typeof parser === "function") url = await parser(url);
|
||||||
mode = `${mode}`.toLowerCase();
|
mode = `${mode}`.toLowerCase();
|
||||||
if (mode === "stealth" || mode == 1) goFrame(url);
|
if (mode === "stealth" || mode == 1) goFrame(url);
|
||||||
|
@ -397,8 +399,41 @@ addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
heli: urlHandler(uvUrl("https://benjames171.itch.io/helo-storm"))
|
heli: urlHandler(uvUrl("https://benjames171.itch.io/helo-storm"))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Attach event listeners using goProx to specific app menus that need it.
|
||||||
|
const prSet = (id, type) => {
|
||||||
|
const formElement = document.getElementById(id);
|
||||||
|
if (!formElement) return;
|
||||||
|
|
||||||
|
let prUrl = formElement.querySelector("input[type=text]"),
|
||||||
|
prGo1 = formElement.getElementsByClassName("pr-go1")[0],
|
||||||
|
prGo2 = formElement.getElementsByClassName("pr-go2")[0];
|
||||||
|
|
||||||
|
// Handle the other menu buttons differently if there is no omnibox. Menus
|
||||||
|
// which lack an omnibox likely use buttons as mere links.
|
||||||
|
const goProxMethod = prUrl !== undefined
|
||||||
|
? mode => () => {goProx[type](prUrl.value, mode)}
|
||||||
|
: mode => () => {goProx[type](mode)},
|
||||||
|
|
||||||
|
// Ultraviolet is currently incompatible with window mode.
|
||||||
|
searchMode = type === "ultraviolet" ? "stealth" : "window";
|
||||||
|
|
||||||
|
if (prUrl) prUrl.addEventListener("keydown", e => {
|
||||||
|
if (e.code === "Enter") goProxMethod(searchMode)();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (prGo1) prGo1.addEventListener("click", goProxMethod("window"));
|
||||||
|
if (prGo2) prGo2.addEventListener("click", goProxMethod("stealth"));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
prSet("pr-uv", "ultraviolet");
|
||||||
|
prSet("pr-rh", "rammerhead");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
// Load in relevant JSON files used to organize large sets of data.
|
// Load in relevant JSON files used to organize large sets of data.
|
||||||
// This first one is for links, whereas the rest are for navigation menus.
|
// This first one is for links, whereas the rest are for navigation menus.
|
||||||
|
@ -409,6 +444,7 @@ addEventListener("DOMContentLoaded", () => {
|
||||||
(document.getElementById(item[0]) || {}).href = item[1];
|
(document.getElementById(item[0]) || {}).href = item[1];
|
||||||
|
|
||||||
const navLists = {
|
const navLists = {
|
||||||
|
// Pair an element ID with a JSON file name. They are identical for now.
|
||||||
"emu-nav": "emu-nav",
|
"emu-nav": "emu-nav",
|
||||||
"emulib-nav": "emulib-nav",
|
"emulib-nav": "emulib-nav",
|
||||||
"flash-nav": "flash-nav",
|
"flash-nav": "flash-nav",
|
||||||
|
@ -430,6 +466,8 @@ addEventListener("DOMContentLoaded", () => {
|
||||||
case "emulib-nav":
|
case "emulib-nav":
|
||||||
case "h5-nav": {
|
case "h5-nav": {
|
||||||
const dirnames = {
|
const dirnames = {
|
||||||
|
// Set the directory of where each item of the corresponding JSON
|
||||||
|
// list will be retrieved from.
|
||||||
"emu-nav": "emu",
|
"emu-nav": "emu",
|
||||||
"emulib-nav": "emulib",
|
"emulib-nav": "emulib",
|
||||||
"h5-nav": "h5g"
|
"h5-nav": "h5g"
|
||||||
|
@ -500,6 +538,7 @@ addEventListener("DOMContentLoaded", () => {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// No default case.
|
// No default case.
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
/* -----------------------------------------------
|
|
||||||
/* Authors: OlyB
|
|
||||||
/* GNU Affero General Public License v3.0: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
||||||
/* prSet script
|
|
||||||
/* ----------------------------------------------- */
|
|
||||||
|
|
||||||
function prSet(type) {
|
|
||||||
var prUrl = document.getElementById("pr-url"),
|
|
||||||
prGo1 = document.getElementById("pr-go1"),
|
|
||||||
prGo2 = document.getElementById("pr-go2");
|
|
||||||
|
|
||||||
prUrl.addEventListener("keydown", function(e) {
|
|
||||||
if (e.code == "Enter" && prUrl.value) goProx[type](prUrl.value);
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
prGo1.addEventListener("click", function() {
|
|
||||||
if (prUrl.value) goProx[type](prUrl.value, "window");
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
prGo2.addEventListener("click", function() {
|
|
||||||
if (prUrl.value) goProx[type](prUrl.value, "stealth");
|
|
||||||
}, false);
|
|
||||||
}
|
|
|
@ -102,11 +102,7 @@ npm <span class="hljs-literal">start</span>
|
||||||
<h4 id="scripts-located-in-views-assets-js-">Scripts located in <code>/views/assets/js/</code></h4>
|
<h4 id="scripts-located-in-views-assets-js-">Scripts located in <code>/views/assets/js/</code></h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>common.js</code> is used on all of the pages for common useful functions.</li>
|
<li><code>common.js</code> is used on all of the pages for common useful functions.</li>
|
||||||
<li><code>prset.js</code> is used on the proxy pages for proxy form functionality.</li>
|
|
||||||
<li><code>header.js</code> inserts the header into every page using javascript.</li>
|
|
||||||
<li><code>csel.js</code> manages the settings menu on the header.</li>
|
<li><code>csel.js</code> manages the settings menu on the header.</li>
|
||||||
<li><code>footer.js</code> inserts the footer into every page using javascript.</li>
|
|
||||||
<li><code>gnav/*.js</code> are used for navigation on the games pages.</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<h2 id="future-additions">Future Additions</h2>
|
<h2 id="future-additions">Future Additions</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
</div>
|
</div>
|
||||||
<p class=cseltitle>Browser Tab Config</p>
|
<p class=cseltitle>Browser Tab Config</p>
|
||||||
<p>Change the universal tab title:</p>
|
<p>Change the universal tab title:</p>
|
||||||
<form class=cselform id=titleform>
|
<form id=titleform>
|
||||||
<input type=text placeholder="Tab Title" spellcheck=false><input type=submit value=Apply>
|
<input type=text placeholder="Tab Title" spellcheck=false><input type=submit value=Apply>
|
||||||
</form>
|
</form>
|
||||||
<p>Change the universal tab <a href=/?i>icon</a>:</p>
|
<p>Change the universal tab <a href=/?i>icon</a>:</p>
|
||||||
<form class=cselform id=iconform>
|
<form id=iconform>
|
||||||
<input type=text placeholder="Icon URL" spellcheck=false><input type=submit value=Apply>
|
<input type=text placeholder="Icon URL" spellcheck=false><input type=submit value=Apply>
|
||||||
</form>
|
</form>
|
||||||
<input id=cselreset type=button value=Reset>
|
<input id=cselreset type=button value=Reset>
|
||||||
|
|
|
@ -50,16 +50,15 @@
|
||||||
Its session-based proxying concept enables much support for webites
|
Its session-based proxying concept enables much support for webites
|
||||||
like Discord, YouTube, and more!
|
like Discord, YouTube, and more!
|
||||||
</p>
|
</p>
|
||||||
<div id="pr-form">
|
<div id=pr-rh class="pr-form">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="pr-url"
|
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
placeholder="Search or enter in a target site!"
|
placeholder="Search or enter in a target site!"
|
||||||
/>
|
/>
|
||||||
<a href="#" id="pr-go1" class="pr-button glowbutton">Cl­assic</a>
|
<a href="#" class="pr-button glowbutton pr-go1">Cl­assic</a>
|
||||||
<a href="#" id="pr-go2" class="pr-button glowbutton">Stea­lth</a>
|
<a href="#" class="pr-button glowbutton pr-go2">Stea­lth</a>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
Important: Make sure you treat this as a PRIVATE session. Do NOT share
|
Important: Make sure you treat this as a PRIVATE session. Do NOT share
|
||||||
|
@ -92,10 +91,6 @@
|
||||||
<!-- IMPORTANT-HUCOOKINGINSERT-DONOTDELETE -->
|
<!-- IMPORTANT-HUCOOKINGINSERT-DONOTDELETE -->
|
||||||
<script src="assets/js/common.js"></script>
|
<script src="assets/js/common.js"></script>
|
||||||
<script src="assets/js/csel.js"></script>
|
<script src="assets/js/csel.js"></script>
|
||||||
<script src="assets/js/prset.js"></script>
|
|
||||||
<script>
|
|
||||||
prSet("rammerhead");
|
|
||||||
</script>
|
|
||||||
<script defer="defer" src="assets/js/particlesjs/particles.js"></script>
|
<script defer="defer" src="assets/js/particlesjs/particles.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -55,16 +55,15 @@
|
||||||
such as service workers and sophisticated rewriting techniques with
|
such as service workers and sophisticated rewriting techniques with
|
||||||
CAPTCHA support.
|
CAPTCHA support.
|
||||||
</p>
|
</p>
|
||||||
<div id="pr-form">
|
<div id=pr-uv class="pr-form">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="pr-url"
|
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
placeholder="Search or enter in a target site!"
|
placeholder="Search or enter in a target site!"
|
||||||
/>
|
/>
|
||||||
<a href="#" id="pr-go1" style="display:none;" class="pr-button glowbutton">Stea­lth</a>
|
<a href="#" style="display:none;" class="pr-button glowbutton pr-go1">Stea­lth</a>
|
||||||
<a href="#" id="pr-go2" class="pr-button glowbutton">Stea­lth</a>
|
<a href="#"" class="pr-button glowbutton pr-go2">Stea­lth</a>
|
||||||
</div>
|
</div>
|
||||||
<h3>More Information:</h3>
|
<h3>More Information:</h3>
|
||||||
<div class="font3">
|
<div class="font3">
|
||||||
|
@ -100,10 +99,6 @@
|
||||||
<!-- IMPORTANT-HUCOOKINGINSERT-DONOTDELETE -->
|
<!-- IMPORTANT-HUCOOKINGINSERT-DONOTDELETE -->
|
||||||
<script src="assets/js/common.js"></script>
|
<script src="assets/js/common.js"></script>
|
||||||
<script src="assets/js/csel.js"></script>
|
<script src="assets/js/csel.js"></script>
|
||||||
<script src="assets/js/prset.js"></script>
|
|
||||||
<script defer="defer" src="assets/js/particlesjs/particles.js"></script>
|
<script defer="defer" src="assets/js/particlesjs/particles.js"></script>
|
||||||
<script>
|
|
||||||
prSet("ultraviolet");
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue