userscripts/fix-orthodox-history-layout/fix_orthodox_history_layout.user.js

39 lines
1.7 KiB
JavaScript
Raw Normal View History

// ==UserScript==
// @name Fix Orthodox History Layout
// @version 2024.10.17
// @description Get rid of their dumb ad sidebar and make the content width normal again.
// @author Rdr. Seraphim Pardee (srp)
// @license Unlicense; https://opensource.org/license/unlicense
// @namespace https://git.hl.srp.life/srp/userscripts
// @homepageURL https://git.hl.srp.life/srp/userscripts
// @supportURL https://git.hl.srp.life/srp/userscripts/issues
// @downloadURL https://git.hl.srp.life/srp/userscripts/raw/branch/main/fix-orthodox-history-layout/fix_orthodox_history_layout.user.js
// @updateURL https://git.hl.srp.life/srp/userscripts/raw/branch/main/fix-orthodox-history-layout/fix_orthodox_history_layout.meta.js
// @match https://orthodoxhistory.org/*
// @icon data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>☦️</text></svg>
// @run-at document-start
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Fixing homepage.
let originElem = document.getElementById("content");
if (originElem) {
let firstColumn = originElem.getElementsByClassName("col-sm-3")[0];
firstColumn.remove();
let contentColumn = originElem.getElementsByClassName("col-sm-6")[0];
contentColumn.className = "col-sm-9";
}
// Prevent scummy ad redirecting.
window.onbeforeunload = function(e) {
if (!window.location.href.startsWith("https://orthodoxhistory.org")) {
e.preventDefault();
e.returnValue = "You are being directed outside of Orthodox History. Do you wish to continue?";
}
};
})();