Skip to content

Commit

Permalink
Update snostorm.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ClassicMC-Studios authored Oct 25, 2024
1 parent 8ea47b3 commit 7b2be86
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions snostorm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// SnoJS Snowstorm BETA

//TODO: mobile computer

// inside exe usable functions
function random(max) {
return Math.floor(Math.random() * max);
Expand Down Expand Up @@ -49,6 +46,40 @@ for(i=0;i<elements.length;i++){
};
const data = parseData();

const parseScreen = () =>{
var hasEither;
var screens = [];
for(i=0;i<elements.length;i++){
hasEither = elements[i].getAttribute("computer");
// computer first mobile second
if(hasEither != null){
screens.push({elem:elements[i],attr:"computer"})
}else if(elements[i].getAttribute("mobile") != null){
screens.push({elem:elements[i],attr:"mobile"})
}
}
return screens;
};
const screens = parseScreen();
const renderScreens = () =>{
for(i=0;i<screens.length;i++){
if(screens[i].attr == "mobile"){
if(window.innerWidth <= 600){
screens[i].elem.style.display="block";
}else{
screens[i].elem.style.display="none";
}
}
if(screens[i].attr == "computer"){
if(window.innerWidth >= 600){
screens[i].elem.style.display="block";
}else{
screens[i].elem.style.display="none";
}
}
}
}

const parseReval = () => {
var hasReval;
var revals = [];
Expand Down Expand Up @@ -267,4 +298,5 @@ requestAnimationFrame( main );
renderIfs();
renderBinds();
renderFors();
renderScreens();
};main();

0 comments on commit 7b2be86

Please sign in to comment.