XHamster Mobile Tweaks

Remove promo messages, allow links to open in the same window, and remove <aside> elements.

As of 2024-12-04. See the latest version.

// ==UserScript==
// @name         XHamster Mobile Tweaks
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Remove promo messages, allow links to open in the same window, and remove <aside> elements.
// @author       CurlyWurly
// @match        *://xhamster.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Remove elements with the class 'promo-messages-wrapper'
    const promoMessages = document.querySelectorAll('[data-role="promo-messages-wrapper"]');
    promoMessages.forEach(el => el.remove());

    // Change all links to open in the same window
    const links = document.querySelectorAll('a[target="_blank"]');
    links.forEach(link => link.setAttribute('target', '_self'));

    // Remove all <aside> elements
    const asides = document.querySelectorAll('aside');
    asides.forEach(aside => aside.remove());
})();