Created
July 1, 2022 10:26
-
-
Save corsonr/cec53e7ca9554c1e5c7bb4ec7e0e08a9 to your computer and use it in GitHub Desktop.
Make iDoneThis URLs Clickable on Calendar View
This file contains 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 iDoneThis - Make URLs clickable | |
// @version 0.1 | |
// @description Make URLs clickable on iDoneThis | |
// @author Remi Corson | |
// @match https://app.idonethis.com/*/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// ==/UserScript== | |
'use strict'; | |
// Get Indicators | |
const indicators = document.querySelectorAll('.indicator'); | |
indicators.forEach(indicator => { | |
indicator.addEventListener('click', () => { | |
makeUrlClickable(); | |
}); | |
}); | |
function makeUrlClickable() { | |
// Get dones | |
const dones = document.querySelectorAll("div.entry-body"); | |
dones.forEach(done => { | |
console.log('done: ', done.innerText); | |
done.innerHTML = done.innerHTML.replace(/(\s)(https:\/\/[^\s]+)(\s)/g, '$1<a href="$2">$2</a>$3'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment