erome infinite scroll & filter video albums only, show/hide photos in albums

Erome infinite scroll. Filter video albums only, button at top right on navbar. Show/hide photos in albums button.

Version vom 19.04.2024. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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         erome infinite scroll & filter video albums only, show/hide photos in albums
// @namespace    http://tampermonkey.net/
// @version      1.0
// @license      MIT
// @description  Erome infinite scroll. Filter video albums only, button at top right on navbar. Show/hide photos in albums button.
// @author       smartacephale
// @match        *://*.erome.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=erome.com
// @run-at       document-end
// @grant        none
// ==/UserScript==

const LOGO = `
⡠⢡⠨⡠⢡⠨⡠⢡⠨⡠⢡⠨⡠⢡⠨⡠⢡⠨⡠⢡⠨⡠⢡⠨⡐⠜⠔⠎⠖⠜⠔⠎⠖⠜⠔⠎⠖⠜⠔⠎⠖⠜⠔⠎⠖⠜⠔⠎⠖⠜
⣐⢂⡒⣂⢒⢂⡒⣂⢒⢂⡒⣂⢒⢂⡒⣂⢒⢂⡒⣂⢒⢂⡒⡒⡐⡍⡍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍⢍
⡆⡇⡕⡜⡜⡌⡎⡆⡇⡇⡕⡜⡜⡌⡎⡆⡇⡇⡕⡜⡜⡌⡎⡜⡜⠌⠎⠜⠔⠕⠌⠦⠱⠌⠦⠱⠌⠦⠱⠌⠦⠱⠌⠦⠱⠌⠦⠱⠌⠆
⣈⣂⣑⣈⢂⡊⣂⢒⣈⢂⡊⣂⢊⡂⣊⡐⣂⢊⡂⣑⡐⣑⢈⣂⢊⠥⢭⢱⢩⠬⠭⠬⠥⠭⠬⠥⠭⠬⠥⠭⠬⠥⠭⠬⠥⠭⠬⠥⡍⡎
⠕⡐⢔⢂⢃⡊⣂⢃⡂⣃⢊⡂⣃⢊⡂⣊⢂⡃⣊⢂⡊⣂⢃⡂⡣⡱⡡⡪⠔⡅⡇⠭⡪⠥⢍⢎⠥⢍⢎⠥⢍⢎⠥⢍⢎⠥⢍⢎⢔⠥
⡕⡕⡕⣜⢔⢎⢆⢇⢎⢆⢇⢎⢆⢇⢎⢆⢇⢎⢆⢇⢎⢆⢇⢎⢖⢐⠐⡈⠌⡐⠨⢈⠄⠅⡂⡂⠅⡁⡂⠡⢁⢂⠡⢁⢂⠡⢁⠂⡂⡁
⢳⢑⣓⡒⡇⡳⡑⡇⡳⡑⡇⡳⡑⡇⡳⡑⡇⡳⡑⡇⡳⡑⡇⡳⡱⡠⡡⢡⠡⡨⡨⠄⡅⢅⠌⡄⠥⡨⠨⡨⡠⡡⠨⢄⠅⡌⠤⡡⡨⡠
⡣⣑⢢⢑⢅⢣⢑⡑⡅⡣⣑⣑⡑⣑⢅⢣⢑⡑⡅⡣⣑⣑⡑⡅⡣⠱⠸⠌⠮⠸⠨⠪⠪⠜⠜⠬⠱⠌⠇⢕⠬⠪⠩⠪⠜⠬⠱⠱⠨⡢
⢔⠢⡃⢎⠢⠣⢒⠱⡘⢔⠢⠢⡊⠆⢎⠢⠣⡊⢆⠣⡒⠔⡢⢃⠎⢕⠝⡸⡘⢕⠍⢇⠫⢪⠱⡙⢜⠱⡙⢜⠸⡘⢍⢎⠣⡹⡘⢕⠍⢎
⢔⢑⠜⡂⢝⢘⡘⣘⢘⡐⢍⢊⠪⡑⣑⢑⡑⣑⢑⢑⡘⣘⢘⡐⢍⠦⡱⡡⡪⡢⠭⠬⡪⠬⡪⢌⢎⠬⡪⢌⢎⢜⢌⠦⡱⡡⡪⡢⠭⢌
⡢⡱⡨⣊⢆⢕⢔⡢⡱⡨⡢⡱⣑⢌⢆⡲⡨⡢⣊⢆⡪⡢⡒⡌⣆⠣⡃⠇⡣⠣⠍⢇⠣⠹⡘⠜⠜⠜⠜⠜⠜⡸⠘⢜⠸⢘⠌⠎⠍⠎
⢇⢕⢕⢢⢣⢱⢑⢌⢎⢜⢌⢎⢆⢣⢱⢸⢨⠪⡢⡱⢌⢆⢇⢇⠦⡡⡨⢨⠠⡡⡡⢡⠡⡑⠌⡌⢌⢌⢌⢌⢌⢄⠍⡄⢅⠅⢅⠍⢌⠅
⢕⢅⢇⢕⢅⢇⢕⠕⡅⡇⡕⢥⢱⢡⢣⢱⢡⢣⢱⢑⢕⠥⡱⡡⡣⢱⠸⠸⡘⡌⢎⠜⡌⢎⠕⠕⡅⢇⠅⡇⠎⢆⠇⢇⢣⠹⡨⠪⠪⠪
⡐⡑⡐⡑⡐⡑⡐⡑⢌⢂⡊⣂⢑⡐⡑⣐⢑⢐⢑⡈⡢⡑⣈⢂⡊⡎⢎⠇⡇⡎⡎⡎⢎⠖⡕⡕⡕⡕⢕⢕⠝⡔⡕⡕⢕⢕⢪⢹⠸⡙
⠕⠕⢕⠕⢕⠕⠕⠝⠜⠜⠜⠜⠜⠜⠜⠜⠜⠜⠜⠜⠜⠜⠜⠜⢌⢆⢅⢎⢔⢔⢔⢌⢆⢅⠦⢬⢰⠨⡔⢤⢱⢰⢨⢰⢡⢢⢡⢢⢱⢨
⡜⣘⢔⢅⢣⢊⢎⢪⢊⢎⢪⢊⡪⡊⡎⡪⡊⡎⡪⡊⡎⡪⣊⢪⢂⢇⠕⡅⢇⢎⠪⡢⡃⢇⠣⡣⢱⢑⠕⢕⠅⡇⢕⠱⡡⢣⠱⡑⡅⢇
⡒⡔⡲⡸⡰⡑⡆⢇⢎⢆⢣⢒⢆⢣⢪⢒⢜⢔⢕⢜⢔⢜⢔⢜⢔⠅⠇⠎⢆⠣⠱⡘⠌⢎⠪⠸⠰⠡⠣⠣⠱⠸⡘⠜⠌⠆⠇⠕⠜⠔
⢃⢃⠣⡊⡢⢃⠎⡊⢆⢃⢃⠣⡊⡪⢂⠣⡊⡢⢃⢒⠱⡘⢔⢑⠢⡣⡣⡍⡆⡇⡇⡕⡍⡆⡇⡝⡌⡇⡝⡌⡇⡇⡎⡎⡎⡕⡍⡎⡕⡕
⡕⡱⡱⢸⠰⡱⡸⢸⠰⡑⡕⢕⠜⡔⢕⠕⡜⢔⠕⡕⡱⡸⡰⡑⡕⢌⠆⢕⠡⡱⢘⢌⠪⡨⢊⢌⠪⡘⢌⠪⡨⢊⠢⡱⢘⠌⡪⡘⢌⢊
⣒⢌⢆⢣⢑⢢⠪⡂⡇⢕⢌⢆⢣⢊⢆⢣⢊⢆⢣⢊⢆⢒⢢⠱⡘⢔⠍⡜⢌⠎⡌⢆⢣⠱⡡⡱⢡⠣⡱⠱⡘⡌⢎⠜⢔⠕⡱⡘⡌⢆
⢔⢕⢜⢔⢕⠕⡕⢕⢜⢜⢔⢕⢜⢔⢕⢜⢔⢕⢪⢢⠣⡣⢣⠣⡣⡑⠕⢌⠆⡣⡑⢅⠥⠱⡨⠌⢆⠕⠜⢌⠪⡨⠢⡩⠢⡱⠨⠢⢪⠨
⢣⢊⠆⡕⢌⠎⡜⢌⢆⢕⢌⢆⠕⡌⡆⡕⠜⡌⢆⠕⡅⡣⡱⡑⢅⢣⢍⢆⢣⢱⢘⢌⢪⢱⢘⢜⢌⢪⢱⢡⠣⡪⡱⡨⡱⡸⡨⢍⢆⢣
⢪⢂⢇⠣⡣⡑⡕⡱⡨⡢⡱⡘⡌⡪⡂⢇⢣⠱⣑⢱⠡⡃⡎⢜⢸⢐⠕⡌⡪⢢⠱⡡⢣⢡⠱⡡⢪⠸⡐⡅⡣⡱⢨⠪⡨⢢⠱⡡⡱⢡
⡌⢆⢣⠱⡡⡱⡘⡌⢆⢕⠜⢌⢪⢘⢌⢎⢊⢎⢢⠱⡑⡅⡣⢣⢑⢅⢇⢪⢸⠰⡱⢸⠰⡡⡣⢱⠡⡣⡱⡘⡔⡱⡡⢣⠱⡡⡣⡱⡘⡌
⠪⡊⢆⢣⠱⡨⡢⢣⢑⢢⢃⢇⢕⠱⡨⢢⢃⢎⠢⡣⢱⢘⢌⢆⢣⢊⢆⢣⢡⠣⡪⢪⠸⡐⡕⢅⠇⡕⡌⢎⢌⢆⢣⠱⡑⡱⡨⢢⠣⡱`;
console.log(LOGO);

