// ==UserScript==
// @name BTVA Casting Call [Blacklist & Whitelist]
// @namespace https://rubyjcat.tumblr.com/
// @description Blacklist - hides projects on BTVA's Casting Call based on certain words the user wants to block. Whitelist - highlights projects based on words the user wants to see.
// @author RubyJCat
// @include http://www.behindthevoiceactors.com/casting-call
// @include http://www.behindthevoiceactors.com/casting-call/*
// @version 1.0
// @grant none
// ==/UserScript==
//*******************************************************//
// USER OPTIONS
//*******************************************************//
/**********************************************************
** What blacklisting does:
** When this script finds any one of the blacklisted phrases in the project listing,
** It hides all the info about that project and also disables clicking on it.
** CaSe-InSenSiTive! Just "Song" will filter out any case of Song, song, SONG, etc.
** Great for filtering out stuff you don't wanna see!
** It's simple - just add a phrase once to the list.
**
** Below is where you can add/change whatever words/phrases you want to blacklist.
** Make sure the phrases are in quotations and separated by commas.
** ex. ["FNAF", "Song", "Fandub", "18+", "Name of some douchebag I never want to work with ever again"]
**
** Whitelisting: The opposite, though it will only highlight the project listing instead
** with a coloured background. Can change the colors if you don't like default BTVA gold.
** Great for filtering out stuff you DO wanna see!
**
** Disclaimer: Whitelisting does not automatically mean that project is "better" than
** other projects. It's just for you to see the projects you may like easier.
** Also has nothing to do with CCC gold ;)
**********************************************************/
var blacklist = ["Noah Vermillion", "Mark Waterflower",
"Voice actors and actresses", "needed for"];
var whitelist = ["Abridged", "Original"];
/**********************************************************
** [toggleHide] : Choose to show a 'This project is blacklisted' message
** or hide the listing completely from the page.
** Default var toggleHide = false;
** set toggleHide = false to show a message.
** set toggleHide = true to hide the listing.
** [whitelistColor] : Change color of whitelisted listings. It is a gradient
** so there are two color choices that blend with each other.
** L for the color on the left, R for the color on the right.
** Default var whitelistColorL = "gold";
var whitelistColorR = "#C90";
** And lastly, can change the whitelisted link color if the default is hard to read.
** Default var linkColor = "#2F9CC9";
** HTML Color Names : https://www.w3schools.com/colors/colors_names.asp
**********************************************************/
var toggleHide = false;
var whitelistColorL = "gold";
var whitelistColorR = "#C90";
var whitelistLinkColor = "#2F9CC9";
//*******************************************************//
// FUNCTIONS START BELOW
//*******************************************************//
$(document).ready(function() {
$.each(blacklist, function (index, phrase) {
var regex = new RegExp(phrase, 'i');
$(".castingcall_listing").filter(function () {
//If a listing contains one of the blacklisted phrases
if (regex.test($(this).text())) {
if (toggleHide) {
$(this).hide();
} //if
else {
// Turns off clicking on blacklisted projects
$(this).off('click');
// Adds a darker colour background to listing
$(this).css({
background: '-moz-linear-gradient(135deg, #004, #666)',
background: '-webkit-linear-gradient(#004, #666)',
background: '-webkit-gradient(linear,left top, right bottom, from(#666), to(#004))',
});
// Adds a messaging saying this listing is blacklisted.
$(this).html("<span style=\"color:#AAF\">This project has been blacklisted.</span>");
} //else
} //regex.test()
}); //filter
}); //each
$.each(whitelist, function (index, phrase) {
var regex = new RegExp(phrase, 'i');
$(".castingcall_listing").filter(function () {
//If a listing contains one of the blacklisted phrases
if (regex.test($(this).text())) {
// Adds a darker colour background to listing
$(this).css({
background: `-webkit-linear-gradient(${whitelistColorL}, ${whitelistColorR})`,
background: `-moz-linear-gradient(135deg, ${whitelistColorL}, ${whitelistColorR})`,
background: `-webkit-gradient(linear,left top, right bottom, from(${whitelistColorL}), to(${whitelistColorR}))`,
});
// Change link color of whitelisted listings for better readability.
$('a', this).css ({color: `${whitelistLinkColor}`});
} //regex.test()
}); //filter
}); //each
}); //ready