EhxVisited

E-H Visited, combined with ExVisited, and then better.

As of 2019-11-07. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         EhxVisited
// @namespace    https://sleazyfork.org/en/users/285675-hauffen
// @version      2.16
// @description  E-H Visited, combined with ExVisited, and then better.
// @author       Hauffen
// @match        https://javascript.info/indexeddb
// @require      https://code.jquery.com/jquery-3.3.1.min.js
// @include      /https?:\/\/(e-|ex)hentai\.org\/.*/
// ==/UserScript==

(function() {
    window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
    window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction || {READ_WRITE: "readwrite"};
    window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;

    if (!window.indexedDB) {
        console.warn("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available.");
        return;
    }

    /*════════════════════╗
    ║    configuration    ║
    ╚════════════════════*/
    var setStore = JSON.parse(localStorage.getItem("ehx-settings")) ? JSON.parse(localStorage.getItem("ehx-settings")) : JSON.parse('{"softHide":false, "minAdd":true, "minShow":false, "cssTT":false, "repPub":false, "cusCSS":true, "visHide":false, "hidShow":false, "pFilter":false, "pLimit":0, "stFilter":false, "stLimit":0}');
    var darkenHidden = setStore.softHide;
    var minimalAddColumn = setStore.minAdd;
    var minimalShowText = setStore.minShow;
    var cssTools = setStore.cssTT;
    var replacePub = setStore.repPub;
    var visHide = setStore.visHide;
    var hidShow = setStore.hidShow;
    var pFilter = setStore.pFilter;
    var pLimit = setStore.pLimit;
    var stFilter = setStore.stFilter;
    var stLimit = setStore.stLimit;
    var filters = localStorage.getItem("ehx-filters") ? localStorage.getItem("ehx-filters") : "#\\[Erocolor\\]";
    /*═══════════════════*/

    let db = null;
    var filterArr = [];
    var cssV = localStorage.getItem("ehx-cssv") ? localStorage.getItem("ehx-cssv") : "box-shadow: inset 0 0 0 500px rgba(2, 129, 255, .2) !important;";
    var cssH = localStorage.getItem("ehx-cssh") ? localStorage.getItem("ehx-cssh") : "box-shadow: inset 0 0 0 500px rgba(255, 40, 0, .2) !important;";
    var cssD;
    if (setStore.cusCSS == false) {
        cssV = "";
        cssH = "";
    }
    if(darkenHidden) {
        cssD = "opacity:0.2; -webkit-opacity: 0.2;";
    } else {
        cssD = "display: none;";
    }
    var pIS = 0;
    var observer = new MutationObserver(function () {
        pIS = true;
        addCSS();
    });

    var spl = document.URL.split("/");
    var d1 = spl[3];
    var sto = '{"data":{}}';
    var galleries = JSON.parse(sto);
    var hidden = JSON.parse(sto);
    var hAmount, gAmount, fAmount, pAmount, rAmount;
    var ehxClearConfirm = 0;

    if (spl[3] == "g") addGallery();
    if (d1.substr(0, 1) == "?" || d1.substr(0, 1) == "#" || d1.substr(0, 1) == "f" || d1.substr(0, 1) == "t" || !d1) {
        popFilter(filters);
        populate();
    }

    function popFilter() {
        if (filters != "") {
            var tempArr = filters.split("\n");
            for(var i = 0; i < tempArr.length; i++) {
                if (tempArr[i].startsWith("#")) continue;
                filterArr.push(new RegExp(tempArr[i], "i"));
            }
        }
        pLimit = parseInt(pLimit) || 0;
    }

    // Generate our database if it's not there
    function addGallery() {
        const request = indexedDB.open("ehxvisited", 1);

        request.onupgradeneeded = e => {
            db = e.target.result;

            if (!db.objectStoreNames.contains('galleries')) {
                db.createObjectStore('galleries', {keyPath: 'id'});
            }
            if (!db.objectStoreNames.contains('hidden')) {
                db.createObjectStore('hidden', {keyPath: 'id'});
            }
        };

        request.onsuccess = e => {
            db = e.target.result;

            var objStore = db.transaction('galleries', 'readwrite').objectStore('galleries');
            var openRequest = objStore.openCursor(spl[4] + "." + spl[5]);

            openRequest.onsuccess = e => {
                var cursor = openRequest.result;
                if (cursor) { // Update entry if key exists
                    cursor.update({id: spl[4] + "." + spl[5], visited: Date.now()});
                    console.log("EhxVisited: Updated " + spl[4] + "." + spl[5]);
                } else { // Otherwise, add entry
                    objStore.add({id: spl[4] + "." + spl[5], visited: Date.now()});
                    console.log("EhxVisited: Added " + spl[4] + "." + spl[5]);
                }
            };

            openRequest.onerror = e => {
                console.log(`EhxVisited: Something bad happened with gallery ${spl[4]}.${spl[5]}: ${e.target.error}`);
            };
        };
    };

    function updateGListing(hideAm, gallAm) {
        var cGal = 0, hGal = hideAm;
        hideAm += fAmount + pAmount + rAmount;
        if ($(".ehx-show").text() === "Hide") {
            if ($(".ehxh-show").html() === "Show") { //vShow + hHide == hAmount
                $("#hideCount").html("There " + (hideAm > 1 || hideAm == 0 ? 'are ' : 'is ' ) + "\<span\>" + hideAm + " hidden " + (hideAm > 1 || hideAm == 0 ? 'galleries' : 'gallery') + "</span> on this page.");
            } else { //vShow + hShow == 0
                $("#hideCount").html("There are <span>0 hidden galleries</span> on this page.");
            }
        } else {
            cGal = gallAm;
            if ($(".ehxh-show").text() === "Hide") { //vHide + hShow == gAmount
                $("#hideCount").html("There " + (gallAm > 1 || gallAm == 0 ? 'are ' : 'is ' ) + "<span>" + gallAm + " hidden " + (gallAm > 1 || gallAm == 0 ? 'galleries' : 'gallery') + "</span> on this page.");
            } else { //vHide + hHide == hAmount + gAmount
                $("#hideCount").html("There " + (parseInt(gallAm + hideAm) > 1 || parseInt(gallAm + hideAm) == 0 ? 'are ' : 'is ' ) + "<span>" + parseInt(gallAm + hideAm) + " hidden " + (parseInt(gallAm + hideAm) > 1 || parseInt(gallAm + hideAm) == 0 ? 'galleries' : 'gallery') + "</span> on this page.");
            }
        }
        $("#hideCount > span").prop("title", "Hidden: " + hGal + " | Visited: " + cGal + " | Filtered: " + fAmount + " | Page Limit:" + pAmount + " | Rating Limit: " + rAmount);
    }

    function getStarNumber(el) {
        var stars = $(el).find(".ir").css("background-position");
        switch(stars) {
            case "0px -1px":
                return 5;
            case "0px -21px":
                return 4.5;
            case "-16px -1px":
                return 4;
            case "-16px -21px":
                return 3.5;
            case "-32px -1px":
                return 3;
            case "-32px -21px":
                return 2.5;
            case "-48px -1px":
                return 2;
            case "-48px -21px":
                return 1.5;
            case "-64px -1px":
                return 1;
            case "-64px -21px":
                return 0.5;
            default:
                return 0;
        }
    }

    function populate() {
        const request = indexedDB.open("ehxvisited", 1);

        request.onupgradeneeded = e => {
            db = e.target.result;

            if (!db.objectStoreNames.contains('galleries')) {
                db.createObjectStore('galleries', {keyPath: 'id'});
            }
            if (!db.objectStoreNames.contains('hidden')) {
                db.createObjectStore('hidden', {keyPath: 'id'});
            }
        };

        request.onsuccess = e => {
            db = e.target.result;
            var objStore = db.transaction("galleries", "readonly").objectStore("galleries");
            var openReq = objStore.getAll();
            openReq.onsuccess = f => {
                console.log("EhxVisited: Populated global variables.");
                var transform = f.target.result;
                for (var i = 0; i < transform.length; i++) {
                    galleries.data[transform[i].id] = transform[i].visited; // Force matrix data into array data
                }
                var gLength = Object.keys(galleries.data).length
                var objStore2 = db.transaction("hidden", "readonly").objectStore("hidden");
                var openReq2 = objStore2.getAll();
                openReq2.onsuccess = g => {
                    var transform2 = g.target.result;
                    for (i = 0; i < transform2.length; i++) {
                        hidden.data[transform2[i].id] = 1; // Force matrix data into array data
                    }
                    var hLength = Object.keys(hidden.data).length
                    $("#toppane").append("<ehx class='ehx-controls'>Galleries visited: " + gLength + " ( <span id='ehx-menu-control'></span><a href='javascript:;' class='ehx-settings'>Settings</a> )<br/>Hidden Galleries: <span id='hLength'>" + hLength + "</span><span id='ehxh-menu-control'></span></ehx>");
                    if (darkenHidden == false) {
                        $("#ehx-menu-control").append("<a href='javascript:;' class='ehx-show'>Hide</a> / ");
                        $("#ehxh-menu-control").append(" ( <a href='javascript:;' class='ehxh-show'>Show</a> )");
                    }
                    $(".ehx-settings").click(e => {
                        e.preventDefault();
                        settings();
                        return false;
                    });
                    $(".ehx-show").click(function () {
                        var disp =  $(".ehx-visited.ehx-hidden").css("display");
                        if ($(".ehx-show").text() === "Show") {
                            $(".ehx-visited").css({display: ""});
                            $(".ehx-visited.ehx-hidden").css({display: disp});
                        } else {
                            $(".ehx-visited").css({display: "none"});
                            $(".ehx-visited.ehx-hidden").css({display: disp});
                        }
                        $(".ehx-show").text(function(i, t){
                            return t === "Show" ? "Hide" : "Show";
                        });
                        updateGListing(hAmount, gAmount);
                        setStore.visHide = $(".ehx-show")[0].innerText === "Show" ? true : false;
                        localStorage.setItem("ehx-settings", JSON.stringify(setStore));
                    });

                    $(".ehxh-show").click(function () {
                        if ($(".ehxh-show").text() === "Show") {
                            if ($(".gl1t").length == 0) {
                                $(".ehx-hidden").css({display: $(".ehx-hidden").parent().find("tr").not(".ehx-hidden").css("display")});
                                $(".ehx-visited.ehx-hidden").css({display: $(".ehx-hidden").parent().find("tr").not(".ehx-hidden").css("display")});
                            } else {
                                $(".ehx-hidden").css({display: 'flex'});
                                $(".ehx-visited.ehx-hidden").css({display: 'flex'});
                            }
                        } else {
                            $(".ehx-hidden").css({display: ""});
                            $(".ehx-visited.ehx-hidden").css({display: ""});
                        }
                        $(".ehxh-show").text(function(i, t){
                            return t === "Show" ? "Hide" : "Show";
                        });
                        updateGListing(hAmount, gAmount);
                        setStore.hidShow = $(".ehxh-show")[0].innerText === "Hide" ? true : false;
                        localStorage.setItem("ehx-settings", JSON.stringify(setStore));
                    });
                    addCSS();
                    if (visHide == false) {
                        if (hidShow == false) { $(".ehx-controls").append("<br /><span id='hideCount'>There " + (hAmount > 1 || hAmount == 0 ? 'are ' : 'is ' ) + "<span>" + hAmount + " hidden " + (hAmount > 1 || hAmount == 0 ? 'galleries' : 'gallery') + "</span> on this page.</span>"); }
                        else { $(".ehx-controls").append("<br /><span id='hideCount'>There are <span>0 hidden galleries</span> on this page.</span>"); }
                    }
                    else $(".ehx-controls").append("<br /><span id='hideCount'>There " + (parseInt(gAmount + hAmount) > 1 ? 'are ' : 'is ' ) + "<span>" + parseInt(gAmount + hAmount) + " hidden " + (parseInt(gAmount + hAmount) > 1 || parseInt(gAmount + hAmount) == 0 ? 'galleries' : 'gallery') + "</span> on this page.</span>");
                    updateGListing(hAmount, gAmount);
                }
            }
        }
    }

    function addCSS() {
        observer.disconnect(); // Disconnect the observer, or else all the CSS changes will trigger the mutation observer
        var img_hide = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIhSURBVDjLlZPrThNRFIWJicmJz6BWiYbIkYDEG0JbBiitDQgm0PuFXqSAtKXtpE2hNuoPTXwSnwtExd6w0pl2OtPlrphKLSXhx07OZM769qy19wwAGLhM1ddC184+d18QMzoq3lfsD3LZ7Y3XbE5DL6Atzuyilc5Ciyd7IHVfgNcDYTQ2tvDr5crn6uLSvX+Av2Lk36FFpSVENDe3OxDZu8apO5rROJDLo30+Nlvj5RnTlVNAKs1aCVFr7b4BPn6Cls21AWgEQlz2+Dl1h7IdA+i97A/geP65WhbmrnZZ0GIJpr6OqZqYAd5/gJpKox4Mg7pD2YoC2b0/54rJQuJZdm6Izcgma4TW1WZ0h+y8BfbyJMwBmSxkjw+VObNanp5h/adwGhaTXF4NWbLj9gEONyCmUZmd10pGgf1/vwcgOT3tUQE0DdicwIod2EmSbwsKE1P8QoDkcHPJ5YESjgBJkYQpIEZ2KEB51Y6y3ojvY+P8XEDN7uKS0w0ltA7QGCWHCxSWWpwyaCeLy0BkA7UXyyg8fIzDoWHeBaDN4tQdSvAVdU1Aok+nsNTipIEVnkywo/FHatVkBoIhnFisOBoZxcGtQd4B0GYJNZsDSiAEadUBCkstPtN3Avs2Msa+Dt9XfxoFSNYF/Bh9gP0bOqHLAm2WUF1YQskwrVFYPWkf3h1iXwbvqGfFPSGW9Eah8HSS9fuZDnS32f71m8KFY7xs/QZyu6TH2+2+FAAAAABJRU5ErkJggg==";
        var list = $("table.itg>tbody>tr").has('.glhide, .gldown, th'); //present only in list views
        var thumb = $(".itg .gl1t"); //present only in thumbnail view
        var gid, galleryId, onFavs, d;
        hAmount = gAmount = fAmount = pAmount = rAmount = 0;

        if (list.length > 0) {
            if ($('.gl1e').length) { //extended
                if ($('h1').text() === "Favorites") {
                    onFavs = 1;
                }
                for (var i = 0; i < list.length; i++) {
                    gid = $(list[i]).find(".gl1e a").attr("href").split("/");
                    galleryId = gid[4] + "." + gid[5];
                    if ($(list[i])[0].children.length === 2 && onFavs) {
                        $(list[i]).append('<td></td>');
                    }
                    if(galleries.data[galleryId] != undefined) {
                        if (!$(list[i]).hasClass('ehx-visited')) {
                            d = new Date(galleries.data[galleryId]);
                            $(list[i]).addClass("ehx-visited");
                            if (cssTools == true ) $(list[i]).find('.glname').attr("title", 'EhxVisited: ' + timeDifference(Date.now(), galleries.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate());
                            //check for fav pages
                            if ($(list[i]).find('.gl3e').children('div').length >= 7) { //date favourited div is present
                                $(list[i]).find('.gl3e > div:last-child').append("<br><ehx class='ehx-extended-favs'>\uD83D\uDC41" + timeDifference(Date.now(), galleries.data[galleryId]) + "<br>" + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate() + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ")</ehx>");
                            } else {
                                $(list[i]).find('.gl3e').append("<ehx class='ehx-extended'>\uD83D\uDC41" + timeDifference(Date.now(), galleries.data[galleryId]) + "<br>" + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate() + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ")</ehx>");
                            }
                        }
                        if (hidden.data[galleryId] == undefined) gAmount++;
                    } else {
                        if (cssTools == true ) $(list[i]).find('.glname').attr("title", "Never Visited");
                    }
                    if(hidden.data[galleryId] != undefined) {
                        if(!$(list[i]).hasClass('ehx-hidden')) { $(list[i]).addClass("ehx-hidden"); };
                        hAmount++;
                    }
                    if($(list[i])[0].childElementCount < 3) {
                        $("<img class='imgHide' src='" + img_hide + "' style='cursor:pointer !important; padding:4px 0px 0px 4px;' title='Show/Hide gallery'>" ).prependTo( $(list[i]).find("a").first().parent().parent().parent() ).on( 'click', function(){
                            var tga = $(this).parent().find("a").attr("href").split("/");
                            var tgid = tga[4] + "." + tga[5];
                            var objStore2 = db.transaction('hidden', 'readwrite').objectStore('hidden');
                            var openReq2 = objStore2.openCursor(tgid);
                            openReq2.onsuccess = e => {
                                var cursor = e.target.result;
                                if (cursor) {
                                    cursor.delete();
                                    console.log("EhxVisited: Removed " + tgid + " from hidden list.");
                                    $(this).parent().removeClass("ehx-hidden");
                                    delete hidden.data[tgid];
                                    updateGListing(--hAmount, gAmount);
                                } else {
                                    objStore2.put({id: tgid});
                                    console.log("EhxVisited: Added " + tgid + " to hidden list.");
                                    $(this).parent().addClass("ehx-hidden");
                                    hidden.data[tgid] = 1;
                                    updateGListing(++hAmount, gAmount);
                                }
                                $("#hLength").text(Object.keys(hidden.data).length);
                            }
                        })
                    }
                    if (filterArr.length > 0) {
                        if(!$(list[i]).hasClass('ehx-hidden')) {
                            if(filterArr.some(rx => rx.test($(list[i]).find('.glink').text()))) {
                                $(list[i]).addClass("ehx-hidden");
                                fAmount++;
                            }
                        }
                    }
                    if (pFilter == true && pLimit > 0) {
                        if(!$(list[i]).hasClass('ehx-hidden')) {
                            if(parseInt($(list[i]).find('.gl3e > div:nth-child(5)').text().split(" ")[0]) < parseInt(pLimit)) {
                                $(list[i]).addClass("ehx-hidden");
                                pAmount++;
                            }
                        }
                    }
                    if (stFilter == true && stLimit > 0) {
                        if(!$(list[i]).hasClass('ehx-hidden')) {
                            if (getStarNumber(list[i]) < stLimit) {
                                $(list[i]).addClass("ehx-hidden");
                                rAmount++;
                            }
                        }
                    }
                }
                updateGListing(hAmount, gAmount);
            } else if ($('.gl1c').length) { //compact
                var borderColour = $('.gl1c').first().css('border-top-color'); //border colour different between domains
                if (!pIS && $('table.itg tbody>tr:first-child')[0].children.length < 5) {
                    $('table.itg tbody>tr:first-child th:nth-child(4)').after('<th style="text-align:center;" title="EhxVisited: Click to Show/Hide">&#x2716</th>');
                    $('table.itg tbody>tr:first-child th:nth-child(2)').after('<th>Visited</th>');
                    pIS = true;
                }
                if ($('h1').text() === "Favorites") {
                    onFavs = 1;
                }
                for (i = 1; i < list.length; i++) {
                    gid = $(list[i]).find(".glname a").attr("href").split("/");
                    galleryId = gid[4] + "." + gid[5];
                    if ($(list[i])[0].children.length === 4 || $(list[i])[0].children.length === 5 && onFavs) {
                        if ($(list[i])[0].children.length === 4 && onFavs) {
                            $(list[i]).append('<td></td>');
                        }
                        if(galleries.data[galleryId] != undefined) {
                            d = new Date(galleries.data[galleryId]);
                            $(list[i]).addClass("ehx-visited");
                            if (cssTools == true ) $(list[i]).find('.glname').attr("title", 'EhxVisited: ' + timeDifference(Date.now(), galleries.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate());
                            $(list[i]).children('.gl2c').after('<td class="ehx-compact" style="border-color:' + borderColour + ';"><ehx>' + timeDifference(Date.now(), galleries.data[galleryId], true) + "<br>(" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ')<br>' + d.getFullYear().toString().substr(2) + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate() + '</ehx></td>');
                            if (hidden.data[galleryId] == undefined) gAmount++;
                        } else {
                            if (cssTools == true ) $(list[i]).find('.glname').attr("title", "Never Visited");
                            $(list[i]).children('.gl2c').after('<td class="ehx-compact" style="border-color:' + borderColour + ';"></td>');
                        }
                    }
                    if(hidden.data[galleryId] != undefined) {
                        if(!$(list[i]).hasClass('ehx-hidden')) { $(list[i]).addClass("ehx-hidden"); };
                        hAmount++;
                    }
                    if($(list[i])[0].childElementCount < 6) {
                        $("<td class='hideContainer' style='border-bottom: 1px solid #6f6f6f4d; border-top: 1px solid #6f6f6f4d;'><img class='imgHide' src='" + img_hide + "' style='cursor:pointer !important; vertical-align:center;' title='Show/Hide gallery'></td>" ).appendTo( $(list[i]).find("a").first().closest("tr") ).on( 'click', function(){
                            var tga = $(this).closest("tr").find($(".gl3c>a")).attr("href").split("/");
                            var tgid = tga[4] + "." + tga[5];
                            var objStore2 = db.transaction('hidden', 'readwrite').objectStore('hidden');
                            var openReq2 = objStore2.openCursor(tgid);
                            openReq2.onsuccess = e => {
                                var cursor = e.target.result;
                                if (cursor) {
                                    cursor.delete();
                                    console.log("EhxVisited: Removed " + tgid + " from hidden list.");
                                    $(this).parent().removeClass("ehx-hidden");
                                    delete hidden.data[tgid];
                                    updateGListing(--hAmount, gAmount);
                                } else {
                                    objStore2.put({id: tgid});
                                    console.log("EhxVisited: Added " + tgid + " to hidden list.");
                                    $(this).parent().addClass("ehx-hidden");
                                    hidden.data[tgid] = 1;
                                    updateGListing(++hAmount, gAmount);
                                }
                                $("#hLength").text(Object.keys(hidden.data).length);
                            }
                        })
                    }
                    if (filterArr.length > 0) {
                        if(!$(list[i]).hasClass('ehx-hidden')) {
                            if(filterArr.some(rx => rx.test($(list[i]).find('.glink').text()))) {
                                $(list[i]).addClass("ehx-hidden");
                                fAmount++;
                            }
                        }
                    }
                    if (pFilter == true && pLimit > 0) {
                        if(!$(list[i]).hasClass('ehx-hidden')) {
                            if(parseInt($(list[i]).find('.gl4c > div:nth-child(2)').text().split(" ")[0]) < parseInt(pLimit)) {
                                $(list[i]).addClass("ehx-hidden");
                                pAmount++;
                            }
                        }
                    }
                    if (stFilter == true && stLimit > 0) {
                        if(!$(list[i]).hasClass('ehx-hidden')) {
                            if (getStarNumber(list[i]) < stLimit) {
                                $(list[i]).addClass("ehx-hidden");
                                rAmount++;
                            }
                        }
                    }
                }
                updateGListing(hAmount, gAmount);
            } else { //minimal
                if(!pIS) {
                    $('table.itg tbody>tr:first-child th:nth-child(6)').after('<th style="text-align:center;" title="EhxVisited: Click to Show/Hide">&#x2716</th>');
                    if (minimalAddColumn) {
                        $('table.itg tbody>tr:first-child th:nth-child(2)').after('<th title="EhxVisited: Hover for timestamps">\uD83D\uDC41</th>');
                    }
                    pIS = true;
                }
                if (replacePub == true) {
                    $('table.itg tbody>tr:first-child')[0].children[1].innerText = "Visited"
                }
                if ($('h1').text() === "Favorites") {
                    onFavs = 1;
                }
                for (i = 1; i < list.length; i++) {
                    gid = $(list[i]).find(".glname a").attr("href").split("/");
                    galleryId = gid[4] + "." + gid[5];
                    if(hidden.data[galleryId] != undefined) {
                        if(!$(list[i]).hasClass('ehx-hidden')) { $(list[i]).addClass("ehx-hidden"); };
                        hAmount++;
                    }
                    if ($(list[i])[0].children.length === 6 || $(list[i])[0].children.length === 7 && onFavs) {
                        if ($(list[i])[0].children.length === 6 && onFavs) {
                            $(list[i]).append('<td></td>');
                        }
                        if (minimalAddColumn == true) { //append viewed column
                            if (galleries.data[galleryId] != undefined) {
                                d = new Date(galleries.data[galleryId]);
                                $(list[i]).addClass("ehx-visited");
                                if (cssTools == true ) $(list[i]).find('.glname').attr("title", 'EhxVisited: ' + timeDifference(Date.now(), galleries.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate());
                                if (minimalShowText == true) { //show text in appended column
                                    $(list[i]).children('.gl2m').after('<td class="ehx-minimal-text"><ehx>' + timeDifference(Date.now(), galleries.data[galleryId], true) + "<br>(" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ')<br>' + d.getFullYear().toString().substr(2) + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate() + '</ehx></td>');
                                } else { //show icon in appended column
                                    $(list[i]).children('.gl2m').after('<td class="ehx-minimal" title="EhxVisited: ' + timeDifference(Date.now(), galleries.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate() + '"><ehx>\uD83D\uDC41</ehx></td>');
                                }
                                if (replacePub == true) {
                                    $(list[i]).find(".gl2m").text(d.getFullYear().toString() + "\u2011" + ('0' + (d.getMonth() + 1)).slice(-2) + "\u2011" + d.getDate() + " " + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0'));
                                }
                                if (hidden.data[galleryId] == undefined) gAmount++;
                            } else { //not viewed
                                $(list[i]).children('.gl2m').after('<td class="ehx-minimal"></td>');
                                if (replacePub == true) $(list[i]).find(".gl2m").text("Never Visited");
                                if (cssTools == true ) $(list[i]).find('.glname').attr("title", "Never Visited");
                            }
                        } else { //append nothing, highlight only
                            if (galleries.data[galleryId] != undefined) {
                                d = new Date(galleries.data[galleryId]);
                                $(list[i]).addClass("ehx-visited");
                                $(list[i]).children('.glname')[0].setAttribute("title", 'EhxVisited: ' + timeDifference(Date.now(), galleries.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate());
                            }
                        }
                        if($(list[i])[0].childElementCount < 8 || ($(list[i])[0].childElementCount < 8 && !minimalAddColumn)) {
                            $("<td class='hideContainer'><img class='imgHide' src='" + img_hide + "' style='cursor:pointer !important; vertical-align:middle;' title='Show/Hide gallery'></td>" ).appendTo( $(list[i]).find("a").first().closest("tr") ).on( 'click', function(){
                                var tga = $(this).closest("tr").find($(".gl3m>a")).attr("href").split("/");
                                var tgid = tga[4] + "." + tga[5];
                                var objStore2 = db.transaction('hidden', 'readwrite').objectStore('hidden');
                                var openReq2 = objStore2.openCursor(tgid);
                                openReq2.onsuccess = e => {
                                    var cursor = e.target.result;
                                    if (cursor) {
                                        cursor.delete();
                                        console.log("EhxVisited: Removed " + tgid + " from hidden list.");
                                        $(this).parent().removeClass("ehx-hidden");
                                        delete hidden.data[tgid];
                                        updateGListing(--hAmount, gAmount);
                                    } else {
                                        objStore2.put({id: tgid});
                                        console.log("EhxVisited: Added " + tgid + " to hidden list.");
                                        $(this).parent().addClass("ehx-hidden");
                                        hidden.data[tgid] = 1;
                                        updateGListing(++hAmount, gAmount);
                                    }
                                    $("#hLength").text(Object.keys(hidden.data).length);
                                }
                            })
                        }
                        if (filterArr.length > 0) {
                            if(!$(list[i]).hasClass('ehx-hidden')) {
                                if(filterArr.some(rx => rx.test($(list[i]).find('.glink').text()))) {
                                    $(list[i]).addClass("ehx-hidden");
                                    fAmount++;
                                }
                            }
                        }
                        if (pFilter == true && pLimit > 0) {
                            if(!$(list[i]).hasClass('ehx-hidden')) {
                                if(parseInt($(list[i]).find('.gl2m > div:nth-child(2) > div:nth-child(2) > div:nth-child(2) > div:nth-child(2)').text().split(" ")[0]) < parseInt(pLimit)) {
                                    $(list[i]).addClass("ehx-hidden");
                                    pAmount++;
                                }
                            }
                        }
                        if (stFilter == true && stLimit > 0) {
                            if(!$(list[i]).hasClass('ehx-hidden')) {
                                if (getStarNumber(list[i]) < stLimit) {
                                    $(list[i]).addClass("ehx-hidden");
                                    rAmount++;
                                }
                            }
                        }
                    }
                }
                updateGListing(hAmount, gAmount);
            }
        } else if (thumb.length > 0) {
            for (i = 0; i < thumb.length; i++) {
                gid = $(thumb[i]).find(".gl3t a").attr("href").split("/");
                galleryId = gid[4] + "." + gid[5];
                if(galleries.data[galleryId] != undefined) {
                    if (!$(thumb[i]).hasClass('ehx-visited')) {
                        d = new Date(galleries.data[galleryId]);
                        $(thumb[i]).addClass("ehx-visited");
                        if (cssTools == true ) {
                            $(thumb[i]).find('.glname').attr("title", 'EhxVisited: ' + timeDifference(Date.now(), galleries.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate());
                            //$(thumb[i]).find('.gl3t img').attr("title", 'EhxVisited: ' + timeDifference(Date.now(), galleries.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate());
                        }
                        $(thumb[i]).children('.gl5t').after("<ehx class='ehx-thumbnail'>\uD83D\uDC41" + timeDifference(Date.now(), galleries.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate() + "</ehx>");
                    }
                    if (hidden.data[galleryId] == undefined) gAmount++;
                } else {
                    if (cssTools = true) {
                        $(thumb[i]).find('.glname').attr("title", "Never Visited");
                        //$(thumb[i]).find('.gl3t img').attr("title", "Never Visited");
                    }
                }
                if(hidden.data[galleryId] != undefined) {
                    if(!$(thumb[i]).hasClass('ehx-hidden')) { $(thumb[i]).addClass("ehx-hidden"); };
                    hAmount++;
                }
                if($(thumb[i]).find(".gl5t").children().length < 3) {
                    $("<div class='hideContainer'><img class='imgHide' src='" + img_hide + "' style='cursor:pointer !important; position:absolute; bottom:3px; left:2px;' title='Show/Hide gallery'></div>" ).appendTo( $(thumb[i]).find(".gl5t")).on( 'click', function(){
                        var tga = $(this).parent().parent().find("a").attr("href").split("/");
                        var tgid = tga[4] + "." + tga[5];
                        var objStore2 = db.transaction('hidden', 'readwrite').objectStore('hidden');
                        var openReq2 = objStore2.openCursor(tgid);
                        openReq2.onsuccess = e => {
                            var cursor = e.target.result;
                            if (cursor) {
                                cursor.delete();
                                console.log("EhxVisited: Removed " + tgid + " from hidden list.");
                                $(this).parent().parent().removeClass("ehx-hidden");
                                delete hidden.data[tgid];
                                updateGListing(--hAmount, gAmount);
                            } else {
                                objStore2.put({id: tgid});
                                console.log("EhxVisited: Added " + tgid + " to hidden list.");
                                $(this).parent().parent().addClass("ehx-hidden");
                                hidden.data[tgid] = 1;
                                updateGListing(++hAmount, gAmount);
                            }
                            $("#hLength").text(Object.keys(hidden.data).length);
                        }
                    })
                }
                if (filterArr.length > 0) {
                    if(!$(thumb[i]).hasClass('ehx-hidden')) {
                        if(filterArr.some(rx => rx.test($(thumb[i]).find('.glink').text()))) {
                            $(thumb[i]).addClass("ehx-hidden");
                            fAmount++;
                        }
                    }
                }
                if (pFilter == true && pLimit > 0) {
                    if(!$(thumb[i]).hasClass('ehx-hidden')) {
                        if(parseInt($(thumb[i]).find('.gl5t > div:nth-child(2) > div:nth-child(2)').text().split(" ")[0]) < parseInt(pLimit)) {
                            $(thumb[i]).addClass("ehx-hidden");
                            pAmount++;
                        }
                    }
                }
                if (stFilter == true && stLimit > 0) {
                    if(!$(thumb[i]).hasClass('ehx-hidden')) {
                        if (getStarNumber(thumb[i]) < stLimit) {
                            $(thumb[i]).addClass("ehx-hidden");
                            rAmount++;
                        }
                    }
                }
            }
            updateGListing(hAmount, gAmount);
        } else {
            console.log("EhxVisited: Something went wrong or an invalid view");
        }
        if (visHide == true) {
            $(".ehx-visited").css({display: "none"});
            $(".ehx-show").text("Show");
        }
        if (hidShow == true) {
            if ($(".ehx-hidden").length < 25) { $(".ehx-hidden").css({display: $(".ehx-hidden").siblings().not(".ehx-hidden").css("display")}) }
            else {
                if ($(".gl1t").length > 0) { $(".ehx-hidden").css({display: "flex"}); }
                else { $(".ehx-hidden").css({display: "table-row"}); }
            }
            $(".ehxh-show").text("Hide");
        }
        observer.observe($('.itg').get(0), { // Reconnect the observer for changes
            childList: true,
            subtree: true
        });
    }

    // get time difference in words
    function timeDifference(current, previous, abbreviate) {
        var msPerMinute = 60 * 1000;
        var msPerHour = msPerMinute * 60;
        var msPerDay = msPerHour * 24;
        var msPerMonth = msPerDay * 30;
        var msPerYear = msPerDay * 365;
        var elapsed = current - previous;

        if (elapsed < msPerMinute) {
            return Math.round(elapsed / 1000) + ((typeof abbreviate !== 'undefined') ? '&nbsp;sec' : ' seconds ago');
        } else if (elapsed < msPerHour) {
            return Math.round(elapsed / msPerMinute) + ((typeof abbreviate !== 'undefined') ? '&nbsp;min' : ' minutes ago');
        } else if (elapsed < msPerDay) {
            return Math.round(elapsed / msPerHour) + ((typeof abbreviate !== 'undefined') ? '&nbsp;hrs' : ' hours ago');
        } else if (elapsed < msPerMonth) {
            return Math.round(elapsed / msPerDay) + ((typeof abbreviate !== 'undefined') ? '&nbsp;days' : ' days ago');
        } else if (elapsed < msPerYear) {
            return Math.round(elapsed / msPerMonth) + ((typeof abbreviate !== 'undefined') ? '&nbsp;mos' : ' months ago');
        } else {
            return Math.round(elapsed / msPerYear) + ((typeof abbreviate !== 'undefined') ? '&nbsp;yrs' : ' years ago');
        }
    }

    function ehxExport(message, items) {
        var data = "";
        for (var i in items) {
            data += items[i].id + ":" + items[i].visited + ";";
        }
        if ($('.ehx-exported-data').length) {
            $('.ehx-exported-data').remove();
        }
        $('.section-container').prepend('<section class="ehx-exported-data"><fieldset><legend>' + message + '</legend><div><textarea class="ehx-exported-data-text">' + data + '</textarea></div></fieldset></section>');
    }

    function settings() {
        const req = indexedDB.open("ehxvisited", 1);

        req.onsuccess = e => {
            if (db == null) db = e.target.result;
            var objStore = db.transaction('galleries', 'readwrite').objectStore('galleries');
            var openReq = objStore.getAll();
            openReq.onsuccess = e => {
                var len = e.target.result;
                // There's probably a much easier way to do this, or at least a nicer looking, more technical way
                var container = $(`<div class="overlay"><div class="settings"><nav class="topNav">
<span style="float:left;margin-left:3px;font-weight:lighter;opacity:0.5;-webkit-opacity:0.5;">All Settings Will Be Applied On Close</span>
<div><a id="ehx-export" href="javascript:;">Export</a> | <a id="ehx-import" href="javascript:;">Import</a> | <a id="settings-close" href="javascript:;">🞫</a></div>
</nav><div class="section-container"><section><fieldset><legend>Settings</legend>
<div><label><input type="checkbox" id="softHide" ` + (setStore.softHide == true ? `checked` : ``) + `>Soft Hide Galleries</label><span>: Darken hidden galleries instead of removing them from view</span></div>
<div><label><input type="checkbox" id="minAdd" ` + (setStore.minAdd == true ? `checked` : ``) + `>Minimal Add Column</label><span>: Show visits in an additional column in Minimal/Minimal+ view modes</span>
<div class="suboptions"><div><span class="branch">&#8735</span>
<label><input type="checkbox" id="minShow" ` + (setStore.minShow == true ? `checked` : ``) + `>Minimal Show Text</label><span>: Show visits as text instead of hovering tooltip in Minimal/Minimal+ view modes</span></div></div></div>
<div><label><input type="checkbox" id="cssTT" ` + (setStore.cssTT == true ? `checked` : ``) + `>CSS Tooltips</label><span>: Replace gallery link tooltips with visited information in all view modes</span></div>
<div><label><input type="checkbox" id="repPub" ` + (setStore.repPub == true ? `checked` : ``) + `>Replace Published</label><span>: Replace date published with date visited in Minimal/Minimal+ view modes</span></div>
</fieldset><fieldset><legend><label id="cCSS"><input type="checkbox" id="cusCSS" ` + (setStore.cusCSS == true ? `checked` : ``) + `>Custom CSS</label></legend>
<h3>Visited Galleries :<div id="visControls"><button id="resV">Reset CSS</button><button class="ehx-clear">Clear Data</button></div></h3>
<textarea id="visited" class="field" spellcheck="false" placeholder="box-shadow: inset 0 0 0 500px rgba(2, 129, 255, .2) !important;">` + cssV + `</textarea>
<h3>Hidden Galleries :<div id="hideControls"><button id="resH">Reset CSS</button><button class="ehxh-clear">Clear Data</button></div></h3>
<textarea id="hidden" class="field" spellcheck="false" placeholder="box-shadow: inset 0 0 0 500px rgba(255, 40, 0, .2) !important;">` + cssH + `</textarea>
</fieldset><fieldset><legend>Filters</legend>
Use one <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">regular expression</a> per line to filter out matching galleries.<ul style="margin: 3px 0px; padding-left: 30px;">
<li>E.G. <code>Ongoing</code> will filter out every gallery with <code>ongoing</code>, case-insensitive, in the title. <code>\\[Digital\\]</code> will filter out every gallery with <code>[Digital]</code>, case-insensitive, in the title.</li>
<li>Lines starting with <code>#</code> will be ignored.</li></ul><textarea id="galFilter">` + filters + `</textarea>
<div><label><input type="checkbox" id="pFilt" ` + (setStore.pFilter == true ? `checked` : `` ) + `>Page Limit</label><span>: Filter out any gallery with pages below the page limit<input id="pLim" type="number" min="1" value="` + setStore.pLimit + `" ` + (setStore.pFilter == true ? `` : `disabled` ) + `/></span></div>
<div><label><input type="checkbox" id="stFilt" ` + (setStore.stFilter == true ? `checked` : `` ) + `>Minimum Rating</label><span>: Filter out any gallery with a rating below the limit<select id="stLim" ` + (setStore.stFilter == true ? `` : `disabled` ) + `>
<option>5</option><option>4.5</option><option>4</option><option>3.5</option><option>3</option><option>2.5</option>
<option>2</option><option>1.5</option><option>1</option><option>0.5</option><option>0</option></select></span>
</div></div></fieldset></section></div></div></div>`);
                $("body").append(container);
                $(document).on("change", "input", e => {
                    if ($("#minAdd").prop('checked')) {
                        $("#minShow").prop("disabled", false);
                    } else {
                        $("#minShow").prop("disabled", true);
                    }
                    if ($("#cusCSS").prop("checked")) {
                        $("#visited").prop("disabled", false);
                        $("#hidden").prop("disabled", false);
                        $("#resV").prop("disabled", false);
                        $("#resH").prop("disabled", false);
                    } else {
                        $("#visited").prop("disabled", true);
                        $("#hidden").prop("disabled", true);
                        $("#resV").prop("disabled", true);
                        $("#resH").prop("disabled", true);
                    }
                    if ($("#pFilt").prop('checked')) {
                        $("#pLim").prop("disabled", false);
                    } else {
                        $("#pLim").prop("disabled", true);
                    }
                    if ($("#stFilt").prop('checked')) {
                        $("#stLim").prop("disabled", false);
                    } else {
                        $("#stLim").prop("disabled", true);
                    }
                });
                $("#settings-close").click(e => {
                    var tempSto = {
                        "softHide": $("#softHide").prop('checked'),
                        "minAdd": $("#minAdd").prop('checked'),
                        "minShow": $("#minShow").prop('checked'),
                        "cssTT": $("#cssTT").prop('checked'),
                        "repPub": $("#repPub").prop('checked'),
                        "cusCSS": $("#cusCSS").prop('checked'),
                        "visHide": $(".ehx-show").text() === "Show" ? true : false,
                        "hidShow": $(".ehxh-show").text() === "Hide" ? true : false,
                        "pFilter": $("#pFilt").prop('checked'),
                        "pLimit": $("#pFilt").prop('checked') ? $("#pLim").val() : "0",
                        "stFilter": $("#stFilt").prop('checked'),
                        "stLimit": $("#stFilt").prop('checked') ? $("#stLim option:selected").text() : "0"
                    }
                    localStorage.setItem("ehx-settings", JSON.stringify(tempSto));
                    setStore = tempSto;
                    localStorage.setItem("ehx-cssv", $("#visited").val());
                    localStorage.setItem("ehx-cssh", $("#hidden").val());
                    localStorage.setItem("ehx-filters", $("#galFilter").val());
                    if (setStore.softHide == true) {
                        $("#ehx-menu-controls").css({display: ""});
                        $("#ehxh-menu-controls").css({display: ""});
                    }
                    $(".overlay").remove();
                    location.reload();
                });
                $("#resV").click(e => { $("#visited").val("box-shadow: inset 0 0 0 500px rgba(2, 129, 255, .2) !important;"); });
                $("#resH").click(e => { $("#hidden").val("box-shadow: inset 0 0 0 500px rgba(255, 40, 0, .2) !important;"); });
                if (!$("#minAdd").prop("checked")) { $("#minShow").prop("disabled", true); }
                if (!$("#cusCSS").prop("checked")) {
                    $("#visited").prop("disabled", true);
                    $("#hidden").prop("disabled", true);
                    $("#resV").prop("disabled", true);
                    $("#resH").prop("disabled", true);
                }
                $("#stLim").val(setStore.stLimit);
                $("body").click(e => {
                    if (e.target.className == "overlay") {
                        var tempSto = {
                            "softHide": $("#softHide").prop('checked'),
                            "minAdd": $("#minAdd").prop('checked'),
                            "minShow": $("#minShow").prop('checked'),
                            "cssTT": $("#cssTT").prop('checked'),
                            "repPub": $("#repPub").prop('checked'),
                            "cusCSS": $("#cusCSS").prop('checked'),
                            "visHide": $(".ehx-show").text() === "Show" ? true : false,
                            "hidShow": $(".ehxh-show").text() === "Hide" ? true : false,
                            "pFilter": $("#pFilt").prop('checked'),
                            "pLimit": $("#pFilt").prop('checked') ? $("#pLim").val() : "0",
                            "stFilter": $("#stFilt").prop('checked'),
                            "stLimit": $("#stFilt").prop('checked') ? $("#stLim option:selected").text() : "0"
                        }
                        localStorage.setItem("ehx-settings", JSON.stringify(tempSto));
                        setStore = tempSto;
                        localStorage.setItem("ehx-cssv", $("#visited").val());
                        localStorage.setItem("ehx-cssh", $("#hidden").val());
                        localStorage.setItem("ehx-filters", $("#galFilter").val());
                        if (setStore.softHide == true) {
                            $("#ehx-menu-controls").css({display: ""});
                            $("#ehxh-menu-controls").css({display: ""});
                        }
                        $(".overlay").remove();
                        location.reload();
                    }
                });
                $("#ehx-import").click(e => {
                    var objStore2 = db.transaction('galleries', 'readwrite').objectStore('galleries');
                    var c = prompt("EhxVisited:\nPaste here to import.");
                    if (c) {
                        var sp = c.split(";");
                        sp = sp.filter(Boolean);
                        var count = 0;
                        insertNext();

                        function insertNext() {
                            if (count < sp.length) {
                                var str = sp[count].split(":");
                                objStore2.put({id: str[0], visited: parseInt(str[1])}).onsuccess = insertNext;
                                ++count;
                            } else {
                                console.log("EhxVisited: Merge Completed");
                            }
                        }
                        alert("EhxVisited:\nImported " + sp.length + " entries.");
                        location.reload();
                    }
                });

                $("#ehx-export").click( e => {
                    ehxExport('Exported entries:', len);
                });

                $(".ehx-clear").click(function () {
                    if (!ehxClearConfirm) {
                        ehxClearConfirm = 1;
                        $('.ehx-clear').append(': Are you sure?');
                        ehxExport('Backup your current data:', len);
                    } else {
                        var objStore2 = db.transaction('galleries', 'readwrite').objectStore('galleries');
                        var openReq = objStore2.clear();
                        openReq.onsuccess = e => {
                            alert("EhxVisited:\nCleared all entries.");
                            location.reload();
                        }
                    }
                });

                $(".ehxh-clear").click(function() {
                    var objStore2 = db.transaction('hidden', 'readwrite').objectStore('hidden');
                    var openReq = objStore2.clear();
                    openReq.onsuccess = e => {
                        alert("EhxVisited:\nCleared all entries.");
                        location.reload();
                    }
                });
            }
        }
    }

    var inheritFonts = $('body').css('font-family') + ', arial, symbola';
    $(`<style data-jqstyle='ehxVisited'>
ehx { font-family:` + inheritFonts + ` }
.gl2c { width: 115px; }
.ehx-visited .gl3e { min-height: 206px; }
.ehx-visited .gl4e { min-height: 264px !important; }
.ehx-hidden { ` + cssD + cssH + ` }
.ehx-exported-data { display: block; }
.ehx-minimal { border-left: 1px solid #6f6f6f4d;}
.ehx-minimal-text { text-align: center; display: block; }
.ehx-compact { border-style: solid; border-width: 1px 0; text-align: center; }
.ehx-extended { width: 120px; position: absolute; left: 3px; top: 172px; text-align: center; font-size: 8pt; line-height: 1.5; }
.ehx-extended-favs { padding: 3px 1px; display: block; line-height: 1.5; }
.ehx-thumbnail { display: block; text-align: center; margin: 3px 0 5px; line-height: 12px; }
.ehx-controls { padding: 3px 1px; text-align: center; display: block; }
#hideCount > span { border-bottom: 1px dotted currentColor; }
table.itg > tbody > tr.ehx-visited, .gl1t.ehx-visited { ` + cssV + ` }
table.itg > tbody > tr.ehx-visited.ehx-hidden, .gl1t.ehx-visited.ehx-hidden { ` + cssH + ` }
.overlay { background: rgba(0,0,0,0.5); display: -webkit-flex; display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index:999; font-size: 9pt; }
.settings { background: ` + $(".ido").css("background") + `; box-sizing: border-box; height: 555px; max-height: 100%; width: 900px; max-width: 100%; margin: auto; padding: 5px; display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.5); }
.settings nav { text-align: right; padding-bottom: 5px; font-weight: bold;}
.settings legend { font-size: 10pt; font-weight: bold; }
.settings label { font-weight: bold; text-decoration: underline; cursor: pointer; }
.settings h3 { margin: 3px; position: relative; }
.settings span { margin-left: -3px; }
.settings input { vertical-align: -1px; }
.settings textarea { width: 100%; height: 150px; resize: vertical; }
.suboptions { position: relative; }
.suboptions > div { position: relative; padding-left: 1.4em; }
.branch { position: absolute; left: 10px; top: 1px; }
.nav > div { text-align: right; }
#settings-close, #cCSS { text-decoration: none; }
#visControls, #hideControls { position: absolute; right: -5px; }
#visControls { top: -6px; }
#hideControls { top: -3px; }
.section-container { text-align: left; overflow: auto;}
.section-container textarea:disabled, .section-container input:disabled, .section-container select:disabled { opacity: 0.6; -webkit-opacity: 0.6; }
.section-container input[type="number"] { border: 1px solid #8d8d8d; margin-left:15px; text-align: center; width: 50px;}
.section-container select {margin-left: 15px; }
.section-container code { color: #000; background-color: #FFF; }
</style>`).appendTo("head");
})();