function togglePhotoElements(){
    Array.from(document.querySelectorAll('.media-group')).forEach(a => {
        if (!a.querySelector('.video')) {
            if (config.showPhotos) {
                $(a.parentElement).css("display", "block");
            } else {
                $(a.parentElement).css("display", "none");
            }
        }
    });
}

function hidePhotoOnlyAlbums() {
    const albumsContainers = document.querySelectorAll('#albums');
    albumsContainers.forEach(a => {
        Array.from(a.children).forEach(a => {
            if (!a.querySelector('.album-videos')) {
                if (config.showPhotoAlbums) {
                    $(a).show();
                } else {
                    $(a).hide();
                }
            }
        });
    });

}

function infiniteScrollAndLazyLoading() {
    // taken from index.html of erome mobile version
    const curPage = window.location.search.match(/page=(\d+)/);
    var next_page = (curPage ? parseInt(curPage) : 1) + 1;

    var infinite = $('#page').infiniteScroll({
        path: function() {
            return location.pathname + '?page=' + next_page;
        },
        append: '.page-content',
        scrollThreshold: 800
    });

    $('#page').on( 'append.infiniteScroll', function( event, body, path, items, response ) {
        hidePhotoOnlyAlbums();
        new LazyLoad();
        next_page = next_page + 1;
        if(next_page > 50  || next_page > 50){
            infinite.destroy();
        }
    });
}

