|
| 1 | +// ==UserScript== |
| 2 | +// @name ImageFap Photo Dimensions Highlighter |
| 3 | +// @namespace Dimensions_Highlighter |
| 4 | +// @version 1.0 |
| 5 | +// @description Highlights dimension text on single photo pages: green (>=1000px), orange (601-999px), red (<=600px) |
| 6 | +// @author masterofobzene |
| 7 | +// @match https://www.imagefap.com/pictures/* |
| 8 | +// @grant none |
| 9 | +// @icon https://www.imagefap.com/favicon.ico |
| 10 | +// @downloadURL https://github.com/masterofobzene/UserScriptRepo/raw/main/NSFW/dimensions_highlighter.user.js |
| 11 | +// @updateURL https://github.com/masterofobzene/UserScriptRepo/raw/main/NSFW/dimensions_highlighter.user.js |
| 12 | +// ==/UserScript== |
| 13 | + |
| 14 | +(function() { |
| 15 | + 'use strict'; |
| 16 | + |
| 17 | + // Target the exact <font><b>W</b> x <b>H</b></font> structure |
| 18 | + document.querySelectorAll('font').forEach(font => { |
| 19 | + const bolds = font.querySelectorAll('b'); |
| 20 | + if (bolds.length === 2 && font.textContent.trim().match(/^\d+\s*x\s*\d+$/)) { |
| 21 | + const w = parseInt(bolds[0].textContent); |
| 22 | + const h = parseInt(bolds[1].textContent); |
| 23 | + const maxSide = Math.max(w, h); |
| 24 | + |
| 25 | + let bg = '#FFA500'; // bright orange |
| 26 | + let color = '#000'; // black text |
| 27 | + if (maxSide >= 1000) { |
| 28 | + bg = '#00CC00'; // darker green |
| 29 | + color = '#000'; |
| 30 | + } else if (maxSide <= 600) { |
| 31 | + bg = '#FF0000'; // bright red |
| 32 | + color = '#FFF'; |
| 33 | + } |
| 34 | + |
| 35 | + font.style.backgroundColor = bg; |
| 36 | + font.style.color = color; |
| 37 | + font.style.padding = '6px 12px'; |
| 38 | + font.style.borderRadius = '6px'; |
| 39 | + font.style.display = 'inline-block'; |
| 40 | + font.style.fontWeight = 'bold'; |
| 41 | + } |
| 42 | + }); |
| 43 | +})(); |
0 commit comments