Notes: added stroked zero button

This commit is contained in:
Szymon Porwolik
2025-10-09 20:26:23 +02:00
parent e237f98b73
commit db19642294
2 changed files with 29 additions and 1 deletions

View File

@@ -24,7 +24,7 @@
<button type="button" class="btn btn-sm btn-outline-secondary btn-light category-btn active" data-category="__all__">
<?= __("All Categories"); ?> <span class="badge bg-secondary"><?= $all_notes_count ?></span>
</button>
<?php
<?php
// Decode HTML entities for proper display
$decoded_categories = array();
foreach ($categories as $key => $value) {
@@ -51,6 +51,9 @@
<!-- Search box and reset button -->
<div class="input-group">
<input type="text" id="notesSearchBox" class="form-control form-control-sm" maxlength="50" placeholder="<?= __("Search notes (min. 3 chars)") ?>">
<button class="btn btn-outline-secondary btn-sm btn-light" id="notesAddStrokedZero" type="button" title="<?= __("Add stroked zero (Ø)") ?>" data-bs-toggle="tooltip">
Ø
</button>
<button class="btn btn-outline-secondary btn-sm btn-light" id="notesSearchReset" type="button" title="<?= __("Reset search") ?>">
<i class="fa fa-times"></i>
</button>

View File

@@ -575,4 +575,29 @@ document.addEventListener('DOMContentLoaded', function() {
if (domCache.notesTableBody) {
performNotesSearch();
}
// Add stroked zero (Ø) to search box
var addStrokedZeroBtn = document.getElementById('notesAddStrokedZero');
if (addStrokedZeroBtn) {
addStrokedZeroBtn.addEventListener('click', function() {
var searchBox = domCache.searchBox;
if (searchBox) {
var currentValue = searchBox.value;
var cursorPos = searchBox.selectionStart;
// Insert Ø at cursor position
var newValue = currentValue.slice(0, cursorPos) + 'Ø' + currentValue.slice(cursorPos);
searchBox.value = newValue;
// Set cursor position after the inserted character
searchBox.focus();
searchBox.setSelectionRange(cursorPos + 1, cursorPos + 1);
// Trigger search if minimum length is met
if (newValue.length >= SEARCH_MIN_LENGTH) {
performNotesSearch();
}
}
});
}
});