From e0b68d54707e1c6480a2c71acda8b0af13a66a25 Mon Sep 17 00:00:00 2001 From: Wisp X Date: Fri, 31 Dec 2021 10:47:10 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/app.js | 6 ++++++ resources/js/app.js | 4 ++++ resources/views/images.blade.php | 27 +++++++++++++++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 5cedf0f7..a2869177 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -5475,6 +5475,7 @@ window.utils = { }, infiniteScroll: function infiniteScroll(selector, options) { if ($(selector).length > 0) { + var classes = options.classes || {}; var loadingText = options.loadingText || '加载中...'; var finishedText = options.finishedText || '我也是有底线的~'; var errorText = options.errorText || '加载失败'; @@ -5484,6 +5485,11 @@ window.utils = { finished: false }; $(selector).append("
".concat(loadingText, "
")); + + for (var classesKey in classes) { + $(selector).find('.infinite-scroll').addClass(classes[classesKey]); + } + var $btn = $(selector + ' .infinite-scroll span'); var opts = { url: options.url || '', diff --git a/resources/js/app.js b/resources/js/app.js index 085f937e..5c6c68c2 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -36,6 +36,7 @@ window.utils = { }, infiniteScroll(selector, options) { if ($(selector).length > 0) { + let classes = options.classes || {}; let loadingText = options.loadingText || '加载中...'; let finishedText = options.finishedText || '我也是有底线的~'; let errorText = options.errorText || '加载失败'; @@ -45,6 +46,9 @@ window.utils = { finished: false, }; $(selector).append(`
${loadingText}
`); + for (const classesKey in classes) { + $(selector).find('.infinite-scroll').addClass(classes[classesKey]); + } let $btn = $(selector + ' .infinite-scroll span'); let opts = { diff --git a/resources/views/images.blade.php b/resources/views/images.blade.php index e6d119f6..5f180cd2 100644 --- a/resources/views/images.blade.php +++ b/resources/views/images.blade.php @@ -48,10 +48,10 @@ -
+
-
-
+
+
@@ -134,6 +134,7 @@ let selectedAlbum = 0; // 选择的相册 + const PHOTOS_SCROLL = '#photos-scroll'; const PHOTOS_GRID = '#photos-grid'; const PHOTOS_ITEM = '.photos-item'; @@ -165,8 +166,9 @@ $photos.justifiedGallery(gridConfigs); - const imagesInfinite = utils.infiniteScroll('#photos-scroll', { + const imagesInfinite = utils.infiniteScroll(PHOTOS_SCROLL, { url: '{{ route('user.images') }}', + classes: ['dragselect'], success: function (response) { if (!response.status) { return toastr.error(response.message); @@ -192,6 +194,7 @@ $photos.append(html); ds.setSelectables($photos.find(PHOTOS_ITEM)); + $(PHOTOS_SCROLL).trigger('click'); }, complete: function () { if ($photos.html() !== '') { @@ -341,17 +344,25 @@ resetImages({page: 1, keyword: $(this).val()}); } }); + + $(document).keydown(e => { + e.preventDefault(); + if (e.keyCode === 65 && (e.altKey || e.metaKey)) { + ds.setSelection($(PHOTOS_ITEM)); + } + });