Add version function and fix multiple visual bugs, fix styling
This commit is contained in:
parent
037f929a8c
commit
aab96e73c5
@ -191,7 +191,7 @@
|
|||||||
--color-text-light-2: #457636;
|
--color-text-light-2: #457636;
|
||||||
--color-text-light-3: #234519;
|
--color-text-light-3: #234519;
|
||||||
--color-footer: #000000;
|
--color-footer: #000000;
|
||||||
--color-timeline: #343c44;
|
--color-timeline: #3ca81e;
|
||||||
--color-input-text: var(--color-text-dark);
|
--color-input-text: var(--color-text-dark);
|
||||||
--color-input-background: #000000;
|
--color-input-background: #000000;
|
||||||
--color-input-toggle-background: #11210c;
|
--color-input-toggle-background: #11210c;
|
||||||
@ -239,20 +239,44 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.full {
|
.full {
|
||||||
position: relative
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#activity-feed.flex-list .flex-item {
|
||||||
|
border: 1px solid var(--color-secondary);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
background: var(--color-box-body);
|
||||||
|
margin: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
box-shadow: rgba(102, 255, 102, 0.1) 0px 1px 0px, rgba(102, 255, 102, 0.1) 0px 8px 24px, rgba(102, 255, 102, 0.1) 0px 16px 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.divider + .flex-list > .flex-item:first-child {
|
||||||
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui.input {
|
.ui.input {
|
||||||
animation: glow 800ms ease-out infinite alternate;
|
animation: glow 800ms ease-out infinite alternate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timeline-item.event {
|
||||||
|
border: 1px solid var(--color-secondary);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
background: var(--color-box-body);
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@keyframes glow {
|
@keyframes glow {
|
||||||
0% {
|
0% {
|
||||||
border-color: #393;
|
border-color: #339933;
|
||||||
box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000;
|
box-shadow: 0 0 5px rgba(0,255,0,.2), inset 0 0 5px rgba(0,255,0,.1), 0 2px 0 #000;
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
border-color: #6f6;
|
border-color: rgb(102, 255, 102);
|
||||||
box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000;
|
box-shadow: 0 0 20px rgba(0,255,0,.6), inset 0 0 10px rgba(0,255,0,.4), 0 2px 0 #000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
// Stolen from https://codepen.io/loktar00/pen/BaGqXY
|
// Stolen from https://codepen.io/loktar00/pen/BaGqXY
|
||||||
// However has modifications to work good as a theme
|
// However has modifications to work good as a theme
|
||||||
|
|
||||||
"use strict";
|
const VERSION = "1.0";
|
||||||
|
const REMOTE_UPDATE_PATH =
|
||||||
|
"https://git.javalsai.dynv6.net/UwU/haxxor-theme/raw/branch/main/"; // Change this to your remote repository!
|
||||||
|
|
||||||
|
("use strict");
|
||||||
function createTetris() {
|
function createTetris() {
|
||||||
var tetrominos = [
|
var tetrominos = [
|
||||||
{
|
{
|
||||||
@ -89,7 +93,6 @@ function createTetris() {
|
|||||||
this.bgCanvas.width = this.fgCanvas.width = this.width;
|
this.bgCanvas.width = this.fgCanvas.width = this.width;
|
||||||
this.bgCanvas.height = this.fgCanvas.height = this.height;
|
this.bgCanvas.height = this.fgCanvas.height = this.height;
|
||||||
|
|
||||||
|
|
||||||
this.bgCtx = this.bgCanvas.getContext("2d");
|
this.bgCtx = this.bgCanvas.getContext("2d");
|
||||||
this.fgCtx = this.fgCanvas.getContext("2d");
|
this.fgCtx = this.fgCanvas.getContext("2d");
|
||||||
|
|
||||||
@ -97,6 +100,8 @@ function createTetris() {
|
|||||||
this.bgCanvas.style.top = this.posY + "px";
|
this.bgCanvas.style.top = this.posY + "px";
|
||||||
|
|
||||||
// Stay in background
|
// Stay in background
|
||||||
|
this.bgCanvas.style.zIndex = 1;
|
||||||
|
this.fgCanvas.style.zIndex = 1;
|
||||||
this.bgCanvas.style.position = "absolute";
|
this.bgCanvas.style.position = "absolute";
|
||||||
this.fgCanvas.style.position = "absolute";
|
this.fgCanvas.style.position = "absolute";
|
||||||
|
|
||||||
@ -123,8 +128,6 @@ function createTetris() {
|
|||||||
this.level = 0;
|
this.level = 0;
|
||||||
this.loseBlock = 0;
|
this.loseBlock = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// init the board
|
// init the board
|
||||||
this.board = [];
|
this.board = [];
|
||||||
this.boardWidth = Math.floor(this.width / this.unitSize);
|
this.boardWidth = Math.floor(this.width / this.unitSize);
|
||||||
@ -479,39 +482,73 @@ function createTetris() {
|
|||||||
curPiece.y = -4;
|
curPiece.y = -4;
|
||||||
};
|
};
|
||||||
|
|
||||||
var width = window.innerWidth,
|
let boardDiv = 20 * Math.round(window.innerWidth / 20),
|
||||||
boardDiv = 20 * Math.round(window.innerWidth / 20),
|
|
||||||
boards = 1,
|
boards = 1,
|
||||||
bWidth = boardDiv / boards,
|
bWidth = boardDiv / boards,
|
||||||
tetrisInstances = [];
|
tetrisInstances = [];
|
||||||
|
|
||||||
let barsHeight = document.getElementsByClassName("secondary-nav")[0].clientHeight + document.getElementById("navbar").clientHeight;
|
let second_nav = 0;
|
||||||
let footer_size = document.getElementsByClassName("page-footer")[0].clientHeight;
|
if (document.getElementsByClassName("secondary-nav")[0] !== undefined)
|
||||||
|
second_nav =
|
||||||
let bheight = window.innerHeight - barsHeight - footer_size;
|
document.getElementsByClassName("secondary-nav")[0].clientHeight;
|
||||||
console.log(window.innerHeight, document.getElementsByClassName("secondary-nav")[0].clientHeight, document.getElementById("navbar").clientHeight);
|
let barsHeight = second_nav + document.getElementById("navbar").clientHeight;
|
||||||
|
|
||||||
|
let bheight = determineFullHeight() - barsHeight;
|
||||||
|
console.log(
|
||||||
|
determineFullHeight(),
|
||||||
|
document.getElementsByClassName("full height")[0].scrollHeight,
|
||||||
|
second_nav,
|
||||||
|
document.getElementById("navbar").clientHeight
|
||||||
|
);
|
||||||
|
|
||||||
for (var w = 0; w < boards; w++) {
|
for (var w = 0; w < boards; w++) {
|
||||||
tetrisInstances.push(
|
tetrisInstances.push(
|
||||||
new Tetris(20 * Math.round((w * bWidth) / 20), barsHeight, bWidth, bheight)
|
new Tetris(
|
||||||
|
20 * Math.round((w * bWidth) / 20),
|
||||||
|
barsHeight,
|
||||||
|
bWidth,
|
||||||
|
bheight
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function determineFullHeight() {
|
||||||
|
if (document.getElementsByClassName("full height")[0] !== undefined) {
|
||||||
|
return document.getElementsByClassName("full height")[0].clientHeight; // This is guaranteed to work very fine
|
||||||
|
} else {
|
||||||
|
let footer_size = 0;
|
||||||
|
if (document.getElementsByClassName("page-footer")[0] !== undefined)
|
||||||
|
footer_size =
|
||||||
|
document.getElementsByClassName("page-footer")[0].clientHeight;
|
||||||
|
return document.documentElement.scrollHeight - footer_size; // Fallback response, might not work as well
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
getUpdated();
|
||||||
|
setTimeout(createTetris, 50); // Sometimes page isnt completely rendered when tetris is supposed to be loaded, so 50ms timeout is enough to load page on most systems
|
||||||
|
}
|
||||||
|
|
||||||
createTetris();
|
async function getUpdated() {
|
||||||
|
try {
|
||||||
|
let remote_version = (await fetch(REMOTE_UPDATE_PATH + "VERSION")).text;
|
||||||
|
if (remote_version != VERSION) {
|
||||||
|
console.log(
|
||||||
|
`New version available in remote:\nRemote: v${remote_version}\nCurrent: v${VERSION}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
console.log("Failed to get updates, is updates repository offline?");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isActive() {
|
function isActive() {
|
||||||
let style = getComputedStyle(document.body);
|
let style = getComputedStyle(document.body);
|
||||||
return style.getPropertyValue("--is-haxxorman") == "true"
|
return style.getPropertyValue("--is-haxxorman") == "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", main);
|
document.addEventListener("DOMContentLoaded", main);
|
Loading…
x
Reference in New Issue
Block a user