From e9be7b5aa3b354a3cedd7af0ab6d1c4aef01ee1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Andreas=20Nilsen?= Date: Fri, 3 Oct 2025 10:10:52 +0200 Subject: [PATCH] moved individual script doc location to their subfolders --- README.md | 12 ++++++------ generate-readme.ps1 | 12 ++++++++---- {doc => scripts/bas-search}/bas-search-lowres.gif | Bin {doc => scripts/bas-search}/bas-search.md | 0 {doc => scripts/topdesk}/topdesk.gif | Bin {doc => scripts/topdesk}/topdesk.md | 0 6 files changed, 14 insertions(+), 10 deletions(-) rename {doc => scripts/bas-search}/bas-search-lowres.gif (100%) rename {doc => scripts/bas-search}/bas-search.md (100%) rename {doc => scripts/topdesk}/topdesk.gif (100%) rename {doc => scripts/topdesk}/topdesk.md (100%) diff --git a/README.md b/README.md index 6c424fd..10e9c5a 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.) - On the login page, the username field is automatically focused. #### Video: -![Search GIF](doc/bas-search-lowres.gif) +![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/scripts/diri/diri.user.js) @@ -106,7 +106,7 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.) - **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. -![Demo GIF](doc/topdesk.gif) +![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/scripts/topdesk-highlight-summary/topdesk-highlight-summary.user.js) @@ -122,7 +122,7 @@ TamperMonkey scripts to improve sites (Fuglane, Innsida etc.) git clone git@git.ntnu.no:M365-Drift/MonkeyMagic.git cd MonkeyMagic ``` -2. Pull the latest changes. (Important since the README.md is generated) +2. If there have been made changes in the repository after you cloned it you should pull the latest changes. (Important since the README.md is auto generated) ```bash git pull ``` @@ -137,8 +137,8 @@ git pull ## Advanced Contribution ### Auto Update -To enable auto update of your UserScript, you need to add the following lines (change the filename to your filename) to the top of your script. This will make TamperMonkey check for updates every 24 hours. +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/bas-search.user.js -// @downloadURL https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/bas-search.user.js +// @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 ``` diff --git a/generate-readme.ps1 b/generate-readme.ps1 index 7f31233..58e8aa3 100644 --- a/generate-readme.ps1 +++ b/generate-readme.ps1 @@ -130,13 +130,17 @@ 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" - if (Test-Path "doc/$baseName.md") { + if (Test-Path $docFile) { $scriptList += "`n" - $extraDoc = Get-Content "doc/$baseName.md" -Raw + $extraDoc = Get-Content $docFile -Raw - # Replace relative image links with absolute links - $extraDoc = $extraDoc | % { $_ -replace '\!\[(.+)\]\((?!doc\/)(.+)\)', "![`$1](doc/`$2)" } + # Replace relative image links with absolute links from the script's subfolder + $relativeScriptPath = $scriptDir.Replace((Get-Location).Path + "\", "").Replace("\", "/") + # Replace relative image links (simple filenames with common image extensions) + $extraDoc = $extraDoc -replace '\!\[([^\]]+)\]\(([^/)]+\.(gif|png|jpg|jpeg|webp|svg))\)', "![`$1]($relativeScriptPath/`$2)" $scriptList += "`n" $scriptList += $extraDoc diff --git a/doc/bas-search-lowres.gif b/scripts/bas-search/bas-search-lowres.gif similarity index 100% rename from doc/bas-search-lowres.gif rename to scripts/bas-search/bas-search-lowres.gif diff --git a/doc/bas-search.md b/scripts/bas-search/bas-search.md similarity index 100% rename from doc/bas-search.md rename to scripts/bas-search/bas-search.md diff --git a/doc/topdesk.gif b/scripts/topdesk/topdesk.gif similarity index 100% rename from doc/topdesk.gif rename to scripts/topdesk/topdesk.gif diff --git a/doc/topdesk.md b/scripts/topdesk/topdesk.md similarity index 100% rename from doc/topdesk.md rename to scripts/topdesk/topdesk.md