diff --git a/.github/workflows/generate-readme.yml b/.github/workflows/generate-readme.yml index c1cc174..f8cd3fb 100644 --- a/.github/workflows/generate-readme.yml +++ b/.github/workflows/generate-readme.yml @@ -2,8 +2,12 @@ on: workflow_dispatch: push: branches: ['main'] - paths: ['**.user.js', 'generate-readme.ps1', 'ReadmeTemplate.md'] - + paths: + - '**.user.js' + - 'generate-readme.ps1' + - 'ReadmeTemplate.md' + - 'doc/**' + name: Generate Readme jobs: diff --git a/README.md b/README.md index 560c3e5..6c1cd9b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Monkey Magic +# Monkey Magic 🐒🪄 TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.) @@ -9,6 +9,14 @@ TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.) - **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. + ### Feide - Auto-Press Microsoft Sign-In. + + - **Install:** [![](https://img.shields.io/badge/feide--microsoft.user.js-1.0-blue.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/feide-microsoft.user.js) + - **Author:** Øyvind Nilsen (on@ntnu.no) + - **Match:** `https://idp.feide.no/simplesaml/*` + - **Description:** Automatically press the Microsoft sign-in button after a countdown, with options to cancel or trigger manually. + + ![Login GIF](doc/feide-microsoft.gif) ### Fuglane - Issue links - **Install:** [![](https://img.shields.io/badge/fuglane.user.js-1.3.1-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/fuglane.user.js) @@ -27,6 +35,8 @@ TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.) - **Author:** Øyvind Nilsen (on@ntnu.no) - **Match:** `https://hjelp.ntnu.no/*` - **Description:** Copies the issue number if you click it in TopDesk + + ![Demo GIF](doc/topdesk.gif) ### YR.no - Hotkeys - **Install:** [![](https://img.shields.io/badge/yr.user.js-1.2.1-green.svg)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/yr.user.js) diff --git a/doc/feide-microsoft.gif b/doc/feide-microsoft.gif new file mode 100644 index 0000000..60319e0 Binary files /dev/null and b/doc/feide-microsoft.gif differ diff --git a/doc/feide-microsoft.md b/doc/feide-microsoft.md new file mode 100644 index 0000000..13dd8c0 --- /dev/null +++ b/doc/feide-microsoft.md @@ -0,0 +1 @@ +![Login GIF](feide-microsoft.gif) \ No newline at end of file diff --git a/doc/topdesk.gif b/doc/topdesk.gif new file mode 100644 index 0000000..187c332 Binary files /dev/null and b/doc/topdesk.gif differ diff --git a/doc/topdesk.md b/doc/topdesk.md new file mode 100644 index 0000000..0cbb2ad --- /dev/null +++ b/doc/topdesk.md @@ -0,0 +1 @@ +![Demo GIF](topdesk.gif) \ No newline at end of file diff --git a/feide-microsoft.user.js b/feide-microsoft.user.js new file mode 100644 index 0000000..c99d9ba --- /dev/null +++ b/feide-microsoft.user.js @@ -0,0 +1,54 @@ +// ==UserScript== +// @name Feide - Auto-Press Microsoft Sign-In. +// @namespace https://git.ntnu.no/M365-Drift/MonkeyMagic +// @version 1.0 +// @description Automatically press the Microsoft sign-in button after a countdown, with options to cancel or trigger manually. +// @author Øyvind Nilsen (on@ntnu.no) +// @match https://idp.feide.no/simplesaml/* +// @icon https://www.google.com/s2/favicons?sz=64&domain=feide.no +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + const button = document.getElementById('microsoft-signin-button'); + if (!button) return; + + let countdown = 5; + let countdownInterval; + + function updateButtonText() { + button.value = `Use work or school account (${countdown}s)`; + } + + function startCountdown() { + updateButtonText(); + countdownInterval = setInterval(() => { + countdown--; + if (countdown <= 0) { + updateButtonText(); + clearInterval(countdownInterval); + button.click(); + } else { + updateButtonText(); + } + }, 1000); + } + + function stopCountdown() { + clearInterval(countdownInterval); + button.value = 'Use work or school account'; + } + + document.addEventListener('keydown', function(event) { + if (event.key === 'Escape') { + stopCountdown(); + } else if (event.ctrlKey && event.key === 'Enter') { + clearInterval(countdownInterval); + button.click(); + } + }); + + startCountdown(); +})(); \ No newline at end of file diff --git a/generate-readme.ps1 b/generate-readme.ps1 index dd0cfc9..1d0a4be 100644 --- a/generate-readme.ps1 +++ b/generate-readme.ps1 @@ -69,6 +69,20 @@ foreach ($file in $userJsFiles) { } $scriptList += " - **Match:** ``$match```n" $scriptList += " - **Description:** $description`n" + + $baseName = $file.Name -replace '\.user\.js$', '' + + if (Test-Path "doc/$baseName.md") { + $scriptList += "`n" + $extraDoc = Get-Content "doc/$baseName.md" + + # Replace relative image links with absolute links + $extraDoc = $extraDoc -replace '\!\[(.+)\]\((?!doc\/)(.+)\)', '![$1](doc/$2)' + + $scriptList += $extraDoc + $scriptList += "`n" + } + } #$tableRows | ForEach-Object { Write-Output $_ }