1
0
Fork 0
cookiedb/userscripts/girlgenius.user.js

11 Zeilen
1.0 KiB
JavaScript

// ==UserScript==
// @name Girlgenius https fix
// @version 0.2
// @source https://gitea.sebastian-tobie.de/sebastian/cookiedb/raw/branch/stable/userscripts/girlgenius.user.js
// @description converts http to https urls
// @author Sebastian Tobie
// @run-at document-body
// @grant none
// ==/UserScript==
(()=>{function c(o){let e=new URL(o);if(console.debug(e.protocol,e.protocol=="http:"),e.protocol=="http:"){let l=e.href;e.protocol="https:",console.debug("fixed url",l,e.href)}return e.toString()}console.debug("http replacer loaded");var n=document.getElementsByTagName("a");console.info("found",n.length,"links");for(let o=0;o<n.length;o++){let e=n[o];console.debug("checking",e),!(e.href==null||e.href=="")&&(e.href=c(e.href),console.debug("edited",e))}var t=document.getElementsByTagName("img");console.info("found",t.length,"images");for(let o=0;o<t.length;o++){let e=t[o];if(console.debug("checking",e),e.src==null||e.src==""){console.debug("href == undefined",e.src==null,"src == ''",e.src=="");continue}e.src=c(e.src),console.debug("edited",e)}})();