From d3b19f71a13e254f7043992107b1155fcc9850ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Andreas=20Nilsen?= Date: Fri, 23 Aug 2024 10:08:54 +0200 Subject: [PATCH 1/4] test new generator --- generate-readme.ps1 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/generate-readme.ps1 b/generate-readme.ps1 index a657981..d8ab03a 100644 --- a/generate-readme.ps1 +++ b/generate-readme.ps1 @@ -6,6 +6,9 @@ $userJsFiles = Get-ChildItem -Path $UserScripts -Filter "*.user.js" | Sort-Objec $regEx = [regex]'\/\/\s+@(\w+)\s+(.+)' + +$scriptList = @() + # Initialize an array to hold the table rows $tableRows = @() @@ -20,7 +23,10 @@ foreach ($file in $userJsFiles) { $i = 0 $endOfCommentBlock = $false $autoUpdate = $false - $name = "" + $name = $file.Name + $version = "Beta" + $author = "" + $match = "" $description = "" do { @@ -36,6 +42,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,13 +58,26 @@ foreach ($file in $userJsFiles) { $i++ } while (($i -lt $content.Length) -and (-not $endOfCommentBlock)) + $endOfCommentBlock = $false + if ($autoUpdate) { $autoUpdateText = "✅" } else { $autoUpdateText = "" } + $scriptList += " ## $name`n`n" + $scriptList += "`n" + $scriptList += " `n" + if ($author) { + $scriptList += " `n" + } + $scriptList += "`n" + $scriptList += "`n" + $scriptList += "
Version$version
Author$author
Match$match
Description$description
`n`n" + + # Add the row to the table $tableRows += "| [$($file.Name)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/$($file.Name)) | $name | $description | $autoUpdateText |`n" } @@ -60,4 +85,4 @@ foreach ($file in $userJsFiles) { #$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 From 6d7126a8d63c6afdf76ba7b30b126abb8338070b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 23 Aug 2024 08:09:41 +0000 Subject: [PATCH 2/4] Generated Readme --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f7091b4..ff6beea 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,51 @@ TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.) # Scripts + ## BAS Quick Search + + + + + + +
Version1.4.3
AuthorØyvind Nilsen (on@ntnu.no)
Matchhttps://bas.ntnu.no/*
DescriptionShow 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 + + + + + + +
Version1.3.1
Authoron@ntnu.no
Matchhttps://fuglane.it.ntnu.no/*
DescriptionReplace NTNU issue numbers, change numbers and upn's with clickable links to TopDesk
+ + ## Innsida Quick Search + + + + + + +
Version1.0.3
AuthorØyvind Nilsen (on@ntnu.no)
Matchhttps://innsida.ntnu.no/*
Description`alt` + `/` to search on Innsida
+ + ## TopDesk - Copy Issuenumber + + + + + + +
Version1.1.0
AuthorØyvind Nilsen (on@ntnu.no)
Matchhttps://hjelp.ntnu.no/*
DescriptionCopies the issue number if you click it in TopDesk
+ + ## YR.no - Hotkeys + + + + + + +
Version1.2.1
Authoron@ntnu.no
Matchhttps://www.yr.no/*
DescriptionNavigate 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`.
-| 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`. | ✅ | # How to use From 42dbe8266d40b99433a4f6cbc9c7fa798f963d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Andreas=20Nilsen?= Date: Fri, 23 Aug 2024 10:24:45 +0200 Subject: [PATCH 3/4] Doc now lists scripts better. (I hope) --- ReadmeTemplate.md | 2 +- generate-readme.ps1 | 24 ++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) 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 d8ab03a..866cfb2 100644 --- a/generate-readme.ps1 +++ b/generate-readme.ps1 @@ -6,15 +6,8 @@ $userJsFiles = Get-ChildItem -Path $UserScripts -Filter "*.user.js" | Sort-Objec $regEx = [regex]'\/\/\s+@(\w+)\s+(.+)' - $scriptList = @() -# Initialize an array to hold the table rows -$tableRows = @() - -$tableRows = "`n| Filename | Name | Description | Auto Update |`n" -$tableRows += "| --- | --- | --- | :-: |`n" - # Loop through each file foreach ($file in $userJsFiles) { # Read the file content @@ -67,19 +60,14 @@ foreach ($file in $userJsFiles) { $autoUpdateText = "" } - $scriptList += " ## $name`n`n" - $scriptList += "`n" - $scriptList += " `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" + $scriptList += "`n - **Author:** $author`n" } - $scriptList += "`n" - $scriptList += "`n" - $scriptList += "
Version$version
Author$author
Match$match
Description$description
`n`n" - - - # 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 += " - **Match:** ``$match```n" + $scriptList += " - **Description:** $description`n" } #$tableRows | ForEach-Object { Write-Output $_ } From aa6d8c122f7ec42cd5012e4ca853b7aa4e55450f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 23 Aug 2024 08:25:37 +0000 Subject: [PATCH 4/4] Generated Readme --- README.md | 77 ++++++++++++++++++++++--------------------------------- 1 file changed, 31 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index ff6beea..35e090f 100644 --- a/README.md +++ b/README.md @@ -3,56 +3,41 @@ TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.) # Scripts - ## BAS Quick Search - - - - - - -
Version1.4.3
AuthorØyvind Nilsen (on@ntnu.no)
Matchhttps://bas.ntnu.no/*
DescriptionShow 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 - - - - - - -
Version1.3.1
Authoron@ntnu.no
Matchhttps://fuglane.it.ntnu.no/*
DescriptionReplace NTNU issue numbers, change numbers and upn's with clickable links to TopDesk
- - ## Innsida Quick Search - - - - - - -
Version1.0.3
AuthorØyvind Nilsen (on@ntnu.no)
Matchhttps://innsida.ntnu.no/*
Description`alt` + `/` to search on Innsida
- - ## TopDesk - Copy Issuenumber - - - - - - -
Version1.1.0
AuthorØyvind Nilsen (on@ntnu.no)
Matchhttps://hjelp.ntnu.no/*
DescriptionCopies the issue number if you click it in TopDesk
- - ## YR.no - Hotkeys - - - - - - -
Version1.2.1
Authoron@ntnu.no
Matchhttps://www.yr.no/*
DescriptionNavigate 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`.
- + ### BAS Quick Search + + - **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