Last active
November 4, 2023 13:17
-
-
Save 56k-modem/a033fe0e75b29c659188511f5f13184e to your computer and use it in GitHub Desktop.
nCore imdb highlight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name nCore imdb highlight | |
// @namespace https://56k-modem.online/ | |
// @version 0.3 | |
// @description see name | |
// @author You | |
// @match https://ncore.pro/torrents.php* | |
// @icon https://static.ncore.pro/styles/ncore.ico | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var elements = document.body.querySelectorAll(":not(script):not(style)"); | |
elements.forEach(function(element) { | |
var regex = /imdb:\s(\d+(\.\d+)?)/g; | |
var matches = element.innerHTML.match(regex); | |
if (matches) { | |
matches.forEach(function(match) { | |
var rating = parseFloat(match.replace("imdb:", "").trim()); | |
if (!isNaN(rating) && rating > 7.5) { | |
var highlightedText = element.innerHTML.replace(new RegExp(match, 'g'), '<span style="background-color: aqua;">' + match + '</span>'); | |
element.innerHTML = highlightedText; | |
} | |
}); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment