From d4a43db187d7fb9a2eed650abb89f0011842f93a Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sat, 1 Jul 2017 09:38:31 +0100 Subject: [PATCH] Stop using window.info on webdav Former-commit-id: 525f0503cb8f56cdf3e8934513b96077d6c2aefb [formerly f6830f5bc3395b8dc8f2d9c0dced5e7c4a463c13] [formerly abf948f3c3fc7beee3ead5582313583af8e8f779 [formerly 01c78d2b3633a7e430a8384238841ee39a939357]] Former-commit-id: 531573bbd76b66d9f72cfb7288e2077fa05a7b39 [formerly 5e5758c2f5a151da2ebcd1df304ae009a03c7904] Former-commit-id: a3a6af9297b489ebd162f89362729e5f952e7900 --- _assets/src/mixins/buttons.js | 50 ----------------------------------- _assets/src/utils/webdav.js | 9 +++---- 2 files changed, 4 insertions(+), 55 deletions(-) delete mode 100644 _assets/src/mixins/buttons.js diff --git a/_assets/src/mixins/buttons.js b/_assets/src/mixins/buttons.js deleted file mode 100644 index 57a4c57c..00000000 --- a/_assets/src/mixins/buttons.js +++ /dev/null @@ -1,50 +0,0 @@ -export default { - data: function () { - return { - buttonState: '' - } - }, - methods: { - setLoading: function () { - let i = this.$el.querySelector('i') - i.style.opacity = 0 - - this.buttonState = i.innerHTML - - setTimeout(() => { - i.classList.add('spin') - i.innerHTML = 'autorenew' - i.style.opacity = 1 - }, 200) - }, - setDone: function (success = true) { - let i = this.$el.querySelector('i') - i.style.opacity = 0 - - let thirdStep = () => { - i.innerHTML = this.buttonState - i.style.opacity = null - } - - let secondStep = () => { - i.style.opacity = 0 - setTimeout(thirdStep, 200) - } - - let firstStep = () => { - i.classList.remove('spin') - i.innerHTML = success - ? 'done' - : 'close' - i.style.opacity = 1 - setTimeout(secondStep, 1000) - } - - setTimeout(firstStep, 200) - } - } -} -/* // third step ? -if (selectedItems.length === 0 && document.getElementById('listing')) { - document.sendCostumEvent('changed-selected') -} */ diff --git a/_assets/src/utils/webdav.js b/_assets/src/utils/webdav.js index 7bab3812..842c962c 100644 --- a/_assets/src/utils/webdav.js +++ b/_assets/src/utils/webdav.js @@ -1,8 +1,7 @@ -// TODO: use store -var $ = window.info +import store from '../store/store' function convertURL (url) { - return window.location.origin + url.replace($.baseURL + '/', $.webdavURL + '/') + return window.location.origin + url.replace(store.state.baseURL + '/', store.state.webDavURL + '/') } function move (oldLink, newLink) { @@ -10,8 +9,8 @@ function move (oldLink, newLink) { let request = new window.XMLHttpRequest() oldLink = convertURL(oldLink) - newLink = newLink.replace($.baseURL + '/', $.webdavURL + '/') - newLink = window.location.origin + newLink.substring($.baseURL.length) + newLink = newLink.replace(store.state.baseURL + '/', store.state.webDavURL + '/') + newLink = window.location.origin + newLink.substring(store.state.baseURL.length) request.open('MOVE', oldLink, true) request.setRequestHeader('Destination', newLink)