userscripts
Scripts
- Better Opennet script - 0.1.1
- Better habr script - 0.4.0
- Better rezka script - 1.1.0
- Media Speed - 0.1.6
- Obsidian Markdown tools script - 0.0.1
- Pikabu tabs - 0.0.1
Usefull links
- https://wiki.greasespot.net/Metadata_Block
- https://www.tampermonkey.net/documentation.php#_match
- https://openuserjs.org/
- https://greasyfork.org/
- https://simply-how.com/enhance-and-fine-tune-any-web-page-the-complete-user-scripts-guide#section-3
Styles
- 4pda style - 0.1.0
- acomics style - 0.0.1
- adme style - 0.0.2
- dcealopez style - 0.0.1
- feedly style - 0.0.1
- free-freecell-solitair style - 0.0.1
- free-play-sudoku style - 0.0.1
- github style - 0.0.1
- kinopoisk style - 0.0.1
- rezka style - 0.1.6
- rollbar style - 0.0.1
- seasonvar style - 1.1.0
- tprogger style - 0.0.1
- whatsapp style - 0.0.1
- youtube style - 0.2.0
Usefull links
- https://github.com/openstyles/stylus/wiki/Usercss
- https://github.com/openstyles/stylus/wiki/Writing-UserCSS
How to add new scripts and styles:
For making template Cookiecutter is used. Install cookiecutter and make new template:
pip install cookiecutter
or
pipx install cookiecutter
References:
- https://cookiecutter.readthedocs.io/en/stable/overview.html
- https://github.com/audreyfeldroy/cookiecutter-pypackage
Create new script
Workflow with styles
$ make user_script
name [Custom Script]: some site
slug [some_site]:
namespace [ilyachch/userscripts/user_scripts]:
version [0.0.1]:
description [Custom Script - some site]:
license [MIT]:
repository_name [ilyachch/userscripts]:
author [ilyachch (https://github.com/ilyachch/userscripts)]:
Select run_at:
1 - document-end
2 - document-start
3 - document-body
4 - document-idle
5 - context-menu
Choose from 1, 2, 3, 4, 5 [1]:
match [*://*/*]:
icon []:
noframes [False]:
unwrap [False]:
antifeature_ads [False]:
antifeature_tracking [False]:
antifeature_miner [False]:
separate_css [False]: True
This will create a folder with the name some_site
and a files some_site.user.js
, some_site.user.css
in it:
userscripts/some_site/
├── some_site.user.css
└── some_site.user.js
// ==UserScript==
// @name some site script
// @namespace ilyachch/userscripts
// @version 0.0.1
// @description Custom Script - some site
// @author ilyachch (https://github.com/ilyachch/userscripts)
// @homepageURL https://github.com/ilyachch/userscripts
// @source https://github.com/ilyachch/userscripts/blob/main/userscripts/some_site/some_site.user.js
// @supportURL https://github.com/ilyachch/userscripts/issues
// @updateURL https://raw.githubusercontent.com/ilyachch/userscripts/main/userscripts/some_site/some_site.user.js
// @downloadURL https://raw.githubusercontent.com/ilyachch/userscripts/main/userscripts/some_site/some_site.user.js
// @license MIT
// @run-at document-end
// @match *://*/*
// @resource styles https://raw.githubusercontent.com/ilyachch/userscripts/main/userscripts/some_site/some_site.user.css
// @grant GM_addStyle
// @grant GM_getResourceText
// ==/UserScript==
// https://github.com/greasemonkey/gm4-polyfill
if (typeof GM_addStyle === "undefined") {
GM_addStyle = (aCss) => {
"use strict";
let head = document.getElementsByTagName("head")[0];
if (head) {
let style = document.createElement("style");
style.setAttribute("type", "text/css");
style.textContent = aCss;
head.appendChild(style);
return style;
}
return null;
};
}
if (typeof GM_getResourceText === "undefined") {
fetch(
"https://raw.githubusercontent.com/ilyachch/userscripts/main/userscripts/some_site/some_site.user.css"
).then((response) => response.text().then((styles) => GM_addStyle(styles)));
} else {
const styles = GM_getResourceText("styles");
GM_addStyle(styles);
}
(function () {
"use strict";
// Your code here...
})();
Workflow without styles
$ make user_script
name [Custom Script]: some site
slug [some_site]:
namespace [ilyachch/userscripts/user_scripts]:
version [0.0.1]:
description [Custom Script - some site]:
license [MIT]:
repository_name [ilyachch/userscripts]:
author [ilyachch (https://github.com/ilyachch/userscripts)]:
Select run_at:
1 - document-end
2 - document-start
3 - document-body
4 - document-idle
5 - context-menu
Choose from 1, 2, 3, 4, 5 [1]:
match [*://*/*]:
icon []:
noframes [False]:
unwrap [False]:
antifeature_ads [False]:
antifeature_tracking [False]:
antifeature_miner [False]:
separate_css [False]:
This will create a folder with the name some_site
and a file some_site.user.js
in it:
userscripts/some_site/
└── some_site.user.js
// ==UserScript==
// @name some site script
// @namespace ilyachch/userscripts
// @version 0.0.1
// @description Custom Script - some site
// @author ilyachch (https://github.com/ilyachch/userscripts)
// @homepageURL https://github.com/ilyachch/userscripts
// @source https://github.com/ilyachch/userscripts/blob/main/userscripts/some_site/some_site.user.js
// @supportURL https://github.com/ilyachch/userscripts/issues
// @updateURL https://raw.githubusercontent.com/ilyachch/userscripts/main/userscripts/some_site/some_site.user.js
// @downloadURL https://raw.githubusercontent.com/ilyachch/userscripts/main/userscripts/some_site/some_site.user.js
// @license MIT
// @run-at document-end
// @match *://*/*
// ==/UserScript==
const css = ``
let style = document.createElement('style');
style.innerHTML = css;
document.head.appendChild(style);
(function () {
"use strict";
// Your code here...
})();
Create new style
Common workflow
$ make user_style
name [Custom CSS]: some site
slug [some_site]:
namespace [ilyachch/userscripts]:
version [0.0.1]:
description [Custom CSS - some site]:
license [MIT]:
Select preprocessor:
1 - default
2 - uso
3 - less
4 - stylus
Choose from 1, 2, 3, 4 [1]:
repository_name [ilyachch/userscripts]:
update_url [https://raw.githubusercontent.com/ilyachch/userscripts/main/usercss/some_site/some_site.user.css]:
author [ilyachch (https://github.com/ilyachch/userscripts)]:
Select filter_by:
1 - domain
2 - url
3 - url-prefix
4 - regexp
Choose from 1, 2, 3, 4 [1]:
This will create a folder with the name some_site
and a file some_site.user.css
in it:
usercss/some_site/
└── some_site.user.css
/* ==UserStyle==
@name some site style
@namespace ilyachch/userscripts/styles
@version 0.0.1
@description Custom CSS - some site
@author ilyachch (https://github.com/ilyachch/userscripts)
@homepageURL https://github.com/ilyachch/userscripts
@supportURL https://github.com/ilyachch/userscripts/issues
@updateURL https://raw.githubusercontent.com/ilyachch/userscripts/main/usercss/some_site/some_site.user.css
@license MIT
@preprocessor default
==/UserStyle== */
@-moz-document domain("some_site") {
/* Your CSS goes here */
}
You should change author
while creating a new style. Also you should change domain("some_site")
.
Quick workflow
Command:
$ name=some_site make simple_user_style
This will create a folder with the name some_site
and a file some_site.user.css
in it:
usercss/some_site/
└── some_site.user.css
/* ==UserStyle==
@name some_site style
@namespace ilyachch/userscripts/styles
@version 0.0.1
@description Custom CSS - some_site
@author ilyachch (https://github.com/ilyachch/userscripts)
@homepageURL https://github.com/ilyachch/userscripts
@supportURL https://github.com/ilyachch/userscripts/issues
@updateURL https://raw.githubusercontent.com/ilyachch/userscripts/main/usercss/some_site/some_site.user.css
@license MIT
@preprocessor default
==/UserStyle== */
@-moz-document domain("some_site") {
/* Your CSS goes here */
}
You should change @author
and domain("some_site")
.
Renew README
make readme
this will update README.md
with new scripts and styles links.