Raw Source
hardforty / Engorgedtits

// ==UserScript==
// @namespace    https://openuserjs.org/users/hardforty
// @name         Engorgedtits
// @author       hardforty
// @description  Hide premium content from listings, link h1 to video in new tab.
// @license      MIT
// @version      1.2.25
// @match        https://engorgedtits.com/*
// @include      https://engorgedtits.com/*
// @connect      engorgedtits.com
// @icon         https://www.google.com/s2/favicons?sz=64&domain=engorgedtits.com
// @downloadURL  https://openuserjs.org/install/hardforty/engorgedtits.user.js
// @updateURL    https://openuserjs.org/meta/hardforty/engorgedtits.meta.js
// @grant        GM_addStyle
// ==/UserScript==

// ==OpenUserJS==
// @author       hardforty
// ==/OpenUserJS==

(function() {
    'use strict';
    console.info('EngT running');

	const
		context = window.location.pathname.startsWith('/video/') ? 'video' : 'listings',
		wipePrem = () => { // Remove premium links
			for (const item of document.querySelectorAll(".categories-1-premium, .categories-blur, .categories-no-milk, .categories-exclusive")) {item.parentNode.remove();} 
		},
		linkH1 = () => { // Link h1 to open video in new tab
			const
				mediaURL = JSON.parse(document.querySelector('[id^="wpfp_"]').getAttribute('data-item'))['sources'][0]['src'].replace('480LQ','1080'),
				h1Element = document.querySelector('h1'),
				h1Text = h1Element.textContent,
				aElement = Object.assign(document.createElement('a'), {
					textContent:	h1Text,
					href:			mediaURL,
					target:			'_self'
				}),
            	aHDElement = Object.assign(document.createElement('a'), {
                	textContent:	` ${String.fromCodePoint(127351)} `,
                    href:			mediaURL.replace('-480','-1080'),
                    target:			'_self'
                });
			h1Element.textContent = '';
			h1Element.appendChild(aElement);
            ((mediaURL.indexOf('CONTABO') == -1) && (mediaURL.indexOf('/480/') == -1) && (mediaURL.indexOf('480.') != -1))  && h1Element.appendChild(aHDElement);
		};
	console.info('constants defined');
	switch (context) { // Main code
		case 'listings':
			wipePrem();
			break;
		case 'video':
			linkH1();
			break;
	}
})();