// ==UserScript== // @name Multi-OCH Helper Highlight links // @namespace cuzi // @license MIT // @copyright 2014, cuzi (https://openuserjs.org/users/cuzi) // @description nopremium.pl and premiumize.me. Highlight one-click-hoster links and include Multi-OCH Helper button // @homepageURL https://openuserjs.org/scripts/cuzi/Multi-OCH_Helper_Highlight_links // @icon https://greasyfork.org/system/screenshots/screenshots/000/003/478/original/icon_ampel.png // @include * // @exclude *.yahoo.* // @exclude *.google.* // @exclude *.youtube.* // @exclude *.bing.com* // @exclude *duckduckgo.com* // @exclude *bandcamp.com* // @exclude *.tumblr.com* // @version 10.7 // @grant GM_setValue // @grant GM_getValue // @grant GM.setValue // @grant GM.getValue // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @require https://openuserjs.org/src/libs/cuzi/OCH_List.js // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js // @downloadURL none // ==/UserScript== (async function() { "use strict"; const MAXTEXTNODES = 10000; const s_myname = "Multi-OCH Helper Highlight links"; const s_topname = "Multi-OCH Helper"; const syncHostersHost = "https://cvzi.github.io/" const syncHostersUrl = syncHostersHost + "Userscripts/index.html?link=sync" const ignoreList = [["a45aF8168E574f39",30]] const chrome = ~navigator.userAgent.indexOf("Chrome") var $J = $.noConflict(true); var config = { mouseOverDelay : 700, frameWidth : "170px", frameHeight : "200px", colorHosterAvailableBG : 'green', colorHosterAvailableFG : 'white', colorHosterUnavailableBG : 'rgba(255,0,0,0.5)', colorHosterUnavailableFG : 'white', colorLinkOfflineBG : 'rgba(255,0,0,0.5)', colorLinkOfflineFG : 'silver', maxRequestsPerPage : 2, updateHosterStatusInterval : 24*7 // weekly update }; // These hosters are supported by but have a X-Frame-Options enabled or simply do not work without javascript. var noframeHosters = [ '1fichier', 'clicknupload', 'filecloud', 'filefactory', 'firedrive', 'mega', 'rapidgator', 'uploaded', 'uploadrocket', 'uptobox' ]; var multi = { 'nopremium.pl' : new (function() { var self = this; this.key = 'nopremium.pl'; this.name = 'NoPremium.pl'; this.homepage = 'https://www.nopremium.pl/'; var mapHosterName = function(name) {return name.replace("-","")}; this.updateStatusURL = 'https://www.nopremium.pl/'; this.updateStatusURLpattern =/https?:\/\/www\.nopremium\.pl.*/; this.status = {}; this.init = async function() { self.lastUpdate = new Date(await GM.getValue(self.key+"_status_time",0)); self.status = JSON.parse(await GM.getValue(self.key+"_status","{}")); }; this.updateStatus = async function() { // Update list of online hosters if(document.location.href.match(self.updateStatusURL)) { // Read and save current status of all hosters self.status = {}; $J("#servers a[title]").each(function() { var name = mapHosterName(this.title); self.status[name] = true; }); await GM.setValue(self.key+"_status",JSON.stringify(self.status)); await GM.setValue(self.key+"_status_time",""+(new Date())); console.log(s_myname+": "+self.name+": Hosters ("+Object.keys(self.status).length+") updated"); } else { alert(s_myname+"\n\nError: wrong update URL"); } }; this.isOnline = function(hostername) { return hostername in self.status && self.status[hostername]; }; })(), 'premiumize.me' : new (function() { var self = this; this.key = 'premiumize.me'; this.name = 'premiumize'; this.homepage = 'https://www.premiumize.me/'; var mapHosterName = function(name) { return name.replace("-","")}; this.updateStatusURL = 'https://www.premiumize.me/hosters'; this.updateStatusURLpattern = /https:\/\/www\.premiumize\.me\/hosters\/?/; this.status = {}; this.init = async function() { self.lastUpdate = new Date(await GM.getValue(self.key+"_status_time",0)); self.status = JSON.parse(await GM.getValue(self.key+"_status","{}")); }; this.updateStatus = function() { // This works only with api key, which only the main script has }; this.isOnline = function(hostername) { return hostername in self.status && self.status[hostername]; }; })() }; function matchHoster(str) { // Return name of first hoster that matches, otherwise return false for(let i in ignoreList) { if (str.indexOf(...ignoreList[i]) !== -1) { return false; } } for(var name in OCH) { for(var i = 0; i < OCH[name].pattern.length; i++) { if(OCH[name].pattern[i].test(str)) { return name } } } return false; } // All suitable urls are saved in this array: var alllinks = []; function frameSrc(src) { // Prevent websites from busting the iframe by using a second "sandboxed" iframe // It's a kind of magic. var framesrc = 'data:text/html,'; framesrc += encodeURIComponent('\ \
\ \