2025-12-20 11:44:54 +02:00
function pickColors ( ) {
2026-05-16 11:34:31 +03:00
const highlights = [
2025-12-20 11:44:54 +02:00
"#000000" , // Black
"#0000AA" , // Blue
"#00AA00" , // Green
"#00AAAA" , // Cyan
"#AA00AA" , // Magenta
"#AA5500" , // Brown
"#AA0000" , // Red
"#555555" , // Dark Gray
"#5555FF" , // Bright Blue
"#55FF55" , // Bright Green
"#55FFFF" , // Bright Cyan
"#FF5555" , // Bright Red
"#FF55FF" , // Bright Magenta
"#FFFF55" , // Bright Yellow
] ;
return {
// background: backgrounds[Math.floor(Math.random() * backgrounds.length)],
highlight : highlights [ Math . floor ( Math . random ( ) * highlights . length ) ] ,
} ;
}
2026-05-16 11:34:31 +03:00
const { background } = pickColors ( ) ;
2025-12-20 11:44:54 +02:00
document . querySelector ( '.home' ) . style . backgroundColor = background ;
2026-05-16 11:34:31 +03:00
const blogTitle = document . querySelector ( '#blog-title' ) . firstElementChild ;
blogTitle . style . color = "#FFFF55" ; // Bright Yellow
// setInterval(() => {
// blogTitle.style.color = pickColors().highlight;
// }, 120);
2023-07-01 11:01:17 +03:00
let scrollHeight = Math . max (
document . body . scrollHeight , document . documentElement . scrollHeight ,
document . body . offsetHeight , document . documentElement . offsetHeight ,
document . body . clientHeight , document . documentElement . clientHeight
) ;
let paras = document . getElementsByClassName ( "para" ) ;
for ( let i = 0 ; i < paras . length ; i ++ ) {
var imageSrc = paras [ i ] . style . backgroundImage . replace ( /url\((['"])?(.*?)\1\)/gi , '$2' ) . split ( ',' ) [ 0 ] ;
var image = new Image ( ) ;
image . src = imageSrc ;
2023-05-03 23:24:05 +03:00
if ( screen . width > screen . height ) {
paras [ i ] . setAttribute ( "offset" , paras [ i ] . getBoundingClientRect ( ) . bottom - image . height * 0.5 ) ;
} else {
paras [ i ] . parentNode . insertBefore ( image , paras [ i ] . nextSibling ) ;
paras [ i ] . style . display = 'none' ;
}
2023-07-01 11:01:17 +03:00
}
window . addEventListener ( 'scroll' , ( ) => {
let { scrollY } = window ;
if ( screen . width > screen . height ) {
for ( let i = 0 ; i < paras . length ; i ++ ) {
paras [ i ] . style . backgroundPositionY = paras [ i ] . getAttribute ( "offset" ) * 0.1 + - 0.1 * scrollY + 'px' ;
}
}
} ) ;
2025-12-20 11:44:54 +02:00
// //components
// //console component
// class Console{
// comps=[];
// input_received=false;
// blocking_interval=null;
// text_color="#bbb";
// constructor(root){
// this.elem=document.createElement("span");
// this.elem.className="console";
// root.appendChild(this.elem);
// this.resetTextColor();
// }
// appendComponent(comp){
// this.comps.push(comp);
// this.elem.appendChild(comp.elem);
// }
// writeLine(txt){
// let text=new Text(txt,this.text_color);
// this.appendComponent(text);
// }
// async readLine(txt){
// let text=new Text(txt,this.text_color);
// this.appendComponent(text);
// let input=new Input(this.text_color);
// this.appendComponent(input);
// input.elem.focus({ preventScroll: true});
// return new Promise(resolve=>{
// this.blocking_interval=setInterval(()=>{
// if(this.input_received){
// this.input_received=false;
// clearInterval(this.blocking_interval);
// resolve(input.elem.innerText);
// }
// },500);
// })
// }
// setTextColor(color){
// this.text_color=color;
// }
// resetTextColor(){
// this.text_color="#bbb";
// }
// //helpers
// get lastComp(){return this.comps[this.comps.length-1]};
// }
// //text component
// class Text{
// constructor(txt,color){
// this.elem=document.createElement("span");
// this.elem.className="text";
// this.elem.style.color=color;
// this.elem.innerText=txt;
// }
// }
// //input component
// class Input{
// constructor(color){
// this.elem=document.createElement("span");
// this.elem.style.color=color;
// this.elem.contentEditable=true;
// this.elem.addEventListener('keydown',function(e){
// let key=e.key;
// if(key=="Enter"){
// e.preventDefault();
// cmd.input_received=true;
// cmd.lastComp.elem.contentEditable=false;
// cmd.lastComp.elem.style.borderWidth="0px";
// }
// });
// }
// }
2023-07-01 11:01:17 +03:00
2025-12-20 11:44:54 +02:00
// /************************************/
// let root=document.getElementById("root");
2023-07-01 11:01:17 +03:00
2025-12-20 11:44:54 +02:00
// let cmd=new Console(root);
// let prompt = "C:\\>"
// async function execute(){
// let command= await cmd.readLine(prompt);
// if ( command == "projects" ) window.location = "/current.html";
// else if ( command == "blog" ) window.location = "/blog";
// else if ( command == "archive" ) window.location = "/archive";
// else if ( command == "dir" ) window.location = "/archive";
// else if ( command == "home" ) window.location = "/";
// else if ( command == "connect" ) window.location = "/connect.html";
// else if ( command == "reboot" ) location.reload();
// else if ( command == "a:" ) {
// prompt = "A:\\>";
// cmd.writeLine("\n");
// cmd=new Console(root);
// execute();
// }
// else if ( command == "b:" ) {
// prompt = "B:\\>";
// cmd.writeLine("\n");
// cmd=new Console(root);
// execute();
// }
// else if ( command == "c:" ) {
// prompt = "C:\\>";
// cmd.writeLine("\n");
// cmd=new Console(root);
// execute();
// }
// else {
// cmd.writeLine("\nSyntax error\n");
// cmd=new Console(root);
// execute();
// }
// }
// execute();