hover tooltip for internal links

This commit is contained in:
azivner
2017-10-11 20:37:27 -04:00
parent 562a071350
commit c4ed01128b
7 changed files with 66 additions and 12 deletions

View File

@@ -53,4 +53,31 @@ $.ui.autocomplete.filter = (array, terms) => {
console.log("Search took " + (new Date().getTime() - startDate.getTime()) + "ms");
return results;
};
};
$(document).tooltip({
items: ".note-editable a",
content: function(callback) {
const noteId = getNoteIdFromLink($(this).attr("href"));
if (noteId !== null) {
loadNote(noteId, note => {
callback(note.detail.note_text);
});
}
},
close: function(event, ui)
{
ui.tooltip.hover(function()
{
$(this).stop(true).fadeTo(400, 1);
},
function()
{
$(this).fadeOut('400', function()
{
$(this).remove();
});
});
}
});