User:Frazyl/dwpriests

From Discworld MUD Wiki
< User:Frazyl
Revision as of 17:40, 7 July 2022 by Frazyl (Talk | contribs) (violentmonkey user script to fix dwpriests wiki with https-only mode on)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Violentmonkey (or other greasemonkey based extension) user script to fix dwpriests wiki with https-only mode on. Because the css is a link to port 80 which is not https but loaded as https...

// ==UserScript==
// @name        Fix dwpriests resources
// @namespace   https://www.dwpriests.com/*
// @match       https://www.dwpriests.com/*
// @grant       none
// @version     1.0
// @author      -
// @description 2022-07-07, 4:23:14 p.m.
// ==/UserScript==

function fix_urls() {
  var i=0, link;
  link = document.getElementsByTagName("link");
  while (i < link.length) {
    link[i].href = link[i].href.replace(":80/", "/");
    i++;
  }
  i=0;
  script = document.getElementsByTagName("script");
  while (i < script.length) {
    if (script[i].src != -1) {
      script[i].src = script[i].src.replace(":80/", "/");
    }
    i++;
  }
}
fix_urls()