From 0d3df2ed2c03d35ddb3d4737bf1d7380c3b2f1dc Mon Sep 17 00:00:00 2001 From: A1Gard Date: Thu, 27 Feb 2025 03:03:16 +0330 Subject: [PATCH] added autoplay video to groups added submenu expandable to homayon-menu repsonosive --- .../AutoPlayAttachment.blade.php | 18 +++++++ .../AutoPlayAttachment/AutoPlayAttachment.js | 19 +++++++ .../AutoPlayAttachment.json | 10 ++++ .../AutoPlayAttachment/AutoPlayAttachment.php | 29 +++++++++++ .../AutoPlayAttachment.scss | 49 +++++++++++++++++++ .../segments/menu/HomayonMenu/HomayonMenu.js | 20 ++++++++ .../menu/HomayonMenu/HomayonMenu.scss | 18 +++++++ 7 files changed, 163 insertions(+) create mode 100644 resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.blade.php create mode 100644 resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.js create mode 100644 resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.json create mode 100644 resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.php create mode 100644 resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.scss diff --git a/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.blade.php b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.blade.php new file mode 100644 index 0000000..be7a58f --- /dev/null +++ b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.blade.php @@ -0,0 +1,18 @@ +
+
+

+ {{getSetting($data->area_name.'_'.$data->part.'_title')}} +

+
+ @php($group = \App\Models\Group::first()) + @foreach($group->attachs()->where('ext','mp4')->get() as $clip) + + @endforeach +
+
+
diff --git a/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.js b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.js new file mode 100644 index 0000000..c54a0bf --- /dev/null +++ b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.js @@ -0,0 +1,19 @@ +document.addEventListener('DOMContentLoaded', function () { + document.querySelectorAll('.autoplay-clip-item-group').forEach(function (el) { + el.addEventListener('mouseenter', function () { + try { + this.querySelector('video').play(); + this.querySelector('i').style.display = 'none'; + } catch { + } + + }); + el.addEventListener('mouseleave', function () { + try { + this.querySelector('video').pause(); + this.querySelector('i').style.display = 'block'; + } catch { + } + }); + }); +}); diff --git a/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.json b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.json new file mode 100644 index 0000000..2385d62 --- /dev/null +++ b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.json @@ -0,0 +1,10 @@ +{ + "name": "AutoPlayAttachment", + "version": "1.0", + "author": "xStack", + "email": "xshop@xstack.ir", + "license": "GPL-3.0-or-later", + "url": "https:\/\/xstack.ir", + "author_url": "https:\/\/4xmen.ir", + "packages": [] +} \ No newline at end of file diff --git a/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.php b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.php new file mode 100644 index 0000000..170dbd5 --- /dev/null +++ b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.php @@ -0,0 +1,29 @@ +section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_title'; + $setting->value = "Clips list"; + $setting->type = 'text'; + $setting->size = 6; + $setting->title = $part->area_name . ' ' . $part->part; + $setting->save(); + } + public static function onRemove(Part $part = null) + { + + } + public static function onMount(Part $part = null) + { + return $part; + } +} diff --git a/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.scss b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.scss new file mode 100644 index 0000000..9328c92 --- /dev/null +++ b/resources/views/segments/group/AutoPlayAttachment/AutoPlayAttachment.scss @@ -0,0 +1,49 @@ +.AutoPlayAttachment { + // scss + padding: 2rem 0; + + h1 { + font-size: 27px; + font-weight: 400; + } + + .autoplay-clip-list { + display: flex; + column-gap: .5rem; + } + a{ + display: block; + position: relative; + i{ + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); + font-size: 75px; + color: white; + } + } + + .autoplay-clip-item-group { + transition: 700ms; + flex: 1; + video,img { + width: 100%; + border-radius: var(--xshop-border-radius); + height: 300px; + object-fit: cover; + } + &:hover{ + flex-grow: 2; + } + } +} + + +/*-768px width*/ +@media (max-width: 768px) { + .autoplay-clip-list { + display: grid !important; + grid-template-columns: repeat(2,1fr) !important; + } +} diff --git a/resources/views/segments/menu/HomayonMenu/HomayonMenu.js b/resources/views/segments/menu/HomayonMenu/HomayonMenu.js index abb548d..27c7f16 100644 --- a/resources/views/segments/menu/HomayonMenu/HomayonMenu.js +++ b/resources/views/segments/menu/HomayonMenu/HomayonMenu.js @@ -26,5 +26,25 @@ const toggleSideMenu = function (e) { }; document.addEventListener('DOMContentLoaded',function () { document.querySelector('#homa-toggle-menu')?.addEventListener('click',toggleSideMenu); + + document.querySelectorAll('.homayon-resp-menu ul li ul')?.forEach(function (el) { + const span = document.createElement('span'); + span.classList.add('ri-arrow-down-wide-line'); + span.classList.add('float-end'); + span.classList.add('m-2'); + el.parentNode.prepend(span); + + span.addEventListener('click',function (e) { + this.parentNode.querySelector(':scope > ul').classList.toggle('active'); + if (this.classList.contains('ri-arrow-down-wide-line')){ + span.classList.remove('ri-arrow-down-wide-line'); + span.classList.add('ri-arrow-up-wide-line'); + }else{ + span.classList.remove('ri-arrow-up-wide-line'); + span.classList.add('ri-arrow-down-wide-line'); + + } + }); + }); }); diff --git a/resources/views/segments/menu/HomayonMenu/HomayonMenu.scss b/resources/views/segments/menu/HomayonMenu/HomayonMenu.scss index 339652d..574872d 100644 --- a/resources/views/segments/menu/HomayonMenu/HomayonMenu.scss +++ b/resources/views/segments/menu/HomayonMenu/HomayonMenu.scss @@ -333,4 +333,22 @@ } } + /* submenu expandable */ + .homayon-resp-menu{ + ul{ + li{ + ul{ + display: none; + + &.active{ + display: block; + } + } + } + } + + .ri-arrow-down-wide-line{ + cursor: pointer; + } + } }