RedGIFs iframe Sound Helper

Provide facilities to automatically enable RedGIFs audio in embedded iframes, and for communication regarding audio controls between the the hosting site and the iframe.

Автор
omegasome
Установок в день
1
Всего установок
99
Оценки
0 0 0
Версия
1.4.1
Создан
07.02.2024
Обновлён
10.02.2024
Лицензия
public domain
Работает на

TESTED IN ViolentMonkey ON FIREFOX.

KNOWN BROKEN IN GreaseMonkey ON FIREFOX.

NOT TESTED WITH ANY OTHER BROWSERS/EXTENSIONS.

Basic Information

Provides facilities for websites using RedGIFs embeds to optionally exercise rudimentary control over the embed, with minimal changes required to distinguish between users using the script and users not using the script. Designed to improve ease of use by disabled users (and people who just don't like clicking so darn much).

When a RedGIFs image is embedded, add a querystring with variables such as sound, link, and loop, with values true or false. sound defaults to false, link and loop default to true. If sound is true, then sound on the video will automatically be enabled. If link is false, then the hyperlink attached to the video will be disabled, so clicking just pauses (sites using this feature should be sure to provide an alternative way to access this feature). If loop is false, the video will not loop on completion.

Additional API details

When the script loads, it calls window.parent.postMessage with the data "gfy_enhanced_api", to allow a parent site to detect whether this script is in use. This should very rarely be important.

If you call iframe.windowContent.postMessage(command, "*"), you can control the behavior in the window. These behaviors should supersede the querystring.

"soundOn" and "soundOff" turn sound on and off. "soundToggle" toggles it.

"linkOn" and "linkOff" enable and disable the hyperlink attached to the video.

"loopOn" and "loopOff" enable and disable looping on the video.

"play" and "pause" play and pause the video.

If looping is disabled, the video call window.parent.postMessage with the data "gfy_ended". This will most likely only be useful on sites using one embed at a time, but will allow you to detect when a video completes to move on to the next one.

Misc Information

I have considered carefully and am confident this userscript does not compromise the security or commercial interests of redgifs or any other website.