2015-08-23 22:38:18 +02:00
|
|
|
<div class="widget">
|
2017-02-05 16:11:01 +01:00
|
|
|
<h3>{{$banner}}</h3>
|
|
|
|
<textarea name="note_text" id="note-text">{{$text}}</textarea>
|
|
|
|
<script>
|
|
|
|
var noteSaveTimer = null;
|
|
|
|
var noteText = $('#note-text');
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2017-02-05 16:11:01 +01:00
|
|
|
noteText.on('change keyup keydown paste cut', function () {
|
|
|
|
$(this).height(0).height(this.scrollHeight);
|
|
|
|
$(document.body).trigger("sticky_kit:recalc");
|
|
|
|
}).change();
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2017-02-05 16:11:01 +01:00
|
|
|
$(document).on('focusout',"#note-text",function(e){
|
|
|
|
if(noteSaveTimer)
|
|
|
|
clearTimeout(noteSaveTimer);
|
|
|
|
notePostFinal();
|
|
|
|
noteSaveTimer = null;
|
|
|
|
});
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2017-02-05 16:11:01 +01:00
|
|
|
$(document).on('focusin',"#note-text",function(e){
|
|
|
|
noteSaveTimer = setTimeout(noteSaveChanges,10000);
|
|
|
|
});
|
2015-08-23 22:38:18 +02:00
|
|
|
|
2017-02-05 16:11:01 +01:00
|
|
|
function notePostFinal() {
|
|
|
|
$.post('notes/sync', { 'note_text' : $('#note-text').val() });
|
|
|
|
}
|
|
|
|
|
|
|
|
function noteSaveChanges() {
|
|
|
|
$.post('notes', { 'note_text' : $('#note-text').val() });
|
|
|
|
noteSaveTimer = setTimeout(noteSaveChanges,10000);
|
|
|
|
}
|
|
|
|
</script>
|
2015-08-23 22:38:18 +02:00
|
|
|
</div>
|