this._cache[key] = value;
}
},
+ unset: function (key) {
+ if (this._support) {
+ if (key.indexOf(this._prefix) !== 0) {
+ key = this._prefix + key;
+ }
+ localStorage.removeItem(key);
+ } else {
+ delete this._cache[key];
+ }
+ },
find: function (search) {
var $this = this;
var res = {};
$this.addNote();
return false;
});
+ $(document).on('click', '.note .remove', function () {
+ $this.removeNote($(this).closest('.note'));
+ return false;
+ });
+
$(document).on('change keyup resize', '.note textarea', function () {
$this.updateNote($(this).closest('.note').attr('id'));
});
addNote: function () {
var name = 'note_' + Math.round(Math.random() * 10000000);
- $("#notesHolder").append('<div class="note" id="' + name + '" style="left:' + (0.5 * this.fluidbook.resize.fluidbookrect.width) + 'px;top:' + (0.5 * this.fluidbook.resize.fluidbookrect.height) + 'px;"><a href="#" class="remove"></a><textarea placeholder="' + __('your text') + '" name="' + name + '"></textarea></div>');
+ $("#notesHolder").append('<div class="note" id="' + name + '" style="left:' + (0.5 * this.fluidbook.resize.fluidbookrect.width) + 'px;top:' + (0.5 * this.fluidbook.resize.fluidbookrect.height) + 'px;"><a href="#" class="remove">' + getSpriteIcon('interface-close') + '</a><textarea placeholder="' + __('your text') + '" name="' + name + '"></textarea></div>');
this.initNotes();
this.createNote(name);
},
+ removeNote: function (n) {
+ var id = $(n).attr('id');
+ $("#" + id).remove();
+ this._unsetNote(id);
+ },
+
clearNotes: function () {
$("#notesHolder .note").each(function () {
interact('#' + $(this).attr('id')).unset();
v.x++;
}
}
- $('#notesHolder').append('<div class="note" id="' + k + '" style="left:' + (v.x * w) + 'px;top:' + (v.y * $this.fluidbook.resize.fluidbookrect.height) + 'px;"><a href="#" class="remove"></a><textarea style="width:' + v.w + 'px;px;height:' + v.h + 'px;" placeholder="' + __('your text') + '" name="' + k + '">' + v.c + '</textarea></div>')
+ $('#notesHolder').append('<div class="note" id="' + k + '" style="left:' + (v.x * w) + 'px;top:' + (v.y * $this.fluidbook.resize.fluidbookrect.height) + 'px;"><a href="#" class="remove">' + getSpriteIcon('interface-close') + '</a><textarea style="width:' + v.w + 'px;px;height:' + v.h + 'px;" placeholder="' + __('your text') + '" name="' + k + '">' + v.c + '</textarea></div>')
});
this.initNotes();
},
}
},
onmove: function (event) {
- console.log('//0');
$this.moveNote(event);
},
onend: function () {
},
moveNote: function (event) {
var target = event.target;
- console.log(target, event.dx);
this.setNotePosition(target, $(target).data('x') + event.dx, $(target).data('y') + event.dy);
},
getNotes: function (pageNr) {
_getNote: function (id) {
return this.fluidbook.cache.get(id, this._defaultNote());
},
+ _unsetNote: function (id) {
+ this.fluidbook.cache.unset(id);
+ }
}
\ No newline at end of file