|
1 | 1 | // ==UserScript== |
2 | 2 | // @name HD-Encode Search+ |
3 | 3 | // @namespace https://hdencode.org/ |
4 | | -// @version 1.1.0 |
| 4 | +// @version 1.1.1 |
5 | 5 | // @description Filtering, advanced sorting, live custom search, custom pagination, category switching, quick links, NFO panel, settings, presets, bulk copy, and sticky UI for HDEncode.org |
6 | 6 | // @author xXSalamanderXx |
7 | 7 | // @homepage https://github.com/xXSalamanderXx/HDEncode-Search-Plus/ |
|
144 | 144 | #${SCRIPT_ID}-bar .fs-search-input { flex: 1 1 340px; min-width: 240px; max-width: 100%; } |
145 | 145 | #${SCRIPT_ID}-bar .fs-section-line { border-top: 1px solid #21262d; } |
146 | 146 |
|
147 | | - /* Remove default spin buttons for a cleaner look on numbers */ |
148 | 147 | #${SCRIPT_ID}-bar input[type=number]::-webkit-inner-spin-button, |
149 | 148 | #${SCRIPT_ID}-bar input[type=number]::-webkit-outer-spin-button { |
150 | 149 | opacity: 0.5; |
|
399 | 398 | if (!h5) return ''; |
400 | 399 | let text = h5.textContent || h5.innerText; |
401 | 400 |
|
402 | | - // Strip bracketed tags, parenthesis years (temporarily) and sizes |
| 401 | + // Strip bracketed tags |
403 | 402 | text = text.replace(/\[.*?\]/g, ' '); |
404 | | - text = text.replace(/\(\d{4}\)/g, (match) => match.replace(/[()]/g, '')); |
405 | | - text = text.replace(/[–-]\s*[\d.]+\s*(GB|MB).*$/i, ''); |
406 | 403 |
|
407 | | - // Cut off exactly at the scene release tags to remove the clutter |
408 | | - const sceneCutoff = /\b(1080p|720p|2160p|480p|4k|uhd|web-dl|webrip|bluray|bdrip|brrip|hdtv|x264|x265|hevc|ddp\d|aac|ac3|dts|remux)\b.*/i; |
409 | | - text = text.replace(sceneCutoff, ''); |
| 404 | + // Strip trailing sizes |
| 405 | + text = text.replace(/[–-]\s*[\d.]+\s*(GB|MB).*$/i, ''); |
410 | 406 |
|
411 | | - // Replace all dots and underscores with spaces |
| 407 | + // Replace dots and underscores with spaces |
412 | 408 | text = text.replace(/[._]/g, ' '); |
413 | 409 |
|
| 410 | + // Strip parenthesis around 4-digit years to expose them as plain numbers |
| 411 | + text = text.replace(/\((\d{4})\)/g, ' $1 '); |
| 412 | + |
| 413 | + // CORE FIX: Cut off everything AFTER the first valid year (1800-2500) |
| 414 | + // Ensure the year is NOT the very first word in the string (solves the '1917' and '2012' movie title issue) |
| 415 | + text = text.replace(/^(.+?)\b(1[8-9]\d{2}|2[0-4]\d{2}|2500)\b.*/, '$1$2'); |
| 416 | + |
| 417 | + // Fallback: If no year is present (e.g. TV episodes), cut off at scene tags |
| 418 | + const sceneCutoff = /\b(1080p|720p|2160p|480p|4k|uhd|web-dl|webrip|bluray|bdrip|brrip|hdtv|x264|x265|hevc|ddp\d|aac|ac3|dts|remux|season|complete)\b.*/i; |
| 419 | + text = text.replace(sceneCutoff, ''); |
| 420 | + |
414 | 421 | // Clean up extra spaces and trailing hyphens |
415 | 422 | text = text.replace(/\s+/g, ' ').replace(/\s-\s*$/, '').trim(); |
416 | 423 |
|
417 | 424 | // Apply clean Title Case formatting |
418 | 425 | text = text.split(' ').map(word => { |
419 | | - if (word.match(/^s\d{2}e\d{2}$/i)) return word.toUpperCase(); // Preserve formatting for S01E01 |
| 426 | + if (word.match(/^s\d{2}e\d{2}$/i)) return word.toUpperCase(); |
420 | 427 | return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); |
421 | 428 | }).join(' '); |
422 | 429 |
|
|
0 commit comments