├── .github
└── ISSUE_TEMPLATE
│ └── website-support-request.md
├── .gitignore
├── .ortfo
└── description.md
├── Justfile
├── LICENSE
├── README.md
├── core.js
├── docs
└── index.html
├── google-sheets.js
├── icon.ai
├── icon.png
├── icon128.png
├── icon16.png
├── icon48.png
├── logotype.png
└── manifest.json
/.github/ISSUE_TEMPLATE/website-support-request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Website support request
3 | about: Request support for a new website
4 | title: Add support for …
5 | labels: ''
6 | assignees: gwennlbh
7 |
8 | ---
9 |
10 | **Link to the website you wanna see support for:**
11 |
12 | Please make sure that you:
13 |
14 | - [ ] Checked before if the website is not impossible to implement: see [the other issues](https://github.com/gwennlbh/smooth-cursorify/issues?q=is%3Aissue%20).
15 | - [ ] If I know how to do it, checked that the site does not use a `
6 |
7 | 
8 | 
9 |
10 |
11 |
12 | ## Supported websites
13 | > Please open an issue to request a new website
14 |
15 | * Google Docs (https://docs.google.com/)
16 | * Overleaf (https://www.overleaf.com/)
17 |
18 | ### To be released
19 |
20 | * Google Sheets (https://sheets.google.com/): the cursor is not transitioned, but the border around the active cell is (thanks @JaduaStudios)
21 | * Typst (https://typst.app)
22 | * LeetCode (https://leetcode.com/)
23 |
24 | ## How does it work?
25 |
26 | Some websites use custom rendering engines to edit rich text, instead of relying on `contenteditable` or using a plain `
`/``. When using such custom methods, the cursor is not the native one, and is instead an HTML element, that can be stylized like any other. For example, Google Docs uses a 2-pixels-wide div with a black background to render its cursor.
27 |
28 | Since those cursors are plain HTML elements, they can be **stylized**, that's where this extension comes in.
29 |
30 | The process is simple:
31 |
32 | 1. Find the element
33 | 2. Append `transition: all 80ms` to its style tag
34 |
35 | The problem with this is that methods using the native cursor can't really have them applied: we _can't_ access the system cursor to style it with CSS.
36 |
37 | ## Contribute a new website
38 |
39 | Thanks a lot :)
40 |
41 | For an example of what adding support for a new site looks like: https://github.com/gwennlbh/smooth-cursorify/commit/9aeaf6faf9e6c2edbbcd7194660b6faedc7d893e
42 |
43 | 1. Find the HTML element that shows the cursor:
44 | 1. open the dev tools / inspect element
45 | 2. find the element that represents the cursor
46 | 2. Add the pages where the cursor exists in manifest.json `content_scripts` > `matches`. For example, if the site you're adding support for has cursors in `https://example.com/document/....`, add `"https://example.com/document/*"` to the `matches` array.
47 | 3. Add your [CSS Selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) for the element you found after all the others, in `core.js`
48 | 4. Mention the website in the README.md file alongside others in the "Not released yet" section
49 | 4. Create a pull request with your changes
50 |
51 |
52 | ## Manual installation
53 | If you want to install this extension manually:
54 |
55 | 1. Download this repository
56 | 2. Load the extension
57 | * On Firefox:
58 | 1. Open
59 | 2. Click "This Firefox"
60 | 3. Click "Load temporary addon"
61 | 4. Navigate to the repository's folder and select the `manifest.json` file.
62 | * On Chrome:
63 | 1. Open
64 | 2. Toggle on "Developer mode"
65 | 3. Click "Load unpacked extension"
66 | 4. Select the repository's folder
67 |
--------------------------------------------------------------------------------
/core.js:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Add your selectors here!
4 | * How to:
5 | * - "your selector" for a selector that will be applied on all sites
6 | * - ["your selector", "example.com"] for a selector that will be applied only on example.com. Useful if your selector is not that specific and could create weird effects on other sites.
7 | */
8 |
9 | declareStyles([
10 | // Monaco: Leetcode, and probably others
11 | ".monaco-editor .cursor",
12 | // Codemirror: Typst, Codepen
13 | ".cm-cursorLayer .cm-cursor",
14 | ".cm-cursorLayer .cm-fat-cursor", // Vim normal mode cursor
15 | ".CodeMirror-cursors .CodeMirror-cursor",
16 | // Kix: Google Docs
17 | [".kix-cursor", "docs.google.com"],
18 | // ACE: Overleaf
19 | ".ace_cursor_layer .ace_cursor",
20 | ])
21 |
22 | function declareStyles(selectors) {
23 | console.log("SmoothCursorify: Adding styles...", selectors)
24 | // Find smooth cursorify style tag
25 | let style = document.head.querySelector(
26 | 'style[data-extension="smoothcursorify"]'
27 | )
28 |
29 | // Create it if it doesn't exist
30 | if (!style) {
31 | style = document.createElement("style")
32 | style.dataset.extension = "smoothcursorify"
33 | document.head.appendChild(style)
34 | }
35 |
36 | for (let selector of selectors) {
37 | // Handle scoped selectors
38 | if (Array.isArray(selector)) {
39 | selector = selector[0]
40 | if (new URL(window.location.href).hostname !== selector[1]) {
41 | continue
42 | }
43 | }
44 |
45 | style.appendChild(
46 | document.createTextNode(
47 | `${selector} { transition: all 80ms ease !important }`
48 | )
49 | )
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
Bookmarklet links〜
2 |
3 |
Google Docs (https://docs.google.com/) ·
4 | bookmarklet