NMAPDEV plugin work v0.5 #645 🆕🔎

This commit is contained in:
jokob-sk
2024-04-24 23:19:23 +10:00
parent c7cb69c914
commit 141ba5d6c1
7 changed files with 151 additions and 51 deletions

View File

@@ -366,6 +366,28 @@ function showModalInput (title, message, btnCancel=getString('Gen_Cancel'), btnO
$('#modal-input').modal('show');
}
// -----------------------------------------------------------------------------
function showModalFieldInput (title, message, btnCancel=getString('Gen_Cancel'), btnOK=getString('Gen_Okay'), curValue="", callbackFunction=null) {
// set captions
prefix = 'modal-field-input'
$(`#${prefix}-title`).html (title);
$(`#${prefix}-message`).html (message);
$(`#${prefix}-cancel`).html (btnCancel);
$(`#${prefix}-OK`).html (btnOK);
if ( callbackFunction != null)
{
modalCallbackFunction = callbackFunction;
}
$(`#modal-field-input-field`).val(curValue)
// Show modal
$(`#${prefix}`).modal('show');
}
// -----------------------------------------------------------------------------
function modalDefaultOK () {
// Hide modal

View File

@@ -185,11 +185,42 @@
// -------------------------------------------------------------------
// Function to initialize remove functionality on select options
function initRemoveBtnOptn(selectorId) {
let isDoubleClick = false;
function initListInteractionOptions(selectorId) {
$(`#${selectorId} option`).addClass('interactable-option')
// Attach double-click event listeners to "Remove"
$(`#${selectorId} option`).addClass('removable-option').on('dblclick', function() {
const $option = $(this);
removeOptionItem($option);
$(`#${selectorId} option`).on('dblclick', function() {
isDoubleClick = true;
const $option = $(this);
removeOptionItem($option);
});
$(`#${selectorId} option`).on('click', function() {
const $option = $(this);
// Reset the flag after a short delay
setTimeout(() => {
console.log(isDoubleClick);
if (!isDoubleClick) {
// Single-click action
showModalFieldInput (
`<i class="fa fa-square-plus pointer"></i> ${getString('DevDetail_button_AddIcon')}`,
getString('DevDetail_button_AddIcon_Help'),
getString('Gen_Cancel'),
getString('Gen_Okay'),
$option.html(),
function() {
alert('aaa');
});
isDoubleClick = false;
}
}, 300); // Adjust this delay as needed
});
}
@@ -198,3 +229,9 @@ function initRemoveBtnOptn(selectorId) {