mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
change in naming conventions for element variables from *El to $name
This commit is contained in:
parent
c76e4faf5d
commit
dbd28377e3
@ -1,18 +1,18 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const addLink = (function() {
|
const addLink = (function() {
|
||||||
const dialogEl = $("#add-link-dialog");
|
const $dialog = $("#add-link-dialog");
|
||||||
const formEl = $("#add-link-form");
|
const $form = $("#add-link-form");
|
||||||
const autoCompleteEl = $("#note-autocomplete");
|
const $autoComplete = $("#note-autocomplete");
|
||||||
const linkTitleEl = $("#link-title");
|
const $linkTitle = $("#link-title");
|
||||||
const clonePrefixEl = $("#clone-prefix");
|
const $clonePrefix = $("#clone-prefix");
|
||||||
const linkTitleFormGroup = $("#add-link-title-form-group");
|
const $linkTitleFormGroup = $("#add-link-title-form-group");
|
||||||
const prefixFormGroup = $("#add-link-prefix-form-group");
|
const $prefixFormGroup = $("#add-link-prefix-form-group");
|
||||||
const linkTypeEls = $("input[name='add-link-type']");
|
const $linkTypes = $("input[name='add-link-type']");
|
||||||
const linkTypeHtmlEl = linkTypeEls.filter('input[value="html"]');
|
const $linkTypeHtml = $linkTypes.filter('input[value="html"]');
|
||||||
|
|
||||||
function setLinkType(linkType) {
|
function setLinkType(linkType) {
|
||||||
linkTypeEls.each(function () {
|
$linkTypes.each(function () {
|
||||||
$(this).prop('checked', $(this).val() === linkType);
|
$(this).prop('checked', $(this).val() === linkType);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -20,39 +20,39 @@ const addLink = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
if (noteEditor.getCurrentNoteType() === 'text') {
|
if (noteEditor.getCurrentNoteType() === 'text') {
|
||||||
linkTypeHtmlEl.prop('disabled', false);
|
$linkTypeHtml.prop('disabled', false);
|
||||||
|
|
||||||
setLinkType('html');
|
setLinkType('html');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linkTypeHtmlEl.prop('disabled', true);
|
$linkTypeHtml.prop('disabled', true);
|
||||||
|
|
||||||
setLinkType('selected-to-current');
|
setLinkType('selected-to-current');
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 700
|
width: 700
|
||||||
});
|
});
|
||||||
|
|
||||||
autoCompleteEl.val('').focus();
|
$autoComplete.val('').focus();
|
||||||
clonePrefixEl.val('');
|
$clonePrefix.val('');
|
||||||
linkTitleEl.val('');
|
$linkTitle.val('');
|
||||||
|
|
||||||
function setDefaultLinkTitle(noteId) {
|
function setDefaultLinkTitle(noteId) {
|
||||||
const noteTitle = noteTree.getNoteTitle(noteId);
|
const noteTitle = noteTree.getNoteTitle(noteId);
|
||||||
|
|
||||||
linkTitleEl.val(noteTitle);
|
$linkTitle.val(noteTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
autoCompleteEl.autocomplete({
|
$autoComplete.autocomplete({
|
||||||
source: noteTree.getAutocompleteItems(),
|
source: noteTree.getAutocompleteItems(),
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
change: () => {
|
change: () => {
|
||||||
const val = autoCompleteEl.val();
|
const val = $autoComplete.val();
|
||||||
const notePath = link.getNodePathFromLabel(val);
|
const notePath = link.getNodePathFromLabel(val);
|
||||||
if (!notePath) {
|
if (!notePath) {
|
||||||
return;
|
return;
|
||||||
@ -75,8 +75,8 @@ const addLink = (function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
formEl.submit(() => {
|
$form.submit(() => {
|
||||||
const value = autoCompleteEl.val();
|
const value = $autoComplete.val();
|
||||||
|
|
||||||
const notePath = link.getNodePathFromLabel(value);
|
const notePath = link.getNodePathFromLabel(value);
|
||||||
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
|
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
|
||||||
@ -85,25 +85,25 @@ const addLink = (function() {
|
|||||||
const linkType = $("input[name='add-link-type']:checked").val();
|
const linkType = $("input[name='add-link-type']:checked").val();
|
||||||
|
|
||||||
if (linkType === 'html') {
|
if (linkType === 'html') {
|
||||||
const linkTitle = linkTitleEl.val();
|
const linkTitle = $linkTitle.val();
|
||||||
|
|
||||||
dialogEl.dialog("close");
|
$dialog.dialog("close");
|
||||||
|
|
||||||
link.addLinkToEditor(linkTitle, '#' + notePath);
|
link.addLinkToEditor(linkTitle, '#' + notePath);
|
||||||
}
|
}
|
||||||
else if (linkType === 'selected-to-current') {
|
else if (linkType === 'selected-to-current') {
|
||||||
const prefix = clonePrefixEl.val();
|
const prefix = $clonePrefix.val();
|
||||||
|
|
||||||
cloning.cloneNoteTo(noteId, noteEditor.getCurrentNoteId(), prefix);
|
cloning.cloneNoteTo(noteId, noteEditor.getCurrentNoteId(), prefix);
|
||||||
|
|
||||||
dialogEl.dialog("close");
|
$dialog.dialog("close");
|
||||||
}
|
}
|
||||||
else if (linkType === 'current-to-selected') {
|
else if (linkType === 'current-to-selected') {
|
||||||
const prefix = clonePrefixEl.val();
|
const prefix = $clonePrefix.val();
|
||||||
|
|
||||||
cloning.cloneNoteTo(noteEditor.getCurrentNoteId(), noteId, prefix);
|
cloning.cloneNoteTo(noteEditor.getCurrentNoteId(), noteId, prefix);
|
||||||
|
|
||||||
dialogEl.dialog("close");
|
$dialog.dialog("close");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,19 +111,19 @@ const addLink = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function linkTypeChanged() {
|
function linkTypeChanged() {
|
||||||
const value = linkTypeEls.filter(":checked").val();
|
const value = $linkTypes.filter(":checked").val();
|
||||||
|
|
||||||
if (value === 'html') {
|
if (value === 'html') {
|
||||||
linkTitleFormGroup.show();
|
$linkTitleFormGroup.show();
|
||||||
prefixFormGroup.hide();
|
$prefixFormGroup.hide();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linkTitleFormGroup.hide();
|
$linkTitleFormGroup.hide();
|
||||||
prefixFormGroup.show();
|
$prefixFormGroup.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
linkTypeEls.change(linkTypeChanged);
|
$linkTypes.change(linkTypeChanged);
|
||||||
|
|
||||||
$(document).bind('keydown', 'ctrl+l', e => {
|
$(document).bind('keydown', 'ctrl+l', e => {
|
||||||
showDialog();
|
showDialog();
|
||||||
|
@ -33,6 +33,8 @@ const attributesDialog = (function() {
|
|||||||
update: function() {
|
update: function() {
|
||||||
let position = 0;
|
let position = 0;
|
||||||
|
|
||||||
|
// we need to update positions by searching in the DOM, because order of the
|
||||||
|
// attributes in the viewmodel (self.attributes()) stays the same
|
||||||
$attributesBody.find('input[name="position"]').each(function() {
|
$attributesBody.find('input[name="position"]').each(function() {
|
||||||
const attr = self.getTargetAttribute(this);
|
const attr = self.getTargetAttribute(this);
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const editTreePrefix = (function() {
|
const editTreePrefix = (function() {
|
||||||
const dialogEl = $("#edit-tree-prefix-dialog");
|
const $dialog = $("#edit-tree-prefix-dialog");
|
||||||
const formEl = $("#edit-tree-prefix-form");
|
const $form = $("#edit-tree-prefix-form");
|
||||||
const treePrefixInputEl = $("#tree-prefix-input");
|
const $treePrefixInput = $("#tree-prefix-input");
|
||||||
const noteTitleEl = $('#tree-prefix-note-title');
|
const $noteTitle = $('#tree-prefix-note-title');
|
||||||
|
|
||||||
let noteTreeId;
|
let noteTreeId;
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
await dialogEl.dialog({
|
await $dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 500
|
width: 500
|
||||||
});
|
});
|
||||||
@ -20,21 +20,21 @@ const editTreePrefix = (function() {
|
|||||||
|
|
||||||
noteTreeId = currentNode.data.noteTreeId;
|
noteTreeId = currentNode.data.noteTreeId;
|
||||||
|
|
||||||
treePrefixInputEl.val(currentNode.data.prefix).focus();
|
$treePrefixInput.val(currentNode.data.prefix).focus();
|
||||||
|
|
||||||
const noteTitle = noteTree.getNoteTitle(currentNode.data.noteId);
|
const noteTitle = noteTree.getNoteTitle(currentNode.data.noteId);
|
||||||
|
|
||||||
noteTitleEl.html(noteTitle);
|
$noteTitle.html(noteTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
formEl.submit(() => {
|
$form.submit(() => {
|
||||||
const prefix = treePrefixInputEl.val();
|
const prefix = $treePrefixInput.val();
|
||||||
|
|
||||||
server.put('tree/' + noteTreeId + '/set-prefix', {
|
server.put('tree/' + noteTreeId + '/set-prefix', {
|
||||||
prefix: prefix
|
prefix: prefix
|
||||||
}).then(() => noteTree.setPrefix(noteTreeId, prefix));
|
}).then(() => noteTree.setPrefix(noteTreeId, prefix));
|
||||||
|
|
||||||
dialogEl.dialog("close");
|
$dialog.dialog("close");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const eventLog = (function() {
|
const eventLog = (function() {
|
||||||
const dialogEl = $("#event-log-dialog");
|
const $dialog = $("#event-log-dialog");
|
||||||
const listEl = $("#event-log-list");
|
const $list = $("#event-log-list");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 700
|
height: 700
|
||||||
@ -15,7 +15,7 @@ const eventLog = (function() {
|
|||||||
|
|
||||||
const result = await server.get('event-log');
|
const result = await server.get('event-log');
|
||||||
|
|
||||||
listEl.html('');
|
$list.html('');
|
||||||
|
|
||||||
for (const event of result) {
|
for (const event of result) {
|
||||||
const dateTime = formatDateTime(parseDate(event.dateAdded));
|
const dateTime = formatDateTime(parseDate(event.dateAdded));
|
||||||
@ -28,7 +28,7 @@ const eventLog = (function() {
|
|||||||
|
|
||||||
const eventEl = $('<li>').html(dateTime + " - " + event.comment);
|
const eventEl = $('<li>').html(dateTime + " - " + event.comment);
|
||||||
|
|
||||||
listEl.append(eventEl);
|
$list.append(eventEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const jumpToNote = (function() {
|
const jumpToNote = (function() {
|
||||||
const dialogEl = $("#jump-to-note-dialog");
|
const $dialog = $("#jump-to-note-dialog");
|
||||||
const autoCompleteEl = $("#jump-to-note-autocomplete");
|
const $autoComplete = $("#jump-to-note-autocomplete");
|
||||||
const formEl = $("#jump-to-note-form");
|
const $form = $("#jump-to-note-form");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
autoCompleteEl.val('');
|
$autoComplete.val('');
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 800
|
width: 800
|
||||||
});
|
});
|
||||||
|
|
||||||
await autoCompleteEl.autocomplete({
|
await $autoComplete.autocomplete({
|
||||||
source: await stopWatch("building autocomplete", noteTree.getAutocompleteItems),
|
source: await stopWatch("building autocomplete", noteTree.getAutocompleteItems),
|
||||||
minLength: 0
|
minLength: 0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectedNotePath() {
|
function getSelectedNotePath() {
|
||||||
const val = autoCompleteEl.val();
|
const val = $autoComplete.val();
|
||||||
return link.getNodePathFromLabel(val);
|
return link.getNodePathFromLabel(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ const jumpToNote = (function() {
|
|||||||
if (notePath) {
|
if (notePath) {
|
||||||
noteTree.activateNode(notePath);
|
noteTree.activateNode(notePath);
|
||||||
|
|
||||||
dialogEl.dialog('close');
|
$dialog.dialog('close');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +42,8 @@ const jumpToNote = (function() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
formEl.submit(() => {
|
$form.submit(() => {
|
||||||
const action = dialogEl.find("button:focus").val();
|
const action = $dialog.find("button:focus").val();
|
||||||
|
|
||||||
goToNote();
|
goToNote();
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const noteHistory = (function() {
|
const noteHistory = (function() {
|
||||||
const dialogEl = $("#note-history-dialog");
|
const $dialog = $("#note-history-dialog");
|
||||||
const listEl = $("#note-history-list");
|
const $list = $("#note-history-list");
|
||||||
const contentEl = $("#note-history-content");
|
const $content = $("#note-history-content");
|
||||||
const titleEl = $("#note-history-title");
|
const $title = $("#note-history-title");
|
||||||
|
|
||||||
let historyItems = [];
|
let historyItems = [];
|
||||||
|
|
||||||
@ -13,23 +13,23 @@ const noteHistory = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function showNoteHistoryDialog(noteId, noteRevisionId) {
|
async function showNoteHistoryDialog(noteId, noteRevisionId) {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 700
|
height: 700
|
||||||
});
|
});
|
||||||
|
|
||||||
listEl.empty();
|
$list.empty();
|
||||||
contentEl.empty();
|
$content.empty();
|
||||||
|
|
||||||
historyItems = await server.get('notes-history/' + noteId);
|
historyItems = await server.get('notes-history/' + noteId);
|
||||||
|
|
||||||
for (const item of historyItems) {
|
for (const item of historyItems) {
|
||||||
const dateModified = parseDate(item.dateModifiedFrom);
|
const dateModified = parseDate(item.dateModifiedFrom);
|
||||||
|
|
||||||
listEl.append($('<option>', {
|
$list.append($('<option>', {
|
||||||
value: item.noteRevisionId,
|
value: item.noteRevisionId,
|
||||||
text: formatDateTime(dateModified)
|
text: formatDateTime(dateModified)
|
||||||
}));
|
}));
|
||||||
@ -37,13 +37,13 @@ const noteHistory = (function() {
|
|||||||
|
|
||||||
if (historyItems.length > 0) {
|
if (historyItems.length > 0) {
|
||||||
if (!noteRevisionId) {
|
if (!noteRevisionId) {
|
||||||
noteRevisionId = listEl.find("option:first").val();
|
noteRevisionId = $list.find("option:first").val();
|
||||||
}
|
}
|
||||||
|
|
||||||
listEl.val(noteRevisionId).trigger('change');
|
$list.val(noteRevisionId).trigger('change');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
titleEl.text("No history for this note yet...");
|
$title.text("No history for this note yet...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,13 +53,13 @@ const noteHistory = (function() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
listEl.on('change', () => {
|
$list.on('change', () => {
|
||||||
const optVal = listEl.find(":selected").val();
|
const optVal = $list.find(":selected").val();
|
||||||
|
|
||||||
const historyItem = historyItems.find(r => r.noteRevisionId === optVal);
|
const historyItem = historyItems.find(r => r.noteRevisionId === optVal);
|
||||||
|
|
||||||
titleEl.html(historyItem.title);
|
$title.html(historyItem.title);
|
||||||
contentEl.html(historyItem.content);
|
$content.html(historyItem.content);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', "a[action='note-history']", event => {
|
$(document).on('click', "a[action='note-history']", event => {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const noteSource = (function() {
|
const noteSource = (function() {
|
||||||
const dialogEl = $("#note-source-dialog");
|
const $dialog = $("#note-source-dialog");
|
||||||
const noteSourceEl = $("#note-source");
|
const $noteSource = $("#note-source");
|
||||||
|
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 500
|
height: 500
|
||||||
@ -15,7 +15,7 @@ const noteSource = (function() {
|
|||||||
|
|
||||||
const noteText = noteEditor.getCurrentNote().detail.content;
|
const noteText = noteEditor.getCurrentNote().detail.content;
|
||||||
|
|
||||||
noteSourceEl.text(formatHtml(noteText));
|
$noteSource.text(formatHtml(noteText));
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatHtml(str) {
|
function formatHtml(str) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const recentChanges = (function() {
|
const recentChanges = (function() {
|
||||||
const dialogEl = $("#recent-changes-dialog");
|
const $dialog = $("#recent-changes-dialog");
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 700
|
height: 700
|
||||||
@ -14,7 +14,7 @@ const recentChanges = (function() {
|
|||||||
|
|
||||||
const result = await server.get('recent-changes/');
|
const result = await server.get('recent-changes/');
|
||||||
|
|
||||||
dialogEl.html('');
|
$dialog.html('');
|
||||||
|
|
||||||
const groupedByDate = groupByDate(result);
|
const groupedByDate = groupByDate(result);
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ const recentChanges = (function() {
|
|||||||
.append(' (').append(revLink).append(')'));
|
.append(' (').append(revLink).append(')'));
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogEl.append(dayEl);
|
$dialog.append(dayEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const recentNotes = (function() {
|
const recentNotes = (function() {
|
||||||
const dialogEl = $("#recent-notes-dialog");
|
const $dialog = $("#recent-notes-dialog");
|
||||||
const searchInputEl = $('#recent-notes-search-input');
|
const $searchInput = $('#recent-notes-search-input');
|
||||||
|
|
||||||
// list of recent note paths
|
// list of recent note paths
|
||||||
let list = [];
|
let list = [];
|
||||||
@ -25,20 +25,20 @@ const recentNotes = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 400
|
height: 400
|
||||||
});
|
});
|
||||||
|
|
||||||
searchInputEl.val('');
|
$searchInput.val('');
|
||||||
|
|
||||||
// remove the current note
|
// remove the current note
|
||||||
const recNotes = list.filter(note => note !== noteTree.getCurrentNotePath());
|
const recNotes = list.filter(note => note !== noteTree.getCurrentNotePath());
|
||||||
|
|
||||||
searchInputEl.autocomplete({
|
$searchInput.autocomplete({
|
||||||
source: recNotes.map(notePath => {
|
source: recNotes.map(notePath => {
|
||||||
const noteTitle = noteTree.getNotePathTitle(notePath);
|
const noteTitle = noteTree.getNotePathTitle(notePath);
|
||||||
|
|
||||||
@ -52,17 +52,17 @@ const recentNotes = (function() {
|
|||||||
select: function (event, ui) {
|
select: function (event, ui) {
|
||||||
noteTree.activateNode(ui.item.value);
|
noteTree.activateNode(ui.item.value);
|
||||||
|
|
||||||
searchInputEl.autocomplete('destroy');
|
$searchInput.autocomplete('destroy');
|
||||||
dialogEl.dialog('close');
|
$dialog.dialog('close');
|
||||||
},
|
},
|
||||||
focus: function (event, ui) {
|
focus: function (event, ui) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
},
|
},
|
||||||
close: function (event, ui) {
|
close: function (event, ui) {
|
||||||
searchInputEl.autocomplete('destroy');
|
$searchInput.autocomplete('destroy');
|
||||||
dialogEl.dialog('close');
|
$dialog.dialog('close');
|
||||||
},
|
},
|
||||||
create: () => searchInputEl.autocomplete("search", ""),
|
create: () => $searchInput.autocomplete("search", ""),
|
||||||
classes: {
|
classes: {
|
||||||
"ui-autocomplete": "recent-notes-autocomplete"
|
"ui-autocomplete": "recent-notes-autocomplete"
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const settings = (function() {
|
const settings = (function() {
|
||||||
const dialogEl = $("#settings-dialog");
|
const $dialog = $("#settings-dialog");
|
||||||
const tabsEl = $("#settings-tabs");
|
const $tabs = $("#settings-tabs");
|
||||||
|
|
||||||
const settingModules = [];
|
const settingModules = [];
|
||||||
|
|
||||||
@ -11,16 +11,16 @@ const settings = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function showDialog() {
|
async function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
const settings = await server.get('settings');
|
const settings = await server.get('settings');
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 900
|
width: 900
|
||||||
});
|
});
|
||||||
|
|
||||||
tabsEl.tabs();
|
$tabs.tabs();
|
||||||
|
|
||||||
for (const module of settingModules) {
|
for (const module of settingModules) {
|
||||||
if (module.settingsLoaded) {
|
if (module.settingsLoaded) {
|
||||||
@ -46,22 +46,22 @@ const settings = (function() {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
settings.addModule((function() {
|
settings.addModule((function() {
|
||||||
const formEl = $("#change-password-form");
|
const $form = $("#change-password-form");
|
||||||
const oldPasswordEl = $("#old-password");
|
const $oldPassword = $("#old-password");
|
||||||
const newPassword1El = $("#new-password1");
|
const $newPassword1 = $("#new-password1");
|
||||||
const newPassword2El = $("#new-password2");
|
const $newPassword2 = $("#new-password2");
|
||||||
|
|
||||||
function settingsLoaded(settings) {
|
function settingsLoaded(settings) {
|
||||||
}
|
}
|
||||||
|
|
||||||
formEl.submit(() => {
|
$form.submit(() => {
|
||||||
const oldPassword = oldPasswordEl.val();
|
const oldPassword = $oldPassword.val();
|
||||||
const newPassword1 = newPassword1El.val();
|
const newPassword1 = $newPassword1.val();
|
||||||
const newPassword2 = newPassword2El.val();
|
const newPassword2 = $newPassword2.val();
|
||||||
|
|
||||||
oldPasswordEl.val('');
|
$oldPassword.val('');
|
||||||
newPassword1El.val('');
|
$newPassword1.val('');
|
||||||
newPassword2El.val('');
|
$newPassword2.val('');
|
||||||
|
|
||||||
if (newPassword1 !== newPassword2) {
|
if (newPassword1 !== newPassword2) {
|
||||||
alert("New passwords are not the same.");
|
alert("New passwords are not the same.");
|
||||||
@ -92,16 +92,16 @@ settings.addModule((function() {
|
|||||||
})());
|
})());
|
||||||
|
|
||||||
settings.addModule((function() {
|
settings.addModule((function() {
|
||||||
const formEl = $("#protected-session-timeout-form");
|
const $form = $("#protected-session-timeout-form");
|
||||||
const protectedSessionTimeoutEl = $("#protected-session-timeout-in-seconds");
|
const $protectedSessionTimeout = $("#protected-session-timeout-in-seconds");
|
||||||
const settingName = 'protected_session_timeout';
|
const settingName = 'protected_session_timeout';
|
||||||
|
|
||||||
function settingsLoaded(settings) {
|
function settingsLoaded(settings) {
|
||||||
protectedSessionTimeoutEl.val(settings[settingName]);
|
$protectedSessionTimeout.val(settings[settingName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
formEl.submit(() => {
|
$form.submit(() => {
|
||||||
const protectedSessionTimeout = protectedSessionTimeoutEl.val();
|
const protectedSessionTimeout = $protectedSessionTimeout.val();
|
||||||
|
|
||||||
settings.saveSettings(settingName, protectedSessionTimeout).then(() => {
|
settings.saveSettings(settingName, protectedSessionTimeout).then(() => {
|
||||||
protected_session.setProtectedSessionTimeout(protectedSessionTimeout);
|
protected_session.setProtectedSessionTimeout(protectedSessionTimeout);
|
||||||
@ -116,16 +116,16 @@ settings.addModule((function() {
|
|||||||
})());
|
})());
|
||||||
|
|
||||||
settings.addModule((function () {
|
settings.addModule((function () {
|
||||||
const formEl = $("#history-snapshot-time-interval-form");
|
const $form = $("#history-snapshot-time-interval-form");
|
||||||
const timeIntervalEl = $("#history-snapshot-time-interval-in-seconds");
|
const $timeInterval = $("#history-snapshot-time-interval-in-seconds");
|
||||||
const settingName = 'history_snapshot_time_interval';
|
const settingName = 'history_snapshot_time_interval';
|
||||||
|
|
||||||
function settingsLoaded(settings) {
|
function settingsLoaded(settings) {
|
||||||
timeIntervalEl.val(settings[settingName]);
|
$timeInterval.val(settings[settingName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
formEl.submit(() => {
|
$form.submit(() => {
|
||||||
settings.saveSettings(settingName, timeIntervalEl.val());
|
settings.saveSettings(settingName, $timeInterval.val());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -136,50 +136,50 @@ settings.addModule((function () {
|
|||||||
})());
|
})());
|
||||||
|
|
||||||
settings.addModule((async function () {
|
settings.addModule((async function () {
|
||||||
const appVersionEl = $("#app-version");
|
const $appVersion = $("#app-version");
|
||||||
const dbVersionEl = $("#db-version");
|
const $dbVersion = $("#db-version");
|
||||||
const buildDateEl = $("#build-date");
|
const $buildDate = $("#build-date");
|
||||||
const buildRevisionEl = $("#build-revision");
|
const $buildRevision = $("#build-revision");
|
||||||
|
|
||||||
const appInfo = await server.get('app-info');
|
const appInfo = await server.get('app-info');
|
||||||
|
|
||||||
appVersionEl.html(appInfo.app_version);
|
$appVersion.html(appInfo.app_version);
|
||||||
dbVersionEl.html(appInfo.db_version);
|
$dbVersion.html(appInfo.db_version);
|
||||||
buildDateEl.html(appInfo.build_date);
|
$buildDate.html(appInfo.build_date);
|
||||||
buildRevisionEl.html(appInfo.build_revision);
|
$buildRevision.html(appInfo.build_revision);
|
||||||
buildRevisionEl.attr('href', 'https://github.com/zadam/trilium/commit/' + appInfo.build_revision);
|
$buildRevision.attr('href', 'https://github.com/zadam/trilium/commit/' + appInfo.build_revision);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
})());
|
})());
|
||||||
|
|
||||||
settings.addModule((async function () {
|
settings.addModule((async function () {
|
||||||
const forceFullSyncButton = $("#force-full-sync-button");
|
const $forceFullSyncButton = $("#force-full-sync-button");
|
||||||
const fillSyncRowsButton = $("#fill-sync-rows-button");
|
const $fillSyncRowsButton = $("#fill-sync-rows-button");
|
||||||
const anonymizeButton = $("#anonymize-button");
|
const $anonymizeButton = $("#anonymize-button");
|
||||||
const cleanupSoftDeletedButton = $("#cleanup-soft-deleted-items-button");
|
const $cleanupSoftDeletedButton = $("#cleanup-soft-deleted-items-button");
|
||||||
const cleanupUnusedImagesButton = $("#cleanup-unused-images-button");
|
const $cleanupUnusedImagesButton = $("#cleanup-unused-images-button");
|
||||||
const vacuumDatabaseButton = $("#vacuum-database-button");
|
const $vacuumDatabaseButton = $("#vacuum-database-button");
|
||||||
|
|
||||||
forceFullSyncButton.click(async () => {
|
$forceFullSyncButton.click(async () => {
|
||||||
await server.post('sync/force-full-sync');
|
await server.post('sync/force-full-sync');
|
||||||
|
|
||||||
showMessage("Full sync triggered");
|
showMessage("Full sync triggered");
|
||||||
});
|
});
|
||||||
|
|
||||||
fillSyncRowsButton.click(async () => {
|
$fillSyncRowsButton.click(async () => {
|
||||||
await server.post('sync/fill-sync-rows');
|
await server.post('sync/fill-sync-rows');
|
||||||
|
|
||||||
showMessage("Sync rows filled successfully");
|
showMessage("Sync rows filled successfully");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
anonymizeButton.click(async () => {
|
$anonymizeButton.click(async () => {
|
||||||
await server.post('anonymization/anonymize');
|
await server.post('anonymization/anonymize');
|
||||||
|
|
||||||
showMessage("Created anonymized database");
|
showMessage("Created anonymized database");
|
||||||
});
|
});
|
||||||
|
|
||||||
cleanupSoftDeletedButton.click(async () => {
|
$cleanupSoftDeletedButton.click(async () => {
|
||||||
if (confirm("Do you really want to clean up soft-deleted items?")) {
|
if (confirm("Do you really want to clean up soft-deleted items?")) {
|
||||||
await server.post('cleanup/cleanup-soft-deleted-items');
|
await server.post('cleanup/cleanup-soft-deleted-items');
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ settings.addModule((async function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cleanupUnusedImagesButton.click(async () => {
|
$cleanupUnusedImagesButton.click(async () => {
|
||||||
if (confirm("Do you really want to clean up unused images?")) {
|
if (confirm("Do you really want to clean up unused images?")) {
|
||||||
await server.post('cleanup/cleanup-unused-images');
|
await server.post('cleanup/cleanup-unused-images');
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ settings.addModule((async function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
vacuumDatabaseButton.click(async () => {
|
$vacuumDatabaseButton.click(async () => {
|
||||||
await server.post('cleanup/vacuum-database');
|
await server.post('cleanup/vacuum-database');
|
||||||
|
|
||||||
showMessage("Database has been vacuumed");
|
showMessage("Database has been vacuumed");
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const sqlConsole = (function() {
|
const sqlConsole = (function() {
|
||||||
const dialogEl = $("#sql-console-dialog");
|
const $dialog = $("#sql-console-dialog");
|
||||||
const queryEl = $('#sql-console-query');
|
const $query = $('#sql-console-query');
|
||||||
const executeButton = $('#sql-console-execute');
|
const $executeButton = $('#sql-console-execute');
|
||||||
const resultHeadEl = $('#sql-console-results thead');
|
const $resultHead = $('#sql-console-results thead');
|
||||||
const resultBodyEl = $('#sql-console-results tbody');
|
const $resultBody = $('#sql-console-results tbody');
|
||||||
|
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
glob.activeDialog = dialogEl;
|
glob.activeDialog = $dialog;
|
||||||
|
|
||||||
dialogEl.dialog({
|
$dialog.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: $(window).width(),
|
width: $(window).width(),
|
||||||
height: $(window).height()
|
height: $(window).height()
|
||||||
@ -18,7 +18,7 @@ const sqlConsole = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function execute() {
|
async function execute() {
|
||||||
const sqlQuery = queryEl.val();
|
const sqlQuery = $query.val();
|
||||||
|
|
||||||
const result = await server.post("sql/execute", {
|
const result = await server.post("sql/execute", {
|
||||||
query: sqlQuery
|
query: sqlQuery
|
||||||
@ -34,8 +34,8 @@ const sqlConsole = (function() {
|
|||||||
|
|
||||||
const rows = result.rows;
|
const rows = result.rows;
|
||||||
|
|
||||||
resultHeadEl.empty();
|
$resultHead.empty();
|
||||||
resultBodyEl.empty();
|
$resultBody.empty();
|
||||||
|
|
||||||
if (rows.length > 0) {
|
if (rows.length > 0) {
|
||||||
const result = rows[0];
|
const result = rows[0];
|
||||||
@ -45,7 +45,7 @@ const sqlConsole = (function() {
|
|||||||
rowEl.append($("<th>").html(key));
|
rowEl.append($("<th>").html(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
resultHeadEl.append(rowEl);
|
$resultHead.append(rowEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const result of rows) {
|
for (const result of rows) {
|
||||||
@ -55,15 +55,15 @@ const sqlConsole = (function() {
|
|||||||
rowEl.append($("<td>").html(result[key]));
|
rowEl.append($("<td>").html(result[key]));
|
||||||
}
|
}
|
||||||
|
|
||||||
resultBodyEl.append(rowEl);
|
$resultBody.append(rowEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).bind('keydown', 'alt+o', showDialog);
|
$(document).bind('keydown', 'alt+o', showDialog);
|
||||||
|
|
||||||
queryEl.bind('keydown', 'ctrl+return', execute);
|
$query.bind('keydown', 'ctrl+return', execute);
|
||||||
|
|
||||||
executeButton.click(execute);
|
$executeButton.click(execute);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
showDialog
|
showDialog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user