NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Pinterest Cleanser // @namespace http://pixelstomp.com // @version 3.2 // @description Removes sponsored posts from Pinterest. Leaves a chunk of whitespace, but maintains the the a e s t h e t i c of your Pinterest algorithm. Updated for Pinterest DOM model as of October 2023 // @author intrepidOlivia // @match *://*.pinterest.com/* // @copyright 2019, intrepidOlivia (https://openuserjs.org//users/intrepidOlivia) // @license MIT // ==/UserScript== (function() { 'use strict'; function hasBeforeContent(element) { const content = window.getComputedStyle(element, '::before').getPropertyValue('content'); return content !== 'none' && content !== ''; } function getBeforeContent(element) { const content = window.getComputedStyle(element, '::before').getPropertyValue('content'); if (content !== 'none' && content !== '') { return content; } else { return null; } } const bulldozer = setInterval(() => { const allPins = document.querySelectorAll('div[data-grid-item="true"]'); allPins.forEach((pin) => { const allChildren = pin.querySelectorAll('*'); // Pinterest has introduced a tricksy mechanism by which the 'Promoted By' text is not part of the DOM but is content injected via CSS. // The following operation is pretty compute-heavy as a result, but works in Chrome and Firefox as tested October 2023. const childrenWithBefore = Array.from(allChildren).filter(elem => hasBeforeContent(elem)).map(elem => getBeforeContent(elem)); const joinedContent = childrenWithBefore.join(''); if (joinedContent.includes('"P""r""o""m""o""t""e""d"" ""b""y"')) { pin.innerHTML = ''; } if (pin.innerText.includes('Promoted by')) { pin.innerHTML = ''; } }); }, 200); })();