Update improved_redgifs.user.js
Decided to complete the IFR page rework.
This commit is contained in:
+48
-25
@@ -2,7 +2,7 @@
|
||||
// @name Improved RedGIFs
|
||||
// @namespace BigDuckie.ImprovedRedgifs
|
||||
// @version 2025.12.21
|
||||
// @description Fixes a few annoying "features" and add an easy download button.
|
||||
// @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)
|
||||
@@ -74,8 +74,15 @@
|
||||
this.remove();
|
||||
});
|
||||
|
||||
// Remove videoLink href
|
||||
jQuery.initialize(".videoLink", function() {
|
||||
jQuery(this).removeAttr("href");
|
||||
});
|
||||
|
||||
// --- Watch pages ---
|
||||
jQuery.initialize(".sideBar", async function () {
|
||||
console.debug("detected watch page gif");
|
||||
|
||||
const sidebar = jQuery(this);
|
||||
const root = sidebar.parents(".GifPreview");
|
||||
|
||||
@@ -117,38 +124,54 @@
|
||||
root.find(".PPButton>svg").replaceWith(pause_svg());
|
||||
});
|
||||
}, { target: jQuery(".previewFeed")[0] });
|
||||
// ---- Watch Pages ---
|
||||
// --- Watch Pages ---
|
||||
|
||||
// IFR pages (Still needs rework)
|
||||
jQuery.initialize(".embeddedPlayer", function () {
|
||||
jQuery(this).children(".buttons").prepend(
|
||||
jQuery("<div>", {
|
||||
class: "button"
|
||||
}).append(
|
||||
pause_svg().attr({ class: "playButton" })
|
||||
).on("click", () => {
|
||||
togglePlayer(jQuery(".videoLink>video")[0]);
|
||||
})
|
||||
)
|
||||
// --- IFR Pages (Embedded) ---
|
||||
jQuery.initialize(".sidebar", function () {
|
||||
console.debug("detected embedded gif");
|
||||
|
||||
jQuery(this).children(".buttons").append(
|
||||
jQuery("<div>", {
|
||||
class: "button"
|
||||
const sidebar = jQuery(this);
|
||||
const root = sidebar.parents(".embeddedPlayer");
|
||||
|
||||
// Add play pause button
|
||||
sidebar.prepend(
|
||||
jQuery("<li>", {
|
||||
class: "item"
|
||||
}).append(
|
||||
download_svg()
|
||||
).on("click", () => {
|
||||
download(window.location.pathname.split("/")[2])
|
||||
})
|
||||
)
|
||||
jQuery("<button>", {
|
||||
class: "PPButton RGButton",
|
||||
"aria-label": "pause play button"
|
||||
}).append(pause_svg()).on("click", () => {
|
||||
togglePlayer(root.find(".videoLink>video")[0]);
|
||||
})
|
||||
));
|
||||
|
||||
// Add download button
|
||||
sidebar.children(".item:has(.FSButton)").after(
|
||||
jQuery("<li>", {
|
||||
class: "item"
|
||||
}).append(
|
||||
jQuery("<button>", {
|
||||
class: "DLButton RGButton",
|
||||
"aria-label": "download button"
|
||||
}).append(download_svg()).on("click", () => {
|
||||
download(window.location.pathname.split("/")[2]);
|
||||
})
|
||||
));
|
||||
}, { target: jQuery(".routeWrapper")[0] });
|
||||
|
||||
// Add callback to change pause play button svg.
|
||||
jQuery.initialize(".videoLink>video", function () {
|
||||
jQuery(this).on("play", function () {
|
||||
jQuery(this).parents(".embeddedPlayer").find("svg.playButton").replaceWith(play_svg().attr({ class: "playButton" }));
|
||||
const video = jQuery(this);
|
||||
const root = video.parents(".embeddedPlayer");
|
||||
|
||||
video.on("play", function () {
|
||||
root.find(".PPButton>svg").replaceWith(play_svg());
|
||||
}).on("pause", function () {
|
||||
jQuery(this).parents(".embeddedPlayer").find("svg.playButton").replaceWith(pause_svg().attr({ class: "playButton" }));
|
||||
root.find(".PPButton>svg").replaceWith(pause_svg());
|
||||
});
|
||||
}, { target: jQuery(".embeddedPlayer")[0] });
|
||||
}, { target: jQuery(".routeWrapper")[0] });
|
||||
// --- IFR Pages ---
|
||||
|
||||
// --- Helper Functions ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user