help buttons and existing custom HTML attribute refactoring to data-*

This commit is contained in:
azivner
2018-08-15 10:14:14 +02:00
parent f440493e45
commit 510704a074
9 changed files with 74 additions and 30 deletions

View File

@@ -33,8 +33,8 @@ async function createNoteLink(notePath, noteTitle = null) {
const noteLink = $("<a>", {
href: 'javascript:',
text: noteTitle
}).attr('action', 'note')
.attr('note-path', notePath);
}).attr('data-action', 'note')
.attr('data-note-path', notePath);
return noteLink;
}
@@ -43,10 +43,10 @@ function goToLink(e) {
e.preventDefault();
const $link = $(e.target);
let notePath = $link.attr("note-path");
let notePath = $link.attr("data-note-path");
if (!notePath) {
const address = $link.attr("note-path") ? $link.attr("note-path") : $link.attr('href');
const address = $link.attr("data-note-path") ? $link.attr("data-note-path") : $link.attr('href');
if (!address) {
return;
@@ -104,7 +104,7 @@ ko.bindingHandlers.noteLink = {
// when click on link popup, in case of internal link, just go the the referenced note instead of default behavior
// of opening the link in new window/tab
$(document).on('click', "a[action='note']", goToLink);
$(document).on('click', "a[data-action='note']", goToLink);
$(document).on('click', 'div.popover-content a, div.ui-tooltip-content a', goToLink);
$(document).on('dblclick', '#note-detail-text a', goToLink);