Add new note prompt
This commit is contained in:
parent
7830ae3217
commit
20ca509a2b
8 changed files with 45 additions and 8 deletions
|
@ -31,4 +31,18 @@ function beginTimeUpdater() {
|
|||
setTimeout(callEveryMinute, difference);
|
||||
setTimeout(updateTime, difference);
|
||||
updateTime();
|
||||
}
|
||||
|
||||
// This does NOT properly sanitize, and assumes a well-meaning user
|
||||
function sanitize(title) {
|
||||
return title
|
||||
.trim()
|
||||
.replace(/ +/g, '-')
|
||||
.replace(/[!*'();:@&=+$,\/?#\[\]]/g, '')
|
||||
}
|
||||
|
||||
// Open a new note
|
||||
function newNote(text_prompt) {
|
||||
name = sanitize(prompt(text_prompt + ':'))
|
||||
window.location.replace('/notes/' + name)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue