Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
(Please fill out the issue template with your details)
Expected Behavior
Normal userscript injection/execution
Actual Behavior
Script is not injected, console from the page where the script was supposed to be injected/executed shows the following error:
"injected: env: missing script "a55b568f-8802-4047-b516-797321680c52"!"
Specifications
Firefox: 112.0.1
TM Beta: 4.19.6181
OS: Windows 11 22H2 Build 22624.1616
Script
(Please give an example of the script if applicable.)
// ==UserScript==
// @name Eka's Portal Toolbox
// @namespace https://aryion.com/
// @version 1.1
// @description Hides blacklisted items on Eka's messages page
// @author Azaxiel
// @match *://aryion.com/g4/messagepage*
// @match *://aryion.com/g4/tags*
// @icon https://www.google.com/s2/favicons?sz=64&domain=aryion.com
// @require http://***.***.***/js/functions.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
/*--------------------- Hide All Blacklisted/Deleted ----------------
| This block contains the code to hide all blacklisted or
| deleted items from the user watch page (called messages on the site)
| or from the gallery when browsing by tags. It functions by first
| expanding any 'more' expandos, then looking for any items that
| have the css class called 'blacklist-overlay', or for deleted items,
| it looks for the title of the item to be 'Item has been deleted'.
| It then sets the css display attribute for these items to 'none'.
| This block uses the 'pause' function, which is provided by the functions
| include in the meta block. Performance metrics are printed to the pages
| footer below the existing text.
*-------------------------------------------------------------------*/
// Pause for 2 seconds to allow any XHR requests to finish loading. Otherwise we may miss some expandos.
// Adjust for your connection speed. IE slower load times may require a longer pause.
pause(500);
//
// Expand all expando links
//
// Get all expando link elements.
var msgldr = document.getElementsByClassName("msg-loader");
// JS can't iterate over the obj type "HTML Collection", so we convert it to an array.
var msgldr_arr = Array.prototype.slice.call(msgldr);
// iterate over each item in the array and send a click event to each one.
msgldr_arr.forEach(clickit);
// provides the actual click used in the forEach statement above.
function clickit(item) {
item.click();
}
//
// Hide all blacklist items
//
// Start a performance timer to check execution time
var blacklistFunctRuntimeStart = performance.now();
// Start the function loop which finds/hides all blacklisted items
var timerVar = setInterval (function() {DoMeEverySecond (); }, 1000);
// Sets the count of blacklisted items to 0. Count is incremented as each blacklisted item is hidden.
var blacklistCount = 0;
// looped function to hide blacklisted items
function DoMeEverySecond () {
// Creates an array of all gallery items
var bliarr = Array.prototype.slice.call(document.getElementsByClassName("gallery-item"));
// Iterates over the array and creates a new one with all the blacklisted items.
var blacklist_items = bliarr.filter(isBlacklisted);
// Checks to see if the item is blacklisted and is not already hidden.
function isBlacklisted(item) {
if (item.querySelector("a.thumb .blacklist-overlay") != null) {
// Gets the computed style of the item, specifically the display style
var itemHiddenCheck = getComputedStyle(item)["display"];
// if display is none, item is already hidden, so we just return nothing and move on.
if (itemHiddenCheck == "none") {
return;
}
}
return item;
}
}
// If the blacklist_items array is 0 length or doesn't exist, then there are no items to hide, so we end the loop.
if (blacklist_items.length == 0 || !blacklist_items) {
clearInterval (timerVar);
timerVar = "";
// Stops the performance timer started above. Execution time is calculated below.
// Text is added to the pages footer below the existing text.
var blacklistFunctRuntimeEnd = performance.now();
var footer = document.getElementById("g-footer");
var footerln1 = document.createElement("p");
var footerln2 = document.createElement("p");
var footerln3 = document.createElement("p");
footerln1.innerText = "All blacklisted items hidden. Loop stoppped.";
footerln2.innerText = "Total number of blacklisted items found/hidden: " + blacklistCount;
footerln3.innerText = `Execution time: ${blacklistFunctRuntimeEnd - blacklistFunctRuntimeStart} ms`;
footer.appendChild(footerln1);
footer.appendChild(footerln2);
footer.appendChild(footerln3);
return;
}
// Iterates over the blacklist_items array and sets the display style to none for each item.
blacklist_items.forEach(hideBlacklistedItems);
// Sets the display style to none for the forEach statement above. Also increments the count of blacklisted items by one.
function hideBlacklistedItems(item) {
item.style.display = "none";
blacklistCount++;
}
}
})();
Console output on page where script should have run
This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”. messagepage.php
content: normal start event processing for lgrrsm24.c6j (2 to run) content.js:57:335
env: schedule "Eka's Portal Toolbox" for document-idle content.js:46:21
env: inject "Eka's Portal Toolbox" now content.js:44:86
Uncaught SyntaxError: missing ) in parenthetical content.js:44:275
env: schedule "test2" for document-idle content.js:46:21
env: inject "test2" now content.js:44:86
Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. jquery-1.6.1.min.js:16:18262
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://static.cloudflareinsights.com/beacon.min.js/v52afc6f149f6479b8c77fa569edb01181681764108816. (Reason: CORS request did not succeed). Status code: (null).
None of the “sha512” hashes in the integrity attribute match the content of the subresource. messagepage.php
content: DOMContentLoaded content.js:57:21
content: load content.js:57:115
env: run "Eka's Portal Toolbox" now (1 requires) content.js:44:374
injected: env: missing script "a55b568f-8802-4047-b516-797321680c52"! content.js:8:1224
env: run "test2" now (0 requires)
(Please fill out the issue template with your details)
Expected Behavior
Normal userscript injection/execution
Actual Behavior
Script is not injected, console from the page where the script was supposed to be injected/executed shows the following error: "injected: env: missing script "a55b568f-8802-4047-b516-797321680c52"!"
Specifications
Script
(Please give an example of the script if applicable.)
Console output on page where script should have run
This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”. messagepage.php content: normal start event processing for lgrrsm24.c6j (2 to run) content.js:57:335 env: schedule "Eka's Portal Toolbox" for document-idle content.js:46:21 env: inject "Eka's Portal Toolbox" now content.js:44:86 Uncaught SyntaxError: missing ) in parenthetical content.js:44:275 env: schedule "test2" for document-idle content.js:46:21 env: inject "test2" now content.js:44:86 Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. jquery-1.6.1.min.js:16:18262 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://static.cloudflareinsights.com/beacon.min.js/v52afc6f149f6479b8c77fa569edb01181681764108816. (Reason: CORS request did not succeed). Status code: (null).
None of the “sha512” hashes in the integrity attribute match the content of the subresource. messagepage.php Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://static.cloudflareinsights.com/beacon.min.js/v52afc6f149f6479b8c77fa569edb01181681764108816. (Reason: CORS request did not succeed). Status code: (null).
None of the “sha512” hashes in the integrity attribute match the content of the subresource. messagepage.php content: DOMContentLoaded content.js:57:21 content: load content.js:57:115 env: run "Eka's Portal Toolbox" now (1 requires) content.js:44:374 injected: env: missing script "a55b568f-8802-4047-b516-797321680c52"! content.js:8:1224 env: run "test2" now (0 requires)