// ==UserScript== // @name Flickr: link to all sizes // @namespace http://tampermonkey.net/ // @version 2024-12-17 // @description try to take over the world! // @author You // @match https://www.flickr.com/photos/*/ // @match https://www.flickr.com/photos/*/page* // @match https://www.flickr.com/photos/*/with/* // @match https://www.flickr.com/photos/*/albums/* // @match https://www.flickr.com/photos/*/albums/*/page* // @match https://www.flickr.com/photos/*/albums/*/with/* // @icon https://www.google.com/s2/favicons?sz=64&domain=flickr.com // @grant none // ==/UserScript== (function() { 'use strict'; const size = '3k'; setTimeout((function monitorUpdateLinks() { let parent = document.querySelector('#content'); let lastNumberProcessed = 0; let observer = new MutationObserver(m => { let links = parent.querySelectorAll('a[href^="/photos"]'); if (links.length == lastNumberProcessed) return; Array.from(links).forEach(a => { a.href = updateLink(a.href); }); }); observer.observe(parent, { subtree: true, childList: true, attributes: true, }); function updateLink(url) { if (url.match(/([0-9]?k|[a-z]|comments|page.*)$/)) return url; let parts = url.match(/\/photos\/[^/]+\/[0-9]+/); if (!parts) return url; console.log('Updating url:', url); return `${parts[0]}/sizes/${size}` } }), 500); })();