Last active
March 24, 2022 19:10
-
-
Save andrewwylde/0973624c0e1ec014561c68a6b28a2117 to your computer and use it in GitHub Desktop.
Why does this not work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Update mailhog links sometimes | |
// @description Update broken Links in mailhog | |
// @author Andrew Wylde <https://codelemur.com/> | |
// @match *localhost:8025* | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0.0 | |
// @updateURL https://gist.github.com/codelemur/0973624c0e1ec014561c68a6b28a2117/raw/update-portal-links.user.js | |
// @downloadURL https://gist.github.com/codelemur/0973624c0e1ec014561c68a6b28a2117/raw/update-portal-links.user.js | |
// @require http://code.jquery.com/jquery-3.4.1.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let hasEdited = false; | |
let intervalRef = setInterval(() => { | |
if (hasEdited) { | |
clearInterval(intervalRef); | |
} else { | |
const correctURL = decodeURIComponent($('#preview-html').contents().find('a:last').prop('textContent').replaceAll('.=','=').replaceAll('=\n','.').replaceAll('-.','-').replaceAll('=3D','=')); | |
$('#preview-html').contents().find('a').attr('href',correctURL); | |
hasEdited = true; | |
} | |
}, 500) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment