Skip to content

Commit ce2c967

Browse files
Release 1.1.1
1 parent f290caa commit ce2c967

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

HDEncode-Search-Plus.user.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name HD-Encode Search+
33
// @namespace https://hdencode.org/
4-
// @version 1.1.0
4+
// @version 1.1.1
55
// @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
66
// @author xXSalamanderXx
77
// @homepage https://github.com/xXSalamanderXx/HDEncode-Search-Plus/
@@ -144,7 +144,6 @@
144144
#${SCRIPT_ID}-bar .fs-search-input { flex: 1 1 340px; min-width: 240px; max-width: 100%; }
145145
#${SCRIPT_ID}-bar .fs-section-line { border-top: 1px solid #21262d; }
146146
147-
/* Remove default spin buttons for a cleaner look on numbers */
148147
#${SCRIPT_ID}-bar input[type=number]::-webkit-inner-spin-button,
149148
#${SCRIPT_ID}-bar input[type=number]::-webkit-outer-spin-button {
150149
opacity: 0.5;
@@ -399,24 +398,32 @@
399398
if (!h5) return '';
400399
let text = h5.textContent || h5.innerText;
401400

402-
// Strip bracketed tags, parenthesis years (temporarily) and sizes
401+
// Strip bracketed tags
403402
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, '');
406403

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, '');
410406

411-
// Replace all dots and underscores with spaces
407+
// Replace dots and underscores with spaces
412408
text = text.replace(/[._]/g, ' ');
413409

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+
414421
// Clean up extra spaces and trailing hyphens
415422
text = text.replace(/\s+/g, ' ').replace(/\s-\s*$/, '').trim();
416423

417424
// Apply clean Title Case formatting
418425
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();
420427
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
421428
}).join(' ');
422429

0 commit comments

Comments
 (0)