Skip to content

Instantly share code, notes, and snippets.

@958
Last active February 26, 2024 07:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 958/6182793 to your computer and use it in GitHub Desktop.
Save 958/6182793 to your computer and use it in GitHub Desktop.
--- old/components/tombfix.js
+++ new/components/tombfix.js
@@ -314,13 +314,22 @@
if(greasemonkey){
greasemonkey = greasemonkey.getService().wrappedJSObject;
- env.addBefore(greasemonkey, 'evalInSandbox', function(){
- for(var i=0, len=arguments.length ; i<len ; i++){
- var arg = arguments[i];
- if(typeof(arg) == 'object'){
- arg.GM_Tombloo = GM_Tombloo;
- arg.GM_Tombfix = GM_Tombfix;
- return;
+ env.addAround(greasemonkey, 'injectScripts', function(func, args){
+ for(var i=0, len=args.length ; i<len ; i++){
+ var arg = args[i];
+ if(typeof(arg) == 'object' && 'document' in arg){
+ arg.wrappedJSObject.GM_Tombloo = GM_Tombloo;
+ arg.wrappedJSObject.GM_Tombfix = GM_Tombfix;
+ break;
+ }
+ }
+ func(args);
+ for(var i=0, len=args.length ; i<len ; i++){
+ var arg = args[i];
+ if(typeof(arg) == 'object' && 'document' in arg){
+ delete arg.wrappedJSObject.GM_Tombloo;
+ delete arg.wrappedJSObject.GM_Tombfix;
+ break;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment