Multi-platform: support multiple files per version #201

Merged
Oleg-Komarov merged 43 commits from multi-os into main 2024-07-09 16:27:46 +02:00
2 changed files with 27 additions and 19 deletions
Showing only changes of commit 50a9ec7be5 - Show all commits

View File

@ -95,20 +95,19 @@
// Create function copyInstallUrl
function copyInstallUrl() {
function init() {
// Create variables
// Create variables single
const btnInstall = document.querySelector('.js-btn-install');
const btnInstallAction = document.querySelector('.js-btn-install-action');
const btnInstallGroup = document.querySelector('.js-btn-install-group');
const btnInstallDrag = document.querySelector('.js-btn-install-drag');
const btnInstallDragGroup = document.querySelector('.js-btn-install-drag-group');
// Create variables multiple
const btnInstallActionItem = document.querySelectorAll('.js-btn-install-action-item');
if (btnInstall == null) {
return;
}
// Get data install URL
const btnInstallUrl = btnInstall.getAttribute('data-install-url');
// Show btnInstallAction
btnInstall.addEventListener('click', function() {
// Hide btnInstallGroup
btnInstallGroup.classList.add('d-none');
@ -117,19 +116,28 @@
btnInstallAction.classList.add('show');
});
// Drag btnInstallUrl
btnInstallDrag.addEventListener('dragstart', function(e) {
// Set data install URL to be transferred during drag
e.dataTransfer.setData('text/plain', btnInstallUrl);
btnInstallActionItem.forEach(function(item) {
// Create variables in function scope
const btnInstallDrag = item.querySelector('.js-btn-install-drag');
const btnInstallDragGroup = item.querySelectorAll('.js-btn-install-drag-group');
// Set drag area active
btnInstallDragGroup.classList.add('opacity-50');
});
// Get data install URL
const btnInstallUrl = item.getAttribute('data-install-url');
// Undrag btnInstallUrl
btnInstallDrag.addEventListener('dragend', function() {
// Set drag area inactive
btnInstallDragGroup.classList.remove('opacity-50');
// Drag btnInstallUrl
btnInstallDrag.addEventListener('dragstart', function(e) {
// Set data install URL to be transferred during drag
e.dataTransfer.setData('text/plain', btnInstallUrl);
// Set drag area active
btnInstallDragGroup.classList.add('opacity-50');
});
// Undrag btnInstallUrl
btnInstallDrag.addEventListener('dragend', function() {
// Set drag area inactive
btnInstallDragGroup.classList.remove('opacity-50');
});
});
}

View File

@ -266,13 +266,13 @@
{% if extension.is_approved %}
{% with download_list=latest.get_download_list %}
<div class="btn-group js-btn-install-group">
<button class="btn btn-flex btn-accent js-btn-install" data-install-url="{{ request.scheme }}://{{ request.get_host }}{{ download_list.0.url }}">
<button class="btn btn-flex btn-accent js-btn-install">
<span>{% trans 'Get' %} {{ extension.get_type_display }}</span>
</button>
</div>
<div class="fade js-btn-install-action">
{% for download_item in download_list %}
<div class="btn-install-action-item">
<div class="btn-install-action-item js-btn-install-action-item" data-install-url="{{ request.scheme }}://{{ request.get_host }}{{ download_item.url }}" download="{{ download_item.name }}">
<div class="btn-install-drag-group js-btn-install-drag-group mb-2 rounded">
<button class="btn btn-flex btn-primary btn-install-drag cursor-move js-btn-install-drag w-100" draggable="true">
<i class="i-move"></i>