Last active
December 27, 2023 10:26
-
-
Save aetonsi/cfd96b3e8cf2d07a86a5a973f834df1d to your computer and use it in GitHub Desktop.
Revisions
-
aetonsi revised this gist
Dec 27, 2023 . 1 changed file with 11 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ // ==UserScript== // @name Scrolller Redirect with NO NAV // @namespace https://your-namespace.example.com/ // @version 1.0 // @description Redirects to the media URL on Scrolller.com after waiting for the element to appear (excluding URLs with ?NONAV and scrolller.com/r/*) // @author YourName // @match https://scrolller.com/* // @exclude https://scrolller.com/r/* @@ -15,22 +15,19 @@ const intervalTime = 1000; // Interval time in milliseconds (adjust if needed) let intervalId; function qMarked(arg, page=location.href) { return page.includes('?') ? `&${arg}` : `?${arg}` } function redirectToMedia() { const mediaElement = document.querySelector('.fullscreen-view__media'); if (mediaElement) { const mediaSrc = mediaElement.currentSrc; if (mediaSrc) { clearInterval(intervalId); // Stop the interval once redirected const m = mediaSrc + qMarked(`from=${encodeURIComponent(location.href)}`, mediaSrc); // save the previous URL in the "url" query param location = m; // navigate } } } intervalId = setInterval(redirectToMedia, intervalTime); })(); -
aetonsi created this gist
Dec 27, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ // ==UserScript== // @name Scrolller Redirect with URL Condition // @namespace https://your-namespace.example.com/ // @version 1.0 // @description Redirects to the media URL on Scrolller.com after waiting for the element to appear (if URL does not match) // @author YourName // @match https://scrolller.com/* // @exclude https://scrolller.com/r/* // @grant none // ==/UserScript== (function() { 'use strict'; const intervalTime = 1000; // Interval time in milliseconds (adjust if needed) let intervalId; function redirectToMedia() { if (!window.location.href.includes('/r/')) { const mediaElement = document.querySelector('.fullscreen-view__media'); if (mediaElement) { const mediaSrc = mediaElement.src; if (mediaSrc) { location.href = mediaSrc; clearInterval(intervalId); // Stop the interval once redirected } } } else { clearInterval(intervalId); // Stop the interval if URL matches /r/ } } intervalId = setInterval(redirectToMedia, intervalTime); })(); // thanks chatgpt!