From 45c4e45cbd540f18d0fbe00823e3e6fa7f52199f Mon Sep 17 00:00:00 2001 From: goodtube4u Date: Mon, 22 Jul 2024 15:09:41 +1000 Subject: [PATCH] Updates minor --- goodtube.user.js | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/goodtube.user.js b/goodtube.user.js index 1663441..ea85830 100644 --- a/goodtube.user.js +++ b/goodtube.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name GoodTube // @namespace http://tampermonkey.net/ -// @version 5.002 +// @version 5.003 // @description Loads Youtube videos from different sources. Also removes ads, shorts, etc. // @author GoodTube // @match https://*.youtube.com/* @@ -18,22 +18,17 @@ (function() { 'use strict'; - // Create variables - let goodTube_loadAttempts = 0; - let goodTube_loadTimeout = false; - // Define load function - function goodTube_load() { + function goodTube_load(loadAttempts) { // If it's the first load attempt - if (goodTube_loadAttempts === 0) { + if (loadAttempts === 0) { // Debug message console.log('\n==================================================\n ______ ________ __\n / ____/___ ____ ____/ /_ __/_ __/ /_ ___\n / / __/ __ \\/ __ \\/ __ / / / / / / / __ \\/ _ \\\n / /_/ / /_/ / /_/ / /_/ / / / / /_/ / /_/ / __/\n \\____/\\____/\\____/\\____/ /_/ \\____/_____/\\___/\n\n=================================================='); console.log('[GoodTube] Initiating...'); } // Only re-attempt to load the GoodTube 10 times - goodTube_loadAttempts++; - if (goodTube_loadAttempts >= 9) { + if (loadAttempts >= 9) { // Debug message console.log('[GoodTube] GoodTube could not be loaded'); @@ -43,30 +38,28 @@ return; } + // Increment the load attempts + loadAttempts++; + // Load GoodTube fetch('https://raw.githubusercontent.com/goodtube4u/GoodTube/main/goodtube.min.js') + // Success .then(response => response.text()) - // If we got a response .then(data => { // Put GoodTube code into a