Skip to content

Commit

Permalink
Merge branch 'crazycleanup' of https://git.ntnu.no/M365-Drift/MonkeyM…
Browse files Browse the repository at this point in the history
…agic into crazycleanup
  • Loading branch information
on committed Oct 3, 2025
2 parents 4f129e6 + 625fe61 commit 631aeae
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.)


# Contribute
## Basic Contribution

## Getting Started
1. Clone the repository
```bash
git clone git@git.ntnu.no:M365-Drift/MonkeyMagic.git
Expand All @@ -126,19 +127,45 @@ cd MonkeyMagic
```bash
git pull
```
3. Add your script to the repository
```bash
git add myscript.user.js
git commit -m "Added my script"
git push
```
4. A Github Action will be automatically triggered and generate a new README.md file.

## Advanced Contribution
## Creating Your UserScript

### Hello World Example
Here's a simple hello world UserScript to get you started:

### Auto Update
To enable auto update of your UserScript, you need to add the following lines to the top of your script. Replace `script-folder` and `script-name.user.js` with your actual script folder and filename. This will make TamperMonkey check for updates every 24 hours.
```javascript
// @updateURL https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/script-folder/script-name.user.js
// @downloadURL https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/script-folder/script-name.user.js
// ==UserScript==
// @name Hello World Example
// @namespace https://git.ntnu.no/M365-Drift/MonkeyMagic/
// @version 1.0.0
// @description A simple hello world example
// @author Your Name (your.email@ntnu.no)
// @match https://example.com/*
// @updateURL https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/hello-world/hello-world.user.js
// @downloadURL https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/hello-world/hello-world.user.js
// @grant none
// ==/UserScript==

(function() {
'use strict';
console.log('Hello World from MonkeyMagic!');
alert('Hello World!');
})();
```

### Important Guidelines
- **Namespace**: Always use `https://git.ntnu.no/M365-Drift/MonkeyMagic/` as your namespace
- **Folder Structure**: Create a subfolder under `scripts/` for your script (e.g., `scripts/hello-world/`)
- **Auto Update**: Include `@updateURL` and `@downloadURL` pointing to your script's location in the repository. This enables automatic updates every 24 hours in TamperMonkey.

### Adding Your Script
1. Create a new folder under `scripts/` with your script name
2. Place your `.user.js` file in that folder
3. Add any documentation or media files to the same folder
4. Commit and push your changes:
```bash
git add scripts/your-script-name/
git commit -m "Added your-script-name userscript"
git push
```
5. A GitHub Action will automatically update the README.md file with your script information.

0 comments on commit 631aeae

Please sign in to comment.