-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.min.js
18 lines (18 loc) · 2.4 KB
/
script.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
* exams: The clock used and projected during examinations in the main hall.
* <https://github.com/rgshw/exams/>
* Copyright (C) 2018 Matt Cowley (MattIPv4) ([email protected])
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, please see
* <https://github.com/rgshw/exams/blob/master/LICENSE> or <http://www.gnu.org/licenses/>.
**/
for(var clock=document.querySelector(".clock"),byFive=function(e){return Boolean(e/5===parseInt(e/5,10))},i=0;i<30;i++){var span=document.createElement("span");byFive(i)&&(span.className="fives"),span.style.transform="translate(-50%,-50%) rotate("+(6*i).toString()+"deg)",clock.appendChild(span)}for(i=1;i<13;i++){var li=document.querySelector("section.clock ul li:nth-child("+i.toString()+")"),lii=document.querySelector("section.clock ul li:nth-child("+i.toString()+") i");li.style.transform="rotate("+(30*(i-1)).toString()+"deg)",lii.style.transform="translateX(-50%) rotate(-"+(30*(i-1)).toString()+"deg) translateY(50%)"}!function e(){var t=new Date,r=t.getHours(),n=t.getMinutes(),o=t.getSeconds(),s={hours:document.querySelector(".hours"),minutes:document.querySelector(".minutes"),seconds:document.querySelector(".seconds")},a=30*r+.5*n,i=6*n+.1*o,u=6*o;s.hours.style.transform="rotate("+a+"deg)",s.minutes.style.transform="rotate("+i+"deg)",s.seconds.style.transform="rotate("+u+"deg)";var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][t.getDay()]+" "+t.getDate()+" "+["January","February","March","April","May","June","July","August","September","October","November","December"][t.getMonth()]+" "+t.getFullYear(),l=(t.getHours()<10?"0":"")+t.getHours();l+=":",l+=(t.getMinutes()<10?"0":"")+t.getMinutes(),l+=":",l+=(t.getSeconds()<10?"0":"")+t.getSeconds(),document.querySelectorAll("output.date")[0].innerHTML="<i> "+c+" </i><br/><b> "+l+" </b>",setTimeout(e,100)}();