No-price package filter

Filter out subs on pricechanges with non-zero new price. Just click the "Recent price changes" title.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         No-price package filter
// @namespace    https://greasyfork.org/en/users/738914-ibreakeverything
// @version      2024-02-06.1
// @description  Filter out subs on pricechanges with non-zero new price. Just click the "Recent price changes" title.
// @author       iBreakEverything
// @match        https://steamdb.info/pricechanges/
// @icon         https://steamdb.info/static/logos/vector_prefers_schema.svg
// @grant        none
// @license      GNU GPLv3
// ==/UserScript==

(function() {
    const ANCHOR_SELECTOR = '.pre-table-title';
    (new MutationObserver((changes, observer) => check(changes, observer, ANCHOR_SELECTOR, main))).observe(document, {childList: true, subtree: true});
    
    function check(changes, observer, target, f) {
    	if (document.querySelector(target)) {
    		observer.disconnect();
    		f();
    	}
    }
    
    // Clicky title for trigger
    function main() {
    	document.querySelector(ANCHOR_SELECTOR).addEventListener('click', () => {showAll();});
    }
    
    function showAll() {
    	// Show 1k entries
    	const changeEvent = document.createEvent("HTMLEvents");
    	changeEvent.initEvent("change", false, true);
    	const entryCountSelect = document.querySelectorAll('select')[1];
    	entryCountSelect.selectedIndex = 4;
    	entryCountSelect.dispatchEvent(changeEvent);
    
        (new MutationObserver((changes, observer) => check(changes, observer, '.package', filterApps))).observe(document, {childList: true, subtree: true});
    }
    
    // Filter apps with new non-zero cost
    function filterApps() {
    	const tableRows = document.querySelectorAll('.package');
    	for(const row of tableRows) {
    		if (row.querySelectorAll('.b')[1].innerText != '—') {
    			row.hidden = true;
    		}
    	}
    }
})();