text
stringlengths
0
14.1k
var resp = resp.responseJSON
if (resp.success) {
notice(""Note removed"")
this_note.removeCleanup()
} else {
notice(""Error: "" + resp.reason)
}
}
})
}
e.stop()
},
// Redirect to the note's history
history: function(e) {
if (Note.debug) {
console.debug(""Note#history (id=%d)"", this.id)
}
this.hideEditBox(e)
if (this.is_new) {
notice(""This note has no history"")
} else {
location.href = '/history?search=notes:' + this.id
}
e.stop()
}
})
// The following are class methods and variables
Object.extend(Note, {
zindex: 0,
counter: -1,
all: [],
display: true,
debug: false,
// Show all notes
show: function() {
if (Note.debug) {
console.debug(""Note.show"")
}
$(""note-container"").show()
},
// Hide all notes
hide: function() {
if (Note.debug) {
console.debug(""Note.hide"")
}
$(""note-container"").hide()
},
// Find a note instance based on the id number
find: function(id) {
if (Note.debug) {
console.debug(""Note.find"")
}
for (var i=0; i<Note.all.size(); ++i) {
if (Note.all[i].id == id) {
return Note.all[i]
}
}
return null
},
// Toggle the display of all notes
toggle: function() {
if (Note.debug) {
console.debug(""Note.toggle"")
}
if (Note.display) {
Note.hide()
Note.display = false
} else {
Note.show()
Note.display = true
}
},
// Update the text displaying the number of notes a post has
updateNoteCount: function() {
if (Note.debug) {
console.debug(""Note.updateNoteCount"")
}
if (Note.all.length > 0) {
var label = """"
if (Note.all.length == 1)
label = ""note""