const DEFAULT_CONFIG = {
    showPhotos: false,
    showPhotoAlbums: false
};

const stored = localStorage.getItem("config");
const config = JSON.parse(stored) || DEFAULT_CONFIG;


(function() {
    'use strict';

    if (/^\/a\//.test(window.location.pathname)) {
        togglePhotoElements();
        $('#user_name').parent().append('<button id="togglePhotos" class="btn btn-pink user-hide">show/hide photos</button>');
        $('#togglePhotos').on('click', () => {
            config.showPhotos = !config.showPhotos;
            localStorage.setItem("config", JSON.stringify(config));
            togglePhotoElements();
        });
    } else {
        hidePhotoOnlyAlbums();
        infiniteScrollAndLazyLoading();
        $('.navbar-nav').append('<li><a href="#" id="togglePhotoAlbums">video only</span></a></li>');
        $('#togglePhotoAlbums').css('color', !config.showPhotoAlbums ? '#eb6395' : '#a09f9d');
        $('#togglePhotoAlbums').on('click', () => {
            config.showPhotoAlbums = !config.showPhotoAlbums;
            localStorage.setItem("config", JSON.stringify(config));
            hidePhotoOnlyAlbums();
            $('#togglePhotoAlbums').css('color', !config.showPhotoAlbums ? '#eb6395' : '#a09f9d');
        });
    }
})();