text
stringlengths
0
14.1k
},
// Removes the edit box
hideEditBox: function(e) {
if (Note.debug) {
console.debug(""Note#hideEditBox (id=%d)"", this.id)
}
var editBox = $('edit-box')
if (editBox != null) {
var boxid = editBox.noteid
$(""edit-box"").stopObserving()
$(""note-save-"" + boxid).stopObserving()
$(""note-cancel-"" + boxid).stopObserving()
$(""note-remove-"" + boxid).stopObserving()
$(""note-history-"" + boxid).stopObserving()
$(""edit-box"").remove()
}
},
// Shows the edit box
showEditBox: function(e) {
if (Note.debug) {
console.debug(""Note#showEditBox (id=%d)"", this.id)
}
this.hideEditBox(e)
var insertionPosition = Note.getInsertionPosition()
var top = insertionPosition[0]
var left = insertionPosition[1]
var html = """"
html += '<div id=""edit-box"" style=""top: '+top+'px; left: '+left+'px; position: absolute; visibility: visible; z-index: 100; background: white; border: 1px solid black; padding: 12px;"">'
html += '<form onsubmit=""return false;"" style=""padding: 0; margin: 0;"">'
html += '<textarea rows=""7"" id=""edit-box-text"" style=""width: 350px; margin: 2px 2px 12px 2px;"">' + this.textValue() + '</textarea>'
html += '<input type=""submit"" value=""Save"" name=""save"" id=""note-save-' + this.id + '"">'
html += '<input type=""submit"" value=""Cancel"" name=""cancel"" id=""note-cancel-' + this.id + '"">'
html += '<input type=""submit"" value=""Remove"" name=""remove"" id=""note-remove-' + this.id + '"">'
html += '<input type=""submit"" value=""History"" name=""history"" id=""note-history-' + this.id + '"">'
html += '</form>'
html += '</div>'
$(""note-container"").insert({bottom: html})
$('edit-box').noteid = this.id
$(""edit-box"").observe(""mousedown"", this.editDragStart.bindAsEventListener(this))
$(""note-save-"" + this.id).observe(""click"", this.save.bindAsEventListener(this))
$(""note-cancel-"" + this.id).observe(""click"", this.cancel.bindAsEventListener(this))
$(""note-remove-"" + this.id).observe(""click"", this.remove.bindAsEventListener(this))
$(""note-history-"" + this.id).observe(""click"", this.history.bindAsEventListener(this))
$(""edit-box-text"").focus()
},
// Shows the body text for the note
bodyShow: function(e) {
if (Note.debug) {
console.debug(""Note#bodyShow (id=%d)"", this.id)
}
if (this.dragging) {
return
}
if (this.hideTimer) {
clearTimeout(this.hideTimer)
this.hideTimer = null
}
if (Note.noteShowingBody == this) {
return
}
if (Note.noteShowingBody) {
Note.noteShowingBody.bodyHide()
}
Note.noteShowingBody = this
if (Note.zindex >= 9) {
/* don't use more than 10 layers (+1 for the body, which will always be above all notes) */
Note.zindex = 0
for (var i=0; i< Note.all.length; ++i) {
Note.all[i].elements.box.style.zIndex = 0
}
}
this.elements.box.style.zIndex = ++Note.zindex
this.elements.body.style.zIndex = 10
this.elements.body.style.top = 0 + ""px""
this.elements.body.style.left = 0 + ""px""
var dw = document.documentElement.scrollWidth
this.elements.body.style.visibility = ""hidden""
this.elements.body.style.display = ""block""
if (!this.bodyfit) {
this.elements.body.style.height = ""auto""
this.elements.body.style.minWidth = ""140px""
var w = null, h = null, lo = null, hi = null, x = null, last = null