wyattjmiller.com/src/main.js

53 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-05-18 06:38:59 -05:00
/*
main.js, for all global functions throughout the site
2019-04-17 22:48:19 -05:00
Created by Wyatt J. Miller, published by Miller Web Solutions
2018-05-18 06:38:59 -05:00
2019-04-17 22:48:19 -05:00
Hey there, nice to see you!
*/
2018-05-18 06:38:59 -05:00
2018-12-31 18:24:34 -06:00
var elTime = document.getElementById("time");
var time = new Date().getHours();
2018-05-18 06:38:59 -05:00
function mediaDetect(){
var ScreenWidth = window.screen.width;
var ScreenHeight = window.screen.height;
print("width: " + ScreenWidth);
print("height: " + ScreenHeight);
2018-05-18 06:38:59 -05:00
if (ScreenWidth < 768){
print("user has a phone!");
2018-05-18 06:38:59 -05:00
} else if (ScreenWidth < 992) {
print("user has a tablet!");
2018-05-18 06:38:59 -05:00
} else if (ScreenWidth < 1200) {
print("user has a desktop!");
2018-05-18 06:38:59 -05:00
} else if (ScreenWidth < 2048) {
print("user has a hd display!");
2018-05-18 06:38:59 -05:00
} else if (ScreenWidth < 4096) {
print("user has a display greater than fhd!");
2018-05-18 06:38:59 -05:00
} else {
print("what do you spend your money on?");
2018-05-18 06:38:59 -05:00
}
2018-05-20 23:11:33 -05:00
}
function backToTop(){
// code goes here
// this function has a button where js moves the page/screen back to the top
}
2018-05-20 23:11:33 -05:00
2018-12-31 18:24:34 -06:00
var x = "Good morning, people!";
var y = "Good afternoon, people!";
var z = "Good evening, people!";
var a = "Hello!";
if (time < 12) {
elTime.innerHTML = x;
} else if (time < 18) {
elTime.innerHTML = y;
2019-01-08 09:34:39 -06:00
} else if (time < 24) {
2018-12-31 18:24:34 -06:00
elTime.innerHTML = z;
} else {
elTime.innerHTML = a;
}
2018-12-28 21:42:40 -06:00
2019-01-12 14:45:33 -06:00
console.log("Anyone that gets the version codename, email me by clicking the contact button.");