Skip to content

Instantly share code, notes, and snippets.

@56k-modem
Last active November 4, 2023 13:17
Show Gist options
  • Save 56k-modem/a033fe0e75b29c659188511f5f13184e to your computer and use it in GitHub Desktop.
Save 56k-modem/a033fe0e75b29c659188511f5f13184e to your computer and use it in GitHub Desktop.
nCore imdb highlight
// ==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