Created
November 2, 2018 02:43
-
-
Save Alger23/4db4830283fc356eadaeb89359b31b1a to your computer and use it in GitHub Desktop.
Greasemonkey template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Greasemonkey Script Name | |
| // @author Your name | |
| // @namespace http://www.example.url/to/your-web-site/ | |
| // @description Put a good description in here | |
| // @license Creative Commons Attribution License | |
| // @version 0.1 | |
| // @include http://www.example.org/* | |
| // @released 2006-04-17 | |
| // @updated 2006-04-19 | |
| // @compatible Greasemonkey | |
| // ==/UserScript== | |
| /* | |
| * This file is a Greasemonkey user script. To install it, you need | |
| * the Firefox plugin "Greasemonkey" (URL: http://greasemonkey.mozdev.org/) | |
| * After you installed the extension, restart Firefox and revisit | |
| * this script. Now you will see a new menu item "Install User Script" | |
| * in your tools menu. | |
| * | |
| * To uninstall this script, go to your "Tools" menu and select | |
| * "Manage User Scripts", then select this script from the list | |
| * and click uninstall :-) | |
| * | |
| * Creative Commons Attribution License (--> or Public Domain) | |
| * http://creativecommons.org/licenses/by/2.5/ | |
| */ | |
| (function(){ | |
| //object constructor | |
| function example(){ | |
| // modify the stylesheet | |
| this.append_stylesheet('body,div { border: 1px solid red; }'); | |
| }; | |
| //create a stylesheet | |
| example.prototype.append_stylesheet = function(css){ | |
| var styletag = document.createElement("style"); | |
| styletag.setAttribute('type', 'text/css'); | |
| styletag.setAttribute('media', 'screen'); | |
| styletag.appendChild(document.createTextNode(css)); | |
| document.getElementsByTagName('head')[0].appendChild(styletag); | |
| }; | |
| //instantiate and run | |
| var example = new example(); | |
| })(); | |
| // you can completely copy this template, including | |
| // the install description, have fun! :-) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Script name | |
| // @description Description | |
| // @namespace https://yourwebsite.com | |
| // @version 0.1.0 | |
| // @author Your name | |
| // @license MIT | |
| // @released 2018-11-01 | |
| // @updated 2018-11-01 | |
| // @match *://example.com/* | |
| // @match *://www.example.com/* | |
| // @grant GM_addStyle | |
| // @run-at document-start | |
| // ==/UserScript== | |
| (() => { | |
| 'use strict'; | |
| // before the DOM has loaded | |
| document.addEventListener('DOMContentLoaded', e => { | |
| // after the DOM has loaded | |
| // silently fails in Firefox if placed outside when `document-start` | |
| GM_addStyle('body { background: hotPink }'); | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment