Blame view

assets/js/pages/pattern-lock-screen.js 1.71 KB
cf76164e6   Ting Chan   20190709
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  
      function updateClock ( )
   	{
   	var currentTime = new Date ( );
    	var currentHours = currentTime.getHours ( );
    	var currentMinutes = currentTime.getMinutes ( );
  
    	// Pad the minutes and seconds with leading zeros, if required
    	currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  
    	// Choose either "AM" or "PM" as appropriate
    	var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
  
    	// Convert the hours component to 12-hour format if needed
    	currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
  
    	// Convert an hours component of "0" to "12"
    	currentHours = ( currentHours == 0 ) ? 12 : currentHours;
  
    	// Compose the string for display
    	var currentTimeString = currentHours + ":" + currentMinutes + " " + timeOfDay;
    	
    	
     	$("#time").html(currentTimeString);
     	  	
   }
  
  $(document).ready(function(){
      var lock = new PatternLock("#patternContainer");
      lock.checkForPattern("321478965", function() {
          window.location.href = "index.html";
      });
      setInterval('updateClock()', 1000);
      
      var objToday = new Date(),
                  weekday = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
                  dayOfWeek = weekday[objToday.getDay()],
                  dayOfMonth = objToday.getDate(),
                  months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'),
                  curMonth = months[objToday.getMonth()],
                  curYear = objToday.getFullYear();
  var today = dayOfWeek + "<br>" + curMonth + " " + dayOfMonth + ", " + curYear;
      
      
     	$("#date").html(today);
  });