Last active
November 30, 2025 04:48
-
-
Save rishubil/0df2c04c44889fc6dbb3d7f8b83c3051 to your computer and use it in GitHub Desktop.
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 characters
| // ==UserScript== | |
| // @name Holodex Most Viewers | |
| // @description Holodex Most Viewers | |
| // @version 0.0.1 | |
| // @match https://holodex.net/favorites | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=holodex.net | |
| // @grant none | |
| // @run-at document-idle | |
| // @updateURL https://gist.github.com/rishubil/0df2c04c44889fc6dbb3d7f8b83c3051/raw/holodex-most-viewers.user.js | |
| // @downloadURL https://gist.github.com/rishubil/0df2c04c44889fc6dbb3d7f8b83c3051/raw/holodex-most-viewers.user.js | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| function wait(milliseconds) { | |
| return new Promise((resolve) => { | |
| setTimeout(() => { | |
| resolve("resolved"); | |
| }, milliseconds); | |
| }); | |
| } | |
| async function getSortButton() { | |
| let path = document.querySelector('path[d="M6,13H18V11H6M3,6V8H21V6M10,18H14V16H10V18Z"]') | |
| while (!path) { | |
| await wait(100); | |
| path = document.querySelector('path[d="M6,13H18V11H6M3,6V8H21V6M10,18H14V16H10V18Z"]') | |
| } | |
| let button = path.closest('button'); | |
| while (!button) { | |
| await wait(100); | |
| button = path.closest('button'); | |
| } | |
| return button; | |
| } | |
| async function getSelectButton() { | |
| let label = document.evaluate("//label[text()='Sort By']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
| while (!label) { | |
| await wait(100); | |
| label = document.evaluate("//label[text()='Sort By']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
| } | |
| let button = label.closest('div[role="button"]'); | |
| while (!button) { | |
| await wait(100); | |
| button = label.closest('div[role="button"]'); | |
| } | |
| return button; | |
| } | |
| async function selectMostViewersOption() { | |
| let item = document.evaluate("//div[text()='Most Viewers']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
| while (!item) { | |
| await wait(100); | |
| item = document.evaluate("//div[text()='Most Viewers']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
| } | |
| let option = item.closest('div[role="option"]'); | |
| while (!option) { | |
| await wait(100); | |
| option = item.closest('div[role="option"]'); | |
| } | |
| return option; | |
| } | |
| async function main() { | |
| const button = await getSortButton(); | |
| button.click(); | |
| const selectButton = await getSelectButton(); | |
| selectButton.click(); | |
| const mostViewersOption = await selectMostViewersOption(); | |
| mostViewersOption.click(); | |
| button.click(); | |
| } | |
| main().then(() => { | |
| console.log("Holodex Most Viewers script executed"); | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment