File: onsave-insert_todo.js

package info (click to toggle)
nixnote2 2.1.7~git20220718%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,984 kB
  • sloc: cpp: 78,958; java: 1,096; sh: 322; javascript: 107; ansic: 10; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 860 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* 
   This is a sample exit. It is called when a note's contents 
   are saved. It will scan the contents of a note for  any
   [], [x], or [X] strings. If found, those strings will be   
   changed into a todo statement.                              	
*/

var c = note.getContents();

var todoUnchecked = "<input type=\"CHECKBOX\" onmouseover=\"style.cursor='hand'\" onclick=\"if(!checked) removeAttribute('checked'); else setAttribute('checked', 'checked'); editorWindow.editAlert();\" style=\"cursor: pointer;\">";

var todoChecked = "<input checked=\"checked\" type=\"checkbox\" onclick=\"if(!checked) removeAttribute('checked'); else setAttribute('checked', 'checked'); editorWindow.editAlert();\" style=\"cursor: hand;\">";


c = c.replace("[]", todoUnchecked);
c = c.replace("[x]", todoChecked);
c = c.replace("[X]", todoChecked);
note.setContents(c);