add date in editor
This commit is contained in:
@@ -1,3 +1,23 @@
|
|||||||
|
function insertAtEnd(myField, myValue) {
|
||||||
|
myField.value += myValue;
|
||||||
|
}
|
||||||
|
function insertDate() {
|
||||||
|
insertAtEnd(document.getElementById("edit_md"),"\n[ ] "+getDate()+" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDate(){
|
||||||
|
var d = new Date();
|
||||||
|
var hr = d.getHours();
|
||||||
|
var min = d.getMinutes();
|
||||||
|
if (min < 10) { min = "0" + min; }
|
||||||
|
var day = d.getDate();
|
||||||
|
var month = 1+d.getMonth();
|
||||||
|
if (month < 10) { month = "0" + month; }
|
||||||
|
var year = d.getFullYear();
|
||||||
|
return year+"-"+month+"-"+day+" "+hr+":"+min
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function growTextarea(name) {
|
function growTextarea(name) {
|
||||||
var el=document.getElementById(name);
|
var el=document.getElementById(name);
|
||||||
var rows=el.value.split(/\r?\n|\r/);
|
var rows=el.value.split(/\r?\n|\r/);
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
<dl>Edit content file:
|
<dl>Edit content file:
|
||||||
<dt><textarea cols=40 rows=5 id=edit_md name=edit_md onkeyup="growTextarea('edit_md')">{{ content }}</textarea><br>
|
<dt><textarea cols=40 rows=5 id=edit_md name=edit_md onkeyup="growTextarea('edit_md')">{{ content }}</textarea><br>
|
||||||
<input type=hidden name=shopid value={{ shopid }}><input class="submit notify" type=submit value=Save onclick="return confirm('Do you really want to replace content?');" >
|
<input type=hidden name=shopid value={{ shopid }}><input class="submit notify" type=submit value=Save onclick="return confirm('Do you really want to replace content?');" >
|
||||||
|
<input class="submit notify" type=button value="Insert Date" onclick="insertDate();" >
|
||||||
</dl>
|
</dl>
|
||||||
</form>
|
</form>
|
||||||
<div class=hidden id=disp_share>
|
<div class=hidden id=disp_share>
|
||||||
|
|||||||
Reference in New Issue
Block a user