Skip to content

Instantly share code, notes, and snippets.

@tdaron
Last active March 4, 2025 09:27
Show Gist options
  • Save tdaron/853e65ee535cf0e9889edd0d270bfdc5 to your computer and use it in GitHub Desktop.
Save tdaron/853e65ee535cf0e9889edd0d270bfdc5 to your computer and use it in GitHub Desktop.
UCLouvain, but better
// ==UserScript==
// @name UCLouvain, but better
// @namespace http://tampermonkey.net/
// @version 2025-03-04
// @description Fix this awful website.
// @author tdaron
// @match https://www.uclouvain.be/*
// @run-at document-start
// @grant none
// @downloadURL https://gist.github.com/tdaron/853e65ee535cf0e9889edd0d270bfdc5/raw/uclouvain.user.js
// @updateURL https://gist.github.com/tdaron/853e65ee535cf0e9889edd0d270bfdc5/raw/uclouvain.user.js
// ==/UserScript==
(function() {
'use strict';
// Create and apply custom CSS styles
const style = document.createElement('style');
style.textContent = `
$ .dialog-off-canvas-main-canvas {
background: hsl(var(--color-blue-nuit-300));
}
$ .widget-actions {
background: none !important;
}
$ .widget_box * {
color: white !important;
}
$ .text_with-html {
-webkit-line-clamp: 6;
}
$ a, $ a:hover, $ .sub-navigation-item__text, $ .sub-navigation-item__text:hover,
$ .language-link:visited, $ #uclouvain_searchengine_results a, $ #uclouvain_searchengine_results a:hover {
color: white !important;
}
$ .dropdown-menu, $ .header-dropdown__head.show {
background: hsl(var(--color-blue-nuit-500));
}
$ .dropdown-menu *, $ .header-dropdown__head.show {
color: white;
}
#edit-search-pattern {
padding: 10px 8px 10px 40px !important;
}
$ .list-group * {
color: white;
background-color: transparent !important;
}
$ .list-group-item {
border-bottom: 1px solid white;
}
$ input {
color: white !important;
}
`.replaceAll("$",".theme-dark");
document.head.appendChild(style);
// Swap the #block-ucl-dashboard-news with its next sibling element
function swapWithFirstSibling(elementId) {
const element = document.getElementById(elementId);
if (element && element.nextElementSibling) {
const sibling = element.nextElementSibling;
element.parentNode.insertBefore(sibling, element);
}
}
// Wait for the DOM to be fully loaded and then swap elements
document.addEventListener("DOMContentLoaded", () => {
console.log("Swapping #block-ucl-dashboard-news with its next sibling.");
swapWithFirstSibling("block-ucl-dashboard-news");
});
console.log("Hourraa");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment