Initial commit
This commit is contained in:
32
app/plugins/notes/js/notes.js
Normal file
32
app/plugins/notes/js/notes.js
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
function setIcon(iconName, iconText) {
|
||||
document.getElementById('iconValue').value = iconName;
|
||||
document.getElementById('selected-icon').innerHTML = '<span class="glyphicon glyphicon-' + iconName + '"></span> ' + iconText;
|
||||
}
|
||||
|
||||
|
||||
$( document ).ready( function () {
|
||||
function autosave() {
|
||||
var title = $( "#title" ).val();
|
||||
var color = $( "#color" ).val();
|
||||
var notebookID = $( "#notebookID" ).val();
|
||||
var noteID = $( "#noteID" ).val();
|
||||
var note = $( "#note" ).val();
|
||||
|
||||
$.post( "/notes/autoUpdate/" + noteID, {
|
||||
title: title,
|
||||
color: color,
|
||||
notebookID: notebookID,
|
||||
note: note,
|
||||
});
|
||||
console.log( 'note saved' );
|
||||
}
|
||||
|
||||
var lastSegment = window.location.pathname.split('/').pop();
|
||||
if (!isNaN(lastSegment)) {
|
||||
if (window.location.pathname.endsWith('/notes/byNote/'+lastSegment)) {
|
||||
console.log( 'autosave enabled' );
|
||||
setInterval(autosave, 60 * 1000);
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user