Show
Ignore:
Timestamp:
11/29/08 00:38:56 (6 weeks ago)
Author:
anekos
Message:

added "%a"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/trunk/clock.js

    r25222 r25288  
    55 * @description-ja  とけい。 
    66 * @author          janus_wel <janus_wel@fb3.so-net.ne.jp> 
    7  * @version         0.11 
     7 * @version         0.12 
    88 * @minversion      2.0pre 
    99 * @maxversion      2.0pre 
     
    2121 *                          %d: day  MM/DD 
    2222 *                          %y: year YYYY 
     23 *                          %a: A abbreviation for the day of the week. 
    2324 *      clock_position: id of element that is marker of insert position. 
    2425 *                      default is 'liberator-commandline-command' ( after commandline ) 
     
    9192                return setInterval(function () label.setAttribute('value', time()), 100); 
    9293            }, 
     94            a: function (label) { 
     95                return setInterval(function () label.setAttribute('value', wday()), 60 * 1000); 
     96            }, 
    9397            d: function (label) { 
    9498                return setInterval(function () label.setAttribute('value', day()), 60 * 1000); 
     
    105109                l.setAttribute('value', time()); 
    106110                let id = self._constants.driver.t(l); 
     111                return { 
     112                    node: l, 
     113                    intervalId: id, 
     114                }; 
     115            }, 
     116            a: function (self) { 
     117                let l = self._master.cloneNode(false); 
     118                l.setAttribute('id', self._constants.prefix + 'wday'); 
     119                l.setAttribute('value', weekDay()); 
     120                let id = self._constants.driver.a(l); 
    107121                return { 
    108122                    node: l, 
     
    237251    return hour + (now.getMilliseconds() < 400 ? ' ' : ':') + min; 
    238252} 
     253function weekDay() { 
     254    const wdays = 'sun mon tue wed thu fri sat'.split(/%s/); 
     255    let now = new Date(); 
     256    return now.toLocaleFormat ? now.toLocaleFormat('%a') 
     257                              : wdays[now.getDay()]; 
     258} 
    239259function day() { 
    240260    let now = new Date();