Cleans up topic titels on Warez-BB
目前為
// ==UserScript==
// @name Warez-BB CleanUP
// @version 0.45
// @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*
// @match http://www.thewarez.org/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @icon http://s10.postimg.org/vklswq3b9/WBB_CU.png
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
// @run-at document-start
// @namespace https://greasyfork.org/users/10999
// ==/UserScript==
var forumSection,
testing = true,
fileHosts,
RegEX = {
"movies": /^((?:[\[(|]?\s?(?:(?:\w{2,5}(?:\.\w{2,3})?|\d{1,2})(?:[\s+|,\-\/\d])?)+[\]})])*)(.+)([.\(\[\s](?:19|20)\d{2}(?:[-+](?:19|20)\d{2})?(?:[.\]\)\s]|$))(.*$)/i,
"tv": /^((?:[\[(|]?\s?(?:(?:\w{2,5}(?:\.\w{2,3})?|\d{1,2})(?:[\s+|,\-\/\d])?)+[\]})])*)(.+?)()((?:[\[(]\s?)?(?:(?:(?:s?\d{1,2}-?)?e\d{1,2})|\d{1,2}x\d{1,2}|(?:(?:s|seasons?)\s?\d{1,2}(?:(?:-|\s)\d{1,2})*)(?![\de]|.episode)|0?1(?:-\d{1,2})+|\d{1,2}[-\/.]\d{1,2}[-\/.]\d{4}|\d{4}[-\/.]\d{1,2}[-\/.]\d{1,2}|\w{3}.{1,2}\d{1,2}.{1,2}\d{4}|(?:19|20)\d{2}|\||complete|dvdrip|(?:mini-)?series?|blu-ray|hdtv|720p|1080p)(?:\s?[\])])?.*$)/i,
"episode":/(?:S\d{1,2}[\s-]E\d{1,2}[-\s]E\d{1,2}|S?\d{1,2}-?e\d{1,2}|\sE\d{1,2}(?:-?E\d{1,2})?|\d{1,2}x\d{1,2}|season\s\d{1,2}.?\sepisode\s\d{1,2})/i,
"season": /(?:\s|^)(?:S|seasons?)\s?(\d{1,2}(?:(?:-|\s)S?\d{1,2})*)(?![\dE]|.{1,2}episode)/i,
"games": /^((?:[\[(|]?\s?(?:(?:\w{2,5}(?:\.\w{2,3})?|\d{1,2})(?:[\s+|\-,\/\d])?)+[\]})])*)(.*$)(.*$)/i,
"console":/^((?:(?:\[|\||\()\s?(?:(?:\w{2,5}(?:\.\w{2,3})?|\d{1,2})(?:[\s+,|\-\/\d])?)+(?:\||\)|\]))*)(.{3,}?)()((?:[\[(]\s?)?(?:XBOX\s?360|XBOX|360|PSP|PSX|PS1|PS2|PS3|PS4|PSN|\W[3n]\s?DS|\WDS|SNES|WII|WIIU|GAMECUBE|NTSC|PAL|USA|EUR|EU|MULTi|DLC|\d(?:[.,]\d+)?GB)(?!\w)(?:\s?[\])])?.*$)/i,
"apps": /^((?:[\[(|]?\s?(?:(?:\w{2,5}(?:\.\w{2,3})?|\d{1,2})(?:[\s+|\,-\/\d])?)+[\]})])*)(.*$)(.*$)/i,
"default":/^((?:(?:\[|\||\()\s?(?:(?:\w{2,5}(?:\.\w{2,3})?|\d{1,2})(?:[\s,+|\-\/\d])?)+(?:\||\)|\]))*)(.*$)(.*$)/i
},
CSS = ".userDescription{float: right;text-align: right;color: #536482;margin: 2px 7px 2px 0;word-spacing: -2px;}" +
".generalDescription{margin-top: 2px;}" +
".season,.episode,.genInfo{font-weight:bold;}" +
".tvDescription{margin-left:5px;}" +
".list-rows .pagination{position: absolute!important;}" +
".fileHost {float: right;margin-right: 2px;}" +
".altHost {text-align: center;font-weight: bold; overflow: hidden;background-image: url(http://s23.postimg.org/b8lsdn453/Not_Listed_2.png);background-size: cover;}" +
".list-rows .rating,.list-rows .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:6%}" +
".ratVal{font-size:larger;display:none}" +
".ratVotes{font-weight: normal;display:none;}" +
".genre {width:15%;word-spacing: -3px}" +
".genre a{display:none;}"
$.expr[":"].containsI = $.expr.createPseudo(function(arg) {
return function( elem ) {
return $(elem).text().trim()
.replace(/\s\([IVX]+\)\s/," ")
.replace(/the\b|part(?=\s?\d)/ig,"")
.replace(/and/ig,"&")
.replace(/äàâ/ig,"A")
.replace(/ç/ig,"C")
.replace(/éèëê/ig,"E")
.replace(/[:\W]/g,"")
.toUpperCase()
.indexOf(arg.trim().replace(/the\b|part(?=\s?\d)|p(?=\d)|3d/ig,"")
.replace(/and/ig,"&")
.replace(/äàâ/ig,"A")
.replace(/ç/ig,"C")
.replace(/éèëê/ig,"E")
.replace(/[:\W]/g,"")
.toUpperCase()) >= 0;
};
});
GM_addStyle(CSS);
if(document.URL.search(/viewforum.php\?f=4(?:&|$)/) > 0) forumSection = 'movies';
if(document.URL.search(/viewforum.php\?f=57(?:&|$)/) > 0) forumSection = 'tv';
if(document.URL.search(/viewforum.php\?f=5(?:&|$)/) > 0) forumSection = 'games';
if(document.URL.search(/viewforum.php\?f=28(?:&|$)/) > 0) forumSection = 'console';
if(document.URL.search(/viewforum.php\?f=3(?:&|$)/) > 0) forumSection = 'apps';
if(!forumSection) forumSection = 'defualt';
getJSON("http://pastebin.com/raw.php?i=yCwfr43g",init);
//THIS IS TO SEE HOW MANY USERS INTALLED THE SCRIPT
(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,retry) {
retry = retry || false;
(function() {
GM_xmlhttpRequest({
method: "GET",
url: "http://akas.imdb.com/find?ref_=nv_sr_fn&q=" + title + ((forumSection === "tv")? "&ttype=tv":"&ttype=ft"),
onload: function(response) {
if (response.status == 200) {
if (!/<a name="tt"><\/a>[\w\W]+?<\/table>/i.test(response.responseText)) {
if (/No results found for/.test(response.responseText)) {
console.log("IMDB_Search: No result found for:", title, year);
} else {
console.log("IMDB_Search: A unkown error has occured:", title, year);
}
return;
}
var responseData = response.responseText.match(/<a name="tt"><\/a>[\w\W]+?<\/table>/i)[0]
.replace(/(<img[\w\W]+?src=)"[^"]+"/g, '$1""'),
selector = {
"movies" :'.findResult:containsI("' + title + '"):not(:containsI("(video game)"),:containsI("(tv episode)"),:containsI("(tv series)"),:containsI("(tv mini-series)"),:containsI("(short)"))',
"tv":'.findResult:containsI("' + title + '"):containsI("(TV Series)"),.findResult:containsI("' + title + '"):containsI("(tv series)"),.findResult:containsI("' + title + '"):containsI("(tv mini-series)")'
},
result = {
"Title": "",
"URL": ""
},
results = $(selector[forumSection], responseData);
if (results.length > 0) {
if (results.length > 1) {
if (year) {
if (results.find(":contains('" + year + "')").length === 0) {
if (results.find(":contains('" + (parseInt(year) - 1) + "')").length === 0) {
results = results.find(":contains('" + (parseInt(year) + 1) + "')");
}else{
results = results.find(":contains('" + (parseInt(year) - 1).toString() + "')");
}
} else {
results = results.find(":contains('" + year + "')");
}
}
if (results.length > 0) {
$('small',results[0]).remove();
result.Title = $(results[0]).text().trim();
result.URL = $(results[0]).find("a").attr("href").replace(/(.+)?\?.+$/, "http://imdb.com$1");
GetInfo(result, item);
} else {
console.log("IMDB_Search: ", "Found no match with the given query and year:", title, year);
}
} else {
$('small',results[0]).remove();
result.Title = $(results[0]).text().trim();
result.URL = $(results[0]).find("a").attr("href").replace(/(.+)?\?.+$/, "http://imdb.com$1");
GetInfo(result, item);
}
} else {
if ($('.findResult', responseData).length === 1) {
results = $('.findResult', responseData);
$('small',results[0]).remove();
result.Title = $(results[0]).text().trim();
result.URL = $(results[0]).find("a").attr("href").replace(/(.+)?\?.+$/, "http://imdb.com$1");
GetInfo(result, item);
} else {
if(forumSection === 'movies' && retry === false && /[\[(][^\])]+[\])]/.test(title)){
IMDB(title.replace(/[\[(][^\])]+[\])]/,""), year, item,true)
}else{
console.log("IMDB_Search: ", "Found no match with the given query:", title, year);
}
}
}
} else {
console.log(response.status + " " + response.statusText);
}
}
});
})();
var GetInfo = function(result, item) {
GM_xmlhttpRequest({
method: "GET",
url: result.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": result.Title,
"Rating": "",
"Count": "",
"Genre": "",
"URL": result.URL
};
Info.Rating = $('span[itemprop="ratingValue"]', responseData).text();
Info.Count = $('span[itemprop="ratingCount"]', responseData).text();
$('span[itemprop="genre"]', responseData).each(function() {
if (Info.Genre !== "") {
Info.Genre += " | ";
}
Info.Genre += $(this).text();
});
setIMDB(Info, item);
}
}
});
};
var setIMDB = function(Info, item) {
if(!testing){
Info.Title = Info.Title.replace(/\s\([IVX]+\)\s/," ");
if(forumSection === "movies"){
$(".REGEX2",item).html(Info.Title.replace(/\((?:19|20)\d{2}\)/i,""));
}else if(forumSection === "tv"){
$(".REGEX2",item).html(Info.Title.replace(/\(TV Series\)/i,"").replace(/\(TV([^)]\))/i,"($1"));
}
}
if(parseInt(Info.Rating) > 0 ){
$(".rating .ratVal", item).html(Info.Rating.replace(".", ","))
.fadeIn(1000);
$(".rating .ratVotes", item).html(Info.Count + " Votes");
}
$(".genre a", item).html(Info.Genre.replace(/,\s/g, "|"))
.attr("href",Info.URL)
.fadeIn(1000);
};
}
function init(data){
fileHosts = data;
if(forumSection === "movies" || forumSection === "tv") reformat();
cleanTopicTitels($(".cat-row:last ~ .list-rows a.topictitle,.search-view ~ .list-wrap .list-rows .topictitle > a:last-child,.topiclist.topics:last .row dt a.topictitle"));
}
function reformat(){
var header = $(".list-header").clone()
$(".short-description",header).after('<div class="rating"><span>Rating</span></div><div class="genre"><span>Genre</span></div>');
$(".cat-row:last").css("display","none");
$(".cat-row:last").after(header);
$(".cat-row:last ~ .list-header .short-description").css("width","49%");
$(".cat-row:last ~ .list-header .topics,.cat-row:last ~ .list-header .views").css("width","5%");
$(".cat-row:last ~ .list-header .last-post").css("width","10%");
$(".cat-row:last ~ .list-rows .description").css("width","46%");
$(".cat-row:last ~ .list-rows .topics,.cat-row:last ~ .list-rows .views").css("width","5%");
$(".cat-row:last ~ .list-rows .last-post").css("width","10%");
$(".cat-row:last ~ .list-rows .description").after('<div class="rating"><div class="ratVal"></div><div class="ratVotes"></div></div><div class="genre"><a></a></div>');
$(".cat-row:last ~ .list-rows").on("mouseenter", function(){
jQuery(this).find(".ratVotes").show("slow");
});
$(".cat-row:last ~ .list-rows").on("mouseleave", function(){
jQuery(this).find(".ratVotes").hide("fast");
});
}
function cleanTopicTitels(list) {
$(list).each(function() {
var curr = $(this).text(),
match,
parent = $(this).parents(".list-rows");
if (isTAG($(this).prev())) {
$(this).prev().prependTo(this);
}
if(forumSection === "console"){
match = curr.match(/^((?:[\[{(](?:[\w{2,5}.]+\b[\s+|\-\/\d]*)*[\]})]\s*)+)?((?:[\[(]\s?)?(?:XBOX\s?360|XBOX|PSP|PS2|PS3|PS4|3\s?DS|DS|WII|WIIU|GAMECUBE)(?:\s?[\])])?)/i);
if(match){
var console = match[2];
curr = curr.replace(console,"") + " " + console;
$(this).text(curr)
}
}
match = curr.match(RegEX[forumSection]);
$(this).attr("title", curr);
if (match) {
var colors = ["orange", "blue", "green", "darkmagenta"],
template = $('<span class=""></span>'),
rep;
for (i = 1; i < match.length; ++i) {
if (typeof match[i] !== "undefined" && match[i] !== " ") {
template.addClass('REGEX' + i);
if (testing) template.css({ "background-color": colors[i - 1],"color": "white"});
switch (i) {
case 2:
template.text((/\s/.test(match[i]) !== true) ? match[i].replace(/\./g, " ") : match[i]);
if(!/\s$/.test(template.text())) template.text(template.text() + " " );
break;
case 3:
template.text(/\(\d{4}\)/.test(match[i]) ? match[i] : (/\d{4}/.test(match[i])) ? ("(" + match[i].match(/\d{4}/) + ")") : match[i]);
break;
default:
template.text(match[i]);
break;
}
$(this).html(curr.replace(match[i].replace(/&/g, "&"), template[0].outerHTML));
curr = $(this).html();
template = $('<span class=""></span>');
}
}
if(!/\s/.test(parent.find(".REGEX2").text().trim())){
var nospace = parent.find(".REGEX2");
nospace.text(nospace.text().replace(/\.|_/g," "));
}
if(forumSection === "movies" || forumSection === "tv"){
var title = parent.find(".REGEX2").text()
.replace(/\sn\s/,'&')
.replace(/\[?(?:Unrated|Extended Cut|Collectors|Edition|Directors Cut)\]?/ig,''),
year = parent.find(".REGEX3").text().replace(/[()]/g,"");
IMDB(/\s/.test(title.trim()) ? title : title.replace(/\./g," "),year,parent);
}
}
parent = $(this).parents(".description,dl");
if ($("span:first:has(br),dt:first:has(br)", parent).length > 0) {
curr = $("span:first:has(br),dt:first:has(br)", parent);
curr.html(curr.html().replace(/(<br>[^<]+)/, '<span id="userDescription">$1</span>'));
}
setHostIcons($(parent.find(".REGEX1")));
setDescription($(parent.find(".REGEX4")));
});
if (!testing)$("span#userDescription,.REGEX4,.REGEX1").hide();
}
function setHostIcons(item){
var TAG = item.text().replace(/[\]\}]\s?[\[\{]/g,"|").replace(/\[|\]|\{|\}|1LINK|1L/gi,"").toUpperCase().trim(),
size = 20,
HOSTS = removeDuplicates(TAG.split(/[/+|\s,\-]/)),
icon = "";
for(i = 0;i < HOSTS.length;i++){
if(fileHosts[HOSTS[i]]){
icon = $("<img src='" + fileHosts[HOSTS[i]].ico + "' title='" + fileHosts[HOSTS[i]].host + "'>");
icon.css({"height":size + "px"});
}else if(HOSTS[i].match(/^\d$/)){
icon = $("<span title='And " + HOSTS[i] + " more hosts!'>" + "+" + HOSTS[i] +"</span>");
icon.css({"height": size + "px","width": size + "px","font-size": size / 2 + "px","line-height": size + "px"});
icon.addClass("altHost");
}else{
icon = $("<span title='Not listed host.\nTAG:" + HOSTS[i] + "'>" + HOSTS[i] +"</span>");
icon.css({"height": size + "px","width": size + "px","font-size": size / 2 + "px","line-height": size + "px"});
icon.addClass("altHost");
}
if(icon){
icon.addClass("fileHost");
item.parent().after(icon);
}
}
}
function setDescription(item) {
var description = removeDuplicates((item.text() + " " + item.parents(".description,dl").find("#userDescription").text())
.replace(/(?:1|single)\s?links?[\S]?/ig,"1L")
.replace(/(\d+(?:[.,]\d+)?)\s?(GB|MB|CH)/ig,function(a,b,c){return b.replace(/\./,",") + c.toUpperCase();})
.replace(/DD5\.1/ig,"DD5,1")
.replace(/(web|dts|XBOX)[\-\s](dl|ONE|360)/ig,"$1,;,$2")
.replace(/[=\/\+\-\[\]\(\)\/\.|_]/g, " ")
.replace(/\s{2,}/g," ")
.replace(/,;,/g,"-").split(/\s/)),
container = {
"Source": [],
"Resolution":[],
"Size": [],
"Container": [],
"Video": [],
"Audio": [],
"Group": [],
"Console": [],
"Extra": [],
},
parent = item.parents(".description"),
result = "";
parent.append("<div class='userDescription'></div>");
parent.find(".pagination").appendTo(parent);
for (var des in description) {
var value = description[des];
switch (true) {
case /^(?:dvd|dvdrip)$/i.test(value):
addInfo(container.Source, "DVD");
break;
case /^(?:dvdr|dvd5|dvd9)$/i.test(value):
addInfo(container.Source, "Full-DVD");
break;
case /^(?:r[1-9])$/i.test(value):
addInfo(container.Source, description[des].toUpperCase());
break;
case /^(?:dvdscr|screener|scr)$/i.test(value):
addInfo(container.Source, "Screener");
break;
case /^(?:bluray|brrip|bdrip|blu-ray|br)$/i.test(value):
addInfo(container.Source, "BluRay");
break;
case /^(?:hddvd)$/.test(value):
addInfo(container.Source, "HD-DVD");
break;
case /^(?:cam|camrip|hdcam)$/i.test(value):
addInfo(container.Source, "CAM");
break;
case /^(?:ts|telesync|hdts)$/i.test(value):
addInfo(container.Source, "TeleSync");
break;
case /^(?:tc|telecine)$/i.test(value):
addInfo(container.Source, "TeleCine");
break;
case /^(?:wp|workprint)$/i.test(value):
addInfo(container.Source, "WorkPrint");
break;
case /^(?:web-?dl|web)$/i.test(value):
addInfo(container.Source, "WEB-DL");
break;
case /^(?:web-?rip)$/i.test(value):
addInfo(container.Source, "WEB-RIP");
break;
case /^(?:web-?cap)$/i.test(value):
addInfo(container.Source, "WEB-CAP");
break;
case /^(?:hdrip|hdtv)$/i.test(value):
addInfo(container.Source, "HDTV");
break;
case /^(?:PPV|PPVRip)$/i.test(value):
addInfo(container.Source, "PPV");
break;
case /^(?:VODRip|VODR)$/i.test(value):
addInfo(container.Source, "VOD");
break;
case /^(?:360p|480p|576p|720p|1080p)$/i.test(value):
addInfo(container.Resolution, description[des].toLowerCase());
break;
case /^(?:x264|h264|x265|h265|hevc|dvix|xvid)$/i.test(value):
addInfo(container.Video, description[des].toUpperCase());
break;
case /^(?:avi|mp4|mkv|asf|flv|f4v)$/i.test(value):
addInfo(container.Container, description[des].toUpperCase());
break;
case /^(?:\d(?:,\d)?ch|dd5,1|dts-hd|dts|aac|ac3)$/i.test(value):
addInfo(container.Audio, description[des].toUpperCase().replace(/,/,"."));
break;
case /^(?:\d+(?:,\d+)?(?:mb|gb))$/i.test(value):
addInfo(container.Size, description[des].toUpperCase().replace(/,/,"."));
break;
case /^(?:XBOX-?ONE|XBOX|PS4|PS3|PS2|PSP|3DS|NDS|SNES|NES|WII?-U|WII|GAMECUBE|Dreamcast)$/i.test(value):
addInfo(container.Console, description[des].toUpperCase());
break;
case /^(?:PS1|PSX)$/i.test(value):
addInfo(container.Console, "PS1");
break;
case /^(?:XBOX-?360|X-?360)$/i.test(value):
addInfo(container.Console, "XBOX360");
break;
case /^(?:Mikas|BHRG|TiTAN|RLSM|RAV3N|NODLABS|RARBG|m2g|GAC|LiGHTFOR|Nocturnal|MARVEL|PLAYASiA|PSFR33|GLoBAL|SPARE|APATHY|STRANGE|DNL|Allstars|CONTRAST|PUSSYCAT|P2P|IPT|VENOM|iMARS|PROTOCOL|COMPLEX|ANTiDOTE|DUPLEX|UNLiMiTED|ACCiDENT|iND|ABSTRAKT|CLANDESTiNE|PSA|PHOBOS|3DT|PRoDJi|TLF|de[42]|decibeL|D-Z0N3|FoRM|FTW-HD|G3N3|HiFi|INtL|McXode|Penumbra|PUDDiNG|SaNcTi|Positive|BDbits|FraMeSToR|ALeSiO|FASM|NiBuRu|LoNeWolf|FLAWL3SS|HDxT|PrimeHD|Grond|MarGe|BluHD|3DNORD|RealHD|Blu Evo|AGB Golden Team|jack|RUXI|JEM|NTb|HiSD|CHD|CHDTV|CHDBits|CHD3D|CHDPAD|AREA11|HDTime|beAst|HDRemuX|TBH|3DV|playHD|playTV|playMUSIC|playON|playXD|playMB|FiLELiST|TvT|HDBrise|mkvrg|SpaceHD|RiplleyHD|RightSiZE|KM|Mikemelo1369|aZA|HDSTaRS|Gh0st|HiDt|ViSTA|HDMaNiAcS|BluDragon|KRaLiMaRKo|iMN|HiDe|HDViE|YoHo|HDC|NoVA|HDCITY|0DAY|CMCT|@Dake AI|@GGZLI|MiniBD1080P|iCandy|HDMEvolution|MobileHD|FourGHD|ReMuXmE|MeRCuRY|DGN|HDL|ASUT|CwP|EbP|EPiK|Hanoi|HDAT|HDNews|HDO|Subits|L2Bits|SDvB|MySilu|HDROAD|HDS|HDSTAR|HDSPAD|HDWing|HDWTV|iHD|HDChina|kishd|FooKaS|Q0S|LTRG|M-Team|KiSHD|BMDru|HDStar|Pack|OpenCD|LLM|KHQ|PS3-Team|PxHD|PxEHD|Px3D|PxHD-mobies|bxEHD|SKALiWAGZ|TBB|HANDJOB|CrEwSaDe|CtrlSD|SaM|Skullz|HaB|Wiki|NGB|BDClub|OoKU|TRiM|IVT|VTBT|VT Team Sub|VTMT|XTSF|DiRTY|ViKAT|Bunny|Chotab|VaAr3|Soul|Nero9|Green|JENC|tRuEHD|IJR|REVEiLLE|FUM|mSD|NhaNc3|MkvCage|VTMT(C)Z|AE|AJ8|AJP|Arucard|AW|BBW|BG|BoK|CRiSC|Crow|CtrlHD|D4|DiGG|DiR|disc|DBO|DON|DoNOLi|ESiR|ETH|fLAMEhd|FPG|FSK|Ft4U|fty|Funner|GMoRK|GoLDSToNE|H2|h264iRMU|HDB|HDBiRD|H@M|hymen|HZ|iLL|IMDTHS|iNFLiKTED|iOZO|J4F|JAVLiU|JCH|k2|KTN|KweeK|lulz|M794|MAGiC|MCR|MdM|MMI|Mojo|NaRB|NiX|NWO|OAS|ONYX|PerfectionHD|PHiN|PiNG|Prestige|Prime|PXE|QDP|QXE|Redµx|REPTiLE|RuDE|S26|sJR|SK|SLO|SPeSHaL|SrS|Thora|tK|TM|toho|TSE|V|VanRay|ViNYL|XSHD|YanY|Z|Zim'D|FGT|NoGRP|C4TV|CHAMPiONS|2HD|LOL|ASAP|KILLERS|DIMENSION|MixedPack|JIVE|AFG|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;
case /^(?:1L|EUR|USA|PAL|NTSC)$/i.test(value):
addInfo(container.Extra,description[des])
break;
}
}
for (var TAG in container) {
if (container[TAG].length > 0) {
if (result !== "") result += " | ";
result += "<span class='TAG'>" + TAG + ": </span>" + "<span class='genInfo'>" + container[TAG].join("<span style='font-weight:normal'> - </span>") + "</span>";
}
}
if (result !== "")$('.userDescription',parent).append("<div class='generalDescription'>" + result + "</div>");
if(forumSection === "tv"){
var season,episode,match;
if(RegEX.episode.test(item.text())){
match = item.text().match(RegEX.episode);
if(!RegEX.season.test(item.text())){
season = "<span class='TAG'>Season: </span><span class='season'>" +
match[0].trim()
.match(/S(?:eason\s?)?\d{1,2}|\d{1,2}x/)[0]
.replace(/[^\d]*(\d+)x?/,"$1")
.replace(/^(\d$)/,"0$1") + "</span>";
}
episode = "<span class='TAG'>Episode: </span><span class='episode'>" +
match[0].trim()
.replace(/season\s\d{1,2}.?\sepisode\s(\d{1,2})/i,"$1")
.replace(/(?:S\d+-?)?E(\d+)[\s\-]E?(\d+)/i,"$1 <span style='font-weight:normal'> To </span> $2")
.replace(/\d{1,2}x(\d{1,2})/,"$1")
.replace(/.+E(\d{1,2})/,"$1")
.replace(/(?:^|E)(\d)$/,"0$1") + "</span>";
$('.userDescription',parent).prepend("<span class='tvDescription'>" + episode + "</span>");
if(season)$('.userDescription',parent).prepend("<span class='tvDescription'>" + season + "</span>");
}
if(RegEX.season.test(item.text())){
match = item.text().match(RegEX.season);
var seasons = match[1].split("-");
season = "<span class='TAG'>Season: </span><span class='season'>";
if(seasons.length > 1){
season += seasons[0].match(/\d{1,2}$/g)[0]
.replace(/^(\d)$/,"0$1") + "<span style='font-weight:normal'> To </span>" +
seasons[seasons.length-1].match(/\d{1,2}$/g)[0]
.replace(/^(\d)$/,"0$1")+ "</span>";
}else{
season += seasons[0].match(/\d+/g)[0].replace(/^(\d)$/,"0$1")+ "</span>";
}
$('.userDescription',parent).prepend("<span class='tvDescription'>" + season + "</span>");
}
}
}
function addInfo(Array,Info){
if(Array.indexOf(Info) === -1)Array.push(Info);
}
function removeDuplicates(Array){
return Array.filter(function(item, pos) {
return ((item !== undefined && item !== "") ? Array.indexOf(item) == pos : null );
})
}
function isTAG(element){
return /((?:(?=\[|\w)\[?(?:\b\w{2,5}\b[+|\-\/\d]*)*\])+)/.test($(element).text());
}
function getJSON(url,callback){
GM_xmlhttpRequest({
method: 'GET',
url: url,
headers: {'Content-Type':'application/x-www-form-urlencoded'},
onload: function(response) {
if(response.status == 200){
callback(JSON.parse(response.responseText));
}else{
console.log(response.status + " " + response.statusText);
}
}
});
}