Created
September 7, 2008 03:00
-
-
Save hrsano645/9223 to your computer and use it in GitHub Desktop.
undefined
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
CmdUtils.CreateCommand({ | |
name: "now-date-format", | |
homepage: "http://d.hatena.ne.jp/piropati/20080906/1220690703", | |
author: { name: "hiroshi sano", email: "pirohatiko@gmal.com"}, | |
license: "MPL", | |
description: "Present time is inserted!", | |
help: "Present time is inserted!", | |
_zerofunc: function(dt) { | |
if(dt < 10) { | |
return "0" + dt | |
} else { | |
return dt | |
} | |
}, | |
_fdate: function(){ | |
var date = new Date(); | |
return date.getFullYear() + "/" + | |
this._zerofunc((date.getMonth()+1)) + "/" + | |
this._zerofunc(date.getDate()) + " " + | |
this._zerofunc(date.getHours()) + ":" + | |
this._zerofunc(date.getMinutes()) + ":" + | |
this._zerofunc(date.getSeconds()) ; | |
}, | |
preview: function( pblock ) { | |
var msg = 'Inserts todays date format: "<i>${predate}</i>"'; | |
pblock.innerHTML = CmdUtils.renderTemplate( msg, {predate: this._fdate()} ); | |
}, | |
execute:function() { | |
CmdUtils.setSelection(this._fdate()); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment