You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
1.6 KiB
83 lines
1.6 KiB
|
|
function allowDrop(ev) {
|
|
ev.preventDefault();
|
|
}
|
|
|
|
function drag(ev) {
|
|
ev.dataTransfer.setData("ID", ev.target.id)
|
|
$('.drop-action').addClass('drop-inactive')
|
|
$('.droppable').removeClass('drop-inactive').addClass('drop-active')
|
|
}
|
|
|
|
function drop(ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
const target = $(ev.currentTarget)
|
|
const overlay = $('#dropConfirm')
|
|
const loading = $('#dropLoading')
|
|
const discard = overlay.find('.discard')
|
|
const confirm = overlay.find('.confirm')
|
|
const data = ev.dataTransfer.getData("ID")
|
|
|
|
let once = true
|
|
|
|
|
|
|
|
overlay.fadeIn()
|
|
|
|
discard.on('click',()=>{
|
|
if(once){
|
|
overlay.fadeOut()
|
|
once = false
|
|
}
|
|
})
|
|
|
|
confirm.on('click', ()=>{
|
|
|
|
const module = $('#'+data)
|
|
|
|
if(once){
|
|
|
|
loading.find('.text').text('Analisi di compatibilità del modulo in corso ...')
|
|
overlay.fadeOut()
|
|
loading.fadeIn()
|
|
timeout_trigger()
|
|
|
|
if(target.find('.modules-container').length){
|
|
target.find('.modules-container').append('<div class="div-drag">'+module.text()+'</div>')
|
|
}else{
|
|
$('.modules-container').append('<div class="div-drag">'+module.text()+'</div>')
|
|
}
|
|
|
|
setTimeout(()=>{
|
|
|
|
loading.fadeOut()
|
|
window.location = 'compatibility'
|
|
},6800)
|
|
once = false
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
function dragLeave(ev) {
|
|
$('.drop-action').removeClass('drop-inactive')
|
|
$('.droppable').removeClass('drop-active')
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).ready(()=>{
|
|
|
|
$(document).keypress((event)=> {
|
|
if(event.which == 32){
|
|
window.location = 'compatibility'
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
|