1function update(widget_id, time_format, date_format) { 2 var ampm = " AM"; 3 var now = new Date(); 4 var hours = now.getHours(); 5 var minutes = now.getMinutes(); 6 var seconds = now.getSeconds(); 7 var months = new Array("January", "February", "March", "April", "May", "June", 8 "July", "August", "September", "October", "November", "December"); 9 var $date = jQuery("#" + widget_id + " .date"); 10 var $time = jQuery("#" + widget_id + " .time"); 11 12 // Date 13 if (date_format != "none") { 14 var currentTime = new Date(); 15 var year = currentTime.getFullYear(); 16 var month = currentTime.getMonth(); 17 var day = currentTime.getDate(); 18 19 if (date_format == "long") { 20 $date.text(months[month] + " " + day + ", " + year); 21 } 22 else if (date_format == "medium") { 23 $date.text(months[month].substring(0, 3) + " " + day + " " + year); 24 } 25 else if (date_format == "short") { 26 $date.text((month + 1) + "/" + day + "/" + year); 27 } 28 else if (date_format == "european") { 29 $date.text(day + "/" + (month + 1) + "/" + year); 30 } 31 } 32 33 // Time 34 if (time_format != "none") { 35 if (hours >= 12) { 36 ampm = " PM"; 37 } 38 39 if (minutes <= 9) { 40 minutes = "0" + minutes; 41 } 42 43 if (seconds <= 9) { 44 seconds = "0" + seconds; 45 } 46 47 if ((time_format == "12-hour") || (time_format == "12-hour-seconds")) { 48 if (hours > 12) { 49 hours = hours - 12; 50 } 51 52 if (hours === 0) { 53 hours = 12; 54 } 55 56 if (time_format == "12-hour-seconds") { 57 $time.text(hours + ":" + minutes + ":" + seconds + ampm); 58 } 59 else { 60 $time.text(hours + ":" + minutes + ampm); 61 } 62 } 63 else if (time_format == "24-hour-seconds") { 64 $time.text(hours + ":" + minutes + ":" + seconds); 65 } 66 else { 67 $time.text(hours + ":" + minutes); 68 } 69 } 70 71 // Update clock every second. 72 if ((date_format != "none") || (time_format != "none")) { 73 setTimeout(function() { 74 update(widget_id, time_format, date_format); 75 }, 1000); 76 } 77}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.