@@ -4,9 +4,16 @@ Fork of [hex0cter/js-injector](https://github.com/hex0cter/js-injector) with boo
44
55Chrome extension for injecting javascript to the webpage you are visiting. It can be used as a handy tool to make your surfing a bit of more fun.
66
7+ Useful for custom changes on how you visit a site like blocking some stuff, automation for clicking button and much more..
8+
79Useful for automating email address input and redirection for low timeout sites Okta, AWS ..etc.
810Opening links in new tab by default news.ycombinator.com.
911
12+ Key Features:
13+
14+ 1 . Supports Pattern Based Injection
15+ 2 . Multiple Separate Injection For A Site
16+
1017## Usage
1118
12191 . Open Y Combinator News Link On New Sites
@@ -21,6 +28,50 @@ document
2128 .forEach (e => element .remove ());
2229```
2330
31+ ## Sample Snippets
32+
33+ ### Y Combinator
34+
35+ Open all links in new tab and also allow to toggle collapse the comment section (only first line of that comment).
36+
37+ ``` js
38+
39+ // open all links in new tab.
40+ document .querySelectorAll (' a[href]' ).forEach (a => {
41+ a .setAttribute (' target' , ' _blank' );
42+ });
43+
44+ // allow to hide the comment chain on clicking
45+ // first line/para of the comment.
46+ function onClickHandler (event ) {
47+ let target = event .target ;
48+
49+ if (
50+ target .nodeName === " DIV" &&
51+ target .classList .contains (" commtext" )
52+ ) {
53+ target
54+ .parentElement
55+ .parentElement
56+ .querySelector (" .togg.clicky" )
57+ .click ();
58+ }
59+ }
60+
61+ document .onclick = onClickHandler;
62+ ```
63+
64+ ### WhatsApp
65+
66+ Focus On ` favorites ` section and remove other sections.
67+
68+ ``` js
69+ // focus on favorities only
70+ document .getElementById (' favorites-filter' ).click ();
71+ // remove all other sections
72+ document .querySelector (' div[aria-label="chat-list-filters"]' ).remove ()
73+ ```
74+
2475## License
2576
2677This code is free to use under the terms of the MIT license.
0 commit comments