Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> [Script] EH Horizontal MPV

 
post Dec 18 2024, 12:58
Post #1
imty



Casual Poster
***
Group: Gold Star Club
Posts: 206
Joined: 20-August 16
Level 359 (Godslayer)


Attached Image

Compatibility:
can be used on Firefox/Edge/Chrome through Tampermonkey/Violentmonkey
cannot be used with Greasemonkey, possibly due to GM_getValue()/GM_setValue().
This script should be compatible with the dark theme script but not with other MPV scripts.

Main features:
Fit images to screen height, display from right to left without gaps.
Use thumbnails, hover over the bottom of the image.
Use image toolbar, hover over the top of the image.
Quick buttons for horizontal/vertical toggling, Show/hide the side toolbar.
Precise positioning and making the target image glow.
Images auto-resize and reposition when stretching the window.
Auto hide after the mouse stops moving.
Shortcut keys swapped: 'a' with 'd', 'left' with 'right.'
1.0.1: Add two buttons, Auto Page Flip and Auto Scroll, allow custom time.

Bug fix:
1.0.2: Fixed an issue where thumbnails could not be called the first time.
1.0.3-1.0.4: Fix the issue where images are incorrectly stretched when there are too few pictures in the gallery.

Known issues:
Setting this horizontal value will result in incorrect width calculations for the image.
Attached Image
This script only performs DOM operations and does not use any network API.
There may be related performance issues.

Download:
Attached File  EH_Horizontal_MPV_1.0.4.user.js.txt ( 33.95k ) Number of downloads: 56

Attached File  EH_Horizontal_MPV_1.0.2.user.js.txt ( 33.46k ) Number of downloads: 29

Attached File  EH_Horizontal_MPV_1.0.1.user.js.txt ( 33.48k ) Number of downloads: 23

Attached File  EH_Horizontal_MPV_1.0.0.user.js.txt ( 27.6k ) Number of downloads: 30


This post has been edited by imty: Jan 4 2025, 07:27
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Dec 18 2024, 14:26
Post #2
Lady_Slayer



Member of the Bal'masqué
*********
Group: Catgirl Camarilla
Posts: 5,457
Joined: 20-December 16
Level 500 (Ponyslayer)


fantastic work!

User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Dec 18 2024, 18:44
Post #3
剑行血间



Peerless Poster
*****
Group: Gold Star Club
Posts: 735
Joined: 13-July 20
Level 489 (Dovahkiin)


Thank you for your excellent script.
I’ve simply added an auto-scroll feature for my needs, which starts scrolling automatically when the mouse approaches the sides of the screen.
Perhaps you could consider adding and improving this feature?
Attached File  EH_Horizontal_MPV_1.0.0_edit.user.js.txt ( 29.32k ) Number of downloads: 15

CODE

    let scrollSpeed = 2 // Speed of scrolling
    let scrollDirection = null
    let scrollFrameId = null

    function startAutoScroll(direction) {
        if (scrollDirection === direction) return
        scrollDirection = direction

        function smoothScroll() {
            if (scrollDirection === 'left') {
                new_pane_images.scrollLeft -= scrollSpeed
            } else if (scrollDirection === 'right') {
                new_pane_images.scrollLeft += scrollSpeed
            }
            pane_images.scrollTop = -new_pane_images.scrollLeft

            if (scrollDirection) {
                scrollFrameId = requestAnimationFrame(smoothScroll)
            }
        }

        smoothScroll()
    }

    function stopAutoScroll() {
        cancelAnimationFrame(scrollFrameId)
        scrollDirection = null
    }

    new_pane_images.addEventListener('mousemove', event => {
        const screenWidth = window.innerWidth
        const mouseX = event.clientX

        if (mouseX < screenWidth * 0.1) {
            startAutoScroll('left')
        } else if (mouseX > screenWidth * 0.9) {
            startAutoScroll('right')
        } else {
            stopAutoScroll()
        }
    })

    new_pane_images.addEventListener('mouseleave', () => stopAutoScroll())
User is online!Profile CardPM
Go to the top of the page
+Quote Post

 
post Dec 19 2024, 09:11
Post #4
imty



Casual Poster
***
Group: Gold Star Club
Posts: 206
Joined: 20-August 16
Level 359 (Godslayer)


QUOTE(剑行血间 @ Dec 19 2024, 00:44) *
Thank you for your excellent script.
I’ve simply added an auto-scroll feature for my needs, which starts scrolling automatically when the mouse approaches the sides of the screen.
Perhaps you could consider adding and improving this feature?

I'm glad you are able to enjoy it.
I really like your code and suggestions.
Please forgive me for incorporating your code almost verbatim.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 26th May 2025 - 01:36