Skip to content

Commit

Permalink
Add option to save page content with note
Browse files Browse the repository at this point in the history
 - add option to also save the page content when adding a note
 - additional option to search in the saved content and not only in notes
  • Loading branch information
pavka14 committed Jan 13, 2025
1 parent 9cb54c7 commit d118ebf
Show file tree
Hide file tree
Showing 37 changed files with 163 additions and 5 deletions.
34 changes: 30 additions & 4 deletions js/all-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ function loadAllWebsites(clear = false, sort_by = "name-az", apply_filter = true
type_to_show = all_strings["global-label"];
type_to_use = "global";
}
page = generateNotes(page, urlPageDomain, notes, title, lastUpdate, type_to_show, urlPageDomain, type_to_use, true);
page = generateNotes(page, urlPageDomain, notes, title, "", lastUpdate, type_to_show, urlPageDomain, type_to_use, true);

if (page !== -1) {
all_pages.append(page);
Expand All @@ -545,10 +545,11 @@ function loadAllWebsites(clear = false, sort_by = "name-az", apply_filter = true
// console.log(websites_json_by_domain);
// console.log(websites_json_to_show);
let lastUpdate = websites_json_to_show[urlPageDomain]["last-update"];
let notes = websites_json_to_show[urlPageDomain]["notes"];
let title = websites_json_to_show[urlPageDomain]["title"];
let notes = websites_json_to_show[urlPageDomain]["notes"];
let content = websites_json_to_show[urlPageDomain]["content"] || "";

page = generateNotes(page, urlPage, notes, title, lastUpdate, all_strings["page-label"], urlPageDomain, "page", false);
page = generateNotes(page, urlPage, notes, title, content, lastUpdate, all_strings["page-label"], urlPageDomain, "page", false);

if (page !== -1) {
all_pages.append(page);
Expand Down Expand Up @@ -696,7 +697,7 @@ function sendMessageUpdateToBackground() {
browser.runtime.sendMessage({"updated": true});
}

function generateNotes(page, url, notes, title, lastUpdate, type, fullUrl, type_to_use, domain_again) {
function generateNotes(page, url, notes, title, content, lastUpdate, type, fullUrl, type_to_use, domain_again) {
try {
let row1 = document.createElement("div");
row1.classList.add("rows");
Expand Down Expand Up @@ -855,7 +856,32 @@ function generateNotes(page, url, notes, title, lastUpdate, type, fullUrl, type_
if (row2.classList.contains("hidden")) row2.classList.remove("hidden");
}
row2.append(pageTitleH3);

page.append(row2);

let row3 = document.createElement("div");
let pageContent = document.createElement("div");
pageContent.classList.add("sub-section-title");
pageContent.style.display = "block";

let inputShowContent = document.createElement("input");
inputShowContent.type = "button";
inputShowContent.value = all_strings["show-content-button"];
inputShowContent.classList.add("button", "very-small-button", "sub-section-title", "single-line");
inputShowContent.onclick = function () {
alert(content); // Display the content in an alert for now, until a better UI is implemented.
}

row3.classList.add("hidden");
if (content !== undefined && content !== "") {
if (row3.classList.contains("hidden")) row3.classList.remove("hidden");
}

pageContent.appendChild(inputShowContent);
row3.append(pageContent);

page.append(row3);

let pageNotes = document.createElement("pre");
pageNotes.classList.add("sub-section-notes");

Expand Down
3 changes: 3 additions & 0 deletions js/languages/af-ZA/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'Clear all notes of this domain',
'no-notes-found-text': 'No notes found',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Copy',
'edit-notes-button': 'Edit',
'finish-edit-notes-button': 'Finish edit',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'When enabled you can save notes also per "sub-domains" like: <span class=\'url-small\'>https://example.page/a-page/*</span>, <span class=\'url-small\'> https://example.page/a-page/other-page/*</span>.',
'html-text-formatting': 'Show HTML text-formatting panel in the popup',
'html-text-formatting-detailed': 'When enabled you will see some useful buttons in the bottom of popup to insert text formatting (like bold, italic, etc.) and undo/redo buttons – although you disable this, you will continue to be able to insert text-formatting via keyboard shortcuts.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Disable word-wrap notes text',
'spellcheck-detection': 'Enabled language spellcheck detection for notes',
'check-green-icon-global': 'Green addon icon when there are Global notes saved',
Expand Down
3 changes: 3 additions & 0 deletions js/languages/ar-SA/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'مسح جميع الملاحظات من هذا المجال',
'no-notes-found-text': 'لم يتم العثور على ملاحظات',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Copy',
'edit-notes-button': 'Edit',
'finish-edit-notes-button': 'Finish edit',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'عند التمكين يمكنك حفظ الملاحظات أيضا لكل "نطاقات فرعية" مثل: <span class=\'url-small\'>https://example.page/a-page/*</span>، <span class=\'url-small\'> https://example.page/a-page/other-page/*</span>.',
'html-text-formatting': 'إظهار لوحة تنسيق نص HTML في النافذة المنبثقة',
'html-text-formatting-detailed': 'عند تمكينك سوف ترى بعض الأزرار المفيدة في أسفل النوافذ المنبثقة لإدراج تنسيق النص (مثل الخط الداكن، الخط المائل، إلخ. و أزرار التراجع/إعادة الدو- على الرغم من تعطيل هذا، سوف تستمر في القدرة على إدراج تنسيق النصوص عن طريق اختصارات لوحة المفاتيح.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'تعطيل نص ملاحظات الكلمات',
'spellcheck-detection': 'تمكين الكشف عن تهجئة اللغة للملاحظات',
'check-green-icon-global': 'أيقونة الإدمان الأخضر عندما تكون هناك ملاحظات عالمية محفوظة',
Expand Down
3 changes: 3 additions & 0 deletions js/languages/ca-ES/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'Clear all notes of this domain',
'no-notes-found-text': 'No notes found',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Copy',
'edit-notes-button': 'Edit',
'finish-edit-notes-button': 'Finish edit',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'When enabled you can save notes also per "sub-domains" like: <span class=\'url-small\'>https://example.page/a-page/*</span>, <span class=\'url-small\'> https://example.page/a-page/other-page/*</span>.',
'html-text-formatting': 'Show HTML text-formatting panel in the popup',
'html-text-formatting-detailed': 'When enabled you will see some useful buttons in the bottom of popup to insert text formatting (like bold, italic, etc.) and undo/redo buttons – although you disable this, you will continue to be able to insert text-formatting via keyboard shortcuts.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Disable word-wrap notes text',
'spellcheck-detection': 'Enabled language spellcheck detection for notes',
'check-green-icon-global': 'Green addon icon when there are Global notes saved',
Expand Down
3 changes: 3 additions & 0 deletions js/languages/cs-CZ/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'Vymazat všechny poznámky z této domény',
'no-notes-found-text': 'Nebyly nalezeny žádné poznámky',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Copy',
'edit-notes-button': 'Edit',
'finish-edit-notes-button': 'Finish edit',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'Pokud je povoleno, můžete uložit poznámky také pro "subdomény": <span class=\'url-small\'>https://example.page/a-page/*</span>, <span class=\'url-small\'> https://example.page/a-page/other-page/*</span>.',
'html-text-formatting': 'Zobrazit HTML textové formátování ve vyskakovacím okně',
'html-text-formatting-detailed': 'Pokud je povoleno, uvidíte některá užitečná tlačítka v dolní části vyskakovacího okna pro vložení textového formátování (jako tučný, kurzíva, atd. a vrátit zpět tlačítka - i když toto zakážete, budete moci nadále vkládat textové formátování pomocí klávesových zkratek.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Zakázat text poznámek ke slovu',
'spellcheck-detection': 'Detekce kontroly pravopisu v jazyce pro poznámky',
'check-green-icon-global': 'Zelená ikona doplňku, když jsou uloženy globální poznámky',
Expand Down
3 changes: 3 additions & 0 deletions js/languages/da-DK/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'Ryd alle noter af dette domæne',
'no-notes-found-text': 'Ingen noter fundet',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Copy',
'edit-notes-button': 'Edit',
'finish-edit-notes-button': 'Finish edit',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'Når aktiveret kan du også gemme noter pr. "underdomæner" som: <span class=\'url-small\'>https://example.page/a-page/*</span>, <span class=\'url-small\'> https://example.page/a-page/other-page/*</span>.',
'html-text-formatting': 'Vis HTML tekstformateringspanel i popup',
'html-text-formatting-detailed': 'Når aktiveret vil du se nogle nyttige knapper i bunden af popup for at indsætte tekstformatering (som fed, kursiv osv. og fortryd / redo knapper – selvom du deaktiverer dette, vil du fortsat være i stand til at indsætte tekstformatering via tastaturgenveje.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Deaktiver tekst-wrap noter tekst',
'spellcheck-detection': 'Aktiverede detektering af sprogstavekontrol for noter',
'check-green-icon-global': 'Grøn addon ikon når der er globale noter gemt',
Expand Down
3 changes: 3 additions & 0 deletions js/languages/de-DE/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'Alle Notizen dieser Domain löschen',
'no-notes-found-text': 'Keine Notizen gefunden',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Copy',
'edit-notes-button': 'Edit',
'finish-edit-notes-button': 'Finish edit',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'Wenn aktiviert, können Sie Notizen auch per "Subdomains" wie z.B. <span class=\'url-small\'>https://example.page/a-page/*</span>, <span class=\'url-small\'> https://example.page/a-page/other-page/*</span> speichern.',
'html-text-formatting': 'HTML-Textformatierungsfeld im Popup anzeigen',
'html-text-formatting-detailed': 'Wenn aktiviert, sehen Sie einige nützliche Schaltflächen am unteren Rand des Popups, um Textformatierung (wie fett, kursiv, etc.) einzufügen. und Rückgängig-Knöpfe – obwohl Sie dies deaktivieren, können Sie weiterhin Textformatierung über Tastaturkürzel einfügen.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Text der Wort-Wrap-Notizen deaktivieren',
'spellcheck-detection': 'Sprachrechtschreibprüfung für Notizen aktiviert',
'check-green-icon-global': 'Grünes Addon-Symbol wenn globale Notizen gespeichert sind',
Expand Down
3 changes: 3 additions & 0 deletions js/languages/el-GR/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'Εκκαθάριση όλων των σημειώσεων αυτού του τομέα',
'no-notes-found-text': 'Δεν βρέθηκαν σημειώσεις',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Copy',
'edit-notes-button': 'Edit',
'finish-edit-notes-button': 'Finish edit',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'Όταν ενεργοποιηθεί, μπορείτε να αποθηκεύσετε σημειώσεις και ανά "subdomains" όπως: <span class=\'url-small\'>https://example.page/a-page/*</span>, <span class=\'url-small\'> https://example.page/a-page/other-page/*</span>.',
'html-text-formatting': 'Εμφάνιση πίνακα μορφοποίησης κειμένου HTML στο αναδυόμενο παράθυρο',
'html-text-formatting-detailed': 'Όταν ενεργοποιηθεί, θα δείτε μερικά χρήσιμα κουμπιά στο κάτω μέρος του αναδυόμενου παραθύρου για την εισαγωγή μορφοποίησης κειμένου (όπως τολμηρή, πλάγια, κλπ. και τα κουμπιά αναίρεσης/αναίρεσης – αν και το απενεργοποιήσετε, θα συνεχίσετε να είστε σε θέση να εισάγετε μορφοποίηση κειμένου μέσω συντομεύσεων πληκτρολογίου.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Απενεργοποίηση κειμένου αναδίπλωσης λέξεων',
'spellcheck-detection': 'Ενεργοποιημένος εντοπισμός ορθογραφικού ελέγχου γλώσσας για σημειώσεις',
'check-green-icon-global': 'Πράσινο εικονίδιο πρόσθετου όταν υπάρχουν καθολικές σημειώσεις αποθηκεύονται',
Expand Down
5 changes: 4 additions & 1 deletion js/languages/en-UK/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ strings[lang] = {
"clear-all-notes-of-this-domain-button": "Clear all notes of this domain",
"no-notes-found-text": "No notes found",
"clear-notes-of-this-page-button": "Clear this note",
'show-content-button': 'Show content',
"copy-notes-button": "Copy",
"edit-notes-button": "Edit",
"finish-edit-notes-button": "Finish edit",
Expand Down Expand Up @@ -89,7 +90,9 @@ strings[lang] = {
"advanced-managing-detailed": "When enabled you can save notes also per \"sub-domains\" like: <span class='url-small'>https://example.page/a-page/*</span>, <span class='url-small'> https://example.page/a-page/other-page/*</span>.",
"html-text-formatting": "Show HTML text-formatting panel in the popup",
"html-text-formatting-detailed": "When enabled you will see some useful buttons in the bottom of popup to insert text formatting (like bold, italic, etc.) and undo/redo buttons – although you disable this, you will continue to be able to insert text-formatting via keyboard shortcuts.",
"disable-word-wrap": "Disable word-wrap notes text",
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Disable word-wrap notes text',
"spellcheck-detection": "Enabled language spellcheck detection for notes",
"check-green-icon-global": "Green addon icon when there are Global notes saved",
"check-green-icon-global-detailed": "When enabled the addon icon in the toolbar will be <b>green</b> if you previously saved <b>Global</b> notes.",
Expand Down
3 changes: 3 additions & 0 deletions js/languages/es-ES/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'Borrar todas las notas de este dominio',
'no-notes-found-text': 'No se encontraron notas ',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Copy',
'edit-notes-button': 'Edit',
'finish-edit-notes-button': 'Finish edit',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'Cuando está habilitado, puedes guardar notas también por "sub-dominios" como: <span class=\'url-small\'>https://example.page/a-page/*</span>, <span class=\'url-small\'> https://example.page/a-page/other-page/*</span>.',
'html-text-formatting': 'Mostrar el panel de formato de texto HTML en la ventana emergente',
'html-text-formatting-detailed': 'Cuando esté habilitado, verá algunos botones útiles en la parte inferior de la ventana emergente para insertar formato de texto (como negrita, cursiva, etc. y botones de deshacer/rehacer – aunque lo desactiva, seguirá siendo capaz de insertar el formato de texto mediante atajos de teclado.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Desactivar texto de notas de palabras',
'spellcheck-detection': 'Activar la detección de corrección ortográfica de idioma para notas',
'check-green-icon-global': 'Icono de complemento verde cuando hay notas globales guardadas',
Expand Down
3 changes: 3 additions & 0 deletions js/languages/fi-FI/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ strings[lang] = {
'clear-all-notes-of-this-domain-button': 'Tyhjennä kaikki tämän verkkotunnuksen merkinnät',
'no-notes-found-text': 'Merkintöjä ei löytynyt',
'clear-notes-of-this-page-button': 'Clear this note',
'show-content-button': 'Show content',
'copy-notes-button': 'Kopioi',
'edit-notes-button': 'Muokkaa',
'finish-edit-notes-button': 'Lopeta muokkaus',
Expand Down Expand Up @@ -87,6 +88,8 @@ strings[lang] = {
'advanced-managing-detailed': 'Kun käytössä, voit tallentaa muistiinpanoja myös "sub-domains": <span class=\'url-small\'>https://example.page/a-page/*</span>, <span class=\'url-small\'> https://example.page/a-page/other-page/*</span>.',
'html-text-formatting': 'Näytä HTML-tekstin muotoilupaneeli ponnahdusikkunassa',
'html-text-formatting-detailed': 'Kun käytössä, näet joitakin hyödyllisiä painikkeita popup alareunassa lisätä tekstin muotoilu (kuten lihavoitu, kursiivi, jne. ja kumoa tai kumoa painikkeet – vaikka poistat tämän käytöstä, voit edelleen lisätä tekstimuotoilua näppäimistön pikakuvakkeiden avulla.',
'save-page-content': 'Save page content too',
'search-page-content': 'Search in page content too, if saved',
'disable-word-wrap': 'Poista tekstikenttä käytöstä',
'spellcheck-detection': 'Käytössä kielen oikoluvun tunnistus muistiinpanoja varten',
'check-green-icon-global': 'Vihreä lisäkuvake, kun globaalit merkinnät on tallennettu',
Expand Down
Loading

0 comments on commit d118ebf

Please sign in to comment.