From 713e89eb687b1d835563618005dc47d06b6ccda7 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 30 Jun 2017 16:04:01 +0100 Subject: [PATCH] Updates and more features Former-commit-id: 9f1f09311813203910d5b323ba80712553ee2741 [formerly 0be00be1de305d786affc6bf0886aed9b20fbc51] [formerly 04597463117e94830b24b87faaaccf3d35284427 [formerly 3f2dc3f1c56a7a636a836d36b94c052f55f32d93]] Former-commit-id: 8d26cc1d96faed73c7974ea7e5e78bf268af3ad9 [formerly a083ac8f68c90a636843c3565bd349657c0ec383] Former-commit-id: ef10f3b3c388d65ceac40785b45dbac190a6cc99 --- _assets/_old/js/common_old.js | 119 +++++--------------- _assets/_old/js/listing.js | 56 --------- _assets/index.html | 6 +- _assets/src/App.vue | 89 +++++++++------ _assets/src/components/DeleteButton.vue | 8 +- _assets/src/components/DeletePrompt.vue | 33 +++--- _assets/src/components/DownloadButton.vue | 36 +++--- _assets/src/components/DownloadPrompt.vue | 42 +++++++ _assets/src/components/InfoPrompt.vue | 2 + _assets/src/components/Listing.vue | 16 +-- _assets/src/components/ListingItem.vue | 6 +- _assets/src/components/MovePrompt.vue | 4 +- _assets/src/components/NewDirPrompt.vue | 4 +- _assets/src/components/NewFilePrompt.vue | 4 +- _assets/src/components/Preview.vue | 4 +- _assets/src/components/RenamePrompt.vue | 4 +- _assets/src/components/Search.vue | 4 +- _assets/src/components/SwitchViewButton.vue | 2 +- _assets/src/css/prompts.css | 17 +++ _assets/src/main.js | 8 +- _assets/src/store/getters.js | 3 +- _assets/src/store/mutations.js | 4 +- _assets/src/store/store.js | 3 +- _assets/src/{ => utils}/css.js | 0 _assets/src/{ => utils}/page.js | 2 +- _assets/src/{ => utils}/webdav.js | 0 26 files changed, 217 insertions(+), 259 deletions(-) delete mode 100644 _assets/_old/js/listing.js create mode 100644 _assets/src/components/DownloadPrompt.vue rename _assets/src/{ => utils}/css.js (100%) rename _assets/src/{ => utils}/page.js (96%) rename _assets/src/{ => utils}/webdav.js (100%) diff --git a/_assets/_old/js/common_old.js b/_assets/_old/js/common_old.js index 4473cd7c..a1c9b8e2 100644 --- a/_assets/_old/js/common_old.js +++ b/_assets/_old/js/common_old.js @@ -1,24 +1,3 @@ -'use strict' - -var tempID = '_fm_internal_temporary_id' - -var templates = {} -var selectedItems = [] -var overlay -var clickOverlay - -// Sends a costum event to itself -Document.prototype.sendCostumEvent = function (text) { - this.dispatchEvent(new window.CustomEvent(text)) -} - - - -/* * * * * * * * * * * * * * * * - * * - * BUTTONS * - * * - * * * * * * * * * * * * * * * */ var buttons = { previousState: {} } @@ -70,77 +49,31 @@ buttons.setDone = function (name, success = true) { return false } -/* * * * * * * * * * * * * * * * - * * - * EVENTS * - * * - * * * * * * * * * * * * * * * */ - -function notImplemented (event) { - event.preventDefault() - clickOverlay.click() - - let clone = document.importNode(templates.message.content, true) - clone.querySelector('h3').innerHTML = 'Not implemented' - clone.querySelector('p').innerHTML = "Sorry, but this feature wasn't implemented yet." - - document.querySelector('body').appendChild(clone) - document.querySelector('.overlay').classList.add('active') - document.querySelector('.prompt').classList.add('active') -} - -// Prevent Default event -var preventDefault = function (event) { - event.preventDefault() -} - -function logoutEvent (event) { - let request = new window.XMLHttpRequest() - request.open('GET', window.location.pathname, true, 'data.username', 'password') - request.send() - request.onreadystatechange = function () { - if (request.readyState === 4) { - window.location = '/' - } +listing.addDoubleTapEvent = function () { + let items = document.getElementsByClassName('item'), + touches = { + id: '', + count: 0 } + + Array.from(items).forEach(file => { + file.addEventListener('touchstart', event => { + if (touches.id != file.id) { + touches.id = file.id + touches.count = 1 + + setTimeout(() => { + touches.count = 0 + }, 300) + + return + } + + touches.count++ + + if (touches.count > 1) { + window.location = file.dataset.url + } + }) + }) } - -/* * * * * * * * * * * * * * * * - * * - * BOOTSTRAP * - * * - * * * * * * * * * * * * * * * */ - -document.addEventListener('DOMContentLoaded', function (event) { - - - let dropdownButtons = document.querySelectorAll('.action[data-dropdown]') - Array.from(dropdownButtons).forEach(button => { - button.addEventListener('click', event => { - button.querySelector('ul').classList.toggle('active') - clickOverlay.classList.add('active') - - clickOverlay.addEventListener('click', event => { - button.querySelector('ul').classList.remove('active') - clickOverlay.classList.remove('active') - }) - }) - }) - - let mainActions = document.getElementById('main-actions') - - document.getElementById('more').addEventListener('click', event => { - event.preventDefault() - event.stopPropagation() - - clickOverlay.classList.add('active') - mainActions.classList.add('active') - - clickOverlay.addEventListener('click', event => { - mainActions.classList.remove('active') - clickOverlay.classList.remove('active') - }) - }) - - return false -}) diff --git a/_assets/_old/js/listing.js b/_assets/_old/js/listing.js deleted file mode 100644 index 85bbbdbe..00000000 --- a/_assets/_old/js/listing.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict' - -listing.redefineDownloadURLs = function () { - let files = '' - - for (let i = 0; i < selectedItems.length; i++) { - let url = document.getElementById(selectedItems[i]).dataset.url - files += url.replace(window.location.pathname, '') + ',' - } - - files = files.substring(0, files.length - 1) - files = encodeURIComponent(files) - - let links = document.querySelectorAll('#download ul a') - Array.from(links).forEach(link => { - link.href = '?download=' + link.dataset.format + '&files=' + files - }) -} - -listing.addDoubleTapEvent = function () { - let items = document.getElementsByClassName('item'), - touches = { - id: '', - count: 0 - } - - Array.from(items).forEach(file => { - file.addEventListener('touchstart', event => { - if (touches.id != file.id) { - touches.id = file.id - touches.count = 1 - - setTimeout(() => { - touches.count = 0 - }, 300) - - return - } - - touches.count++ - - if (touches.count > 1) { - window.location = file.dataset.url - } - }) - }) -} - - -document.addEventListener('DOMContentLoaded', event => { - listing.addDoubleTapEvent() - - if (user.AllowNew) { - buttons.new.addEventListener('click', listing.newFileButton) - } -}) diff --git a/_assets/index.html b/_assets/index.html index 6c540a9f..69b8c6c2 100644 --- a/_assets/index.html +++ b/_assets/index.html @@ -36,7 +36,7 @@ background: #fff; z-index: 9999; transition: .1s ease opacity; - -webkit-transition: .5s ease opacity; + -webkit-transition: .1s ease opacity; } #loading.done { @@ -79,10 +79,10 @@ } @keyframes sk-bouncedelay { - 0%, 80%, 100% { + 0%, 80%, 100% { -webkit-transform: scale(0); transform: scale(0); - } 40% { + } 40% { -webkit-transform: scale(1.0); transform: scale(1.0); } diff --git a/_assets/src/App.vue b/_assets/src/App.vue index 12280787..d6daa580 100644 --- a/_assets/src/App.vue +++ b/_assets/src/App.vue @@ -1,5 +1,5 @@