Multi-platform: support multiple files per version #201
@ -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,6 +116,14 @@
|
||||
btnInstallAction.classList.add('show');
|
||||
});
|
||||
|
||||
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');
|
||||
|
||||
// Get data install URL
|
||||
const btnInstallUrl = item.getAttribute('data-install-url');
|
||||
|
||||
// Drag btnInstallUrl
|
||||
btnInstallDrag.addEventListener('dragstart', function(e) {
|
||||
// Set data install URL to be transferred during drag
|
||||
@ -131,6 +138,7 @@
|
||||
// Set drag area inactive
|
||||
btnInstallDragGroup.classList.remove('opacity-50');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
init();
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user