Skip to content

Instantly share code, notes, and snippets.

@MatyiFKBT
Created January 13, 2025 15:04
Show Gist options
  • Save MatyiFKBT/64b32e9336be4af77cc7804261660794 to your computer and use it in GitHub Desktop.
Save MatyiFKBT/64b32e9336be4af77cc7804261660794 to your computer and use it in GitHub Desktop.
Show new beers on Untappd - quick userscript might use later
// ==UserScript==
// @name New Beerz
// @namespace http://tampermonkey.net/
// @version 2025-01-13
// @description Add button to filter for new beeeeeeeerz.
// @author MatyiFKBT
// @match https://untappd.com/v/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=untappd.com
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
GM_addStyle(".menu-search-bar .filter-toggle, .menu-search-bar .search-form .search-btn { width:12%; padding-left:0; }");
GM_addStyle(".hidden { display:none; }");
const menu = document.querySelector(".menu-search-bar");
const div = document.createElement("div");
div.classList.add("filter-toggle");
div.innerHTML = `<p><span id="show-new-btn">new</span></p>`;
menu.appendChild(div);
document.querySelector("#show-new-btn").addEventListener('click', ()=>{
[...document.querySelectorAll('.menu-item#beer')].filter(e=>e.querySelector('.drankit')).map(e=>e.classList.toggle('hidden'));
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment