diff --git a/README.md b/README.md index f7091b4..35e090f 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,41 @@ TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.) # Scripts + ### BAS Quick Search -| Filename | Name | Description | Auto Update | -| --- | --- | --- | :-: | -| [bas-search.user.js](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/bas-search.user.js) | BAS Quick Search | Show a textbox on `Alt` + `/` key press and redirect to Cereweb search on Enter key press. Supports group search with "g:" prefix and accounts if you use no prefix or "a:" prefix. | ✅ | -| [fuglane.user.js](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/fuglane.user.js) | Fuglane - Issue links | Replace NTNU issue numbers, change numbers and upn's with clickable links to TopDesk | ✅ | -| [innsida-search.user.js](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/innsida-search.user.js) | Innsida Quick Search | `alt` + `/` to search on Innsida | ✅ | -| [topdesk.user.js](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/topdesk.user.js) | TopDesk - Copy Issuenumber | Copies the issue number if you click it in TopDesk | ✅ | -| [yr.user.js](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/yr.user.js) | YR.no - Hotkeys | Navigate the yr.no navbar using `Ctrl` + `←` and `Ctrl` + `→`. Navigate to 21-day forecast, radar map or daily table view using `Alt` + `L`, `Alt` + `R` or `Alt` + `V`. | ✅ | + - **Install:** [![](https://img.shields.io/badge/bas--search.user.js-1.4.3-blue.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/bas-search.user.js) + - **Author:** Øyvind Nilsen (on@ntnu.no) + - **Match:** `https://bas.ntnu.no/*` + - **Description:** Show a textbox on `Alt` + `/` key press and redirect to Cereweb search on Enter key press. Supports group search with "g:" prefix and accounts if you use no prefix or "a:" prefix. + ### Fuglane - Issue links + + - **Install:** [![](https://img.shields.io/badge/fuglane.user.js-1.3.1-blue.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/fuglane.user.js) + - **Author:** on@ntnu.no + - **Match:** `https://fuglane.it.ntnu.no/*` + - **Description:** Replace NTNU issue numbers, change numbers and upn's with clickable links to TopDesk + ### Innsida Quick Search + + - **Install:** [![](https://img.shields.io/badge/innsida--search.user.js-1.0.3-blue.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/innsida-search.user.js) + - **Author:** Øyvind Nilsen (on@ntnu.no) + - **Match:** `https://innsida.ntnu.no/*` + - **Description:** `alt` + `/` to search on Innsida + ### TopDesk - Copy Issuenumber + + - **Install:** [![](https://img.shields.io/badge/topdesk.user.js-1.1.0-blue.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/topdesk.user.js) + - **Author:** Øyvind Nilsen (on@ntnu.no) + - **Match:** `https://hjelp.ntnu.no/*` + - **Description:** Copies the issue number if you click it in TopDesk + ### YR.no - Hotkeys + + - **Install:** [![](https://img.shields.io/badge/yr.user.js-1.2.1-blue.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/yr.user.js) + - **Author:** on@ntnu.no + - **Match:** `https://www.yr.no/*` + - **Description:** Navigate the yr.no navbar using `Ctrl` + `←` and `Ctrl` + `→`. Navigate to 21-day forecast, radar map or daily table view using `Alt` + `L`, `Alt` + `R` or `Alt` + `V`. # How to use 1. Install the TamperMonkey extension for your browser -2. Click on the script you want to install (in the list above) +2. Click on the ![](https://img.shields.io/badge/Install-Link-blue.svg) for the script you want to install (in the list above) 3. TamperMonkey should open and ask you to install the script # Contribute diff --git a/ReadmeTemplate.md b/ReadmeTemplate.md index a6ecd3d..d8ac8b4 100644 --- a/ReadmeTemplate.md +++ b/ReadmeTemplate.md @@ -7,7 +7,7 @@ TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.) # How to use 1. Install the TamperMonkey extension for your browser -2. Click on the script you want to install (in the list above) +2. Click on the ![](https://img.shields.io/badge/Install-Link-blue.svg) for the script you want to install (in the list above) 3. TamperMonkey should open and ask you to install the script # Contribute diff --git a/generate-readme.ps1 b/generate-readme.ps1 index a657981..866cfb2 100644 --- a/generate-readme.ps1 +++ b/generate-readme.ps1 @@ -6,11 +6,7 @@ $userJsFiles = Get-ChildItem -Path $UserScripts -Filter "*.user.js" | Sort-Objec $regEx = [regex]'\/\/\s+@(\w+)\s+(.+)' -# Initialize an array to hold the table rows -$tableRows = @() - -$tableRows = "`n| Filename | Name | Description | Auto Update |`n" -$tableRows += "| --- | --- | --- | :-: |`n" +$scriptList = @() # Loop through each file foreach ($file in $userJsFiles) { @@ -20,7 +16,10 @@ foreach ($file in $userJsFiles) { $i = 0 $endOfCommentBlock = $false $autoUpdate = $false - $name = "" + $name = $file.Name + $version = "Beta" + $author = "" + $match = "" $description = "" do { @@ -36,6 +35,12 @@ foreach ($file in $userJsFiles) { $description = $value } elseif ($key -eq 'updateURL') { $autoUpdate = $true + } elseif ($key -eq 'version') { + $version = $value + } elseif ($key -eq 'author') { + $author = $value + } elseif ($key -eq 'match') { + $match = $value } } @@ -46,18 +51,26 @@ foreach ($file in $userJsFiles) { $i++ } while (($i -lt $content.Length) -and (-not $endOfCommentBlock)) + $endOfCommentBlock = $false + if ($autoUpdate) { $autoUpdateText = "✅" } else { $autoUpdateText = "" } - # Add the row to the table - $tableRows += "| [$($file.Name)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/$($file.Name)) | $name | $description | $autoUpdateText |`n" + $scriptList += " ### $name`n`n" + $scriptList += " - **Install:** " + $scriptList += New-MDImage -Subject "$($file.Name)" -Status "$version" -Color blue -Link "https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/$($file.Name)" + if ($author) { + $scriptList += "`n - **Author:** $author`n" + } + $scriptList += " - **Match:** ``$match```n" + $scriptList += " - **Description:** $description`n" } #$tableRows | ForEach-Object { Write-Output $_ } $template = Get-Content .\ReadmeTemplate.md -$template -replace '{scriptlist}', $tableRows \ No newline at end of file +$template -replace '{scriptlist}', $scriptList \ No newline at end of file