Update control frequency (days)
/* colorpalettes */
// feel free to create your own. color in this order : back, highlight, front, light.
//var cpChrome=new colorPalette("#E1ECFE","#FD2","#4277CF","#FFF"); // but for Firefox ;-)
//var cpUserscript=new colorPalette("#000","#F80","#FFF","#EEE"); // javascrgeek only
//var cpFlickr=new colorPalette("#FFF","#FF0084","#0063DC","#FFF"); // pink my blue
var cpNG=new colorPalette("#616060","#F80","#FFF","#EEE"); // Les-Newsgroup palette
// choose yours
var GMSUCPal=cpNG; // colorPalette you prefer
/* launching script version control */
if(BrowserDetect.browser!='Chrome') GM_scriptVersionControl();
// define launch function
function GM_scriptVersionControl() {
// test if script should be performed to control new release regarding frequency
var GMSUCreleaseDate=new Date();
GMSUCreleaseDate.setFullYear(eval(thisReleaseDate.substring(0,4)),eval(thisReleaseDate.substring(4,6))-1,eval(thisReleaseDate.substring(6,8)));
var GMSUCtoday=new Date(); var GMSUCdif=Math.floor((GMSUCtoday-GMSUCreleaseDate)/1000/60/60/24);
if (GMSUCdif%GMSUCfreq==0) {
GMSUC_Control(0);
}
}
// define control function
function GMSUC_Control(force) { //force parameter : Added by les-newsgroup
var scriptId=thisId;var version=thisVersion;
var scriptMetasUrl=thisScriptFolderURL+scriptId+".meta.js";
// go to script home page to get official release number and compare it to current one
GM.xmlHttpRequest({
method: 'GET',
url: scriptMetasUrl,
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey/0.3',
'Accept': 'text/html,application/xml,text/xml',
},
onload: function(responseDetails) {
var textResp=responseDetails.responseText;
var offRel=/\/\/\s*@version\s*(.*)\s*\n/i.exec(textResp);
if(offRel==null){ //Ce test est nécessaire car userscripts est quelque fois inaccessible
if (force) alert("No Updates");
return 0;
}
offRel=offRel[1];
var scriptName=/\/\/\s*@name\s*(.*)\s*\n/i.exec(textResp)[1];
if(offRel>version) {
// Styling
addGlobalStyle("#GMSUC-alerte {position:fixed;z-index:1000;top:156px;left:50%;margin:20px 0 0 -128px;padding:6px;width:250px;-moz-border-radius:6px;background:"+GMSUCPal.back+";border:"+GMSUCPal.light+" 1px solid;color:"+GMSUCPal.front+";font-size:1.5em;text-align:center} #GMSUC-alerte a {font-weight:bold;font-size:1em} #GMSUC-alerte * {color:"+GMSUCPal.front+";} #GMSUC-alerte table {width:100%;margin:0.5em 0 0 0} #GMSUC-alerte td {width:33%;text-align:center;border:solid 1px "+GMSUCPal.front+"} #GMSUC-alerte td:hover{background:"+GMSUCPal.high+"} #GMSUC-alerte td:hover a {color:"+GMSUCPal.front+"} #GMSUC-timer {font:2em bold;margin:0.5em 0 0 0} #GMSUC-info {text-align:right;font:0.5em serif;margin:1em 0 0 0} #GMSUC-info a {font:1.3em serif} #GMSUC-info a:hover {background:"+GMSUCPal.front+";color:"+GMSUCPal.back+"}");
// Lang detection and apply
var Langues="en, fr";
var lang=navigator.language;
var reg=new RegExp(lang,"g");
if(!Langues.match(lang)) lang="en";
/* traductions / translations */
var Txt=new Array();
for(i=1;i<8;i++) {Txt[i]=new Array();}
// français
Txt[1]["fr"]="Vous utilisez la version";
Txt[2]["fr"]="du script";
Txt[3]["fr"]="La version officielle est différente";
Txt[4]["fr"]="installer cette version";
Txt[5]["fr"]="";
Txt[6]["fr"]="";
Txt[7]["fr"]="Page de la version ";
// english
Txt[1]["en"]="You're using";
Txt[2]["en"]="version of";
Txt[3]["en"]="script. Official release version is different";
Txt[4]["en"]="install this version";
Txt[5]["en"]="";
Txt[6]["en"]="";
Txt[7]["en"]="Page of version ";
/* ------------------------------- */
//Added by Les-Newsgroup
if (document.getElementById('GMSUC-alerte')==null) { //then we did not create this div yet
var alerte=document.createElement('div');
alerte.setAttribute('id','GMSUC-alerte');
var GMSUCtextAlerte=Txt[1][lang]+" "+version+" "+Txt[2][lang]+" "+scriptName+"";
GMSUCtextAlerte+=". "+Txt[3][lang]+" ("+offRel+")";
GMSUCtextAlerte+="";
GMSUCtextAlerte+=""
if(GMSUCtime>0) GMSUCtextAlerte+=""+GMSUCtime+" s
";
GMSUCtextAlerte+="";
document.body.appendChild(alerte);
document.getElementById('GMSUC-alerte').innerHTML=GMSUCtextAlerte;
document.getElementById('closeUpdater').addEventListener('click', function(){ document.getElementById('GMSUC-alerte').setAttribute('style','display:none');GMSUCtime=0;}, false );
document.getElementById('closeUpdater').href = 'javascript:void(0);';
document.getElementById('installUpdate').addEventListener('click', function(){ document.getElementById('GMSUC-alerte').setAttribute('style','display:none');GMSUCtime=0;}, false );
}else if(force) document.getElementById("GMSUC-alerte").setAttribute("style","display:visible;");
if(GMSUCtime>0 && document.getElementById("GMSUC-timer")!=null) {
function disparition() {
if(GMSUCtime>0) {
document.getElementById("GMSUC-timer").innerHTML=GMSUCtime+" s";
GMSUCtime+=-1;
setTimeout(disparition,1000)
}
else {
document.getElementById("GMSUC-alerte").setAttribute("style","display:none");
document.getElementById("GMSUC-timer").innerHTML='';
}
}
disparition();
}
}else if (force) alert("No Updates");
}
});
}
/* Color palette creator */
function colorPalette(b,h,f,l) {this.back=b;this.high=h;this.front=f;this.light=l;}
/******* END OF SCRIPT VERSION CONTROL **********/
/******** BetaSeries **********/
function cleanup_serie(str) {
/* Small function to cleanup a string, remove html tags, underscores, weird characters etc. */
str = str.replace(/[_-]/g, ' ') // _ or - to space
.replace(/[\(\)\."\[\]\{\}]/g, '')
.replace(/&/g, 'and')
.replace(/[:;\?,!-]/g, ' ')
.replace(/ +/g, ' ') // double spaces
.replace(/ *$/, '') // remove lonely spaces
.replace(/^ */, '') // remove lonely spaces
.replace(/<\/?[^>]+(>|$)/g, ""); // HTML TAGS
debug(str);
serie_details = str.match(/^(?:\s*)(.*) (?:s|saison|season) *([0-9]{1,2})(?:[\- ,;]*(?:e|ep|ep\.|episode|episodes) *([0-9]{1,3}))?/i);
//serie_details[1]:title
//serie_details[2]:season
//serie_details[3]:episode
debug(serie_details[1]);
return serie_details;
}
function betaseriesGetUrl(serie_details, element){
if (serie_details == null) return 0;
var serieTitle=serie_details[1];
var serieUrl='';
GM.xmlHttpRequest({
method: 'GET',
url: 'http://api.betaseries.com/shows/search.json?key=7ecb330c435e&title='+serieTitle,
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept': 'application/atom+xml,application/xml,text/xml',
'X-BetaSeries-Version': '2.4',
},
onload: function(responseDetails) {
// debug(responseDetails.responseText);
var arrRes = eval('(' + responseDetails.responseText + ')');
if (arrRes.root.code=="1" && typeof arrRes.root.shows[0] != 'undefined') { //no error while fetching serie and fetched at least 1 serie
// debug(arrRes.root.shows[0].url);
if(typeof arrRes.root.shows[1] == 'undefined') //only one serie fetched, so we assumed that we found the good one ... can't verify it
serieUrl=arrRes.root.shows[0].url;
else{//fetched more than 1 serie ... but there can be only one !!
// var show;
// var showCount=0;
for(show in arrRes.root.shows){
if(arrRes.root.shows[show].url == serieTitle.replace(' ', '') || arrRes.root.shows[show].title.toLowerCase() == serieTitle.replace(' ', '') || arrRes.root.shows[show].url == serieTitle.replace(' ', '-') || arrRes.root.shows[show].title.toLowerCase() == serieTitle.replace(' ', '-')) { //trying to find an exact match
serieUrl=arrRes.root.shows[show].url;
break;
}
}
}
if(serieUrl != ''){
serie_details.push(serieUrl);
betaseriesGetInfos(serie_details, element);
}else
debug("betaseriesGetUrl() => Aucune correspondance : '"+ serieTitle.replace(' ', '') + "' ====> " + responseDetails.responseText);
}else{
debug("betaseriesGetUrl() => Pas de résultats / Erreur : '"+ serieTitle + "' ====> " + responseDetails.responseText);
void(0);
//essayer ici de voir si serieTitle.replace(' ', '') || serieTitle.replace(' ', '-') correspond à une série ! si oui hop on a l'URL (c'est le cas par exemple pour 'greys anatomy' ... avec le search, rien n'est retourné, alors que l'URL est 'greysanatomy'
}
}
});
}
function betaseriesGetInfos(serie_details, element){
var serieTitle=serie_details[1];
var serieSeason=serie_details[2];
var serieEpisode=serie_details[3];
var serieUrl=serie_details[4];
var infosType=GM_config.read()['rating_BS_infos'];
if(infosType==1 || typeof serieSeason == 'undefined' || typeof serieEpisode == 'undefined') //We're fetching serie's Infos
var url='http://api.betaseries.com/shows/display/' + serieUrl + '.json?key=7ecb330c435e';
else
var url='http://api.betaseries.com/shows/episodes/' + serieUrl + '.json?key=7ecb330c435e&season=' + serieSeason + '&episode=' + serieEpisode;
debug('betaseriesGetInfos() => season:'+ serieSeason + ' - Episode:' + serieEpisode + ' - Série:' + serieUrl);
GM.xmlHttpRequest({
method: 'GET',
url: url,
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept': 'application/atom+xml,application/xml,text/xml',
'X-BetaSeries-Version': '2.4',
},
onload: function(responseDetails) {
// debug(responseDetails.responseText);
var arrRes = eval('(' + responseDetails.responseText + ')');
if (arrRes.root.code=="1") { //no error while fetching infos
if(infosType==1 || typeof serieSeason == 'undefined' || typeof serieEpisode == 'undefined'){
var objInfos=arrRes.root.show;
}else{
var objInfos=arrRes.root.seasons[0].episodes[0];
}
debug('betaseriesGetInfos() => title:' + objInfos.title + ' - Note:' + objInfos.note.mean + ' - Votes:' + objInfos.note.members + ' - Série:' + serieUrl);
addratingLinkToElement(element, [objInfos.title, objInfos.note.mean, 'http://www.betaseries.com/episode/' + serieUrl + '/s' + serieSeason + 'e' + serieEpisode, objInfos.note.members.toString()], 2, 2);
}else {
debug('betaseriesGetInfos() => Auncue info trouvée!');
addratingLinkToElement(element, 1, 1, 1, true);
}
}
});
}
/********START OF SCRIPT Show IMDB Ratings http://userscripts.org/scripts/review/56362 -- Script by Vigazor -- modified by les-newsgroup*********/
/* Whats been modified by les-newsgroup ?
starimage1 & starimage2
checkMovie()
- removed this function
handleDTentry()
-Split this function into two others (googleRequest & omdbApiRequest ... now googleRequest can call omdbApiRequest several times)
-Change the regular expression to match regular expression with a dot (7.3) AND or with a comma (7,3)
- modified the imdb url with the french one (.fr)
-modified the way imdburl is parsed, because with the use of .fr instead of .com, theres one character less, now using substring() with the position of the last '/' character
cleanup()
- replaced 'and' by 'et' (french for 'and')
- added some special test to match binnewz typical titles
addratingLinkToElement()
-Replaced this function with the one of : 'Nitin Hayaran' (http://userscripts.org/scripts/show/59570)
-made some modifications
-added a caption to the stars div
-other modifications
-added modifications by Cook2
*/
var starimage =''+
'iVBORw0KGgoAAAANSUhEUgAAAMgAAAAoCAMAAACMwkUuAAAAAXNSR0IArs4c6QAAAARnQU1BAACx'+
'jwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAABgUExURQAAAP7+/fv7/Pn5+vf39/789PPz8+3t'+
'7ebm5uDg4Pn12vDqz/XssuParPLnmtbKjbGcMrqnU8O0bcixN9fAP9zNdt/IPODg4OXOQ+jVV+nZ'+
'c+3ZSfLgVPXssvfnbf///6oVmaEAAAAQdFJOUwAECAsPExciLjlFW5GcvtnZ3S3RAAABKElEQVRY'+
'w+3ZzXKEIBAE4BlFEUVl1SysmOz7v2UG1/1JKtccmtq+WH63KaC1lCi/cC7W5GFUG5WFceN1DkbK'+
'e8MZGGvvf48HZqxUrXUyb+SqlMI0mcv41xiNaZIfampYSy32tBLYiMq7NgxtRM2BGtz4MR22pSfL'+
'sd2wjXRqsFKa4OXdBdGklpsiDdk8igzS5Nzch6o1tL3zzr+mysW+8jCyW8s5GMVtyMJsiFuVgdEq'+
'aKGt6lo7DOs5xMs6WNu1su0QjaqPeV6W5RxCjBdJtID2eU1rMrrEoiFhxwxqxL1zSXc++gzRJN1N'+
'l7AWhGxEp32llmUAN+VkvMQjtlXG7RGGttQBzo3tJPo8N4hWTG6SO+5Oc49scm5uXx2Z+xHaiP/4'+
'qYhoOeQbGAy9N11bgA4AAAAASUVORK5CYII=';
var starimage0 =''+
'iVBORw0KGgoAAAANSUhEUgAAAMgAAAAoCAMAAACMwkUuAAAAY1BMVEUAAAD+/v37+/z5+fr39/f+'+
'/PTz8/Pt7e3m5ubg4OD59drw6s/17LLj2qzy55rWyo2xnDK6p1PDtG3IsTfXwD/czXbfyDzg4ODl'+
'zkPo1Vfp2XPt2Uny4FT17LL3523/AAD////+etw4AAAAEHRSTlMABAgLDxMXIi45RVuRnL7Z2d0t'+
'0QAAARZJREFUeAHt0lFugzAQhGFvMKzXOEASGhOclt7/lB0a2p5hrP4SWs33il2FSS0W6jDXma/C'+
'JGTlN+RzNqnARHPOSm3ifaeqeds2w/XeUxpQLaPt+LIppyHoH1rHaqiD/ljDa6ixw4IwGwoHKrmJ'+
'5VeB25z/fW7c5hRTG7VsntpELZxwfbCO2FDw7lWn1PYfcwS1tdhHHebSMwq/ofIcqrC0lGdLb2gF'+
'Jmpr+5iGYb0v5bEOKfUxCqW59u12m+f5viylPFBJhPb+6dA4gXddduxFSM3JeZp2/eYIIjXUv3Re'+
'1pMjNnTZ/xQayM1PExQ8cltrQARmNjRCxniFRmG203W6Ykl/uZ2JDV2scUjkPFIbljuisir7AriP'+
'wKgnaJyBAAAAAElFTkSuQmCC';
var starimage1=''+
'iVBORw0KGgoAAAANSUhEUgAAAGQAAAAoCAMAAAA/pq9xAAAAAXNSR0IArs4c6QAAAARnQU1BAACx'+
'jwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAADSUExURQAAAKYwOa1NWa9nM6+GM7GcMrdmb7d5'+
'UreSUrqnU7s0P8GObMGjbMO0bcZzN8aXN8ixN8s8SM9wdtCVmtE4QtZAStZ+QNakQNfAP9lSWdui'+
'dtu2ndu7dtvFndxudNzNdtzRnd2CO92qO95ES9/IPODg4OJOVOKIROKwROWXV+W6V+XGyeXOQ+do'+
'bOimdOjDdOjVV+mtsOnZc+qRSOq6SOrYzOrgzO3ZSe3ozO+cU+/DU/HN0PLgVPSsbvTObvTRtfTh'+
'tfXts/fi0vfnbffs0vn00yklNIoAAAABdFJOUwBA5thmAAACCklEQVRIx+2VbVeiQBiGMcHKd5Z4'+
'aV0NQ4SK1RSKCncVgv//l/aZmcM4CCEforOn4/3x+nBfPPPMHDjulP845lcws34G0PwKZtbKTDY1'+
'sQytjTG0RkZprez7SIqO8LNZ+jzNOtkpp9Sc94rsbwH7U8B+F7BkU43Fb3kWveZZMC+Q+JuwEvPe'+
'djnmvm5zzJiv8h/t+JsqLLa93CiR5eZGCWQjP8oaCpMKbAmS+IAtQBIdsAlIgswXh+F65viP6zBJ'+
'yli82y1vbe9+uYupJ9puF1PLvVtsI+oJVqvJlWxcT1ZB6rkZDjVNmzmO7z9C/OQD9mswUFX11rY9'+
'7x7iIc/Pfl9RlKllue4dxEWeH+22KIpXsmwY1xCDeHQBVUKjgwq5D9mYRxqw2EhC2KiJNGCxkIQw'+
'qYE0YJGRJB3vRRBQI64sY888jyxYk7KnZhNZsCZlD40GsmANsxXSqDnrI4xYVHvJMGJRrAXDiEWU'+
'J+zqL/HpaFp4hF3gE1NV9qmc4xNTFPapnOETE8XMUxHgs1GlfoTxMArSjDOTgAU0o8wkYAGNdCDB'+
'ndoRxuOAJivBHiUrwR6RYTq06VwPGsvZGAxjrguWPRuBYcR1wLJnEhgkrgUWRtITemQNw5dS1uW7'+
'ZDWDZ8o6zQ5ZTf+JslajRVbTfmB2TC+uXsou6GXeL+WcXub9Us7oZZa+1+/wH/4dffbd60agAAAA'+
'AElFTkSuQmCC';
var starimage2=''+
'iVBORw0KGgoAAAANSUhEUgAAAMgAAAAoCAMAAACMwkUuAAAAAXNSR0IArs4c6QAAAARnQU1BAACx'+
'jwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAFxUExURQAAAKYwMKdDMKlZMapuMayEMq1NUK9b'+
'Tq+QM7FsT7GcMrJ9ULSQUbdmZ7eaUrhzZ7qCaLqnU7s0NLyRab1LNL6har9jNcF8NcGrbMOVNsO0'+
'bcajN8ixN8s8PMxVPc9uPs9xcNCHPtCVldE6ONGCcNGgl9NVONOiP9OrmNSUctWmc9W2mNZCQNZw'+
'OdawQNeLOdfAP9fCmthcQdi4dNlWUtnKnNp3QdqoOttuU9vDdtxvbtySQtzNdtzRnd2GVN24O95K'+
'RN6Db99kRN+fVN+tQ9/IPOCXcODg4OJWTuJ/ReKqceK3VeK9RORvT+SbRuXAcuXGV+XGxuXOQ+du'+
'aOeKUOepqOe3R+fMx+jMdOjTyOjVV+mFaemlUemvrenZc+nZyeq5rerHSOvgyuybauzAUu3Gr+3Z'+
'Se3lzO3ozO6za+7RsO/QU/DdsfHLbPHOzfLUzvLgVPLy8vPls/TZbvTcz/Xj0PXts/fnbffr0fjw'+
'0/n003k3aXEAAAABdFJOUwBA5thmAAADh0lEQVRYw+3X21cSQRzA8UVBETXN+w0ITLFABFI0CQVE'+
'EUVUMkTzAiZoSmAEBPz1/WbmMDvL8NA57oPr2d/j92k+zGUPgqCOOur850ReS4u8jgYx8lpaRPEt'+
'wo6Cm6QqujFV4Y1WxTcV8kJbROmt+YmMKL2po4466ihw/src/rRpv9q0n23ajzbte5v2tU1rPMnb'+
'6o98q93yrXLBt/IJ34oHfCvstoHknqqytsxjiWvJ2zzX4hcPXIueZLkWOkhzLbB7yf+oidyTnK0e'+
'y3BbUgsnuS2p+OLclpS9UW5Lip4QtyUFR4DfkitYTEPGlgJIvaUdAqTW0vYAUmlpOwApt7QgQIot'+
'bR0gBckvWq1ebSdy51fVRkOOVi+VUpuxzFGqVKeWWj5/uBpO7h/ma9RSeXjYW/LFt/YeKtRSzmZ3'+
'Fr3RjZ1smVqK6XRw3hNaC6aL1FK4vFyfdQSW1y8LTcuXmRmXy7WdSORy5zC5xjPb5+lpp9O5GYtl'+
'MkcwGWT5NDlps9lWw+Fkch8miSwfx8ctFsuSzxePb8HEkeXD2JjZbF70eqPRDZgosrwfGTGZTPMe'+
'Tyi0BhNClndDQ0ajcdbhCASWYQLffiOJ34CWA6tJoMUQ3XPaih5RQBJDENLcOkQBSRhBSLNrEQUk'+
'PgQhbaETUUDiRRDS5joQBSQeBCHNqkEUkDgQpLlN9wYDWg1ejhztTq9HEkxpthudDkkwpdmutVok'+
'wZRmO+vsRBJMabbTjg4kwZRmO9ZokARTmFtCVuNKXMnUiMQZSzGNSGzhQ6YRicW3xzQiMXt3mEYk'+
'Jk+QaURidKyz1/0tPiEuV1Wm9gafLqeT/ZT04dNls7Gfkl58uiwW9lPSg0+X2cx+Srrx6TKZ2E9J'+
'Fz5dRqPkU2KAnxUtxy9T08OWIMqKZEdAAhS3ZEdAAhS7ZEdAApQFyY6ABChzkh0BCVCsLRC8HpdM'+
'TY8HKFIIttikEGyxSCHYYpZCsMUkhWCLkWl+WIlfmILVyNNWQLEiTIBEbG5QuIVRkIjNDgq7MAwS'+
'sS2AYkEYBInY5kAxJwyARGxWUFiFfpAwkCnDFDnuM/eytAn9BLkq03e0jepGyVWZvKFtWDtMrsr4'+
'NW2DnYPkqoyd0TbQMUCuysgpbf2afnJVho6Z+0ofU78s7Q19iMVL0kcfYvGS9NKHWLwkPfQhFi9J'+
'N32IxUvSRR9iq/oX7CXOP0hn0ljJajC/AAAAAElFTkSuQmCC';
// Cook2 : More cleanings
function cleanup(str) {
/* Small function to cleanup a string, remove html tags, underscores, weird characters etc. */
var str1 = str.replace(/ \(?(\+|sur)?(\s*\(a(lt)?.*\.?b.*\.[a-z0-9\.\-_@]+)\s*\)?/ig, '')
.replace(/(autres? post|\*.*\*)/i, '')
.replace(/\"/g, '') // "
//.replace(/\'/g, '') // ' //do not replace '
.replace(/\./g, ' ') // . to space
.replace(/_/g, ' ') // _ to space
.replace(/-/g, ' ') // - to space
.replace(/:/g, ' ') // : space
.replace(/\s/g, ' ') // unbreakable space to space
.replace(/[23]d/gi, '')
.replace(/films? hd/i, '')
.replace(/animes? hd/i, '')
.replace(/\(hsbs\)/i, '')
.replace(/\{720[ip]\}/i, '')
.replace(/\{1080[ip]\}/i, '')
.replace(/\(\D*\)/g, '')
.replace(/\[.*\]/g, '')
.replace(/\(/g, ' ') // (
.replace(/\)/g, ' ') // )
.replace(/ +/g, ' ') // double spaces
.replace(/ $/, '') // remove last lonely space
.replace(/^ /, '') // remove first lonely space
.replace(/&/g, 'et')
.replace(/<\/?[^>]+(>|$)/g, ''); // HTML TAGS
// debug('cleanup( ' + str + ' ) => ' + str1 );
return str1;
}
//This function adds thousand separator to the number paramter
function formatVotes(nvotes)
{
if(isNaN(nvotes)) return;
var sRegExp=/([0-9]+)([0-9]{3})/i;
while(sRegExp.test(nvotes))
{
nvotes = nvotes.replace(sRegExp, '$1 $2');
}
return nvotes;
}
function space(num)
{
return new Array((num|0) + 1).join("-");
}
//This function can search for a movie via two ways : using the site www.omdbapi.com or using the imdb website
//the 'searchTry' param is used to cycle trough thye different way to get the movie info
//
// 0->1 = omdbapi Title + Year -> Data
// 1->2 = omdbapi Title + (Year-1) -> Data
// 2->3 = omdbapi Title + (Year+1) -> Data
// 3->4 = imdb.com Title + Year -> imdbID
//
// 10->11 = omdbapi Title -> Data
// 11->12 = imdb.com Title -> imdbID
// 12->13 = duckduckgo Title +/- Year -> imdbID/Data
//
// 20->21 = omdbapi imdbID -> Data
// 21->22 = imdb.com imdbID -> Data
function imdbRequest(searchTitle, element, searchTry)
{
searchTry=(searchTry|0) + 1;
requestImdbID = searchTitle.match(/tt\d{7}/);
if(requestImdbID)
if(searchTry<21) searchTry=21; // 20 = omdbapi imdbID -> Data
cleanTitle = searchTitle.replace(/\s*tt\d{7}\s*/,''); // Title without imdbID
requestYear = cleanTitle.match(/[0-9]{4}$/);
if(!requestYear)
if(searchTry<11) searchTry=11; // 10 = omdbapi Title -> Data
requestTitle = cleanTitle.replace(/\+[0-9]{4}$/, '').replace(/\+[0-9]{4}$/, ''); // Title without year (eventually 2)
debug(space(searchTry/10)+'imdbRequest( ['+(searchTry)+'] '+searchTitle+' ) => cleanTitle : ' + cleanTitle + ' requestTitle : ' + requestTitle + ' requestYear : ' + requestYear + ' requestImdbID : ' + requestImdbID);
if(!requestImdbID && !requestTitle)
{
debug(space(searchTry/10)+'imdbRequest( ['+(searchTry)+'] '+searchTitle+' ) => Nothing to search : no Title and no imdbID' );
return;
}
if(searchTry==5) searchTry=11; // keep space for aditional search method
switch (searchTry)
{
case 1: // 0 = omdbapi Title + Year -> Data
requestUrl='http://www.omdbapi.com/?t=' + requestTitle +'&y='+ requestYear;
break;
case 2: // 1 = omdbapi Title + (Year-1) -> Data
requestUrl='http://www.omdbapi.com/?t=' + requestTitle +'&y='+ ((requestYear|0)-1);
break;
case 3: // 2 = omdbapi Title + (Year+1) -> Data
requestUrl='http://www.omdbapi.com/?t=' + requestTitle +'&y='+ ((requestYear|0)+1);
break;
case 4: // 3 = imdb.com Title + Year -> imdbID
requestUrl='http://www.imdb.com/find?q=' + requestTitle + '+(' + requestYear + ')&s=tt';
break;
case 11: // 10 = omdbapi Title -> Data
requestUrl='http://www.omdbapi.com/?t=' + requestTitle;
break;
case 12: // 11 = imdb.com Title -> imdbID
requestUrl='http://www.imdb.com/find?q=' + requestTitle + '&s=tt';
break;
case 13: // 12 = duckduckgo Title +/- Year -> imdbID/Data
if(requestYear)
requestUrl='https://duckduckgo.com/?q=!ducky+'+ requestTitle + '+(' + requestYear + ')+site%3Aimdb.com'
else
requestUrl='https://duckduckgo.com/?q=!ducky+'+ requestTitle + '+site%3Aimdb.com'
break;
case 21: // 20 = omdbapi imdbID -> Data
requestUrl='http://www.omdbapi.com/?i=' + requestImdbID;
break;
case 22: // 21 = imdb.com imdbID -> Data
requestUrl='http://www.imdb.com/title/' + requestImdbID + '/';
break;
default:
requestUrl='https://duckduckgo.com/?q=!ducky+'+ requestTitle + '+(' + requestYear + ')+site%3Aimdb.com'
debug(space(searchTry/10)+'imdbRequest( ['+searchTry+'] '+searchTitle+' ) => Last search step requestURL : ' + requestUrl + ' *Title not Found*' );
addratingLinkToElement(element, [requestTitle.replace(/\+/g, ' ') + " (" + requestYear + ")", 0, requestUrl, 0], 1, 1, true) // Nothing found despite all these efforts
return;
}
debug(space(searchTry/10)+'imdbRequest( ['+searchTry+'] '+searchTitle+' ) => requestURL : ' + requestUrl);
GM.xmlHttpRequest
(
{
method: 'GET',
url: requestUrl,
headers:
{
'User-agent': 'Mozilla/4.0',
'Accept': 'application/atom+xml,application/xml,text/xml',
},
onload: function(responseDetails)
{
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => finalURL : ' + responseDetails.finalUrl);
//debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => responseText : ' + responseDetails.responseText);
var res = responseDetails.responseText;
// Please see https://regex101.com in case you need some help with RegEx
imdbFind = ' ([^<>]*)<\\/a>[^<>]*\\((\\d{4})\\)[^<>]*<\\/td>';
var imdbMatch = res.match(imdbFind);
// debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => IMDb List Page : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
if (imdbMatch!=null)
{
var imdbTitle = '';
var imdbYear = '';
var urlMatch = responseDetails.finalUrl.match(/\+\((\d{4})\)/);
if (urlMatch!=null)
{
imdbYear = urlMatch[1];
imdbTitle = searchTitle.replace(/ tt\d{7}$/, '').replace(/\+(\d{4})$/, '').replace(/\+/g, ' ');
imdbFind = ' | '+imdbTitle+'<\\/a>[^<>]*\\('+imdbYear+'\\)[^<>]*<\\/td>';
var imdbMatch = res.toLowerCase().match(imdbFind);
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => Year : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
if (imdbMatch==null)
{
imdbYear = ((imdbYear|0)-1);
imdbFind = ' | '+imdbTitle+'<\\/a>[^<>]*\\('+imdbYear+'\\)[^<>]*<\\/td>';
var imdbMatch = res.toLowerCase().match(imdbFind);
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => Year-1 : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
}
if (imdbMatch==null)
{
imdbYear = ((imdbYear|0)+2);
imdbFind = ' | '+imdbTitle+'<\\/a>[^<>]*\\('+imdbYear+'\\)[^<>]*<\\/td>';
var imdbMatch = res.toLowerCase().match(imdbFind);
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => Year+1 : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
}
if (imdbMatch==null)
{
imdbFind = ' | ([^<>]*)<\\/a>[^<>]*\\((\\d{4})\\)[^<>]*<\\/td>';
var imdbMatch = res.match(imdbFind);
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => 1st Item : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
}
}
else
{
imdbFind = ' | ([^<>]*)<\\/a>[^<>]*\\((\\d{4})\\)[^<>]*<\\/td>';
var imdbMatch = res.match(imdbFind);
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => No Year : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
}
}
if (imdbMatch!=null)
{
imdbID = 'tt'+imdbMatch[1];
if(!imdbTitle) imdbTitle = imdbMatch[2];
if(!imdbYear) imdbYear = imdbMatch[3];
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => imdbID Parsed from IMDb list : ' + imdbID + ' ' + imdbTitle + ' (' + imdbYear + ')');
imdbRequest(searchTitle + ' ' + imdbID, element, searchTry); // next try with imdbID found
}
else
{
var titleMatchVF = res.match(/(.*) - IMDb<\/title>/); // La cour de Babel (2013) - IMDb
var titleMatchVO = res.match(//); //
var ratingMatch = res.match(/itemprop="ratingValue">([\d\.,]*)<\/span>/); // itemprop="ratingValue">7,2
var votesMatch = res.match(/itemprop="ratingCount">([\d, ]*)<\/span>/); // itemprop="ratingCount">281
if ((titleMatchVO!=null && titleMatchVO[1]!='') || ratingMatch!=null || votesMatch!=null)
{
var imdbTitle='';
var imdbRating = 0.0;
var imdbVotes = 0;
if (titleMatchVF) imdbTitle = titleMatchVF[1];
if (titleMatchVF && titleMatchVO) imdbTitle += ' ';
if (titleMatchVO) imdbTitle += titleMatchVO[1];
if (ratingMatch) imdbRating = ratingMatch[1].replace(/,/g, '.');
if (votesMatch) imdbVotes = votesMatch[1].replace(/[, ]/g, '');
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => imdbRating Parsed from IMDd page : ' + imdbTitle + ' ' + imdbRating + ' (' + imdbVotes + ') ' + responseDetails.finalUrl);
addratingLinkToElement(element, [imdbTitle, imdbRating, responseDetails.finalUrl, imdbVotes], 1, 1);
}
else
{
if(res.match('"Response":"True"'))
{
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => responseText : ' + responseDetails.responseText);
var arrRes = eval('(' + responseDetails.responseText + ')');
imdbTitle = searchTitle.replace(/ tt\d{7}$/, '').replace(/\+(\d{4})$/, '').replace(/\+/g, ' ');
if (arrRes.Response=='True') //no error while fetching movie
{
var imdbUrl='http://www.imdb.com/title/' + arrRes.imdbID + '/combined';
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => omdbRating Parsed from OMDb Api : ' + arrRes.Title + ' (' + arrRes.Year + ') ' + arrRes.imdbRating + ' (' + arrRes.imdbVotes.replace(',', '') + ') ' + imdbUrl);
if( arrRes.imdbRating == 'N/A' || typeof arrRes.imdbRating == 'undefined' || arrRes.imdbRating<=0 )
imdbRequest(searchTitle, element, searchTry); // next try
else
addratingLinkToElement(element, [arrRes.Title + " (" + arrRes.Year + ")", arrRes.imdbRating, imdbUrl, arrRes.imdbVotes.replace(/,/g,'')], 1, 1);
}
else
imdbRequest(searchTitle, element, searchTry); // next try
}
else
{
var imdbMatch = searchTitle.match(/tt(\d{7})$/);
if (imdbMatch==null) // imdbID is still unknown
{
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => responseText : ' + responseDetails.responseText);
if(dickduckgoMatch = responseDetails.finalUrl.match(/duckduckgo\.com/))
{
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => Try to parse imdbID from DuckDuckGo request');
if(imdbID = responseDetails.responseText.match(/tt\d{7}/))
{
debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => imdbID Parsed from DuckDuckGo request : ' + imdbID);
imdbRequest(searchTitle + ' ' + imdbID, element, searchTry); // next try with imdbID found
}
else
imdbRequest(searchTitle, element, searchTry); // next try
}
else
imdbRequest(searchTitle, element, searchTry); // next try
}
else
imdbRequest(searchTitle, element, searchTry); // next try
}
}
}
}
}
);
}
//element: DOM Object
//ratingLink : rating informations [title, note, url of info page, votes]
//mediaType : 1 => Imdb
// 2 => BetaSeries
//Modifier : 1 => original note is 10based
// 2 => original note is 5based
function addratingLinkToElement(element, ratingLink, mediaType, modifier, ratingError){ //modifier is a new param : it is used with a value of 2 when the note is 5based ... so that we can calculate a 10based note
ratingError=ratingError||false; //set default
//if theres no error within the presume imdb url (means we do find 'imdb' or 'betaseries' or 'duckduckgo' inside it), we set 2 variables to let us insert the imdb link later
if (typeof ratingLink[2] != 'undefined' && (ratingLink[2].indexOf('imdb') != -1 || ratingLink[2].indexOf('betaseries') != -1 || ratingLink[2].indexOf('duckduckgo') != -1))
{
ratingOpenLink="";
ratingCloseLink=""
}
else
{
ratingOpenLink="";
ratingCloseLink=""
}
if (ratingLink && ratingLink != -1)
{
ratingElement = "";
if (GM_config.read().rating_twolines)
{
ratingElement += ""; // For two lines
}
else
{
ratingElement += " "; // For everything on one line AND IMDB stars
}
ratingElement+=ratingOpenLink;
ratingElement += " ";
if (GM_config.read().rating_showgreystars)
ratingElement += " ";
else
if (ratingError)
ratingElement += GM_trans.lang('ratingerror');
else
ratingElement += GM_trans.lang('norating');
noresult=true;
}
else
{
ratingElement+="title='" + (mediaType==2 && GM_trans.lang('rating_serie')==2?GM_trans.lang('episode_title') + ' : ':'') + ratingLink[0].replace(/['"]/g, ' ') + " - " + GM_trans.lang('note') + ": " + ratingLink[1] * modifier + " / 10" + " " + GM_trans.lang('with') + " " + formatVotes(ratingLink[3]) + " " + GM_trans.lang('votes') + "' ";
ratingElement+="style='height:20px; float:left;'>";
if (GM_config.read().rating_starmode != 1) // starmode 2 & 3 = Stars only & Rating + stars
{
//New rating display mode by Cook2
if(GM_config.read().rating_displayMode_byCook2)
{
starrating = ratingLink[1] * modifier;
if ( mediaType == 1)
starrating = (starrating * starrating)/81*6-1; // en fonction du carré de la note en enlevant les extrèmes
else
starrating = (starrating * starrating)/100*6-1; // en fonction du carré de la note en enlevant les extrèmes
starrating = starrating * GM_config.read().rating_shownotation; //cette option égale 1 si on veut une note sur 5 étoiles, ou 2 si note sur 10 étoiles
if (starrating <= 0) starrating = 0;
if (starrating >= 5 * GM_config.read().rating_shownotation) starrating = 5 * GM_config.read().rating_shownotation;
if (ratingLink[3] != 'N/A' && ratingLink[3] > 0)
{
if ( mediaType == 1)
starvote = Math.sqrt(ratingLink[3])/10;
else
starvote = Math.sqrt(ratingLink[3]);
}
else
starvote = 0;
if (starvote <= 1) starvote = 1;
if (starvote >= 20) starvote = 20;
starpos = starvote - 40;
startop = 20 - starvote;
imdbrating='';
if (GM_config.read().rating_showgreystars) imdbrating = " ";
imdbrating += " ";
imdbrating += " ";
imdbrating += " ";
if (GM_config.read().rating_showgreystars) imdbrating += " ";
ratingElement += imdbrating;
//End
}
else
{
imdbrating='';
if (GM_config.read().rating_showgreystars) imdbrating = " ";
imdbrating += " ";
imdbrating += " ";
if (GM_config.read().rating_showgreystars) imdbrating += " ";
ratingElement += imdbrating;
}
}
}
if(GM_config.read().rating_starmode != 2 && !noresult) //rating_starmode = 1 & 3 : Rating & Rating + Stars
{
ratingElement += " ";
ratingElement += ratingCloseLink;
ratingElement += ratingOpenLink + " ";
ratingElement += " " + ratingLink[1] * modifier;
//Adding /10 (or /5) on rating display
if(GM_config.read().rating_displayMode)
ratingElement += " / " + 5 * Math.abs(modifier-3);
ratingElement += "" + ratingCloseLink;
}
else // normal behavior
{
ratingElement+=ratingCloseLink;
ratingElement += " ";
}
if (GM_config.read().rating_showvotes && ratingLink[3] != 'N/A' && typeof ratingLink[3] != 'undefined')
{
ratingElement += " (" + formatVotes(ratingLink[3]) + " " + GM_trans.lang('votes') + ") ";
}
ratingElement += " ";
newText= element.parentNode.innerHTML + ratingElement;
element.parentNode.innerHTML = newText;
}
}
//----------------------------------------------
//----------------------------------------------
//---------------LOCALIZATION-----------
//----------------------------------------------
//----------------------------------------------
GM_trans.setTranslations('en',{
//Localization of configuration
'ConfigTitle': '\'Better Usenet\' Settings',
'script_options':'General settings',
'updater_timer':'Seconds to wait before autoclosing the updater window (0=no autoclose timer)',
'updater_delay':'Days between new update checking',
'noupdate':'No \'Better Usenet\' update',
'language_option':'Display language (\'Save\' to apply)',
'language_section':'Language',
'option_fixedheader':'Make the header (menu + search) fixed',
'option_deletead':'Delete the ad banner',
'option_forcessl':'Force SSL protocol',
'option_scrolltoresults':'Go to search results after loading page',
'option_resize':'Change the results table width (%)',
'option_othernzbindexerbuttons':'Add a button to do the same search on other NZB Indexers',
'option_nocheckboxifpassword':'Delete the selection checkbox if the result is password protected',
'option_highlightifpassword':'Highlight a result if it is password protected',
'display_binsearch1':'Display a link to Binsearch (popular groups)',
'display_binsearch2':'Display a link to Binsearch (other groups) (not recommended)',
'display_nzbindex':'Display a link to NZBIndex',
'display_nzbfriends':'Display a link to NZBFriends',
'display_allocine':'Display a link to Allociné', //Cook2 Allociné added (replace dead Yubse)
'display_thxlink':'Display a link to thanks the poster of each release',
'display_infolink':'Display a link to retrieve votes for an element',
'thxlink_title':'Thank you !',
'infolink_title':'Find its ratings',
'binnewz_selectedresultcolor':'Color to highlight the \'Age\' and \'Group\' cells if matching',
'binnewz_highlighttolerance':'Accept a +-1 day tolerance when trying to determine if \'Age\' cell match Binnewz selection',
'binnewz_toleranceresultcolor':'Color to highlight the \'Age\' if matching with tolerance',
'binnewz_displaysearchinformations':'Display details of your Binnewz selection on Binsearch and NZBIndex',
'binnewz_nzblinks_place':'Display NZB links in the following column',
'nzblinks_place_title':'Title ("Titre" in french)',
'nzblinks_place_file':'File ("Fichier " in french)',
'nzblinks_place_size':'Size ("Taille" in french)',
'binnewz_deletenodeifpassword':'Hide results that are password protected or virus',
'binnewz_highlightifpassword':'Highlight a result if it is password protected or a virus',
'binnewz_donothingifpassword':'Do not display NZB links and do not fetch rating for a result that is password protected or virus',
'binsearch_nzbbuttons':'Add a NZB button for each result',
'binsearch_nzbbuttoncolor':'NZB button\'s color',
'binsearch_nonzbbuttonifpassword':'Do not add a NZB button if Binsearch says the result is password protected',
'binsearch_missingpartsdetails_option':'If there is missing parts, display precisly how many are missing',
'binsearch_selectbuttons':'Add new selection buttons (Select all / Cancel selection) [Firefox only]',
'binsearch_noresultbutton':'If there is no result from the selected groups (popular/other), add a button to do the same search on the other groups (other/popular)',
'binsearch_autoloadothersearch':'If there is no result from the selected groups (popular/other), automaticaly do the same search on the other groups (other/popular)',
'binsearch_autoloadnzbindex':'If there is really no result on Binsearch, automaticaly do the same search on NZBIndex',
'binsearch_delete_oldcontentline':'Delete the yellow line inserted by Binsearch when it displays old results',
'binsearch_advancedsearch':'Activate Binsearch\'s advanced search form',
'binsearch_showcollections':'Only show collections (you need to activate the advanced search)',
'nzbindex_nonzbbuttonifpassword':'Remove the \'download\' link if NZBIndex says the result is password protected',
'nzbindex_delete_oldcontentline':'Delete the yellow line inserted by NZBIndex when it displays old results',
'nzbindex_onlycollections':'Only display \'collection\' type results (you can still deactivate it with the checkbox on top of results)',
'nzbindex_orderbuttons':'Add icons to order results by size or age',
'nzbindex_resultLinks_fontSize':'Font size for the "Download" and "View Collection" links (nzbindex default : 10 pixel)',
'nzbindex_autoloadbinsearch':'If no result on NZBIndex, do the same search on Binsearch automatically',
'rating':'Rating',
'rating_imdb':'Fetch rating + votes from IMDB database and display it on every appropriate results on Binnewz (movies, animes, documentaries)',
'rating_betaseries':'Fetch rating + votes from BetaSeries database and display it on every appropriate results on Binnewz (series only)',
'rating_BS_infos':'Fetching infos from BetaSeries for : ',
'rating_starmode':'Display mode for ratings',
'rating_shownotation':'The rating will be displayed with :',
'rating_displayMode_byCook2':'Use a different graphic display mode for ratings : Enhancement of best ratings and display of the stars depending on number of votes',
'rating_showgreystars':'When displaying rating with stars, display greystars for rating less than the maximum note',
'rating_showvotes':'Also display votes (however votes will still be displayed when hoovering the note)',
'rating_twolines':'Display rating form IMDB on another line',
'rating_displayMode':'In textmode, display rating + max rating (4/10 or 2/5)',
'debug_log':'Afficher les messages de logs (cf la "Console d\'erreurs > Messages")',
'debug_time':'Afficher le temps d\'exécution du script (dans la barre de configuration)',
'script_link_openingconfiguration':'Settings',
'script_link_lookingforupdate':'Check for update',
'script_link_forum':'Support Forum',
'script_link_siteofficiel':'Official website',
'script_link_whatsnew':'Changelog',
//Localization of user interface
'binsearch_missingpartsdetails':'Missing',
'binnewz_alert_nooptions':'It is not possible to open the \'Better Usenet\' Configuration when you are on Binnewz.in (because there are html frames). You can only load the options from Binsearch.info website',
'make_link_title':'Search for a NZB on',
'binsearch_selectall_button':'Select all',
'binsearch_unselectall_button':'Cancel selection',
'noresult_button':'No result',
'binsearch_button_populargroups':'Search on popular groups of Binsearch',
'binsearch_button_othergroups':'Search on other groups of Binsearch',
'othernzbindexer_button':'Search on',
'binsearch_autoload_suceeded':'The script \'Better Usenet\' has loaded the other/popular groups results',
'nzbindex_str_onlycollections':'Show only collections',
'nzbindex_openoptions':'See options',
'nzbindex_hiddenresults':' hidden results (no collections)',
'binnewz_searchinformations_title':'You\'re searching for :',
'filename':'Filename :',
'age':'Age',
'groups':'Groups :',
'or':'or',
'days':'days',
'caption_title':'Highligting caption :',
'caption_selectedresult':'Age/Group match',
'caption_toleranceresult':'Age +-1 day',
'rating_serie':'the serie',
'rating_episode':'the episode',
'with':'with',
'note':'Rating',
'votes':'Votes',
'stars':'stars',
'episode_title':'Title of this episode',
'add_to_selection':'Clic to add to selection',
'remove_from_selection':'Clic to remove from selection',
'AlertFirstLaunch':'"Better Usenet" Warning :\n\n Remember to deactivate others userscripts which have the same functionalities than Better Usenet. \n\n To check your activated user scripts, go to "Tools - Greasemonkey - Manage User Scripts"',
'starmode':'Graphical mode',
'textmode':'Text mode',
'protected_row':'This result is password protected',
'debug':'Debug',
'norating':'No rating found',
'ratingerror':'Error while fetching rating',
});
GM_trans.setTranslations('fr',{
//Traduction de la partie 'Configuration'
'ConfigTitle':'Configuration de \'Better Usenet\'',
'script_options':'Options générales',
'updater_timer':'Nombre de secondes avant la fermeture automatique de la fenêtre d\'information de mise à jour (0=pas de timer)',
'updater_delay':'Nombre de jours entre les vérifications automatiques de présence d\'une mise à jour',
'noupdate':'Pas de mise à jour de \'Better Usenet\'',
'language_option':'Langue d\'affichage (bouton \'Save\' pour appliquer)',
'language_section':'Langue',
'option_fixedheader':'Rendre fixe l\'entête des sites gérés',
'option_deletead':'Supprimer la bannière de publicité',
'option_forcessl':'Forcer l\'utilisation du protocole SSL',
'option_scrolltoresults':'Aller directement aux résultats de recherche au chargement de la page',
'option_resize':'Modifier la taille du tableau des résultats (en %)',
'option_othernzbindexerbuttons':'Ajouter un bouton pour faire la même recherche sur les autres sites de NZB',
'option_nocheckboxifpassword':'Supprimer la case à cocher si le contenu associé à la ligne est marqué comme protégé par un mot de passe',
'option_highlightifpassword':'Change la couleur d\'une ligne si le contenu associé est marqué comme protégé par un mot de passe',
'display_binsearch1':'Affiche un lien vers Binsearch (groupes populaires)',
'display_binsearch2':'Affiche un lien vers Binsearch (autres groupes) (pas conseillé)',
'display_nzbindex':'Affiche un lien vers NZBIndex',
'display_nzbfriends':'Affiche un lien vers NZBFriends',
'display_allocine':'Affiche un lien vers Allociné', // Cook2
'display_thxlink':'Afficher un lien pour chaque référencement afin de remercier le posteur',
'display_infolink':'Afficher un lien pour récupérer la notation d\'un élément',
'thxlink_title':'Merci au référenceur!',
'infolink_title':'Trouver la notation',
'binnewz_selectedresultcolor':'Couleur du surlignage de la case \'Age\' ou \'Group\' si correspondance',
'binnewz_highlighttolerance':'Accorder une tolérance de +- 1 jour pour le surlignage de la case \'Age\'',
'binnewz_toleranceresultcolor':'Couleur du surlignage de la case \'Age\' si il y a eu tolerance à +- 1 jour',
'binnewz_displaysearchinformations':'Affiche sur NZBIndex et Binsearch les détails de la sélection faite sur Binnewz',
'binnewz_nzblinks_place':'Affiche les liens NZB dans la colonne suivante',
'nzblinks_place_title':'Titre',
'nzblinks_place_file':'Fichier',
'nzblinks_place_size':'Taille',
'binnewz_deletenodeifpassword':'Cacher les résultats inutiles (virus ou protégé par un mot de passe) [Note : Si coché, les 2 paramètres suivants seront inutiles]',
'binnewz_highlightifpassword':'Change la couleur d\'une ligne si le contenu associé est marqué comme un virus ou protégé par un mot de passe',
'binnewz_donothingifpassword':'Ne pas afficher les liens NZB ni la notation si un mot de passe ou un virus est annoncé par Binnewz',
'binsearch_nzbbuttons':'Ajouter un bouton NZB pour chaque résultat',
'binsearch_nzbbuttoncolor':'Couleur du bouton NZB',
'binsearch_nonzbbuttonifpassword':'Ne pas créer de bouton NZB si le contenu associé à la ligne est marqué comme protégé par un mot de passe',
'binsearch_missingpartsdetails_option':'Si il y a des parts manquantes, affiche le nombre précis',
'binsearch_selectbuttons':'Ajouter des boutons supplémentaires de sélection (Tout sélectionner / Annuler la sélection) [Firefox uniquement]',
'binsearch_noresultbutton':'Si il n\'y a aucun résultat pour les groupes sélectionnés (populaires/autres), ajoute un bouton pour faire la même recherche dans les autres groupes (autres/populaires)',
'binsearch_autoloadothersearch':'Si il n\'y a aucun résultat pour les groupes sélectionnés (populaires/autres), faire automatiquement la même recherche dans les autres groupes (autres/populaires)',
'binsearch_autoloadnzbindex':'Si il n\'y a vraiment aucun résultat sur Binsearch, faire automatiquement la même recherche sur NZBIndex',
'binsearch_delete_oldcontentline':'Supprime la ligne insérée par Binsearch dans les vieux résultats',
'binsearch_advancedsearch':'Active la recherche avancée de Binsearch',
'binsearch_showcollections':'Affiche uniquement les collections de fichiers (nécessite d\'activer la recherche avancée)',
'nzbindex_nonzbbuttonifpassword':'Supprimer le lien \'Download\' si le contenu associé à la ligne est marqué comme protégé par un mot de passe',
'nzbindex_delete_oldcontentline':'Supprime la ligne insérée par NZBIndex dans les vieux résultats',
'nzbindex_onlycollections':'N\'afficher que des collections de fichiers dans les résultats (vous pourrez toujours désactiver ça via la case à cocher au dessus des résultats)',
'nzbindex_orderbuttons':'Ajouter des icônes pour trier les résultats selon la taille ou l\'âge',
'nzbindex_resultLinks_fontSize':'Taille de la police utilisée pour les liens "Download" et "View Collection" (nzbindex défaut : 10 pixel)',
'nzbindex_autoloadbinsearch':'Si aucun résultat sur NZBIndex, fait automatiquement la même recherche sur Binsearch',
'rating':'Notation',
'rating_imdb':'Récupère la note et les votes du site IMDB and les affiche pour chaque résultat approprié de Binnewz (films, animes, documentaires)',
'rating_betaseries':'Récupère la note et les votes du site BetaSeries and les affiche pour chaque résultat approprié de Binnewz (séries uniquement)',
'rating_BS_infos':'Les infos récupérées sur BetaSeries seront pour : ',
'rating_starmode':'Mode d\'affichage des notes',
'rating_shownotation':'La notation sera affichée sur :',
'rating_displayMode_byCook2':'Utiliser un rendu graphique de la note différent : mise en valeur des meilleurs notes et coloration des étoiles en fonction des votes',
'rating_showgreystars':'Quand la note est affichée en mode graphique, affiche des étoiles grises quand la note est inférieure à la note maximale',
'rating_showvotes':'Affiche les votes en plus de la note (le nombre de votes sera cependant toujours visible au survol de la souris)',
'rating_twolines':'Affiche la notation d\'IMDB sur une ligne supplémentaire',
'rating_displayMode':'En mode texte, afficher la note + la note maximale (4/10 or 2/5)',
'debug_log':'Afficher les messages de logs (cf la "Console d\'erreurs > Messages")',
'debug_time':'Afficher le temps d\'exécution du script (dans la barre de configuration)',
//Traduction de l'interface (boutons, messages utilisateurs, etc)
'script_link_openingconfiguration':'Configuration',
'script_link_lookingforupdate':'Maj ? ',
'script_link_forum':'Forum de discussion',
'script_link_siteofficiel':'Site web officiel',
'script_link_whatsnew':'Changelog',
'binsearch_missingpartsdetails':'Manque',
'binnewz_alert_nooptions':'Impossible d\'afficher les options via Binnews (à cause des frames html). Vous ne pouvez ouvrir les options qu\'à partir du site \'binsearch.info\'',
'make_link_title':'Chercher le NZB sur',
'binsearch_selectall_button':'Tout sélectionner',
'binsearch_unselectall_button':'Annuler la sélection',
'noresult_button':'Aucun résultat',
'binsearch_button_populargroups':'Chercher sur les groupes populaires de Binsearch',
'binsearch_button_othergroups':'Chercher sur les autres groupes de Binsearch',
'othernzbindexer_button':'Rechercher sur',
'binsearch_autoload_suceeded':'Le script \'Better Usenet\' a chargé automatiquement les résultats sur les autres groupes.',
'nzbindex_str_onlycollections':'N\'afficher que les collections',
'nzbindex_openoptions':'Voir les options',
'nzbindex_hiddenresults':' résultats masqués (pas des collections)',
'binnewz_searchinformations_title':'Vous recherchez',
'filename':'Nom de fichier',
'age':'Age',
'groups':'Groupes',
'or':'ou',
'days':'jours',
'caption_title':'Légende de la coloration',
'caption_selectedresult':'Age/Groupe correspond',
'caption_toleranceresult':'Age +-1 jour',
'rating_serie':'la série',
'rating_episode':'l\'épisode',
'with':'avec',
'note':'Note',
'votes':'Votes',
'stars':'étoiles',
'episode_title':'Titre de cet épisode',
'add_to_selection':'Cliquez pour ajouter à la sélection',
'remove_from_selection':'Cliquez pour retirer de la sélection',
'AlertFirstLaunch':'Avertissement "Better Usenet" :\n\n Pensez à désactiver les autres scripts qui pourraient avoir les mêmes fonctions que Better Usenet. \n\n Pour vérifier vos scripts actifs dans Greasemonkey, allez dans "Outils - GreaseMonkey - Manage User Scrips"',
'starmode':'Mode graphique',
'textmode':'Mode Texte',
'protected_row':'Ce résultat est protégé par un mot de passe',
'debug':'Debug',
'norating':'Aucune notation disponible',
'ratingerror':'Récupération de la note impossible',
});
//Setting Language (if language not set yet, use EN)
if (GM_config.read()['language_option'])
GM_trans.setLang(GM_config.read()['language_option']);
else
GM_trans.setLang('en');
//----------------------------------------------
//----------------------------------------------
//-------------------CONFIG-----------------
//----------------------------------------------
//----------------------------------------------
/* Remove the 40% wasted space to the left */
var configStyle = ".field_label {padding-left:15px;}";
configStyle=configStyle.toString();
function initConfig() {
GM_config.init(GM_trans.lang('ConfigTitle'),
{
'language_option':
{
section : [GM_trans.lang('language_section')],
label: GM_trans.lang('language_option'),
type:'select',
options:{'fr':'Français','en':'English'},
default:'fr'
},
'updater_delay':
{
section : [GM_trans.lang('script_options')],
label: GM_trans.lang('updater_delay'),
type:'text',
default:'3'
},
'updater_timer':
{
label: GM_trans.lang('updater_timer'),
type:'text',
default:'0'
},
'searchnzb_forcessl':
{
label: GM_trans.lang('option_forcessl'),
type: 'checkbox',
default: true
},
'deletead':
{
label: GM_trans.lang('option_deletead'),
type: 'checkbox',
default: true
},
'option_fixedheader':
{
label: GM_trans.lang('option_fixedheader'),
type: 'checkbox',
default: true
},
'display_binsearch1':
{
label: GM_trans.lang('display_binsearch1'),
type: 'checkbox',
default: true
},
'display_binsearch2':
{
label: GM_trans.lang('display_binsearch2'),
type: 'checkbox',
default: false
},
'display_nzbindex':
{
label: GM_trans.lang('display_nzbindex'),
type: 'checkbox',
default: true
},
'display_nzbfriends':
{
label: GM_trans.lang('display_nzbfriends'),
type: 'checkbox',
default: false
},
'display_allocine': // Cook2
{
label: GM_trans.lang('display_allocine'),
type: 'checkbox',
default: true
},
'display_thxlink':
{
label: GM_trans.lang('display_thxlink'),
type: 'checkbox',
default: true
},
'binnewz_nzblinks_place':
{
label: GM_trans.lang('binnewz_nzblinks_place'),
type:'select',
options:{1:GM_trans.lang('nzblinks_place_title'),2:GM_trans.lang('nzblinks_place_file'),3:GM_trans.lang('nzblinks_place_size')},
default:1
},
// 1 : Place NZB links in the size cell
// 2 : Place NZB links in the file cell
// 3 : Place NZB links in the title cell
'binnewz_resize':
{
label: GM_trans.lang('option_resize'),
type: 'text',
default: '100'
},
'binnewz_highlighttolerance':
{
label: GM_trans.lang('binnewz_highlighttolerance'),
type: 'checkbox',
default: true
},
'binnewz_selectedresultcolor':
{
label: GM_trans.lang('binnewz_selectedresultcolor'),
type: 'text',
default: '#95E07E'
},
'binnewz_toleranceresultcolor':
{
label: GM_trans.lang('binnewz_toleranceresultcolor'),
type: 'text',
default: '#C7E2BF' //(lesser green)
},
'binnewz_displaysearchinformations':
{
label: GM_trans.lang('binnewz_displaysearchinformations'),
type: 'checkbox',
default: true
},
'binnewz_deletenodeifpassword':
{
label: GM_trans.lang('binnewz_deletenodeifpassword'),
type: 'checkbox',
default: true
},
'binnewz_highlightifpassword':
{
label: GM_trans.lang('binnewz_highlightifpassword'),
type: 'checkbox',
default: true
},
'binnewz_donothingifpassword':
{
label: GM_trans.lang('binnewz_donothingifpassword'),
type: 'checkbox',
default: true
},
'binsearch_nzbbuttons':
{
'section': ['Binsearch'],
label: GM_trans.lang('binsearch_nzbbuttons'),
type: 'checkbox',
default: true
},
'binsearch_nzbbuttoncolor':
{
label: GM_trans.lang('binsearch_nzbbuttoncolor'),
type: 'text',
default: '#EAD7D7'
},
'binsearch_nonzbbuttonifpassword':
{
label: GM_trans.lang('binsearch_nonzbbuttonifpassword'),
type: 'checkbox',
default: true
},
'binsearch_nocheckboxifpassword':
{
label: GM_trans.lang('option_nocheckboxifpassword'),
type: 'checkbox',
default: true
},
'binsearch_highlightifpassword':
{
label: GM_trans.lang('option_highlightifpassword'),
type: 'checkbox',
default: true
},
'binsearch_missingpartsdetails':
{
label: GM_trans.lang('binsearch_missingpartsdetails_option'),
type: 'checkbox',
default: true
},
'binsearch_selectbuttons':
{
label: GM_trans.lang('binsearch_selectbuttons'),
type: 'checkbox',
default: true
},
'binsearch_noresultbutton':
{
label: GM_trans.lang('binsearch_noresultbutton'),
type: 'checkbox',
default: true
},
'binsearch_autoloadothersearch':
{
label: GM_trans.lang('binsearch_autoloadothersearch'),
type: 'checkbox',
default: true
},
'binsearch_resize':
{
label: GM_trans.lang('option_resize'),
type: 'text',
default: '100'
},
'binsearch_scrolltoresults':
{
label: GM_trans.lang('option_scrolltoresults'),
type: 'checkbox',
default: true
},
'binsearch_delete_oldcontentline':
{
label: GM_trans.lang('binsearch_delete_oldcontentline'),
type: 'checkbox',
default: true
},
'binsearch_advancedsearch':
{
label: GM_trans.lang('binsearch_advancedsearch'),
type: 'checkbox',
default: false
},
'binsearch_showcollections':
{
label: GM_trans.lang('binsearch_showcollections'),
type: 'checkbox',
default: false
},
'binsearch_autoloadnzbindex':
{
label: GM_trans.lang('binsearch_autoloadnzbindex'),
type: 'checkbox',
default: true
},
'nzbindex_nonzbbuttonifpassword':
{
'section': ['NZBIndex'],
label: GM_trans.lang('nzbindex_nonzbbuttonifpassword'),
type: 'checkbox',
default: true
},
'nzbindex_nocheckboxifpassword':
{
label: GM_trans.lang('option_nocheckboxifpassword'),
type: 'checkbox',
default: true
},
'nzbindex_highlightifpassword':
{
label: GM_trans.lang('option_highlightifpassword'),
type: 'checkbox',
default: true
},
'nzbindex_scrolltoresults':
{
label: GM_trans.lang('option_scrolltoresults'),
type: 'checkbox',
default: true
},
'nzbindex_delete_oldcontentline':
{
label: GM_trans.lang('nzbindex_delete_oldcontentline'),
type: 'checkbox',
default: true
},
'nzbindex_onlycollections':
{
label: GM_trans.lang('nzbindex_onlycollections'),
type: 'checkbox',
default: false
},
'nzbindex_orderbuttons':
{
label: GM_trans.lang('nzbindex_orderbuttons'),
type: 'checkbox',
default: true
},
'nzbindex_resize':
{
label: GM_trans.lang('option_resize'),
type: 'text',
default: '100'
},
'nzbindex_resultLinks_fontSize':
{
label: GM_trans.lang('nzbindex_resultLinks_fontSize'),
type: 'text',
default: '13'
},
'nzbindex_autoloadbinsearch':
{
label: GM_trans.lang('nzbindex_autoloadbinsearch'),
type: 'checkbox',
default: true
},
'rating_imdb':
{
'section': [GM_trans.lang('rating')],
label: GM_trans.lang('rating_imdb'),
type: 'checkbox',
default: true
},
'rating_betaseries':
{
label: GM_trans.lang('rating_betaseries'),
type: 'checkbox',
default: true
},
'rating_BS_infos':
{
label: GM_trans.lang('rating_BS_infos'),
type:'select',
options:{1:GM_trans.lang('rating_serie'),2:GM_trans.lang('rating_episode')},
default:1
},
// 1 : Rating only
// 2 : Star only
// 3 : Rating + Star
'rating_starmode':
{
label: GM_trans.lang('rating_starmode'),
type:'select',
options:{1:GM_trans.lang('textmode'),2:GM_trans.lang('starmode'),3:GM_trans.lang('textmode') + ' & ' + GM_trans.lang('starmode')},
default:2
},
'rating_displayMode_byCook2':
{
label: GM_trans.lang('rating_displayMode_byCook2'),
type: 'checkbox',
default: false
},
'rating_shownotation':
{
label: GM_trans.lang('rating_shownotation'),
type:'select',
options:{1:'5 ' + GM_trans.lang('stars'),2:'10 ' + GM_trans.lang('stars')},
default:1
},
'rating_displayMode':
{
label: GM_trans.lang('rating_displayMode'),
type: 'checkbox',
default: false
},
'rating_showgreystars':
{
label: GM_trans.lang('rating_showgreystars'),
type: 'checkbox',
default: true
},
'rating_showvotes':
{
label: GM_trans.lang('rating_showvotes'),
type: 'checkbox',
default: true
},
'rating_twolines':
{
label: GM_trans.lang('rating_twolines'),
type: 'checkbox',
default: true
},
'debug_log':
{
'section': [GM_trans.lang('debug')],
label: GM_trans.lang('debug_log'),
type: 'checkbox',
default: false
},
'debug_time':
{
label: GM_trans.lang('debug_time'),
type: 'checkbox',
default: false
}
},
configStyle, //My CSS modifications (see upper)
{
open: function() {},
save: function() {
location.reload();
},
close: function() {
//GM_config.fadeIn();
}
}
);
}
//---------------------------------------------
//---------------------CSS-------------------
//---------------------------------------------
//----------------------------------------------
//----------------------------------------------
//--------------------MAIN------------------
//----------------------------------------------
//----------------------------------------------
var website=null;
var protocol='http://';
if (document.location.hostname.indexOf('binnews')!=-1) {
website='binnewz';
binnewz_url=document.location.hostname;
if (GM_config.read().searchnzb_forcessl)
protocol='https://';
//debug('toto');
}
else {
if (GM_config.read().searchnzb_forcessl){
protocol='https://';
if(document.location.protocol=='http:') //If acceeding nzb search engines without SSL while user wants SSL
document.location.href=document.location.href.replace('http:', 'https:'); //we reload the page with ssl
}
if (document.location.hostname.indexOf('binsearch.info')!=-1) {
//Theres a feature within Binsearch thats displays a 'Now loading' message ... script must not load in that case
if (document.getElementsByTagName('h1')[0]==null) return;
website='binsearch';
}
else if (document.location.hostname.indexOf('nzbindex.com')!=-1) website='nzbindex';
}
initConfig();
GM_config.save();
//URL Parameters associative array
UrlParams=extractUrlParams();
var query=UrlParams["q"];
if(typeof query=='undefined') query='';
//Variables for the Hightlight Option
var sinceXdays=UrlParams["sinceXdays"];
if(typeof sinceXdays=='undefined') sinceXdays='';
var fromGroups=UrlParams["fromGroups"];
if(typeof fromGroups=='undefined') fromGroups='';
var showcol=UrlParams["showcol"];
var myorder=UrlParams["myorder"];
if(typeof myorder=='undefined') //if NZBIndex is accessed directly with an order param
if(typeof UrlParams["sort"]!='undefined') myorder=UrlParams["sort"];
else myorder='';
var pingpong=UrlParams["pong"];
if(typeof pingpong=='undefined') pingpong='';
if(document.styleSheets.length!=0)
var sty = document.styleSheets[document.styleSheets.length - 1];
else
var sty = null;
if (website=='binsearch') { //Binsearch modifications
var searchform=document.getElementsByName('r')[0];
var tabresults=document.getElementById('r2');
var top_div=tabresults;
var searchServers=UrlParams["server"];
var autoload=UrlParams["autoload"];
var coldetails=UrlParams["b"];
binsearch_configurationIntegration();
if (GM_config.read().deletead) Binsearch_DeleteAd();
if(GM_config.read().option_fixedheader) binsearch_fixedHeader(); //A appeler après binsearch_configurationIntegration();
if (typeof searchform != 'undefined'&& typeof coldetails == 'undefined' && query != '') {//no 'r' searchform, no 'q' param, or presence of 'b' param : not a results page, just the basic or advanced query form
if (tabresults!=null) { //if there is results in Binsearch
resize_binsearch(GM_config.read().binsearch_resize);
if(sinceXdays!=null || fromGroups!=null) {
//Theres a bug with Firefox 4.* and 3.* : Binsearch results source code is not the same
if(searchform.parentNode.tagName=="TD") //first case : firefox 4
insertInformations(document.getElementsByClassName('mt')[0].children[0].children[1].children[1], searchform);
else if(searchform.parentNode.tagName=="FORM") //2nd case : Firefox 3
insertInformations(document.getElementsByTagName("FORM")[0], searchform);
}
//selectTheResult : to know if theres only one result
//selectTheResult=searchform.getElementsByTagName('table')[searchform.getElementsByTagName('table').length-1].getElementsByTagName('td')[0].textContent.search(/ 1 /)!=-1;
selectTheResult=((tabresults.getElementsByTagName('input').length))==1;
if (GM_config.read().binsearch_selectbuttons && BrowserDetect.browser!='Chrome') make_select_buttons();
if (GM_config.read().binsearch_scrolltoresults) top_div.scrollIntoView();
if(BrowserDetect.browser!='Chrome'){
//This part to prepare the 'clickRow' functionnality
var inputsCol=tabresults.parentNode.parentNode.children;
for(i=0;i0){ //Only if there are results
if(BrowserDetect.browser!='Chrome') nzbindex_add_buttons();
if(sinceXdays!=null || fromGroups!=null) insertInformations(nzbindex_results, nzbindex_results.firstElementChild);
resize_nzbindex(GM_config.read().nzbindex_resize);
selectTheResult=THead.firstElementChild.children[1].firstElementChild.childNodes[1].textContent.search(/of 1 /)!=-1; //If true : one result only
if (GM_config.read().nzbindex_scrolltoresults)
top_div.scrollIntoView();
nzbindex_onlycollections();
if (GM_config.read().nzbindex_orderbuttons)
nzbindex_orderbuttons();
nzbindex_otherresultspages_correction();
//This part to prepare the 'clickRow' functionnality
if(BrowserDetect.browser!='Chrome'){
for(j=0;jtest';
if (sinceXdays != '' || fromGroups!='')
insertSelectedResultsLegend(mydiv1);
mydiv3=document.createElement('div');
mydiv3.setAttribute('style', 'float:left;margin:5px; text-align:left;height:auto');
//mydiv3.innerHTML='test';
insertBinnewzSelection(mydiv3);
before_div=document.createElement('div');
before_div.setAttribute('style', 'display:block;clear:both;');
top_div.appendChild(mydiv1);
top_div.appendChild(mydiv3);
after_div=document.createElement('div');
after_div.setAttribute('style', 'display:block;clear:both;');
parentNode.insertBefore(before_div, afterNode);
parentNode.insertBefore(top_div, afterNode);
parentNode.insertBefore(after_div, afterNode);
}
function insertSelectedResultsLegend(div){
tmpdiv=document.createElement('div');
tmpdiv.setAttribute('style', 'float:right;text-align:left;');
div.appendChild(tmpdiv);
div.firstElementChild.innerHTML=''+GM_trans.lang('caption_title') + ' : ';
tmpspan=document.createElement('span');
tmpspan.setAttribute('style', 'display:inline-block;width:30px; height:20px; margin-bottom:3px; background-color:'+GM_config.read().binnewz_selectedresultcolor+';');
tmpspan.innerHTML=' '
div.firstElementChild.appendChild(tmpspan);
div.firstElementChild.appendChild(document.createTextNode(' : '+GM_trans.lang('caption_selectedresult')));
div.firstElementChild.innerHTML+=' ';
tmpspan=document.createElement('span');
tmpspan.setAttribute('style', 'display:inline-block;width:30px; height:20px;background-color:'+GM_config.read().binnewz_toleranceresultcolor+';');
tmpspan.innerHTML=' '
div.firstElementChild.appendChild(tmpspan);
div.firstElementChild.appendChild(document.createTextNode(' : '+GM_trans.lang('caption_toleranceresult')));
}
function insertBinnewzSelection(div) {
var qInput=document.getElementsByName('q');
qInput=qInput[0].value;
div.innerHTML=''+GM_trans.lang('binnewz_searchinformations_title') + ' : ';
div.innerHTML+=GM_trans.lang('filename') + ' : ' + qInput + ' ';
div.innerHTML+=GM_trans.lang('age') + ' : ';
if (sinceXdays != '') div.innerHTML+='' + sinceXdays + ' ' + GM_trans.lang('days')+'';
div.innerHTML+=' ';
div.innerHTML+=GM_trans.lang('groups') + ' : ' + fromGroups.replace(/^\|/, '').replace(/\|$/, '').split('|').join(' '+GM_trans.lang('or').toUpperCase()+' ') + ' ';
}
//-------------------------------------------
//-------------------------------------------
//--------------NZBIndex-----------------
//-------------------------------------------
function nzbindex_configurationIntegration(){
var nzbindexMenu=document.getElementById('menu');
nzbindexMenu.firstElementChild.setAttribute('style', 'margin:10px;');
var mymenu=createConfigurationMenu();
mymenu.setAttribute('style', 'position:relative;left:-50px;font-size: 14px;');
nzbindexMenu.insertBefore(mymenu, nzbindexMenu.firstElementChild.nextElementSibling);
}
function nzbindex_make_othernzbindexer_button() {
var binsearchButton=createButton('Binsearch', binsearch_makeurl(document.getElementsByName('q')[0].value));
if (nzbindex_buttons.length>0){
//Adding Binsearch button
nzbindex_buttons[0].firstElementChild.appendChild(document.createTextNode(' '));
nzbindex_buttons[0].firstElementChild.appendChild(binsearchButton);
nzbindex_buttons[1].firstElementChild.appendChild(document.createTextNode(' '));
nzbindex_buttons[1].firstElementChild.appendChild(binsearchButton.cloneNode(0));
}else{
binsearchButton.setAttribute('style', 'color:red; padding:15px; font-size:17px; font-weight:bold;');
binsearchButton.value=GM_trans.lang('noresult_button') + ' - ' + binsearchButton.value;
nzbindex_results.getElementsByTagName('h2')[0].parentNode.replaceChild(binsearchButton, nzbindex_results.getElementsByTagName('h2')[0]);
}
}
function nzbindex_otherresultspages_correction() {
var TFoot_links=nzbindex_results.getElementsByTagName('tfoot')[0].getElementsByTagName('a');
for(i=0;i0)
if (test_sinceXdays(resultLine[4].innerHTML, parseInt(sinceXdays)-1)) tolerance_check=true; //test with -1 day (only if sinceXdays != 0day)
if (!tolerance_check && test_sinceXdays(resultLine[4].innerHTML, parseInt(sinceXdays)+1)) tolerance_check=true; //test with +1 day
if (tolerance_check==true) resultLine[4].setAttribute('bgcolor', GM_config.read().binnewz_toleranceresultcolor);
}
}
//Now checking if group corresponds, if so we highlight the groups Cell
if (typeof tmp_groups != 'undefined'){//check only if groups have been passed within the url (see 'tmp_groups' declaration at start of function)
var tmp_indic=false;
var tmp_compare=resultLine[3].getElementsByTagName('a');
for(j=0;j have been deleted
var resultsHidden=document.createElement('p');
resultsHidden.innerHTML="" + TRDeleted + GM_trans.lang('nzbindex_hiddenresults') + "";
THead.firstElementChild.children[1].appendChild(resultsHidden);
}
}
function nzbindex_makeurl(search, otherparams){
var host='www.nzbindex.com/search/';
var params='?results=250&sort=age_desc&q='+escape(search);
if (GM_config.read().nzbindex_onlycollections) params+='&showcol=1';
params+='&sinceXdays=' + sinceXdays + '&fromGroups=' + fromGroups;
if(pingpong!='') {
params+='&pong='+pingpong;
// alert(params);
}
if(typeof otherparams!='undefined') params=params+otherparams
return 'http://'+host+params
}
function nzbindex_add_buttons() {
//Unselect Button
var selectButton=document.createElement('input');
selectButton.name='cancelButton';
selectButton.type='button';
selectButton.value="Unselect All";
if(BrowserDetect.browser!='Chrome') selectButton.setAttribute('onclick','clickTheseRows(document.getElementById("results"), 0);')
var buttonsCol = document.evaluate( '//input[@value="Select all"]' ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
//insert top line button
insertAfter(selectButton, buttonsCol.snapshotItem(0));
insertAfter(document.createTextNode(' '), buttonsCol.snapshotItem(0));
//insert bottom line button
insertAfter(selectButton.cloneNode(0), buttonsCol.snapshotItem(1));
insertAfter(document.createTextNode(' '), buttonsCol.snapshotItem(1));
}
function nzbindex_fixedHeader() {
//NZBIndex nécessite l'injection d'une fonction pour devenir fixed au scroll
var scriptCode = new Array(); // this is where we are going to build our new script
// here's the build of the new script, one line at a time
scriptCode.push('var fixmeTop = $("#searchform").offset().top;');
scriptCode.push('$(window).scroll(function() {');
scriptCode.push('var currentScroll = $(window).scrollTop();');
scriptCode.push('if (currentScroll >= fixmeTop) {$("#searchform").css({ position: "fixed", top: "10px",left: "50%", marginLeft: "-380px"});');
scriptCode.push(' } else {$("#searchform").css({ position: "static", marginLeft: "0px"});}});');
// now, we put the script in a new script element in the DOM
var scriptNZBIndexFixedHeader = document.createElement('script'); // create the script element
scriptNZBIndexFixedHeader.innerHTML = scriptCode.join('\n'); // add the script code to it
scriptCode.length = 0; // recover the memory we used to build the script
document.getElementsByTagName('head')[0].appendChild(scriptNZBIndexFixedHeader);
}
//-------------------------------------------
//-------------------------------------------
//-----------BINSEARCH-----------------
//-------------------------------------------
function binsearch_configurationIntegration() {
var binsearchMenu=document.getElementsByTagName('h1')[0].parentNode.nextElementSibling;
var mymenu=createConfigurationMenu();
mymenu.setAttribute('style', 'margin-top:10px;font-size: 14px;');
binsearchMenu.appendChild(mymenu);
}
//-----------MAKE NZB BUTTONS------
function binsearch_process_results() {
//Original source from this script : binsearch.info download button http://userscripts.org/scripts/show/72182
//Modified by les-newsgroup.fr
if (fromGroups!=''){ //We do this only one time to save some millisec
fromGroups=fromGroups.replace(/\./g,'');
var tmp_groups=fromGroups.split('|');
}
var rows = tabresults.getElementsByTagName('tr');
for (var i = 1; i < rows.length; i++) {
if(rows[i].getAttribute('done')=="1") continue;
var cells = rows[i].getElementsByTagName('td');
var checkboxCell = cells[1];
var subjectCell = cells[2];
var protect=false;
if (GM_config.read().binsearch_delete_oldcontentline) {//OPTION : Delete the 'old results' yellow line
if (rows[i].getAttribute('bgcolor')=='#ffffbb') {
rows[i].parentNode.removeChild(rows[i]);
i--;
continue;
}
}
var inputs = checkboxCell.getElementsByTagName('input');
if (inputs.length <= 0)
continue;
//Prepare this row for the easy-select functionnalities
rowClickable(rows[i]);
var protect=false;
var tdspans=subjectCell.getElementsByTagName('span');
if (tdspans.length>1) {
var fonttag=tdspans[1].getElementsByTagName('font');
if (fonttag.length>0) {
//Password for the result ?
if (fonttag[0].innerHTML.indexOf('password')!=-1) { //Yes : password
setProtectedRow(rows[i]); //change the way this row is displayed
if (GM_config.read().binsearch_nocheckboxifpassword) //delete the checkbox ?
if (checkboxCell.getElementsByTagName('input')[0].type=='checkbox')
checkboxCell.removeChild(checkboxCell.getElementsByTagName('input')[0]);
if (GM_config.read().binsearch_nonzbbuttonifpassword) //OPTION : Block the NZB button creation if passworded
protect=true;
// continue; //Go to the next result : do not create NZB button and do not do anything else for this result
}
//OPTION : Displays details of missing parts
if (GM_config.read().binsearch_missingpartsdetails)
if (fonttag[0].innerHTML.indexOf('/')!=-1) {
var tmp=fonttag[0].innerHTML.split('/');
if (parseInt(tmp[1] - tmp[0]) > 0)
fonttag[0].innerHTML=fonttag[0].innerHTML + ' [' + GM_trans.lang('binsearch_missingpartsdetails') + ' ' + parseInt(tmp[1] - tmp[0]) + ']';
else{ //if theres is more parts available than it should be, we remove the 'parts available' red color
//fonttag[0].innerHTML='';
//fonttag[0].parentNode.innerHTML=fonttag[0].parentNode.innerHTML.replace(', parts available:', '');
fonttag[0].color='green';
}
}
}
}
//OPTION : Highlight the age if it is the same age than the binnewz' selection
if (sinceXdays != ''){
resultAge=cells[5].innerHTML;
if(i==rows.length-1) {//alors on doit faire une manip' sur l dernière cellule car binsearch y à intégrer un commentaire HTML
resultAge=resultAge.slice(0, resultAge.indexOf(' |