When i open giveaway and see screenshots, i want fast close it and press ESC, but its not work =_=

Small help for keyboard active user? =)

3 years ago*

Comment has been collapsed.

+1, it annoys me too 😣

(BTW, you should change the discussion category to "Bug/Suggestions" instead of "General")

3 years ago
Permalink

Comment has been collapsed.

Change, thanks =)

3 years ago
Permalink

Comment has been collapsed.

I agree, would be a very nice feature indeed 😎
then again no idea how easy/hard itΒ΄d be to implement .. but IΒ΄m just a potato

3 years ago
Permalink

Comment has been collapsed.

You can use userscripts to do this kind of simple tweaks.

// ==UserScript==
// @match https://www.steamgifts.com/giveaway/*
// ==/UserScript==

(function() {
    'use strict'

    const lightboxes = document.getElementsByClassName("lightbox")

    if (lightboxes && lightboxes.length)
    {
        document.addEventListener("keydown", (event) => {
            if (event.keyCode === 27 && lightboxes[0].style.display !== "none")
            {
                const closeIcons = document.getElementsByClassName("lightbox_header_icon--close")

                if (closeIcons && closeIcons.length)
                {
                    closeIcons[0].click()
                }
            }
        })
    }
})()
3 years ago
Permalink

Comment has been collapsed.

Hey, just found this topic as i was having the same issue, tried your script in Tampermonkey, but when i try to save it it just pops up with an "Invalid script" message, and nothing more. I've never added something from copy / paste, is there something i forgot ?

2 years ago
Permalink

Comment has been collapsed.

Sorry, I was too lazy to write the full header, but here it goes:

// ==UserScript==
// @name         Please close screenshots by ESC
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Bender takes over the world!
// @author       who
// @match        https://www.steamgifts.com/*
// @icon         https://www.google.com/s2/favicons?domain=steamgifts.com
// @grant        none
// ==/UserScript==
2 years ago*
Permalink

Comment has been collapsed.

Now i can save it, thanks !... but nothing has changed. It is active in Tampermonkey, i have relaunched Chrome just in case but still nothing. I even tried to add an alert("..."), but nothing happens.

2 years ago
Permalink

Comment has been collapsed.

Do you have other userscripts applied to SteamGifts (e.g., ESGST)?

2 years ago
Permalink

Comment has been collapsed.

Yes.

2 years ago
Permalink

Comment has been collapsed.

If you use ESGST, you can use its built in option to do this instead:
https://www.steamgifts.com/account/settings/profile?esgst=settings&id=sk_cp

(The ability to close the SteamGifts screenshot overlay was added recently)

2 years ago
Permalink

Comment has been collapsed.

This is weird, this functionnality is listed as 2.30.1, but when i go to 2.30, it's only "[SG] Search Magnifying Glass Button".
I have tried to activate it, but it doesn't seem to change anything (even esc on the popups after entering a GA doesn't work).

2 years ago*
Permalink

Comment has been collapsed.

Ok got it, it was 2.29.1 on my options (weird because i just tried to update), and now it's working. Didn't know this part of the ESGST options, i will epxlore.

Thanks to both of you !

2 years ago
Permalink

Comment has been collapsed.

Glad you got it working. =)

2 years ago
Permalink

Comment has been collapsed.

Thanks for this BTW, it was very useful while I waited for it to be added to ESGST 😎

2 years ago
Permalink

Comment has been collapsed.

You're welcome! Glad to know that my untested code was actually useful to someone.

2 years ago
Permalink

Comment has been collapsed.

Nice one!

I extended it by adding left/right key navigation:

(function() {
    const lightbox = document.getElementsByClassName("lightbox")[0]
    document.addEventListener("keydown", (evt) => {
        if (lightbox.style.display === "none")
            return
        if (evt.keyCode === 27)
        {
            lightbox.getElementsByClassName("lightbox_header_icon--close")[0].click()
        }
        else if (evt.keyCode === 37 || evt.keyCode === 39)
        {
            let [idx, count] = lightbox.getElementsByClassName("lightbox_header_description_count")[0]
                .textContent.match(/\d+/g).map(x => +x)
            idx += (evt.keyCode === 39 ? +1 : -1)
            idx = Math.min(Math.max(idx, 1), count)
            lightbox.getElementsByClassName("lightbox_thumbnail")[idx-1].click()
        }
    })
})()

PS: this might interfere with forward/backward skipping when watching the videos but I don't care ;)

2 years ago*
Permalink

Comment has been collapsed.

You're absolutely right, I wish more storefronts (e.g., Steam...) would do this.

    document.addEventListener("wheel", (evt) => {
        if (lightbox.style.display === "none")
            return
        const nums = lightbox.getElementsByClassName("lightbox_header_description_count")[0]
        .textContent.match(/\d+/g).map(x => parseInt(x, 10))
        let idx = nums[0] + (evt.deltaY < 0 ? +1 : -1)
        idx = Math.min(Math.max(idx, 1), nums[1])
        lightbox.getElementsByClassName("lightbox_thumbnail")[idx-1].click()
    })
2 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 3 years ago.

3 years ago
Permalink

Comment has been collapsed.

Sign in through Steam to add a comment.