Discussions » Development

Use ChatGPT to help general people to write userscripts

https://chat.openai.com/g/g-Mp0PIpwBG-userscript-gpt

And here is its work.


// ==UserScript==
// @name         Ad and Element Remover for GreasyFork
// @namespace    http://greasyfork.org/
// @version      1.0
// @description  Remove specific ads and elements from GreasyFork
// @author       UserScript GPT
// @match        https://greasyfork.org/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // Function to remove elements by selector
    function removeElementsBySelector(selector) {
        const elements = document.querySelectorAll(selector);
        elements.forEach(el => el.remove());
        return elements.length;
    }

    // Delay execution to ensure page is fully loaded
    setTimeout(() => {
        let count = 0;

        // Remove elements by class and ID
        count += removeElementsBySelector('.adsbygoogle');
        count += removeElementsBySelector('#ad_position_box');

        // Log the number of removed elements
        console.log('Removed ' + count + ' element(s).');
    }, 1000); // 1 second delay
})();

Hope it can help you:)

§
Posted: 8.1.2024
Edited: 8.1.2024

what about this though: https://greasyfork.org/discussions/requests/221077-in-a-steam-workshop-page-is-it-possible-to-raise-the-number-of-items-shown-per-page-past-30

Steam Workshop page?

Which page? Can you give me a link? Let me try to communicate with GPT and see the result

Post reply

Sign in to post a reply.