From 1dac356776eae2ace1bc3bb9756a042348a874d7 Mon Sep 17 00:00:00 2001 From: Muah Date: Wed, 11 Oct 2017 12:28:56 +0200 Subject: [PATCH] v1.3.4 --- logs/v1.3.3.txt | 7 - logs/v1.3.4.txt | 3 + .../assets/js/components/media-bulma.vue | 191 ++++++++++-------- .../js/components/mixins/methods/utils.js | 8 +- .../assets/js/components/mixins/watch.js | 1 + src/resources/assets/sass/shared/manager.scss | 8 +- src/resources/views/media-bulma.blade.php | 12 +- 7 files changed, 118 insertions(+), 112 deletions(-) delete mode 100644 logs/v1.3.3.txt create mode 100644 logs/v1.3.4.txt diff --git a/logs/v1.3.3.txt b/logs/v1.3.3.txt deleted file mode 100644 index 9505b18..0000000 --- a/logs/v1.3.3.txt +++ /dev/null @@ -1,7 +0,0 @@ -- add media autoplay -- fix issue for bulk select and search -- some changes to assets structure -- better ux for pdf -- change views folder structure -- cleanup shownotif -- update readme \ No newline at end of file diff --git a/logs/v1.3.4.txt b/logs/v1.3.4.txt new file mode 100644 index 0000000..3b8830e --- /dev/null +++ b/logs/v1.3.4.txt @@ -0,0 +1,3 @@ +- fix pressing enter not working correctly because “selectedFile” is not cleared after last dir +- more optimization for keyboard events so now it fires only when needed. +- you can now use “left/right/home/end” when image lightBox is active \ No newline at end of file diff --git a/src/resources/assets/js/components/media-bulma.vue b/src/resources/assets/js/components/media-bulma.vue index 160dd79..53743d2 100644 --- a/src/resources/assets/js/components/media-bulma.vue +++ b/src/resources/assets/js/components/media-bulma.vue @@ -85,6 +85,44 @@ export default { } }, methods: { + navigation(e, curSelectedIndex) { + e.preventDefault() + + let cur = '' + let newSelected = '' + + // go to prev image + if ((keycode(e) == 'left' || keycode(e) == 'up') && curSelectedIndex !== 0) { + newSelected = curSelectedIndex - 1 + cur = $('div[data-index="' + newSelected + '"]') + this.scrollToFile(cur) + } + + // go to next image + if ((keycode(e) == 'right' || keycode(e) == 'down') && curSelectedIndex < this.allItemsCount - 1) { + newSelected = curSelectedIndex + 1 + cur = $('div[data-index="' + newSelected + '"]') + this.scrollToFile(cur) + } + + // go to last item + if (keycode(e) == 'end') { + newSelected = this.allItemsCount - 1 + cur = $('div[data-index="' + newSelected + '"]') + this.scrollToFile(cur) + } + + // go to first item + if (keycode(e) == 'home') { + this.scrollToFile() + } + + if (!this.selectedFileIs('image')) { + this.noScroll() + } + }, + + // init initManager() { let manager = this @@ -129,78 +167,42 @@ export default { let curSelected = $('#files li .selected') let curSelectedIndex = parseInt(curSelected.data('index')) + let newSelected = '' // when modal isnt visible if (!$('.modal').hasClass('is-active')) { // when search is not focused if (!$('.input').is(':focus')) { - // lightbox is not active - if (!this.lightBoxIsActive()) { - // when no bulk selecting - if (!this.isBulkSelecting()) { - - let cur = '' - let newSelected = '' - let index = '' - - if ((keycode(e) == 'left' || keycode(e) == 'up') && curSelectedIndex !== 0) { - e.preventDefault() - - newSelected = curSelectedIndex - 1 - cur = $('div[data-index="' + newSelected + '"]') - this.scrollToFile(cur) - } - - if ((keycode(e) == 'right' || keycode(e) == 'down') && curSelectedIndex < this.allItemsCount - 1) { - e.preventDefault() - - newSelected = curSelectedIndex + 1 - cur = $('div[data-index="' + newSelected + '"]') - this.scrollToFile(cur) - } + // when no bulk selecting + if (!this.isBulkSelecting()) { - // open folder - if (keycode(e) == 'enter') { - this.openFolder(this.selectedFile) - } - - // go up a dir - if (keycode(e) == 'backspace') { - index = parseInt(this.folders.length) - 1 + // open folder + if (keycode(e) == 'enter' && this.selectedFile) { + this.openFolder(this.selectedFile) + } - if (index < 0) { - return false - } + // go up a dir + if (keycode(e) == 'backspace' && this.folders.length) { + newSelected = parseInt(this.folders.length) - 1 - this.goToFolder(index) + if (newSelected < 0) { + return false } - // go to first / last item - if (this.allItemsCount) { - if (keycode(e) == 'home') { - e.preventDefault() - - this.scrollToFile() - } - - if (keycode(e) == 'end') { - e.preventDefault() - - index = this.allItemsCount - 1 - cur = $('div[data-index="' + index + '"]') - this.scrollToFile(cur) - } - } + this.goToFolder(newSelected) + } - // file upload - if (keycode(e) == 'u') { - $('#upload').trigger('click') - } + // when there are files + if (this.allItemsCount) { + this.navigation(e, curSelectedIndex) - // play-pause for media - if (keycode(e) == 'space' && e.target == document.body) { + if ( + keycode(e) == 'space' && e.target == document.body && + (this.selectedFileIs('video') || this.selectedFileIs('audio') || this.selectedFileIs('image')) + ) { e.preventDefault() + // play-pause media if (this.selectedFileIs('video') || this.selectedFileIs('audio')) { return $('.player')[0].paused ? $('.player')[0].play() @@ -213,44 +215,49 @@ export default { this.toggleModal('#img_modal') } } - } - /* end of no bulk selection */ - - // when there are files - if (this.allItemsCount) { - // bulk select - if (keycode(e) == 'b') { - $('#blk_slct').trigger('click') - } - - // add all to bulk list - if (this.isBulkSelecting() && keycode(e) == 'a') { - $('#blk_slct_all').trigger('click') - } - - // delete file - if (keycode(e) == 'delete' || keycode(e) == 'd') { - $('#delete').trigger('click') - } // refresh if (keycode(e) == 'r') { $('#refresh').trigger('click') } + } + // end of when there are files - // move file - if (this.checkForFolders() && keycode(e) == 'm') { - $('#move').trigger('click') - } + // file upload + if (keycode(e) == 'u') { + $('#upload').trigger('click') + } + } + /* end of no bulk selection */ + + // with or without bulk selection + if (this.allItemsCount) { + // bulk select + if (keycode(e) == 'b') { + $('#blk_slct').trigger('click') + } + + // add all to bulk list + if (this.isBulkSelecting() && keycode(e) == 'a') { + $('#blk_slct_all').trigger('click') } - /* end of there are files */ - // toggle file details sidebar - if (keycode(e) == 't') { - $('.toggle').trigger('click') + // delete file + if (keycode(e) == 'delete' || keycode(e) == 'd') { + $('#delete').trigger('click') } + + // move file + if (this.checkForFolders() && keycode(e) == 'm') { + $('#move').trigger('click') + } + } + /* end of with or without bulk selection */ + + // toggle file details sidebar + if (keycode(e) == 't') { + $('.toggle').trigger('click') } - /* end of no lightbox is active */ } /* end of search is not focused */ } @@ -263,11 +270,17 @@ export default { $('.modal.is-active').find('button[type="submit"]').trigger('click') } - if (this.lightBoxIsActive() && keycode(e) == 'space') { - e.preventDefault() - this.toggleModal() + if (this.lightBoxIsActive()) { + // hide lb + if (keycode(e) == 'space') { + e.preventDefault() + this.toggleModal() + } + + this.navigation(e, curSelectedIndex) } + // hide lb if (keycode(e) == 'esc') { this.toggleModal() } diff --git a/src/resources/assets/js/components/mixins/methods/utils.js b/src/resources/assets/js/components/mixins/methods/utils.js index 13fe5f1..cf6bf6b 100644 --- a/src/resources/assets/js/components/mixins/methods/utils.js +++ b/src/resources/assets/js/components/mixins/methods/utils.js @@ -53,10 +53,10 @@ export default { return 'N/A' } - let k = 1000, - dm = 2, - sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - i = Math.floor(Math.log(bytes) / Math.log(k)) + let k = 1000 + let dm = 2 + let sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + let i = Math.floor(Math.log(bytes) / Math.log(k)) return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i] }, diff --git a/src/resources/assets/js/components/mixins/watch.js b/src/resources/assets/js/components/mixins/watch.js index dac02d8..8099cce 100644 --- a/src/resources/assets/js/components/mixins/watch.js +++ b/src/resources/assets/js/components/mixins/watch.js @@ -2,6 +2,7 @@ export default { watch: { allFiles(val) { if (val.length < 1) { + this.resetInput('selectedFile') return this.noFiles('show') } diff --git a/src/resources/assets/sass/shared/manager.scss b/src/resources/assets/sass/shared/manager.scss index d98c4c9..646ae58 100644 --- a/src/resources/assets/sass/shared/manager.scss +++ b/src/resources/assets/sass/shared/manager.scss @@ -17,10 +17,10 @@ $blue_2: #276cda; // toolbar #toolbar { flex-wrap: wrap; + margin: 0; padding: 1rem; border: 1px solid $gray_2; border-bottom: 0; - margin: 0; border-radius: 4px 4px 0 0; background: $white_gray; } @@ -62,11 +62,11 @@ $blue_2: #276cda; // breadcrump .breadcrumb-container { + margin: 0 !important; padding: 0.5rem 1rem; border: 1px solid $gray_2; border-top: 0; background: $gray_3; - margin: 0 !important; .breadcrumb { margin-bottom: 0 !important; @@ -369,7 +369,3 @@ $blue_2: #276cda; .m-l-50 { margin-left: 50px !important; } - -.m-0 { - margin: 0 !important; -} diff --git a/src/resources/views/media-bulma.blade.php b/src/resources/views/media-bulma.blade.php index 3b1e14a..2bf16f9 100755 --- a/src/resources/views/media-bulma.blade.php +++ b/src/resources/views/media-bulma.blade.php @@ -220,7 +220,7 @@ class="button" {{-- ====================================================================== --}} {{-- upload --}} -
+
@@ -352,7 +352,7 @@ class="button"

- +
{{ trans('MediaManager::messages.add_new_folder') }}

- +