Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name New Userscript
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match https://schedule.hololive.tv/
- // @icon https://www.google.com/s2/favicons?sz=64&domain=hololive.tv
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (function() {
- // Format
- //const whiteList = ['name'];
- // Example
- const whiteList = ['FUWAMOCO','Ina','Amelia','Shiori','Kaela','Flayon','Crimzon','ホロライブ'];
- // Official schedule
- if (location.host === "schedule.hololive.tv") {
- document.addEventListener('DOMContentLoaded', () => {
- document.body.querySelectorAll(".name").forEach(nameE => {
- const name = nameE.innerText.trim();
- if (!whiteList.some(wlN => name.includes(wlN))) {
- nameE.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.remove();
- };
- });
- if (blBtn = document.evaluate("//a[contains(., 'ホロスタ')]", document, null, XPathResult.ANY_TYPE, null ).iterateNext()) {
- blBtn.parentNode.remove();
- }
- });
- }
- // Holotools
- if (location.host === "hololive.jetri.co") {
- document.addEventListener('DOMContentLoaded', () => {
- // here we will modify the response
- function modifyResponse(response) {
- if (this.readyState === 4) {
- const url = response.target.responseURL;
- const original_response = response.target.responseText;
- if (url.search("//api.holotools.app/v1/live") >= 0) {
- Object.defineProperty(this, "responseText", {writable: true});
- const modified_response = JSON.parse(original_response);
- modified_response.live = keepWhitelisted(modified_response.live);
- modified_response.ended = keepWhitelisted(modified_response.ended);
- modified_response.upcoming = keepWhitelisted(modified_response.upcoming);
- this.responseText = JSON.stringify(modified_response);
- }
- if (url.search("//api.holotools.app/v1/videos") >= 0) {
- Object.defineProperty(this, "responseText", {writable: true});
- const modified_response = JSON.parse(original_response);
- modified_response.videos = keepWhitelisted(modified_response.videos);
- this.responseText = JSON.stringify(modified_response);
- }
- if (url.search("//api.holotools.app/v1/channels") >= 0) {
- Object.defineProperty(this, "responseText", {writable: true});
- const modified_response = JSON.parse(original_response);
- modified_response.channels = keepWhitelisted(modified_response.channels);
- this.responseText = JSON.stringify(modified_response);
- }
- }
- }
- function keepWhitelisted(items) {
- return items.filter(item => whiteList.some(wlN => item.channel.name.includes(wlN)));
- }
- function openBypass(original_function) {
- return function(method, url, async) {
- this.addEventListener("readystatechange", modifyResponse);
- return original_function.apply(this, arguments);
- };
- }
- XMLHttpRequest.prototype.open = openBypass(XMLHttpRequest.prototype.open);
- });
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment