There are 8 previous versions of this script.
// ==UserScript==
// @name IMDb Plot Keywords alphabetiser
// @namespace http://userscripts.org/users/67626
// @description Alphabetise plot keywords on title pages.
// @include http://*.imdb.com/title/*/keywords
// ==/UserScript==
(function() {
var Custom = new Array();
var Highlight_color = "red";
var Background_color = "white";
// Add your words to the *above* Array, like this:
// Array("maniac", "murder", "wax-museum");
// (They should be all-lower-case, with hyphens instead of spaces, in quotes, separated by commas.)
// You can also change the highlight colours.
function highlight(x) {
for (i in x) {
for (j in Custom) {
if (x[i].match(Custom[j])) {
x[i] = x[i].replace('<a', '<a style="background-color:' + Background_color + '; color:' + Highlight_color + '"');
break;
}
}
}
}
if (window.location.hostname == "pro.imdb.com") {
var Keywords = document.getElementsByTagName("br")[1].nextSibling.nextSibling;
var K = Keywords.innerHTML.split("/ ");
K.sort();
if (Custom[0]) {highlight(K)}
Keywords.innerHTML = K.join("<br>");
}
else {
var U = document.getElementById("tn15content").getElementsByTagName("ul")[0];
var L1 = U.getElementsByTagName("li");
var L2 = new Array();
for (i=0; i<L1.length; i++) {L2[i] = L1[i].innerHTML}
L2.sort();
if (Custom[0]) {highlight(L2)}
U.innerHTML = "<li>" + L2.join("</li><li>") + "</li>";
}
})();