Skip to content

Commit bba8dca

Browse files
committed
Create a privacy policy
1 parent ffcf4f3 commit bba8dca

File tree

25 files changed

+626
-297
lines changed

25 files changed

+626
-297
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,8 @@ npm run docs:build
7272
## License
7373

7474
MIT. See `LICENSE.txt`.
75+
76+
## Privacy Policy
77+
78+
- Docs page: `https://mrblankcoding.github.io/CodeTweak/guide/privacy`
79+
- Source page: `docs-src/guide/privacy.md`

docs-src/.vitepress/config.mjs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export default defineConfig({
2020
items: [
2121
{ text: 'Getting Started', link: '/guide/getting-started' },
2222
{ text: 'Install CodeTweak', link: '/guide/installation' },
23-
{ text: 'Use the Editor', link: '/guide/editor' },
23+
{ text: 'Using the Editor', link: '/guide/editor' },
24+
{ text: 'Writing Userscripts', link: '/guide/writing-userscripts' },
2425
{ text: 'Manage Scripts', link: '/guide/dashboard' },
2526
{ text: 'Install From Greasy Fork', link: '/guide/greasyfork' },
2627
{ text: 'Privacy and Permissions', link: '/guide/privacy' }
@@ -29,7 +30,17 @@ export default defineConfig({
2930
{
3031
text: 'Reference',
3132
items: [
32-
{ text: 'GM APIs', link: '/reference/gm-apis' },
33+
{
34+
text: 'GM APIs',
35+
link: '/reference/gm-apis',
36+
items: [
37+
{ text: 'Storage & Data', link: '/reference/gm-apis/storage' },
38+
{ text: 'UI & Elements', link: '/reference/gm-apis/ui' },
39+
{ text: 'Network & Clipboard', link: '/reference/gm-apis/network' },
40+
{ text: 'Resources', link: '/reference/gm-apis/resources' },
41+
{ text: 'Advanced & Utility', link: '/reference/gm-apis/advanced' }
42+
]
43+
},
3344
{ text: 'Run Timing', link: '/reference/run-timing' },
3445
{ text: 'Match Patterns', link: '/reference/match-patterns' }
3546
]

docs-src/guide/editor.md

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,44 @@
1-
# Use the Editor
1+
# Using the Editor
22

3-
CodeTweak has two editing modes:
3+
This guide covers the features and workflow of the CodeTweak script editor.
44

5-
- Standard script editor
6-
- AI DOM Editor sidebar
5+
## Opening the Editor
76

8-
## Standard editor workflow
7+
You can access the editor in two ways:
8+
1. **Create a New Script**: Click the **CodeTweak icon** in your browser toolbar and select **Create Script**.
9+
2. **Edit an Existing Script**: Go to the **Dashboard** and click on any script in the list.
910

10-
1. Set metadata.
11-
2. Write script code.
12-
3. Save.
13-
4. Test on a matching URL.
11+
## The Editor Interface
1412

15-
Minimal metadata template:
13+
The editor is split into several key areas:
1614

17-
```javascript
18-
// ==UserScript==
19-
// @name My Script
20-
// @match https://app.example.com/*
21-
// @run-at document-end
22-
// @grant GM_getValue
23-
// @grant GM_setValue
24-
// ==/UserScript==
25-
```
15+
### 1. Code Editor (Center)
16+
The main window where you write your JavaScript and metadata block. It features syntax highlighting, auto-completion, and basic linting.
2617

27-
State example:
18+
### 2. Header & Toolbar (Top)
19+
- **Save**: Saves your script and immediately applies it to matched pages.
20+
- **Settings**: Opens the editor's display and behavior settings.
21+
- **Close**: Closes the editor and returns to the previous view.
2822

29-
```javascript
30-
(async () => {
31-
const count = await GM_getValue("count", 0);
32-
await GM_setValue("count", count + 1);
33-
console.log("runs:", count + 1);
34-
})();
35-
```
23+
### 3. Sidebar Panels (Right)
24+
These panels allow you to configure your script without manually editing the metadata block:
25+
- **Script Info**: Change the script's name, version, and description.
26+
- **Execution Settings**: Manage `@match` patterns and `@run-at` timing.
27+
- **GM API Access**: Toggle permissions for specific `GM_*` APIs.
28+
- **External Resources**: Add `@require` and `@resource` links.
29+
- **Script Errors**: View compilation and runtime errors for the current script.
3630

37-
## AI DOM Editor workflow
31+
## The AI DOM Editor
3832

39-
1. Open popup.
40-
2. Click `AI DOM Editor`.
41-
3. Click `Select Element` in sidebar.
42-
4. Click target element on page.
43-
5. Enter instruction.
33+
The AI DOM Editor is a powerful tool for generating userscript code by simply describing what you want to change on a webpage.
4434

45-
Example instructions:
35+
1. **Open AI Sidebar**: Click **AI DOM Editor** in the popup or from the editor's sidebar.
36+
2. **Select an Element**: Click the **Select Element** button and hover over the element on the page you want to modify.
37+
3. **Describe the Change**: In the text box, describe what you want the AI to do (e.g., "Hide this element" or "Change the background color to blue").
38+
4. **Review and Apply**: The AI will generate code for you. You can review it and click **Apply to Script** to add it to your current userscript.
4639

47-
- `Hide this element`
48-
- `Change this button text to "Checkout"`
49-
- `Add red border to this card`
40+
## Debugging and Testing
5041

51-
Review generated code before saving.
52-
53-
## Common mistakes
54-
55-
- `@match` too broad (`*://*/*`) or too narrow.
56-
- Wrong `@run-at` for the DOM state you expect.
57-
- Missing `@grant` for GM APIs.
42+
- **Live Updates**: When you save a script, it is instantly updated. Refresh the target website to see your changes.
43+
- **Console Logs**: Use `console.log()` in your script and open the browser's DevTools (F12) to see output.
44+
- **Error Highlighting**: If your script has syntax errors, they will be highlighted in the **Script Errors** panel.

docs-src/guide/getting-started.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ console.log("CodeTweak script running");
3939

4040
Next:
4141

42-
- [Use the Editor](/guide/editor)
42+
- [Using the Editor](/guide/editor)
43+
- [Writing Userscripts](/guide/writing-userscripts)
4344
- [Manage Scripts](/guide/dashboard)
4445
- [GM API Reference](/reference/gm-apis)

docs-src/guide/privacy.md

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,60 @@
1-
# Privacy and Permissions
1+
# Privacy Policy
22

3-
CodeTweak runs locally and stores data in extension storage.
3+
Last updated: February 18, 2026
44

5-
## Stored data
5+
CodeTweak is a browser extension for creating and running userscripts. This policy explains what data CodeTweak handles and how it is used.
66

7-
- Userscript code
8-
- Script settings
9-
- Extension settings
7+
## Summary
108

11-
## Permission map
9+
- CodeTweak processes script data locally in your browser.
10+
- CodeTweak does not sell personal information.
11+
- CodeTweak does not run a remote tracking or analytics service.
1212

13-
- `storage`: save scripts/settings
14-
- `scripting`, `webNavigation`: run scripts at chosen timing
15-
- `tabs`: target active tab
16-
- `notifications`: GM/system notifications
17-
- `downloads`: export scripts
18-
- `clipboardWrite`: clipboard support
19-
- `contextMenus`: selector and menu actions
13+
## Data CodeTweak handles
14+
15+
CodeTweak may handle the following data:
16+
17+
- Userscript code and metadata (for scripts you create or import)
18+
- Script execution settings and extension settings
19+
- Stored values written by scripts via supported GM storage APIs
20+
- Limited page context required to decide when scripts should run (for example, current tab URL matching)
21+
22+
## How data is used
23+
24+
Data is used only to provide extension functionality, including:
25+
26+
- Saving and loading scripts and settings
27+
- Matching scripts to pages and run timing
28+
- Running script features such as notifications, clipboard support, and downloads when triggered by you or your scripts
29+
30+
## Data sharing
31+
32+
- CodeTweak itself does not sell or rent user data.
33+
- CodeTweak itself does not transmit extension telemetry for advertising or profiling.
34+
- Network requests can occur when you explicitly import scripts (for example, from Greasy Fork) or when a userscript you installed makes requests using supported APIs. Those requests are initiated by user action or script behavior you control.
35+
36+
## Data retention and deletion
37+
38+
- Data is stored in browser extension storage until you remove it.
39+
- You can delete data by removing scripts/settings in CodeTweak, resetting extension data, or uninstalling the extension.
40+
41+
## Permissions and purpose
42+
43+
- `storage`: save scripts and settings
44+
- `scripting`, `webNavigation`: determine matching pages and run scripts at the selected timing
45+
- `tabs`: target the active tab for editor and execution flows
46+
- `notifications`: show extension or script notifications
47+
- `downloads`: export scripts/files when requested
48+
- `clipboardWrite`: copy text when requested
49+
- `contextMenus`: enable selector/editor context actions
50+
51+
## Third-party content and scripts
52+
53+
Userscripts are third-party code chosen by you. Installed scripts may process page data or make network requests according to their own logic. Review script source and metadata before enabling.
2054

2155
## Security guidance
2256

2357
- Keep `@match` patterns specific.
24-
- Keep `Allow external resources` off unless required.
58+
- Keep external resource loading disabled unless needed.
2559
- Review imported scripts before enabling.
60+
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Writing Userscripts
2+
3+
This guide explains how to write userscripts for CodeTweak, assuming you are already familiar with JavaScript.
4+
5+
## The Metadata Block
6+
7+
Every userscript starts with a metadata block (also known as the userscript header). This block tells CodeTweak when and where to run your script.
8+
9+
```javascript
10+
// ==UserScript==
11+
// @name My Awesome Script
12+
// @namespace https://mrblankcoding.github.io/CodeTweak/
13+
// @version 1.0
14+
// @description Does something amazing
15+
// @author You
16+
// @match https://example.com/*
17+
// @grant GM_setValue
18+
// @grant GM_getValue
19+
// @run-at document-end
20+
// ==/UserScript==
21+
```
22+
23+
### Key Metadata Tags
24+
25+
- **@name**: The name of your script.
26+
- **@match**: Defines the URLs where your script should run. You can use wildcards (e.g., `*`).
27+
- **@run-at**: Controls when the script executes:
28+
- `document-start`: Runs before any DOM is loaded.
29+
- `document-end`: Runs when the DOM is fully loaded.
30+
- `document-idle`: Runs after the page and all resources are loaded.
31+
- **@grant**: Requests access to specific `GM_*` APIs. Use `none` if you don't need any.
32+
- **@require**: Includes external libraries (e.g., jQuery).
33+
34+
## Structuring Your Script
35+
36+
It is best practice to wrap your script in an Immediately Invoked Function Expression (IIFE) to avoid polluting the global scope and to prevent conflicts with the website's own scripts.
37+
38+
```javascript
39+
(function() {
40+
'use strict';
41+
42+
// Your code here
43+
console.log('Script loaded on ' + window.location.href);
44+
45+
const button = document.createElement('button');
46+
button.textContent = 'Click Me';
47+
button.style.position = 'fixed';
48+
button.style.top = '10px';
49+
button.style.right = '10px';
50+
button.onclick = () => alert('Hello from CodeTweak!');
51+
52+
document.body.appendChild(button);
53+
})();
54+
```
55+
56+
## Using GM APIs
57+
58+
CodeTweak provides several APIs to perform tasks that standard web scripts cannot, such as cross-origin requests or persistent storage.
59+
60+
### Persistent Storage
61+
62+
Use `GM_setValue` and `GM_getValue` to store data that persists across page reloads and even browser restarts.
63+
64+
```javascript
65+
// Store a value
66+
GM_setValue('username', 'Alice');
67+
68+
// Retrieve a value
69+
const name = GM_getValue('username', 'Guest');
70+
console.log('Hello, ' + name);
71+
```
72+
73+
### Cross-Origin Requests
74+
75+
Use `GM_xmlhttpRequest` to fetch data from domains other than the one the script is running on.
76+
77+
```javascript
78+
GM_xmlhttpRequest({
79+
method: "GET",
80+
url: "https://api.example.com/data",
81+
onload: function(response) {
82+
console.log(JSON.parse(response.responseText));
83+
}
84+
});
85+
```
86+
87+
## Best Practices
88+
89+
1. **Be Specific with @match**: Only run your script on the pages it is needed for to improve performance and security.
90+
2. **Check for Element Existence**: When manipulating the DOM, always ensure the elements you are looking for exist, especially if using `document-start`.
91+
3. **Use 'use strict'**: Helps catch common coding mistakes.
92+
4. **Minimal @grant**: Only request the permissions you actually use.

docs-src/index.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ hero:
1313
- theme: alt
1414
text: GM API
1515
link: /reference/gm-apis
16+
- theme: alt
17+
text: Privacy Policy
18+
link: /guide/privacy
1619

1720
features:
18-
- title: Fast setup
21+
- title: Clean Workflow
1922
details: Build, load unpacked, and run a script in minutes.
20-
- title: Practical editor
21-
details: Metadata, linting, script logs, and one-click save.
23+
- title: Modern editor
24+
details: Metadata, linting, script logs, built in AI support
2225
- title: GM API support
2326
details: Persistent values, notifications, clipboard, and HTTP requests.
2427
- title: Debug workflow

0 commit comments

Comments
 (0)