// ==UserScript== // @name Snackology Landing Page Router & Rewriter // @namespace https://www.theomnicosm.com/ // @version 1.2 // @description Standardizes Snackology landing pages, injects UI, and rewrites category URLs. // @match https://www.theomnicosm.com/* // @grant none // ==/UserScript== (function() { 'use strict'; // 1. URL Rewriting / Redirection mapping for category tags const urlMap = { "/tag/snackology-toy-included/": "/snackology-toy-included/" }; const currentPath = window.location.pathname; if (urlMap[currentPath]) { window.history.replaceState(null, '', urlMap[currentPath]); } // Intercept clicks on links pointing to old tag URLs document.addEventListener('click', function(e) { const anchor = e.target.closest('a'); if (anchor && anchor.getAttribute('href')) { for (const [oldUrl, newUrl] of Object.entries(urlMap)) { if (anchor.getAttribute('href').includes(oldUrl)) { e.preventDefault(); window.location.href = newUrl; return; } } } }, true); // 2. Landing Page Templates & Configurations const pages = { "/snackology-mcdonalds/": { title: "McDonald’s", tag: "mcdonalds", buttonText: "More McDonald’s" }, "/snackology-mountain-dew/": { title: "Mountain Dew", tag: "mountain-dew", buttonText: "More Mountain Dew" }, "/snackology-nerds-gummy-clusters/": { title: "Nerds Gummy Clusters", tag: "nerds-gummy-clusters", buttonText: "More Nerds Gummy Clusters" }, "/snackology-oreo/": { title: "Oreo", tag: "oreo", buttonText: "More Oreo" }, "/snackology-pop-tarts/": { title: "Pop-Tarts", tag: "pop-tarts", buttonText: "More Pop-Tarts" }, "/snackology-reeses/": { title: "Reese’s", tag: "reeses", buttonText: "More Reese’s" }, "/snackology-soda/": { title: "Soda", tag: "soda", buttonText: "More Soda" }, "/snackology-taco-bell/": { title: "Taco Bell", tag: "taco-bell", buttonText: "More Taco Bell" }, "/snackology-wendys/": { title: "Wendy’s", tag: "wendys", buttonText: "More Wendy’s" }, "/snackology-snack-chat/": { title: "Snack Chat", tag: "snackology-snack-chat", buttonText: "More Snack Chat" }, "/snackology-food-finds/": { title: "Food Finds", tag: "snackology-food-finds", buttonText: "More Food Finds" }, "/snackology-versus-ranked/": { title: "Versus & Ranked", tag: "tag:[snackology-versus,snackology-ranked]", buttonText: "More Versus & Ranked", isMultiTag: true }, "/snackology-toy-included/": { title: "Toy Included", tag: "snackology-toy-included", buttonText: "More Toy Included" } }; const config = pages[currentPath]; if (!config) return; // Inject CSS styling const style = document.createElement('style'); style.innerHTML = ` #snackology-landing { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #15171a; background: #fff; width: calc(100vw - 40px); max-width: 1200px; margin-left: 50%; transform: translateX(-50%); box-sizing: border-box; position: relative; z-index: 1; padding: 0 0 60px 0; scroll-behavior: smooth; } .snack-brand-header { text-align: center; padding: 40px 0 10px 0; } .snack-brand-header img { max-width: 400px; width: 100%; height: auto; } .page-title-centered { display: block; text-align: center; font-family: 'Bitter', serif; font-size: 41.6px; font-weight: 700; color: rgb(38, 38, 38); line-height: 53.25px; margin: 10px 0 30px 0; } .snack-sub-nav { display: flex; justify-content: center; border-top: 1px solid #eeeeee; border-bottom: 1px solid #eeeeee; padding: 12px 0; margin-bottom: 40px; background: #fff; flex-wrap: wrap; } .snack-sub-nav a { color: rgb(38, 38, 38); text-decoration: none !important; font-size: 14px; font-weight: 500; padding: 5px 15px; transition: color 0.2s ease; } .snack-sub-nav a:hover { color: #f21b3f; } .grid-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 50px 25px; margin-bottom: 40px; } .mini-card { text-decoration: none !important; color: inherit; display: block; } .mini-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #f7f7f8; border-radius: 4px; margin-bottom: 15px; } .mini-card h4 { margin: 0 0 10px 0; font-size: 1.25em; line-height: 1.3; font-weight: 800; color: #15171a; } .card-excerpt { display: block; font-family: 'Bitter', serif; font-size: 14.4px; font-weight: 400; color: rgb(38, 38, 38); line-height: 21.6px; hyphens: none; letter-spacing: normal; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 6px; } .card-date { font-family: Inter, sans-serif; font-size: 12.8px; font-weight: 500; color: rgb(38, 38, 38); opacity: 0.65; text-transform: uppercase; line-height: 20.48px; display: block; margin-top: 4px; } .mini-card:hover h4 { text-decoration: underline; color: #f21b3f; } .more-container { display: flex; justify-content: center; margin-top: 20px; } .more-link-btn { display: flex; justify-content: center; align-items: center; background-color: transparent; border: 1px solid #404040; color: #404040 !important; padding: 0 60px; text-decoration: none !important; font-weight: 600; font-size: 13.6px; text-transform: uppercase; letter-spacing: 0.4px; height: 42px; cursor: pointer; transition: 0.2s; } .more-link-btn:hover { background: #404040; color: #fff !important; } @media (max-width: 900px) { #snackology-landing { width: 100%; margin-left: 0; transform: none; padding: 10px 15px; } .snack-sub-nav { display: none; } .grid-row { grid-template-columns: 1fr; gap: 40px 0; } .page-title-centered { font-size: 32px; } } `; document.head.appendChild(style); // Build standard layout structure document.body.innerHTML = `
Snackology

${config.title}

`; // Ghost API Fetch Logic & Rendering const G_URL = 'https://popculturology.ghost.io'; const G_KEY = '3a7b1d5910d2206d00de6684c8'; let currentPage = 1; const postsPerPage = 15; function formatDate(dateString) { if (!dateString) return ''; const d = new Date(dateString); return d.toLocaleDateString('en-US', { month: 'long', day: '2-digit', year: 'numeric' }).toUpperCase(); } async function fetchSnacks(page = 1) { const btn = document.getElementById('load-more-btn'); btn.innerText = "Loading..."; try { const filterParam = config.isMultiTag ? config.tag : `tag:${config.tag}`; const res = await fetch(`${G_URL}/ghost/api/content/posts/?key=${G_KEY}&filter=${filterParam}&limit=${postsPerPage}&page=${page}`); const d = await res.json(); const container = document.getElementById('snack-grid'); if (d.posts && d.posts.length > 0) { const html = d.posts.map(p => { const cleanExcerpt = p.excerpt ? p.excerpt.replace(/\s?\.\.\.\s?$/, '') : ''; return `

${p.title}

${cleanExcerpt} ${formatDate(p.published_at)}
`; }).join(''); container.insertAdjacentHTML('beforeend', html); btn.innerText = config.buttonText; if (!d.meta.pagination.next) { btn.parentElement.style.display = 'none'; } } } catch (e) { console.error(e); btn.innerText = config.buttonText; } } document.getElementById('load-more-btn').addEventListener('click', () => { currentPage++; fetchSnacks(currentPage); }); fetchSnacks(currentPage); })();

The Lonely Island

2 articles

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to The Omnicosm.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.