-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
042875f
commit dcd1450
Showing
5 changed files
with
57 additions
and
36 deletions.
There are no files selected for viewing
Binary file modified
BIN
+270 Bytes
(110%)
.sass-cache/9e714dfd47ad9bab2d70b3ee99690702320fc3c0/style.scssc
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,54 @@ | ||
function clock () { | ||
// defining vars | ||
var time = new Date(); | ||
var timeHours = time.getHours() > 12 ? time.getHours() - 12 : time.getHours(); | ||
var timeMinutes = time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes(); | ||
var timeSeconds = time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds(); | ||
var timeSplit = timeHours + ":" + timeMinutes + ":" + timeSeconds; | ||
|
||
// setting time | ||
$(".current-time").html(timeSplit); | ||
|
||
// defining percentage | ||
var roundedTimeSeconds = parseFloat((timeSeconds/60).toFixed(2)); | ||
var roundedTimeSecondsToInt= (roundedTimeSeconds * 100).toString(); | ||
(function () { | ||
|
||
// console log percentage | ||
console.log(roundedTimeSecondsToInt); | ||
var intervalId = 0; | ||
var displayClock = document.querySelector(".current-time"); | ||
var mouseIsHovering= false; | ||
|
||
// setting width = 'initial' | ||
$(".time-bar").css("width", roundedTimeSecondsToInt + "%"); | ||
function timeToHex (h, m, s) { | ||
var timeHex = "#" + s.toString() + m.toString() + h.toString(); | ||
return timeHex; | ||
} | ||
|
||
var timeToColor = function(a,b,c){ | ||
var concatTimes = a.toString() + b.toString() + c.toString(); | ||
// console.log('concat times', concatTimes); | ||
return concatTimes; | ||
function hoverHex(display) { | ||
displayClock.textContent = display; | ||
} | ||
|
||
$('body').css("background-color", timeToColor(timeSeconds, timeMinutes, timeHours)); | ||
function printTime () { | ||
var currentTime = new Date(); | ||
var hours = currentTime.getHours() > 12 ? currentTime.getHours() - 12 : currentTime.getHours(); | ||
var minutes = currentTime.getMinutes() < 10 ? "0" + currentTime.getMinutes() : currentTime.getMinutes(); | ||
var seconds = currentTime.getSeconds() < 10 ? "0" + currentTime.getSeconds() : currentTime.getSeconds(); | ||
|
||
var hexedTime = timeToHex(hours, minutes, seconds); | ||
|
||
if (mouseIsHovering) { | ||
displayClock.textContent = hexedTime; | ||
} else { | ||
displayClock.textContent = hours + ":" + minutes + ":" + seconds; | ||
} | ||
|
||
$('body').css("background-color", hexedTime); | ||
|
||
var percentage = parseFloat((seconds/60).toFixed(2)); | ||
var percentageToInt = (percentage * 100).toString(); | ||
|
||
$(".time-bar").css("width", percentageToInt + "%"); | ||
} | ||
|
||
|
||
function hoverHex () { | ||
mouseIsHovering = true; | ||
} | ||
|
||
function noHoverHex () { | ||
mouseIsHovering = false; | ||
} | ||
|
||
|
||
displayClock.addEventListener('mouseenter', hoverHex); | ||
displayClock.addEventListener('mouseout', noHoverHex); | ||
|
||
$(".current-time").hover(function(e){ | ||
$(this).text("#" + timeToColor(timeSeconds, timeMinutes, timeHours)); | ||
}); | ||
} | ||
intervalId = window.setInterval(printTime, 100); | ||
|
||
// function call on timer | ||
window.setInterval(clock, 1000); | ||
setInterval(printTime, 1000); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters