Unsorted & Copy

main
Satur@it-depot.ru 2025-03-06 12:43:35 +03:00
parent 62acaac983
commit 2f9cb3132a
1 changed files with 24 additions and 1 deletions

View File

@ -26,8 +26,10 @@
.protocol-icon { margin-right: 5px; height: 16px; width: 16px; vertical-align: middle; } .protocol-icon { margin-right: 5px; height: 16px; width: 16px; vertical-align: middle; }
.connection-link { color: blue; text-decoration: underline; cursor: pointer; } .connection-link { color: blue; text-decoration: underline; cursor: pointer; }
.edit-button { display: none; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); background: #007bff; color: white; border: none; padding: 2px 5px; border-radius: 3px; cursor: pointer; } .edit-button { display: none; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); background: #007bff; color: white; border: none; padding: 2px 5px; border-radius: 3px; cursor: pointer; }
.edit-button:hover { background: #0056b3; } .copy-button { display: none; position: absolute; right: 25px; top: 50%; transform: translateY(-50%); background: #28a745; color: white; border: none; padding: 2px 5px; border-radius: 3px; cursor: pointer; }
.copy-button:hover { background: #218838; }
.install-item:hover .edit-button { display: inline-block; } .install-item:hover .edit-button { display: inline-block; }
.install-item:hover .copy-button { display: inline-block; }
.action-buttons { display: none; } .action-buttons { display: none; }
.install-item:hover .action-buttons { display: inline; } .install-item:hover .action-buttons { display: inline; }
#import-form { margin-top: 5px; } #import-form { margin-top: 5px; }
@ -162,6 +164,16 @@
parent: folder.parent_id ? folder.parent_id : "root" parent: folder.parent_id ? folder.parent_id : "root"
}))); })));
cb(treeData); cb(treeData);
// Автоматически выбираем папку "Несортированные" после загрузки дерева
const unsortedFolder = data.find(f => f.name === 'Несортированные');
if (unsortedFolder) {
setTimeout(() => {
$('#folder-tree').jstree('select_node', unsortedFolder.id);
loadInstalls(unsortedFolder.id);
updateFolderActions();
}, 100); // Задержка для инициализации jstree
}
}); });
}, },
'check_callback': true 'check_callback': true
@ -261,6 +273,7 @@
<div style="flex: 1; text-align: center; position: relative;"> <div style="flex: 1; text-align: center; position: relative;">
<span class="protocol-icon">${protocolIcons[item.protocol]}</span> <span class="protocol-icon">${protocolIcons[item.protocol]}</span>
<a href="${protocolLinks[item.protocol]}${item.rust_id}" class="connection-link" onclick="selectInstall(${item.id}, '${item.rust_id}', '${item.protocol}'); return false;">${item.rust_id}</a> <a href="${protocolLinks[item.protocol]}${item.rust_id}" class="connection-link" onclick="selectInstall(${item.id}, '${item.rust_id}', '${item.protocol}'); return false;">${item.rust_id}</a>
<button class="copy-button" onclick="copyToClipboard('${item.rust_id}')">📋</button>
<button class="edit-button" onclick="editField(${item.id}, 'rust_id', '${item.rust_id}')">✏️</button> <button class="edit-button" onclick="editField(${item.id}, 'rust_id', '${item.rust_id}')">✏️</button>
</div> </div>
<div style="flex: 1; text-align: center; position: relative;"> <div style="flex: 1; text-align: center; position: relative;">
@ -619,6 +632,16 @@
textarea[0].selectionEnd = start + newText.length - (selected ? 0 : '[текст]'.length); textarea[0].selectionEnd = start + newText.length - (selected ? 0 : '[текст]'.length);
} }
} }
// Функция для копирования в буфер обмена
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(() => {
alert('ID скопирован в буфер обмена: ' + text);
}).catch(err => {
console.error('Ошибка копирования: ', err);
alert('Не удалось скопировать ID');
});
}
</script> </script>
</body> </body>
</html> </html>