// ==UserScript==
// @name Improved RedGIFs
// @namespace BigDuckie.ImprovedRedgifs
// @version 2025.1.13
// @description Fix a few annoying "features" and add an easy download button.
// @icon https://www.google.com/s2/favicons?sz=64&domain=redgifs.com
// @author Big Duckie
// @copyright 2025, Big Duckie (https://bigduckie.dev)
// @license MIT
// @match https://*.redgifs.com
// @match https://*.redgifs.com/watch/*
// @match https://*.redgifs.com/niches/*
// @match https://*.redgifs.com/ifr/*
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js
// @require https://raw.githubusercontent.com/pie6k/jquery.initialize/master/jquery.initialize.min.js
// @grant GM_addStyle
// @grant GM_download
// ==/UserScript==
(function () {
'use strict';
GM_addStyle(`
.DLButton {
background: 0 0;
border: none;
cursor: pointer;
color: var(--white);
font: var(--s1-medium);
text-shadow: var(--black) 1px 0 5px;
text-align: center;
}
.embeddedPlayer .buttons .button svg {
margin-left: 3px;
}`);
jQuery.noConflict();
const play_svg = () => jQuery(document.createElementNS("http://www.w3.org/2000/svg", "svg")).attr({
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
stroke_width: 2,
stroke_linecap: "round",
stroke_linejoin: "round"
}).html(``);
const pause_svg = () => jQuery(document.createElementNS("http://www.w3.org/2000/svg", "svg")).attr({
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
stroke_width: 2,
stroke_linecap: "round",
stroke_linejoin: "round"
}).html(``);
const download_svg = () => jQuery(document.createElementNS("http://www.w3.org/2000/svg", "svg"))
.attr({
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
stroke_width: 2,
stroke_linecap: "round",
stroke_linejoin: "round"
}).html(``);
// Remove overlayer
jQuery.initialize(".Player-OverLayer", function() {
this.remove();
});
// Watch & Niche pages
jQuery.initialize(".SideBar", function () {
const gif_root = jQuery(this).parent().parent();
let gif_id = gif_root.attr("id").substring(4);
jQuery(this).find(".SideBar-Item>.rg-button.views").on("click", function () {
togglePlayer(gif_root.find(".Player-Video>video")[0]);
}).children("svg").replaceWith(pause_svg());
jQuery(this).children(".SideBar-Item:has(.FSButton)").after(
jQuery("
", {
class: "SideBar-Item"
}).append(
jQuery("