NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Camdevils.com filter search results by site // @description Adds the possibility of filtering search results based on the websites. Hide a website where you don't have an account, show only results from a single website, etc. // @version 1.0.0 // @grant GM.setValue // @grant GM.getValue // @license MIT // @copyright 2018, kompisn90 (https://openuserjs.org/users/kompisn90) // @include https://camdevils.com/*/*/ // ==/UserScript== // ==OpenUserJS== // @author kompisn90 // ==/OpenUserJS== var camSites const filter = () => { let items = [...document.querySelectorAll('.portfolio li')] items.forEach(item => { item.style.display = '' let link = item.querySelector('a').href let showLink = Object.keys(camSites) .filter(site => camSites[site]) .reduce((showLink, site) => { return showLink || link.indexOf(site) > -1 }, false) if (!showLink) { item.style.display = 'none' } }) } GM.getValue('camSites', JSON.stringify({ streamate: true, chaturbate: true, bongacams: true, livejasmin: true, xlovecam: true, })) .then(result => { camSites = JSON.parse(result) filter() const breadcrumb = document.querySelector('.breadcrumb') const div = document.createElement('div') Object.keys(camSites).forEach(site => { let label = document.createElement('label') label.textContent = site[0].toUpperCase() + site.slice(1) let input = document.createElement('input') input.type = 'checkbox' input.value = site if (camSites[site]) { input.checked = 'checked' } input.addEventListener('change', e => { camSites[e.target.value] = !camSites[e.target.value] GM.setValue('camSites', JSON.stringify(camSites)) filter() }) label.appendChild(input) div.appendChild(label) }) breadcrumb.parentNode.insertBefore(div, breadcrumb) const observer = new MutationObserver(filter) observer.observe(document.querySelector('.portfolio'), { childList: true, subtree: true }) })