
Script for Me troch yobukodori
A tiny userscript manager. Injects JavaScript code (and CSS code) into a page. A simple wrapper for the browser.contentScripts API. Works on Android as well as on PC. ウェブページにスクリプト(CSSも可)を注入する拡張機能。browser.contentScripts APIの単純なラッパー。Androidでも機能します。
EksperiminteelEksperiminteel
Beskikber yn Firefox foar Android™Beskikber yn Firefox foar Android™
34 brûkers34 brûkers
Metadata útwreiding
Skermôfbyldingen


Oer dizze útwreiding
A tiny userscript manager. Injects JavaScript code (and CSS code) into a page. A simple wrapper for the browser.contentScripts API. Works on Android as well as on PC.
Usage
See the screenshot.
Usage
See the screenshot.
- Enable at startup: Enable this feature when the browser is started.
- Print debug info: Output debug information at the bottom of the Options tab.
- Add line numbers: Add line numbers to script resource.
- Theme: Select a color theme for the settings page. As soon as you select a theme, it will be reflected in the settings page, but only temporarily. Apply or Save as needed.
- Script Resource: Scripts to inject.    - Script Resource must not begin with a non-directive line, such as a blank line. Always start with a specific directive line.
- Each script begins with the //matches directive.
 The //matches directive specifies a comma-separated list of URL patterns for the pages where you want to inject the script.
 If the //matches directive are omitted, then*://*/*is used as the default value.
 //matches https://www.google.com/*, https://github.com/*
 //js
 (function(){/* code for google.com and github.com */})();
 //js
 (function(){/* code for any webpage */})();
- The //exclude directive specifies a comma-separated list of URL patterns to exclude from code injection.//matches *://*/*
 //exclude *://github.com/yobukodori*,*://yobukodori.github.io/*
 //js
 alert("Come on-a my house");
- The //option directive specifies a comma-separated list of tokens. The following tokens are available.  
 e.g.//option page, all, start
 nonce: SetstruetowrapCodeInScriptTagandnonce.
 page: SetstruetowrapCodeInScriptTag.
 all: SetstruetoallFrames.
 blank: SetstruetomatchAboutBlank.
 start: Setsdocument_starttorunAt.
 end: Setsdocument_endtorunAt.
 See the following //options directive for options.
- The //options directive sets various options. (Optional)
 //options
 {
 "css": [{"code":"body{background-color:red;}"}],
 "runAt": "document_end",
 "wrapCodeInScriptTag": true
 }
 wrapCodeInScriptTag is a Script For Me specific option. If its value is true, the code is wrapped in a script tag and executed. Then you can access the variables defined by page script.
 Internally convert it to the following code and execute it.
 (function() {
 let e = document.createElement("script");
 e.append(<your code>);
 e.nonce = <nonce value>; // Set if nonce option is true.
 document.documentElement.appendChild(e);
 e.remove();
 })();
 For example, twitter.com restricts script execution with Content Security Policy nonce-source. To run code in the context of a page script:
 //name xhr logger
 //matches *://twitter.com/*
 //; The next option should be 'nonce'. Specifying 'page' will fail.
 //option nonce
 //js
 XMLHttpRequest.prototype.open = new Proxy(XMLHttpRequest.prototype.open, {
 apply: function(target, thisArg, args ) {
 console.log(args[0], args[1]);
 return Reflect.apply(target, thisArg, args);
 }
 });
 You can also use comment style or comma expression style so that it will not cause an error when executed as javascript.
 //options
 /* { "wrapCodeInScriptTag": true } */
 or
 //options
 0, { "wrapCodeInScriptTag": true }
- Content scripts and Page scripts
 See Content script environment.
 This add-on executes the code as a content scripts.
 To execute the code in the context of a page scripts, inject a script tag that wraps the code. The option wrapCodeInScriptTag does this for you.
 Without wrapCodeInScriptTag option
 [advantage]
 - Can execute external script file specified in the //js section without CSP restrictions.
- Can read cross-origin resources with xhr/fetch without CORS restrictions.
 - Can't access the variables/functions/objects, etc. defined by the page script.
 
 You can access the variables/functions/objects, etc. defined by the page scripts. However, the above restrictions of CSP and CORS will apply.
- The //css directive injects CSS code to page.  //name No image
 //matches *://*/*
 //css
 img, background-image {
 display: none !important;
 }
 If you use the //css directive, you can omit the //js directive.
- Finally, write the code with the //js directive. 
 [NOTE] Doesn't check the syntax of the code, so please paste the code that has been tested to work.
 //js
 (function(){
 alert("hello");
 })();
- Simply write the URL and you can execute the script.
 This add-on itself reads the script from the URL and executes the loaded code.//js
 https://yobukodori.github.io/foo.js
- //module directive and //require directive
 //module: define module.
 //require: import module or external script file. Can import multiple modules.
 //module libA
 //js
 function foo(){ return "Hello"; }
 function bar(){ return " from"; }
 //module libB
 //js
 function baz(){ return " Script for Me"; }
 //matches httpss://www.google.com/
 //require libA, libB, https://code.jquery.com/jquery-2.2.4.min.js
 //js
 $("body").prepend("<h1>" + foo() + bar() + baz() + "</h1>");
- //#include preprocess-directive replaces this line with the contents of the file at the given url.
 //#include https://yobukodori.github.io/scrip-for-me-resource.js
- Other directives. (Optional)  
 //name: This can be placed before the //matches directive.
 //disable: disable this script. In case you don't use the script but want to keep it.
 //eof: Ignore the lines that follow.
 //[-=*;#]: Comment line. Excluding //#include.
 //name Obsolete script
 //matches https://obsolete.site/*
 //disable
 //js
 (function(){/* code */})();
 //=========================
 //matches *://abitdirtypage.com/*
 //# comment
 //js
 (function(){/* code */})();
 //---------------------------
 //; comment
 //eof
 //matches *://leavemealone.com/*
 
- Go to line: Move the cursor to the specified line.
- Go to script: Move the cursor to the start of each script.
- Select script: Select a code range for each script.
- Save: Save settings and scripts resource. And apply settings and scripts.
- Apply: Apply settings and scripts. (doesn't save).
- Get Status: get current status and applied scripts.
- On enables this feature. Off disables this feature. Or clicking on the syringe icon will bring up a pop-up menu where you can turn it on and off. From this menu you can temporarily turn individual scripts on or off.
- Clear Log: Clear log.
- Export Settings: Export settings to the file. It is the currently applied settings that are exported, not the saved settings.
- Import Settings: Import and apply settings from the file. Do not save.
Wurdearre: 0 troch 0 beoardielers
Tastimmingen en gegevens
Mear ynformaasje
- Add-on-keppelingen
- Ferzje
- 0.2.9
- Grutte
- 39,5 KB
- Lêst bywurke
- 2 jierren lyn (28 feb. 2024)
- Sibbe kategoryen
- Lisinsje
- Mozilla Public License 2.0
- Privacybelied
- It privacybelied foar dizze add-on lêze
- Ferzjeskiednis
- Tafoegje oan kolleksje