Created
June 18, 2023 03:45
-
-
Save MorrowM/a1ad618bb5e5ea2514e45ead6077b111 to your computer and use it in GitHub Desktop.
Better logo for dark mode on the Haskell Discourse instance
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 Haskell Discourse Dark Mode Logo | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Better dark mode logo for Haskell Discourse instance. | |
// @author Morrow | |
// @match https://discourse.haskell.org/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// ==/UserScript== | |
function waitForElm(selector) { | |
return new Promise(resolve => { | |
if (document.querySelector(selector)) { | |
return resolve(document.querySelector(selector)); | |
} | |
const observer = new MutationObserver(mutations => { | |
if (document.querySelector(selector)) { | |
resolve(document.querySelector(selector)); | |
observer.disconnect(); | |
} | |
}); | |
observer.observe(document.body, { | |
childList: true, | |
subtree: true | |
}); | |
}); | |
} | |
let svg = '<svg xmlns="http://www.w3.org/2000/svg" alt="Haskell Community" id="site-logo" class="logo-big" width="512" height="80" viewBox="0 0 512.00001 80"><g fill-opacity=".937" fill="#ddd"><path d="M188.778 3.424v74.198h-20.39V48.57h-24.89v29.05h-20.39V3.424h20.39v27.38h24.89V3.424h20.39zm26.79 75.243q-4.078 0-7.634-1.36-3.555-1.357-6.17-3.657-2.51-2.403-3.973-5.643-1.46-3.24-1.46-7.002 0-4.18 1.78-7.628 1.78-3.45 4.92-5.957 3.14-2.508 7.43-3.867 4.39-1.358 9.62-1.358 6.7 0 11.09 2.09v-1.672q0-3.867-2.3-5.748-2.19-1.88-7.21-1.88-4.7 0-8.68 1.566-3.97 1.47-8.36 4.39l-5.75-12.33q10.876-7 24.78-7 13.177 0 20.288 5.86 7.11 5.86 7.11 17.56v10.66q0 2.82 1.05 3.97 1.05 1.05 3.77 1.26v16.72q-2.72.52-5.126.73-2.407.32-4.29.32-5.332 0-8.156-1.88-2.72-1.98-3.56-5.75l-.42-1.98q-3.66 4.71-8.47 7.21-4.81 2.41-10.25 2.41zm5.96-14.213q1.778 0 3.66-.522 1.882-.628 3.346-1.568 1.15-.836 1.883-1.777.732-1.045.732-2.09v-4.075q-1.78-.627-3.87-1.045-2.1-.418-3.77-.418-3.66 0-6.07 1.77t-2.41 4.49q0 2.3 1.78 3.76 1.88 1.46 4.7 1.46zm65.41 14.213q-3.45 0-7.424-.523-3.974-.522-7.843-1.358-3.76-.836-7.32-1.986-3.55-1.254-6.16-2.717l7.64-13.48q5.75 3.03 10.98 4.597 5.23 1.568 9.73 1.568 5.23 0 5.23-2.613 0-1.36-2.09-2.404-2.09-1.04-7.94-2.5-5.85-1.56-9.83-3.13-3.97-1.56-6.37-3.45-2.41-1.98-3.45-4.28-1.05-2.4-1.05-5.54 0-4.18 1.674-7.73 1.777-3.55 4.914-6.16 3.136-2.61 7.423-3.97 4.39-1.46 9.515-1.46 5.544 0 11.82 1.57 6.38 1.57 12.965 4.6l-7.64 12.63q-5.86-2.72-9.728-3.87-3.87-1.25-7.43-1.25-2.3 0-3.763.73-1.36.63-1.36 2.09 0 .84.42 1.47.42.52 1.47 1.044 1.05.523 2.83 1.15 1.88.523 4.6 1.15 6.275 1.567 10.56 3.344 4.29 1.68 6.8 3.77 2.613 1.99 3.66 4.6 1.15 2.51 1.15 5.85 0 8.47-6.484 13.38-6.38 4.92-17.465 4.92zm66.962-1.045l-12.445-20.065-3.973 4.39V77.62h-19.87V1.332h19.87v41.7l14.64-20.38h20.914l-18.928 24.036 20.81 30.934h-21.02z"/><path d="M402.905 78.667q-7.215 0-12.862-2.195-5.647-2.3-9.516-6.166-3.764-3.866-5.75-8.883-1.988-5.016-1.988-10.555 0-5.956 1.88-11.286 1.98-5.33 5.75-9.3 3.87-3.972 9.41-6.27 5.64-2.405 13.07-2.405 7.32 0 12.97 2.404 5.64 2.3 9.41 6.27 3.87 3.87 5.75 9.1 1.98 5.12 1.98 10.77 0 1.57-.21 3.24-.11 1.57-.32 2.82H393.9q.315 4.39 3.243 6.38 2.927 1.88 6.377 1.88 3.25 0 6.07-1.46 2.93-1.46 3.87-4.07l16.84 4.81q-3.344 6.59-10.35 10.77-6.902 4.18-17.045 4.18zm8.784-34.382q-.53-3.97-2.93-6.27-2.41-2.3-6.17-2.3-3.77 0-6.17 2.3t-2.93 6.27h18.19zm27.54-42.952h19.86v53.09q0 6.27 5.12 6.27 1.25 0 2.72-.42 1.46-.417 2.72-1.15l2.51 15.99q-3.56 1.673-8.06 2.613-4.39.94-8.37.94-7.95 0-12.24-4.075-4.29-4.07-4.29-11.8V1.34zm37.98 0h19.87v53.09q0 6.27 5.12 6.27 1.25 0 2.72-.42 1.46-.417 2.72-1.15l2.51 15.99q-3.56 1.673-8.06 2.613-4.39.94-8.37.94-7.95 0-12.23-4.075-4.29-4.07-4.29-11.8V1.34z"/></g><path d="M1.842 77.722L26.586 40.63 1.842 3.537H20.4L45.144 40.63 20.4 77.722H1.842zm0 0" fill="#453a62"/><path d="M86.384 56.085L78.136 43.72h28.868v12.366h-20.62zM74.012 37.54l-8.248-12.365h41.24V37.54H74.012zm0 0" fill="#8f4e8b"/><path d="M26.586 77.722L51.33 40.63 26.586 3.537h18.558L94.63 77.722H76.074L60.61 54.54 45.143 77.722H26.586zm0 0" fill="#5e5086"/></svg>'; | |
waitForElm('#site-logo').then((logo) => { | |
logo.parentNode.innerHTML = svg; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment