diff --git a/src/main.js b/src/main.js index 372cc9d..19ca3c6 100644 --- a/src/main.js +++ b/src/main.js @@ -3,7 +3,7 @@ main.js, for all global functions throughout the site Created by Wyatt J. Miller, published by Entourage Solutions Hey there, nice to see you! There's nothing here so why don't you fuck off?? -*/ +*/ function mediaDetect(){ var ScreenWidth = window.screen.width; @@ -39,12 +39,13 @@ function whatTimeIsIt(){ print("Geolocation is not supported. Update your shit."); } + // working on getting user location and setting timezone to said location function timezoneOffset(zone){ var offset = Math.abs(zone/60); - getHoursOffset = death.getHours + offset; - getMinutesOffset = death.getMinutes + offset; - getSecondsOffset = death.getSeconds + offset; + var getHoursOffset = death.getHours + offset; + var getMinutesOffset = death.getMinutes + offset; + var getSecondsOffset = death.getSeconds + offset; return getHoursOffset, getMinutesOffset, getSecondsOffset; } diff --git a/src/video.js b/src/video.js new file mode 100644 index 0000000..17de85f --- /dev/null +++ b/src/video.js @@ -0,0 +1,63 @@ +// custom video player, used when YouTube isn't available +// written by Wyatt J. Miller + +var videoContainer = document.getElementsById("video-container"); +var videoControls = document.getElementById("video-controls"); +var video = document.getElementsById("video"); + +var supportsVideo = !!document.createElement("video").canPlayType; +if (supportsVideo){ + // if supportsVideo is true, setting variables using DOM + var playPause = document.getElementsById("play-pause"); + var rewind = document.getElementById("rewind"); + var rewindBeginning = document.getElementById("rewind-beginning"); + var mute = document.getElementsById("mute"); + var volUp = document.getElementsById("vol-up"); + var volDown = document.getElementsById("vol-down"); + var progress = document.getElementById("progress"); + var progressBar = document.getElementById("progress-bar"); +} +// hide browser's default controls +video.controls = false; + +// displays custom controls +videoControls.style.display = "block"; + +function changeVolume(x){ + var currentVol = Math.floor(video.volume * 10) / 10; + + if (x === "+") { + if (currentVol < 1) video.volume += 0.1; + } else if (x === "-") { + if (currentVol > 0) video.volume -= 0.1; + } +} + +playPause.addEventListener("click", function(e){ + if (video.paused || video.ended) video.play; + else video.pause; +}); + +mute.addEventListener("click", function(e){ + video.muted = !video.muted; +}); + +volUp.addEventListener("click", function(e){ + changeVolume("+"); +}); + +volDown.addEventListener("click", function(e){ + changeVolume("-"); +}); + +rewind.addEventListener("click", function(e){ + // code goes here + // rewind event is supposed to rewind the video a bit +}); + +rewindBeginning.addEventListener("click", function(e){ + video.pause; + video.currentTime = 0; + progress.value = 0; + video.play; +}); \ No newline at end of file