Cleans up topic titels on Warez-BB
目前為
// ==UserScript==
// @name Warez-BB CleanUP
// @version 0.37
// @description Cleans up topic titels on Warez-BB
// @author FuSiOn
// @match https://www.warez-bb.org/viewforum.php?f=*
// @match https://www.warez-bb.org/search.php*
// @require http://code.jquery.com/jquery-latest.js
// @icon http://s10.postimg.org/vklswq3b9/WBB_CU.png
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
// @namespace https://greasyfork.org/users/10999
// ==/UserScript==
var fileHosts = {
"RG" :{"host":"rapidgator.net",
"ico" :"http://s2.postimg.org/ph2t90ajp/Rapid_Gator_2.png"},
"UL" :{"host":"uploaded.net",
"ico" :"http://s23.postimg.org/gm4uzin0n/Uploaded2.png"},
"DF" :{"host":"dfiles.eu",
"ico" :"http://s12.postimg.org/gqpey5ua1/Deposit_Files_2.png"},
"BS" :{"host":"bitshare.com",
"ico" :"http://s2.postimg.org/yw9sg5isl/Bit_Share.png"},
"1F" :{"host":"1fichier.com",
"ico" :"http://s11.postimg.org/jgv0x1zvz/1fichier_3.png"},
"CU" :{"host":"clicknupload.com",
"ico" :"http://s23.postimg.org/nbbefj8cn/clicknupload_2.png"},
"CNU" :{"host":"clicknupload.com",
"ico" :"http://s23.postimg.org/nbbefj8cn/clicknupload_2.png"},
"BU" :{"host":"billionuploads.com",
"ico" :"http://s16.postimg.org/optcxhkfl/billionuploads_2.png"},
"OF" :{"host":"ozofiles.com",
"ico" :"http://s14.postimg.org/scpled2al/ozofiles_2.png"},
"OZO" :{"host":"ozofiles.com",
"ico" :"http://s14.postimg.org/scpled2al/ozofiles_2.png"},
"OZF" :{"host":"ozofiles.com",
"ico" :"http://s14.postimg.org/scpled2al/ozofiles_2.png"},
"HF" :{"host":"hugefiles.net",
"ico" :"http://s3.postimg.org/6y4to1n9b/hugefiles_5.png"},
"HGF" :{"host":"hugefiles.net",
"ico" :"http://s3.postimg.org/6y4to1n9b/hugefiles_5.png"},
"HUGF" :{"host":"hugefiles.net",
"ico" :"http://s3.postimg.org/6y4to1n9b/hugefiles_5.png"},
"UA" :{"host":"uploadable.ch",
"ico" :"http://s17.postimg.org/u02a37qpn/uploadable_2.png"},
"ULD" :{"host":"uploadable.ch",
"ico" :"http://s17.postimg.org/u02a37qpn/uploadable_2.png"},
"FF" :{"host":"filefactory.com",
"ico" :"http://s1.postimg.org/r5ags4na3/filefactory_2.png"},
"SU" :{"host":"secureupload.eu",
"ico" :"http://s15.postimg.org/4vvhdro3b/secureupload.png"},
"UR" :{"host":"uploadrocket.net",
"ico" :"http://s7.postimg.org/gy3osuddz/uploadrocket.png"},
"FR" :{"host":"filerock.net",
"ico" :"http://s10.postimg.org/5fyp9vyh1/filerock_net.png"},
"NF" :{"host":"nitroflare.com",
"ico" :"http://s22.postimg.org/b5qsigivx/nitroflare_com_2.png"},
"NL" :{"host":"netload.in",
"ico" :"http://s18.postimg.org/tfah8wazp/netload_in_2.png"},
"NL.IN":{"host":"netload.in",
"ico" :"http://s18.postimg.org/tfah8wazp/netload_in_2.png"},
"KS" :{"host":"keep2share.cc",
"ico" :"http://s11.postimg.org/x7atvlr1r/k2s_cc.png"},
"K2S" :{"host":"keep2share.cc",
"ico" :"http://s11.postimg.org/x7atvlr1r/k2s_cc.png"},
"FB" :{"host":"fboom.me",
"ico" :"http://s12.postimg.org/g3jntoaex/fboom_me.png"},
"OB" :{"host":"oboom.com",
"ico" :"http://s2.postimg.org/3ws2y3wc5/oboom.jpg"},
"OBOOM":{"host":"oboom.com",
"ico" :"http://s2.postimg.org/3ws2y3wc5/oboom.jpg"},
"MS" :{"host":"megashares.com",
"ico" :"http://s22.postimg.org/hyxcoi9kt/megashares_com.png"},
"PL" :{"host":"putlocker.com",
"ico" :"http://s14.postimg.org/839yp1n99/putlocker_com.png"},
"LF" :{"host":"geupload.com",
"ico" :"http://s14.postimg.org/xwtzmey8t/geupload_2.png"},
"GU" :{"host":"geupload.com",
"ico" :"http://s14.postimg.org/xwtzmey8t/geupload_2.png"},
"UT" :{"host":"uploadto.us",
"ico" :"http://s2.postimg.org/zdlcovbz9/uploadto.png"},
"UMB" :{"host":"uploadto.us",
"ico" :"http://s2.postimg.org/zdlcovbz9/uploadto.png"},
"GB" :{"host":"gboxes.com",
"ico" :"http://s12.postimg.org/g0excqjyh/gboxes_com.png"},
"OB" :{"host":"oboom.com",
"ico" :"http://s24.postimg.org/kafzpgoqp/oboom.png"},
"LL" :{"host":"letitload.com",
"ico" :"http://s15.postimg.org/y8afkyuaf/letitload_com_3.png"},
"24" :{"host":"24uploading.com",
"ico" :"http://s15.postimg.org/6oj8aqqbb/24uploading_com.png"},
"24U" :{"host":"24uploading.com",
"ico" :"http://s15.postimg.org/6oj8aqqbb/24uploading_com.png"},
"24UP" :{"host":"24uploading.com",
"ico" :"http://s15.postimg.org/6oj8aqqbb/24uploading_com.png"},
"180" :{"host":"180upload.com",
"ico" :"http://s8.postimg.org/4v90o7bhd/180upload_2.png"},
"180U" :{"host":"180upload.com",
"ico" :"http://s8.postimg.org/4v90o7bhd/180upload_2.png"},
"180UP":{"host":"180upload.com",
"ico" :"http://s8.postimg.org/4v90o7bhd/180upload_2.png"},
"MEGA" :{"host":"mega.co.nz",
"ico" :"http://s7.postimg.org/5c1pv1h3b/Mega_2.png"},
"HTTP" :{"host":"",
"ico" :"http://s24.postimg.org/mntaf71a9/HTTP.png"},
"MULTI":{"host":"Multiple Hosts!",
"ico" :"http://s23.postimg.org/5zv9iituv/Multi.png"}
},
CSS = ".fileHost {float: right;margin-right: 2px;}" +
".altHost {background-color: white;border: 1px solid;text-align: center;font-weight: bold; overflow: hidden;}" +
".topicrow .rating,.topicrow .genre {color: #536482;font-weight: bold;font-family: 'Lucida Grande', Verdana, Helvetica, Arial, sans-serif; border-bottom: 1px #E3E9F0 solid;border-right: 1px #E3E9F0 solid; text-align: center;background-color: #EDF1F5; vertical-align: middle;font-size: 10px;}" +
".rating{width:3%}" +
".genre{width:15%}";
GM_addStyle(CSS);
jQuery.expr[":"].containsI = jQuery.expr.createPseudo(function(arg) {
return function( elem ) {
return jQuery(elem).text().trim().replace(/\s\([IVX]+\)\s/," ")
.replace(/the|part/ig,"")
.replace(/and/ig,"&")
.replace(/[:']/g,"")
.replace(/[\.,\-\/]/g," ")
.replace(/\s{2,}/g," ")
.toUpperCase()
.indexOf(arg.trim().replace(/the|part/ig,"")
.replace(/and/ig,"&")
.replace(/[:']/g,"")
.replace(/[\.,\-\/]/g," ")
.replace(/\s{2,}/g," ").toUpperCase()) >= 0;
};
});
/*---------------------------------------------------------------------------
THIS IS TO SEE HOW MANY USERS INTALLED THE SCRIPT
IT LOADS A DUMMIE FILE ON PASTBIN WHEN THE SCRIPT IS RUN FOR THE FIRST TIME
---------------------------------------------------------------------------*/
(function(){
var FR = GM_getValue("WBB-CU-FirstRun",1);
if(FR === 1 ){
GM_xmlhttpRequest({
method: "GET",
url: "http://pastebin.com/raw.php?i=HnumG4Qs",
onload: function(response) {
if(response.responseText === "Dummie"){
GM_setValue("WBB-CU-FirstRun",0);
}
}
});
}
})();
/*---------------------------------------------------------------------------
THIS IS FOR GETTING THE IMDB INFORMATION
---------------------------------------------------------------------------*/
var IMDB = function (title,year,item){
(function (title,year,item){
GM_xmlhttpRequest({
method: "GET",
url: "http://www.imdb.com/find?ref_=nv_sr_fn&q=" + title,
//url: "http://www.imdb.com/find?ref_=nv_sr_fn&s=tt&q=" + title,
onload: function(response) {
if(response.status == 200){
var responseData = response.responseText.match(/<a name="tt"><\/a>[\w\W]+?<\/table>/i)[0]
.replace(/(<img[\w\W]+?src=)"[^"]+"/g,'$1""'),
results = jQuery('.findResult:containsI("' + title +'"):not(:containsI("(video game)"),:containsI("(tv episode)"),:containsI("(tv series)"),:containsI("(tv mini-series)"),:containsI("(short)"))',responseData),
movie = {"Title": "", "URL":""};
if(results.length > 0 ){
if(results.length > 1 ){
if (results.find(":contains('" + year + "')").length === 0){
results = results.find(":contains('" + (parseInt(year) - 1).toString() + "')");
}else{
results = results.find(":contains('" + year + "')");
}
if(results.length > 0 ){
movie.Title = jQuery(results[0]).text().trim();
movie.URL = jQuery(results[0]).find("a").attr("href").replace(/(.+)?\?.+$/,"http://imdb.com$1");
GetInfo(movie,item);
}else{
console.log("IMDB_Search: ","Found No Match With Query 2", title, year );
}
}else{
movie.Title = jQuery(results[0]).text().trim();
movie.URL = jQuery(results[0]).find("a").attr("href").replace(/(.+)?\?.+$/,"http://imdb.com$1");
GetInfo(movie,item);
}
}else{
console.log("IMDB_Search: ","Found No Match With Query", title, year );
}
}else{
console.log(response.status + " " + response.statusText);
}
}
});
})(title,year,item);
var GetInfo = function(movie,item){
GM_xmlhttpRequest({
method: "GET",
url: movie.URL,
onload: function(response) {
if(response.status == 200){
var responseData = response.responseText.match(/<div id="title-overview-widget">[\w\W]+?<\/tbody>[\w\W]+?<\/table>[\w\W]+?<\/div>/i)[0]
.replace(/(<img[\w\W]+?src=)"[^"]+"/g,'$1""'),
Info = {"Title": movie.Title, "Rating":"","Count":"","Genre":""};
Info.Rating = jQuery('span[itemprop="ratingValue"]',responseData).text();
Info.Count = jQuery('span[itemprop="ratingCount"]',responseData).text();
jQuery('span[itemprop="genre"]',responseData).each(function(){
if(Info.Genre !== ""){
Info.Genre += "|";
}
Info.Genre += jQuery(this).text();
});
setIMDB(Info,item);
}
}
});
};
var setIMDB = function(Info,item){
jQuery(".rating span",item).text(Info.Rating.replace(".",","));
jQuery(".genre span",item).text(Info.Genre.replace(/,\s/g,"|"));
};
}
//---------------------------------------------------------------------------
cleanTopicTitels(jQuery(".cat-row:last ~ .list-rows a.topictitle,.search-view ~ .list-wrap .list-rows .topictitle > a:last-child,.topiclist.topics:last .row dt a.topictitle"),false);
jQuery(".REGEX1").each(setHostIcons);
jQuery(".REGEX4").each(setDescription);
if(document.URL.search('viewforum.php\\?f=4') > 0){
reformat();
jQuery(".REGEX2").each(function(){
var parent = jQuery(this).parents(".list-rows"),
title = jQuery(this).text(),
year = parent.find(".REGEX3").text().replace(/[()]/g,"");
IMDB(title.replace('&','and')
.replace(/Unrated|Extended|Collectors|Edition|Directors Cut/ig,''),year,parent);
});
}
function reformat(){
var header = jQuery(".list-header").clone()
jQuery(".short-description",header).after('<div class="rating"><span>Rating</span></div><div class="genre"><span>Genre</span></div>');
jQuery(".cat-row:last").css("display","none");
jQuery(".cat-row:last").after(header);
jQuery(".cat-row:last ~ .list-header .topics,.cat-row:last ~ .list-header .views").css("width","5%");
jQuery(".cat-row:last ~ .list-header .last-post").css("width","10%");
jQuery(".cat-row:last ~ .list-rows .topics,.cat-row:last ~ .list-rows .views").css("width","5%");
jQuery(".cat-row:last ~ .list-rows .last-post").css("width","10%");
jQuery(".cat-row:last ~ .list-rows .description").after('<div class="rating"><span></span></div><div class="genre"><span></span></div>');
}
function cleanTopicTitels(list,testing){
jQuery(list).each(function(){
if(isTAG(jQuery(this).prev())){
jQuery(this).prev().prependTo(this);
}
var curr = jQuery(this).text(),
movieTitle = /((?:(?=\[|\w)\[?(?:[\w{2,5}.]+\b[\s+|\-\/\d]*)*\]\s*)+)?((?:(?:'|\b\w+\b)[\s:\.\-'\/,êë&ùéèà!?]*)+)([\(\[]?(?:19|20)\d{2}[\]\)]?|(?:s\d{1,2}e\d{1,2}|\d{1,2}x\d{1,2})|(?:(?:s\s|seasons?\s)\d{1,2}(?:-|\s|$))+)(.*$)/i,
//((?:(?=\[|\w)\[?(?:[\w{2,5}.]+\b[\s+|\-\/\d]*)*\]\s?)+)?\s*((?:(?:'|\b\w+\b)[\s:\.\-'\/,êë&ùéèà!?]*)+?)([\(\[]?(?:19|20)\d{2}[\]\)]?|(?:s\d{1,2}e\d{1,2}|\d{1,2}x\d{1,})|(?:(?:s\s|seasons?\s)?[s\d]*\d(?:-|\s|$))+)(.*$)/i,
///((?:(?=\[|\w)\[?(?:\b\w{2,5}\b[\s+|\-\/\d]*)*\]\s?)+)?\s*((?:(?:'|\b\w+\b)[\s:\.\-'\/,êë&ùéèà!?]*)+)([\(\[]?(?:19|20)\d{2}[\]\)]?)(.*$)/i,
//((?:(?=\[|\w)\[?(?:\b\w{2,5}\b[\s+|\-\/\d]*)*\]\s?)+)?\s*((?:\b\w+\b[\s:\.\-'\/,êë&ùéèà!?]*)+)([\(\[]?(?:19|20)\d{2}[\]\)]?)(.*$)/i,
match = curr.match(movieTitle);
jQuery(this).attr("title",curr);
if(match){
var colors = ["orange", "blue" , "green", "darkmagenta"],
template = '<span class="REGEX">REGDATA</span>',
rep;
if(testing) template = jQuery(template).css({"color":"white"})[0].outerHTML;
for(i = 1; i < match.length; ++i){
if (typeof match[i] !== "undefined"){
rep = template.replace(/REGEX/,"REGEX" + i);
if(testing)rep = jQuery(rep).css({"background-color":colors[i-1]})[0].outerHTML;
rep = rep.replace(/REGDATA/, (i != 3) ? (i != 1) ? match[i].replace(/(\w)(?!\d)\.(?!\d)(\w|$)/g,"$1 $2"): match[i] : /\(\d{4}\)/.test(match[i]) ? match[i] : (/\d{4}/.test(match[i]))? ("(" + match[i].match(/\d{4}/)+ ")"):match[i]);
jQuery(this).html(curr.replace(match[i].replace(/&/g,"&"),rep));
curr = jQuery(this).html();
}
}
}
var parent = jQuery(this).parents(".description,dl");
if(jQuery("span:first:has(br),dt:first:has(br)",parent).length > 0 ){
curr = jQuery("span:first:has(br),dt:first:has(br)",parent);
curr.html(curr.html().replace(/(<br>[^<]+)/,'<span id="userDescription">$1</span>'));
}
});
if(!testing)jQuery("span#userDescription,.REGEX4,.REGEX1").hide();
}
function setHostIcons(){
var TAG = jQuery(this).text().replace(/\]\s?\[/g,"|").replace(/\[|\]|1L/g,"").toUpperCase().trim(),
size = 18,
HOSTS = removeDuplicates(TAG.split(/\/|\+|\||\s/)),
icon = "";
for(i = 0;i < HOSTS.length;i++){
if(fileHosts[HOSTS[i]]){
icon = jQuery("<img src='" + fileHosts[HOSTS[i]].ico + "' title='" + fileHosts[HOSTS[i]].host + "'>");
icon.css({"height":size + "px"});
}else if(HOSTS[i].match(/^\d$/)){
icon = jQuery("<span title='And " + HOSTS[i] + " more hosts!'>" + "+" + HOSTS[i] +"</span>");
icon.css({"height": size - 2 + "px","width": size - 2 + "px","font-size": size / 2 + "px","line-height": size - 2 + "px"});
icon.addClass("altHost");
}else{
icon = jQuery("<span title='Not listed host.\nTAG:" + HOSTS[i] + "'>" + HOSTS[i] +"</span>");
icon.css({"height": size - 2 + "px","width": size - 2 + "px","font-size": size / 2 + "px","line-height": size - 2 + "px"});
icon.addClass("altHost");
}
if(icon){
icon.addClass("fileHost");
jQuery(this).parent().after(icon);
}
}
}
function setDescription(){
var description = removeDuplicates((jQuery(this).text() + " " + jQuery(this).parents(".description,dl").find("#userDescription").text())
.replace(/(\d+)\.(\d+)\s?gb/i,"$1,$2GB")
.replace(/(\d+)\.(\d+)\s?mb/i,"$1,$MB")
.replace(/^(\d+)\s?mb/i,"$1MB")
.replace(/[=\/\+\-\[\]\(\)\/\.|_]/g," ").split(" ")),
container = {"Source":[],
"Resolution":[],
"Size":[],
"Container":[],
"Video":[],
"Audio":[],
"Group":[]},
result = "";
for(var des in description){
var value = description[des].toLowerCase();
switch(true) {
case /^(?:dvd|dvdrip)$/.test(value):
addInfo(container.Source,"DVD");
break;
case /^(?:dvdr|dvd5|dvd9)$/.test(value):
addInfo(container.Source,"Full-DVD");
break;
case /^(?:r[1-9])$/.test(value):
addInfo(container.Source,description[des].toUpperCase());
break;
case /^(?:dvdscr|screener|scr)$/.test(value):
addInfo(container.Source,"Screener");
break;
case /^(?:bluray|brrip|bdrip|blu-ray|br)$/.test(value):
addInfo(container.Source,"BluRay");
break;
case /^(?:hddvd)$/.test(value):
addInfo(container.Source,"HD-DVD");
break;
case /^(?:cam|camrip|hdcam)$/.test(value):
addInfo(container.Source,"CAM");
break;
case /^(?:ts|telesync|hdts)$/.test(value):
addInfo(container.Source,"TeleSync");
break;
case /^(?:tc|telecine)$/.test(value):
addInfo(container.Source,"TeleCine");
break;
case /^(?:wp|workprint)$/.test(value):
addInfo(container.Source,"WorkPrint");
break;
case /^(?:web|webdl)$/.test(value):
addInfo(container.Source,"WEB-DL");
break;
case /^(?:webrip)$/.test(value):
addInfo(container.Source,"WEB-RIP");
break;
case /^(?:hdrip|hdtv)$/.test(value):
addInfo(container.Source,"HDTV");
break;
case /^(?:360p|480p|576p|720p|1080p)$/.test(value):
addInfo(container.Resolution,description[des].toLowerCase());
break;
case /^(?:x264|h264|dvix|xvid)$/.test(value):
addInfo(container.Video,description[des].toUpperCase());
break;
case /^(?:avi|mp4|mkv|asf|flv|f4v)$/.test(value):
addInfo(container.Container,description[des].toUpperCase());
break;
case /dts-hd|aac|ac3/.test(value):
addInfo(container.Audio,description[des].toUpperCase());
break;
case /^\d+(?:.\d+)?(?:mb|gb)$/.test(value):
addInfo(container.Size,description[des].toUpperCase());
break;
case /^(?:kingdom|viethd|nCore|HDA|hijacked|anoXmous|SANTi|fanta|ind|ozlem|redblade|psychd|playnow|resurrection|cybermen|juggs|highcode|imp3ria|sinners|rarbg|budyzer|fico|ift|legion|evo|amiable|melite|ink|ebp|mchd|hdaccess|sparks|cadaver|fragment|jyk|rovers|lost|wiki|an0nym0us|ltu|taste|covziro|bipolar|rusted|brmp|blackjesus|geckos|tayto|hidt|sonido|majestic|nohate|alliance|kaka|yify|noscreens|shaanig|fwolf|eve|sadpanda|blitzcrieg|axxo|viznu)$/i.test(value):
addInfo(container.Group,description[des]);
break;
}
}
for(var TAG in container){
if(container[TAG].length > 0){
if(result !== "")result += " | ";
result += TAG + ": " + container[TAG].join(" - ");
}
}
if(result !== ""){
var parent = jQuery(this).parents(".description");
parent.append("<span class='movieDescription' style='float: right;'>" + result + "</span>");
parent.find(".pagination").appendTo(parent)
}
}
function addInfo(Array,Info){
if(Array.indexOf(Info) === -1)Array.push(Info);
}
function removeDuplicates(Array){
var uniqueArray = Array.filter(function(item, pos) {
return ((item !== undefined && item !== "") ? Array.indexOf(item) == pos : null );
})
return uniqueArray
}
function isTAG(element){
return /((?:(?=\[|\w)\[?(?:\b\w{2,5}\b[+|\-\/\d]*)*\])+)/.test(jQuery(element).text());
}