From db42c28255fc1c86f1f517bde3bf46cf0ad69552 Mon Sep 17 00:00:00 2001 From: Carmine De Rosa Date: Sun, 21 Jan 2018 18:03:05 +0100 Subject: [PATCH] generalization --- css/styles.css | 70 +++++++++--------- header.php | 2 +- index.php | 9 +++ js/compatibility.js | 17 ++++- js/modules.js | 61 +++++++++++++++ js/plans.js | 1 + js/scripts.js | 62 ---------------- modules.php | 12 +-- plans.php | 1 + scripts/compatibility.php | 2 + scripts/modules.php | 1 + .../global.scssc | Bin 18319 -> 26686 bytes .../modules.scssc | Bin 59847 -> 51180 bytes .../sections.scssc | Bin 759 -> 858 bytes scss/global.scss | 36 +++++++++ scss/sections/modules.scss | 33 --------- scss/sections/plans.scss | 1 + scss/sections/sections.scss | 1 + 18 files changed, 166 insertions(+), 143 deletions(-) create mode 100644 js/modules.js create mode 100644 js/plans.js create mode 100644 plans.php create mode 100644 scss/sections/plans.scss diff --git a/css/styles.css b/css/styles.css index 78037a1..1bd2dbe 100644 --- a/css/styles.css +++ b/css/styles.css @@ -14574,6 +14574,41 @@ a:hover { padding: 10px; } +/* line 102, global.scss */ +#dropLoading { + display: none; + position: fixed; + left: 0; + top: 50px; + height: calc(100vh - 50px); + width: 100%; + background: rgba(0, 0, 0, 0.8); + overflow: hidden; +} +/* line 111, global.scss */ +#dropLoading #animation_container { + position: absolute; + height: 300px; + width: 300px; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} +/* line 120, global.scss */ +#dropLoading #countdown { + position: fixed; + height: 30px; + line-height: 30px; + width: 50px; + z-index: 9999; + top: calc(50% + 30px); + left: 50%; + transform: translate(-50%, -50%); + text-align: center; + font-size: 1.125rem; + color: white; +} + /* line 3, forms.scss */ input, button { border: none; @@ -14925,41 +14960,6 @@ header .container .row .menu ul li.active a:hover, header .container .row .menu font-weight: 700; } -/* line 239, sections/modules.scss */ -#dropLoading { - display: none; - position: fixed; - left: 0; - top: 50px; - height: calc(100vh - 50px); - width: 100%; - background: rgba(0, 0, 0, 0.8); - overflow: hidden; -} -/* line 248, sections/modules.scss */ -#dropLoading #animation_container { - position: absolute; - height: 300px; - width: 300px; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); -} -/* line 257, sections/modules.scss */ -#dropLoading #countdown { - position: fixed; - height: 30px; - line-height: 30px; - width: 50px; - z-index: 9999; - top: calc(50% + 30px); - left: 50%; - transform: translate(-50%, -50%); - text-align: center; - font-size: 1.125rem; - color: white; -} - /* line 2, sections/compatibility.scss */ .compatibility { min-height: calc(100vh - 50px); diff --git a/header.php b/header.php index bfaf234..62a4e66 100644 --- a/header.php +++ b/header.php @@ -10,7 +10,7 @@
  • ">Risultati
  • ">Piani attivi
  • ">Report
  • -
  • ">Moduli disponibili
  • +
  • ">Moduli disponibili
  • diff --git a/index.php b/index.php index e989ba4..bb4a3c8 100644 --- a/index.php +++ b/index.php @@ -45,6 +45,15 @@ + +
    +
    + +
    +
    +
    +
    + diff --git a/js/compatibility.js b/js/compatibility.js index c398966..c94c18b 100644 --- a/js/compatibility.js +++ b/js/compatibility.js @@ -4,15 +4,28 @@ $(document).ready(()=>{ const compatibility = $('.compatibility') const sheets = compatibility.find('.sheet-container') const values = sheets.find('.value') + const confirm = compatibility.find('.button.confirm') + const loading = $('#dropLoading') values.each((index,elem)=>{ const el = $(elem) const percent = el.find('.percent') const value = percent.data('percent')+'%' - - console.log(percent) + percent.animate({'width': value},500) }) + confirm.on('click', ()=>{ + + loadingInit() + loading.fadeIn() + setTimeout(()=>{ + loading.fadeOut(()=>{ + window.location='/plans' + }) + },7000) + + }) + }) diff --git a/js/modules.js b/js/modules.js new file mode 100644 index 0000000..35fcf40 --- /dev/null +++ b/js/modules.js @@ -0,0 +1,61 @@ + +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).find('.modules-container') + 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', ()=>{ + + if(once){ + loadingInit() + overlay.fadeOut() + loading.fadeIn() + + setTimeout(()=>{ + const module = $('#'+data) + loading.fadeOut() + target.append('
    '+module.text()+'
    ') + },7000) + once = false + } + + }) + +} + +function dragLeave(ev) { + $('.drop-action').removeClass('drop-inactive') + $('.droppable').removeClass('drop-active') +} + + + + + diff --git a/js/plans.js b/js/plans.js new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/js/plans.js @@ -0,0 +1 @@ + diff --git a/js/scripts.js b/js/scripts.js index 8d95e13..8b13789 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -1,63 +1 @@ -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).find('.modules-container') - 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 - - console.log('TARGET1:',target) - - overlay.fadeIn() - - discard.on('click',()=>{ - if(once){ - overlay.fadeOut() - once = false - } - }) - - confirm.on('click', ()=>{ - - if(once){ - loadingInit() - overlay.fadeOut() - loading.fadeIn() - - setTimeout(()=>{ - const module = $('#'+data) - loading.fadeOut() - target.append('
    '+module.text()+'
    ') - },7000) - once = false - } - - }) - -} - -function dragLeave(ev) { - $('.drop-action').removeClass('drop-inactive') - $('.droppable').removeClass('drop-active') -} - - - - - diff --git a/modules.php b/modules.php index bd89e8b..3ca7e49 100644 --- a/modules.php +++ b/modules.php @@ -1,6 +1,6 @@ -
    +
    -