Skip to content

Commit

Permalink
moved readme template and generation script to doc dir
Browse files Browse the repository at this point in the history
  • Loading branch information
on committed Oct 3, 2025
1 parent f6c1fca commit 64fac62
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/generate-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
branches: ['main']
paths:
- '**.user.js'
- 'generate-readme.ps1'
- 'ReadmeTemplate.md'
- 'doc/generate-readme.ps1'
- 'doc/ReadmeTemplate.md'
- 'doc/**'

name: Generate Readme
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Generate Readme
shell: pwsh
run: |
./generate-readme.ps1 | Out-File -filePath README.md -Encoding UTF8
./doc/generate-readme.ps1 | Out-File -filePath README.md -Encoding UTF8
git config user.email "m365-bot@ntnu.no"
git config user.name "github-actions[bot]"
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.)

### BAS - Modern Style Toggle

- **Install:** [![](https://img.shields.io/badge/modern--bas.user.js-1.0.13-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/modern-bas/modern-bas.user.js)
- **Install:** [![](https://img.shields.io/badge/modern--bas.user.js-1.0.13-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/modern-bas/modern-bas.user.js)
- **Author:** Øyvind Nilsen (on@ntnu.no)
- **Match:** `https://bas.ntnu.no/*`
- **Exclude:**
Expand All @@ -41,7 +41,7 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.)
- **Description:** Apply modern styling to BAS/Cereweb with toggle between modern and classic
### BAS - Quick Search

- **Install:** [![](https://img.shields.io/badge/bas--search.user.js-1.8.5-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/bas-search/bas-search.user.js)
- **Install:** [![](https://img.shields.io/badge/bas--search.user.js-1.8.5-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/bas-search/bas-search.user.js)
- **Author:** Øyvind Nilsen (on@ntnu.no)
- **Match:** `https://bas.ntnu.no/*`
- **Description:** Quick search using `Ctrl` + `Shift` + `F` hotkey, group search with "g:" and person search with "p:" prefix. Navigate tabs with Ctrl + Left/Right keys. Navigate search results with up and down keys.
Expand All @@ -60,19 +60,19 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.)
![Search GIF](scripts/bas-search/bas-search-lowres.gif)
### Diri.ai - Remove blur

- **Install:** [![](https://img.shields.io/badge/diri.user.js-0.1.1-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/diri/diri.user.js)
- **Install:** [![](https://img.shields.io/badge/diri.user.js-0.1.1-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/diri/diri.user.js)
- **Author:** Øyvind Nilsen (on@ntnu.no)
- **Match:** `https://diri.ai/*`
- **Description:** Sets --blur-xs to 0px instead of 4px for diri.ai
### Feide - Auto-Press Microsoft Sign-In.

- **Install:** [![](https://img.shields.io/badge/feide--microsoft.user.js-1.1.3-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/feide-microsoft/feide-microsoft.user.js)
- **Install:** [![](https://img.shields.io/badge/feide--microsoft.user.js-1.1.3-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/feide-microsoft/feide-microsoft.user.js)
- **Author:** Øyvind Nilsen (on@ntnu.no)
- **Match:** `https://idp.feide.no/simplesaml/module.php/*`
- **Description:** Automatically press the Microsoft sign-in button.
### Fuglane - Issue links

- **Install:** [![](https://img.shields.io/badge/fuglane.user.js-1.3.6-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/fuglane/fuglane.user.js)
- **Install:** [![](https://img.shields.io/badge/fuglane.user.js-1.3.6-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/fuglane/fuglane.user.js)
- **Author:** Øyvind Nilsen (on@ntnu.no)
- **Match:**
- `https://fuglane.it.ntnu.no/display/*`
Expand All @@ -82,25 +82,25 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.)
- **Description:** Replace NTNU issue numbers, change numbers and upn's with clickable links to TopDesk
### Innsida - Custom CSS

- **Install:** [![](https://img.shields.io/badge/innsida--custom--css.user.js-1.2-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/innsida-custom-css/innsida-custom-css.user.js)
- **Install:** [![](https://img.shields.io/badge/innsida--custom--css.user.js-1.2-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/innsida-custom-css/innsida-custom-css.user.js)
- **Author:** Magnus Børnes (magnborn@ntnu.no)
- **Match:** `https://innsida.ntnu.no/*`
- **Description:** Custom CSS and Text Removal for innsida.ntnu.no
### Innsida - Quick Search

- **Install:** [![](https://img.shields.io/badge/innsida--search.user.js-1.2.0-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/innsida-search/innsida-search.user.js)
- **Install:** [![](https://img.shields.io/badge/innsida--search.user.js-1.2.0-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/innsida-search/innsida-search.user.js)
- **Author:** Øyvind Nilsen (on@ntnu.no)
- **Match:** `https://innsida.ntnu.no/*`
- **Description:** `Ctrl` + `Shift` + `F` to search on Innsida
### M365 Admin - PIM Activate Hotkey

- **Install:** [![](https://img.shields.io/badge/m365--admin.user.js-1.0.0-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/m365-admin/m365-admin.user.js)
- **Install:** [![](https://img.shields.io/badge/m365--admin.user.js-1.0.0-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/m365-admin/m365-admin.user.js)
- **Author:** Øyvind Nilsen (on@ntnu.no)
- **Match:** `https://portal.azure.com/*`
- **Description:** `Ctrl` + `Enter` to Activate PIM role instead of having to manually click the `Activate` button.
### TopDesk - Copy Issuenumber

- **Install:** [![](https://img.shields.io/badge/topdesk.user.js-1.2.3-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/topdesk/topdesk.user.js)
- **Install:** [![](https://img.shields.io/badge/topdesk.user.js-1.2.3-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/topdesk/topdesk.user.js)
- **Author:** Øyvind Nilsen (on@ntnu.no)
- **Match:** `https://hjelp.ntnu.no/tas/secure/mango/window/*`
- **Description:** Copies the issue number if you click it in TopDesk or with the hotkey `ctrl` + `alt` + `c`. It copies plain text and a clickable HTML version. So if the place you paste supports HTML, you can paste a clickable link to the issue.
Expand All @@ -109,7 +109,7 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.)
![Demo GIF](scripts/topdesk/topdesk.gif)
### TOPdesk - Highlight Summary

- **Install:** [![](https://img.shields.io/badge/topdesk--highlight--summary.user.js-1.6-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main//home/ubuntu/actions-runner/_work/MonkeyMagic/MonkeyMagic/scripts/topdesk-highlight-summary/topdesk-highlight-summary.user.js)
- **Install:** [![](https://img.shields.io/badge/topdesk--highlight--summary.user.js-1.6-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/scripts/topdesk-highlight-summary/topdesk-highlight-summary.user.js)
- **Author:** Magnus Børnes (magnborn@ntnu.no)
- **Match:** `https://hjelp.ntnu.no/tas/secure/mango/window/*`
- **Description:** Highlight the summary section in a box with a slightly yellow-orange background
Expand Down
File renamed without changes.
14 changes: 8 additions & 6 deletions generate-readme.ps1 → doc/generate-readme.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Define the directory containing the user scripts
$UserScripts = "scripts"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$rootDir = Split-Path -Parent $scriptDir
$UserScripts = Join-Path $rootDir "scripts"

# Get all .user.js files in the scripts subdirectories
$userJsFiles = Get-ChildItem -Path $UserScripts -Filter "*.user.js" -Recurse | Select-Object fullname, name, @{ Name = 'NameTag'; Expression = { $name_tag = ([regex]"@name\s+(.+)").Match((Get-Content $_.fullname -Raw)).Groups[1].value; if ($name_tag -eq "") { $_.name} else { $name_tag } }} | sort NameTag
Expand Down Expand Up @@ -103,7 +105,7 @@ foreach ($file in $userJsFiles) {
$scriptList += " - **Install:** "
if ($autoUpdate) { $color = "green" } else { $color = "blue" }
# Get the relative path from the root, replacing backslashes with forward slashes for URLs
$relativePath = $file.FullName.Replace((Get-Location).Path + "\", "").Replace("\", "/")
$relativePath = $file.FullName.Replace($rootDir + "\", "").Replace("\", "/")
$scriptList += New-MDImage -Subject "$($file.Name)" -Status "$version" -Color $color -Link "https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/$relativePath"
if ($author) {
$scriptList += "`n - **Author:** $author`n"
Expand All @@ -130,15 +132,15 @@ foreach ($file in $userJsFiles) {
$scriptList += " - **Description:** $description`n"

$baseName = $file.Name -replace '\.user\.js$', ''
$scriptDir = Split-Path $file.FullName -Parent
$docFile = Join-Path $scriptDir "$baseName.md"
$currentScriptDir = Split-Path $file.FullName -Parent
$docFile = Join-Path $currentScriptDir "$baseName.md"

if (Test-Path $docFile) {
$scriptList += "`n"
$extraDoc = Get-Content $docFile -Raw

# Replace relative image links with absolute links from the script's subfolder
$relativeScriptPath = $scriptDir.Replace((Get-Location).Path + "\", "").Replace("\", "/")
$relativeScriptPath = $currentScriptDir.Replace($rootDir + "\", "").Replace("\", "/")
# Replace relative image links (simple filenames with common image extensions)
$extraDoc = $extraDoc -replace '\!\[([^\]]+)\]\(([^/)]+\.(gif|png|jpg|jpeg|webp|svg))\)', "![`$1]($relativeScriptPath/`$2)"

Expand All @@ -149,6 +151,6 @@ foreach ($file in $userJsFiles) {

}

$template = Get-Content .\ReadmeTemplate.md
$template = Get-Content (Join-Path $scriptDir "ReadmeTemplate.md")
$template = $template -replace '{content_list}', $content_list
$template -replace '{scriptlist}', $scriptList

0 comments on commit 64fac62

Please sign in to comment.