Skip to content

Newdoc #7

Merged
merged 5 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ReadmeTemplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 22 additions & 9 deletions generate-readme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -20,7 +16,10 @@ foreach ($file in $userJsFiles) {
$i = 0
$endOfCommentBlock = $false
$autoUpdate = $false
$name = ""
$name = $file.Name
$version = "Beta"
$author = ""
$match = ""
$description = ""

do {
Expand All @@ -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
}
}

Expand All @@ -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
$template -replace '{scriptlist}', $scriptList