Xhamster Search Favs in Collection List v.1

Xhamster Search Favs in Collection List

Version vom 22.02.2025. 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 or Violentmonkey 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         Xhamster Search Favs in Collection List v.1
// @namespace    https://greasyfork.org/fr/users/7434-janvier56
// @version      1.0.0
// @description  Xhamster Search Favs in Collection List
// @icon         https://external-content.duckduckgo.com/ip3/fr.xhamster.com.ico
// @author       janvier57
// @include      https://xhamster.com/my/favorites/*
// @license      unlicense
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';
    var searchInput = document.createElement('input');
    searchInput.type = 'search';
    searchInput.placeholder = 'Rechercher';
    searchInput.id = 'search-favs';

    var clearButton = document.createElement('button');
    clearButton.textContent = 'X';
    clearButton.id = 'clear-search';

    var searchContainer = document.createElement('div');
    searchContainer.appendChild(searchInput);
    searchContainer.appendChild(clearButton);

    var target = document.querySelector('.favorites-page .side-column ul.submenu li:last-child');
    target.parentNode.insertBefore(searchContainer, target.nextSibling);

    clearButton.addEventListener('click', function() {
        searchInput.value = '';
        var links = document.querySelectorAll('.favorites-page .side-column ul.favorites-side-switcher li a + ul a:not(.edit-collection)');
        links.forEach(function(link) {
            link.parentNode.style.display = '';
        });
    });

    searchInput.addEventListener('input', function() {
        var filter = searchInput.value.toLowerCase();
        var links = document.querySelectorAll('.favorites-page .side-column ul.favorites-side-switcher li a + ul a:not(.edit-collection)');
        links.forEach(function(link) {
            var text = link.textContent.toLowerCase();
            if (text.includes(filter)) {
                link.parentNode.style.display = '';
                link.classList.add('match');
            } else {
                link.parentNode.style.display = 'none';
                link.classList.remove('match');
            }
        });
    });

    GM_addStyle(`
        /* XHAM - GM "Xhamster Search Favs in Collection Liste v.1" */
        .width-wrap ,
        .main-wrap {
            max-width: 100%;
        }
        .side-column {
            position: relative;
            float: left;
            width: 300px ;
            padding-right: 31px;
            border-right: 1px solid silver;
        }
        .favorites-page .favorites-side-switcher ul.video-collections-list {
            min-height: 370px;
            max-height: 370px;
            background: #111;
            border: 1px solid silver;
            border-left: 3px solid red;
        }

        .favorites-page .side-column ul.submenu li a {
          color: silver ;
          display: inline-block;
          max-width: 245px;
          overflow: hidden;
          padding-right: 5px;
          text-overflow: ellipsis;
          vertical-align: middle;
        }
        .content-column {
          margin-left: 380px;
        }
        /* GM */

        .favorites-page ul.submenu .create-video-collection + div:has(#search-favs) {
            position: fixed;
            display: inline-block;
            height: 2.9vh !important;
            width: 330px;
            bottom: 0.5vh;
            right: 1540px;
            z-index: 1;
            background: rgb(34, 34, 34);
            border: 1px solid azure;
        }
        /* HOVER */
        .favorites-page ul.submenu .create-video-collection + div:has(#search-favs):hover{
            background: green !important;
            border: 1px solid azure !important;
        }

        .favorites-page ul.submenu .create-video-collection + div:has(#search-favs) input#search-favs {
            position: relative  !important;
            display: inline-block;
            height: 2.5vh !important;
            width: 300px ;
            top: 0vh ;
            right: 0 ;
            z-index: 5000;
            color: gold;
            background: rgb(34, 34, 34);
            border: 1px solid azure;
        }
                .favorites-page ul.submenu .create-video-collection + div:has(#search-favs) button#clear-search {
            display: inline-block;
            height: 2.5vh !important;
            width: 20px;
            z-index: 5000;
            background: red;
            border: 1px solid azure;
        }
    `);
})();