Bad Dragon White/Blank Page Fix

Workaround for the white page & blank page bugs on Bad Dragon.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Bad Dragon White/Blank Page Fix
// @namespace    https://greasyfork.org/en/scripts/432440-bad-dragon-white-blank-page-fix
// @version      0.1.5
// @description  Workaround for the white page & blank page bugs on Bad Dragon.
// @author       tikutaro
// @match        *://bad-dragon.com/*
// @icon         https://www.google.com/s2/favicons?domain=bad-dragon.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const exp = /.*\:\/\/.*\.cloudfront\.net\/(app|media)-.*\.js/;
    const scripts = [];
    for (const child of document.getElementsByTagName('script')) {
        if (exp.test(child.src)) {
            scripts.push(child.src);
        }
    }
    const head = document.getElementsByTagName('head')[0];
    for (const url of scripts) {
        const tag = document.createElement('script');
        tag.setAttribute('type', 'text/javascript');
        tag.setAttribute('src', url);
        head.appendChild(tag);
    }
})();