E-H Visited

Upgrade to EhxVisited (sleazyfork.org/en/scripts/377945)

< Feedback on E-H Visited

Question/comment

§
Posted: 29.3.2019

Merge Function

$(".ehv-merge").click(function() {
            var c = prompt("E-H Visited:\nPaste here to import, and merge with current data.");
            if (c) {
                var d = JSON.parse('{"data":{}}');
                var sp = c.split(";");
                sp = sp.filter(Boolean);
                for (var k in sp) {
                    var s = sp[k].split(":");
                    d.data[s[0]] = parseInt(s[1]);
                }
                for(var i = 0; i < Object.keys(vis.data).length; i++) {
                    d.data[Object.keys(vis.data)[i]] = vis.data[Object.keys(vis.data)[i]];
                }

                alert("Merged " + Object.keys(d.data).length + " entries.");
                localStorage.setItem(storageName, JSON.stringify(d));
                location.reload();
            }
        });

Add the sp = sp.filter(Boolean); to the import function since it's adding a null element currently.

§
Posted: 29.3.2019

} else { //minimal for (i = 1; i < list.length; i++) { gid = $(list[i]).find(".glname a").attr("href").split("/"); galleryId = gid[4] + "." + gid[5]; if (vis.data[galleryId] != undefined) { d = new Date(vis.data[galleryId]); $(list[i]).addClass("ehv-visited"); $(list[i]).children('.gl3m')[0].setAttribute("title", 'E-H Visited: ' + timeDifference(Date.now(), vis.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() + "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate()); } } }

Tooltips on minimal mode

§
Posted: 29.3.2019

With our Avast customer support services, you can get an immediate resolution for all the errors that may affect the functioning of the antivirus. Once it stops scanning, your PC might be vulnerable to the several hacking attacks such as Ransomware. To prevent this, all you need to do is call our Avast support phone number, which remains available for all day long. http://www.avast-support.net/

§
Posted: 31.3.2019

} else if ($('.gl1c').length) { //compact var borderColour = $('.gl1c').first().css('border-top-color'); //border colour different between domains if ($('table.itg tbody>tr:first-child')[0].cells.length < 5 && !repDate) { $('table.itg tbody>tr:first-child th:nth-child(2)').after('Visited'); } if (repDate) { $('table.itg tbody>tr:first-child')[0].children[1].innerText = "Visited" }

            for (i = 1; i < list.length; i++) {
                gid = $(list[i]).find(".glname a").attr("href").split("/");
                galleryId = gid[4] + "." + gid[5];
                if (vis.data[galleryId] != undefined) {
                    d = new Date(vis.data[galleryId]);
                    if (repDate != true) {
                        if (list[i].cells.length < 5) {
                            $(list[i]).addClass("ehv-visited");
                            $(list[i]).children('.gl2c').after('<td class="ehv-compact" style="border-color:' + borderColour + ';"><ehv>' + timeDifference(Date.now(), vis.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() + '</ehv></td>');
                        }
                    } else {
                        $(list[i]).addClass("ehv-visited");
                        $(list[i])[0].children[1].children[1].innerText = 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');
                    }
                } else {
                    if (!repDate) {
                        if (list[i].cells.length < 5) {
                            $(list[i]).children('.gl2c').after('<td class="ehv-compact" style="border-color:' + borderColour + ';"></td>');
                        }
                    } else {
                        $(list[i])[0].children[1].children[1].innerText = "Never Visited";
                    }
                }
            }
        } else { //minimal
            if (repDate) {
                $('table.itg tbody>tr:first-child')[0].children[1].innerText = "Visited"
            }

            for (i = 1; i < list.length; i++) {
                gid = $(list[i]).find(".glname a").attr("href").split("/");
                galleryId = gid[4] + "." + gid[5];
                if (vis.data[galleryId] != undefined) {
                    d = new Date(vis.data[galleryId]);
                    if (!repDate) {
                        $(list[i]).addClass("ehv-visited");
                        $(list[i]).children('.gl3m')[0].setAttribute("title", 'E-H Visited: ' + timeDifference(Date.now(), vis.data[galleryId]) + " (" + d.getHours().toString().padStart(2, '0') + ":" + d.getMinutes().toString().padStart(2, '0') + ") " + d.getFullYear().toString() +  "\u2011" + (d.getMonth() + 1) + "\u2011" + d.getDate());
                    } else {
                        $(list[i])[0].children[1].children[1].innerText = 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');
                    }
                } else {
                    if (repDate) {
                        $(list[i])[0].children[1].children[1].innerText = "Never Visited";
                    }
                }
            }
        }

Replacing Published with date viewed, add in a member boolean variable called repDate.

HEN-TIEAuthor
§
Posted: 4.4.2019
Edited: 4.4.2019

The merge function is excellent, going to add it soon B) Also going to add some non-default appearance options for the other ideas here.

Made this to replace the write on page load. Very broad, yet unobtrusive.

    // track galleries opened on-site
    $('a').on('mouseup', function () {
        var spl = this.href.split("/");
        var d1 = spl[3]
        var d2 = spl[4];
        var d3 = spl[5];

        if (d1 == "g") {
            var c = d2 + "." + d3;
            vis.data[c] = Date.now();
            localStorage.setItem(storageName, JSON.stringify(vis));
        }
    });

    // track galleries opened indirectly (offsite link, shortcut file, context menu, bookmark, etc.)
    $(window).one('click scroll', function () {
        if (d1 == "g") {
            var c = d2 + "." + d3;
            vis.data[c] = Date.now();
            localStorage.setItem(storageName, JSON.stringify(vis));
        }
    });
§
Posted: 8.4.2019

Add in an if statement to cull table cell additions in table based views, fixes for infinite scrolling. if ($(list[i])[0].children.length === x) { //Add cells } x is 6 in Minimal and Minimal+, 4 in Compact.

HEN-TIEAuthor
§
Posted: 9.4.2019

Do you also have 50 search results per page? Logged out, you get 25, and I don't know if I have some kind of perk, or if everyone logged in gets 50.

I'm trying to use an offset subtracted from the galleries on the page, instead of IFs.

It seems to be working right now, except on favorites. Might scrap the idea and just add more IFs everywhere.

headerGalLen = galLen = $("table.itg>tbody>tr, .itg .gl1t").length - 50;
§
Posted: 9.4.2019

I log in using cookie editing, and I only have 25 results per page. You could just change that portion of code to get the initial div count per page instead of hardcoding a value. Honestly though, iterating through 50 values vs. 500 values is not much of a computational difference, so it's probably just easier to use the if statements.

HEN-TIEAuthor
§
Posted: 10.4.2019

Maybe it's an account age thing? I have no idea.

I've switched over to that if statement.

Post reply

Sign in to post a reply.