Better Usenet

Correction bug binnews, bug debug, utilisation API 2.4 Beta series

  1. /*
  2. Better Usenet (c) les-newsgroup 2017
  3.  
  4. Find more about Newsgroups here : http://www.les-newsgroup.fr
  5.  
  6. Find support for 'Better Usenet' on our forum : http://forum.les-newsgroup.fr
  7.  
  8.  
  9. ********* LICENSE*********
  10.  
  11. This program is free software: you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation, either version 3 of the License, or
  14. (at your option) any later version.
  15.  
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with this program. If not, see <http://www.gnu.org/licenses/>.
  23.  
  24.  
  25. ********* METADATA *********
  26. // ==UserScript==
  27. // @name Better Usenet
  28. // @namespace www.les-newsgroup.fr
  29. // @description Correction bug binnews, bug debug, utilisation API 2.4 Beta series
  30. // @match *://*.binsearch.info/*
  31. // @match *://*.binnews.in/index.php*
  32. // @match *://*.binnews.in/_bin/liste.php*
  33. // @match *://*.binnews.in/_bin/lastrefs.php*
  34. // @match *://*.binnews.in/_bin/search.php*
  35. // @match *://*.binnews.in/_bin/search2.php*
  36. // @match *://*.binnews.biz/index.php*
  37. // @match *://*.binnews.biz/_bin/liste.php*
  38. // @match *://*.binnews.biz/_bin/lastrefs.php*
  39. // @match *://*.binnews.biz/_bin/search.php*
  40. // @match *://*.binnews.biz/_bin/search2.php*
  41. // @match *://*.nzbindex.com/index.php*
  42. // @match *://*.nzbindex.com/search/*
  43. // @exclude http*://*.binsearch.info/iframe.php
  44. // @exclude http*://*.binsearch.info/similar.php*
  45. // @exclude http*://*.binnews.in/_bin/entete.php*
  46. // @exclude http*://*.binnews.biz/_bin/entete.php*
  47. // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
  48. // @grant GM_setValue
  49. // @grant GM.setValue
  50. // @grant GM_getValue
  51. // @grant GM.getValue
  52. // @grant GM_xmlHttpRequest
  53. // @grant GM.xmlHttpRequest
  54. // @version 1.941
  55. // ==/UserScript==
  56. */
  57.  
  58. /* script 'Version Control' parameters */
  59. var thisId=95746; // your script userscript id
  60. var thisVersion="1.941"; // the @version metadata value
  61. var thisReleaseDate="20171122"; // release date of your script. Not mandatory, use this paramater
  62. // only if you want to be sharp on version control frequency.
  63. var thisScriptFolderURL="http://www.les-newsgroup.fr/better-usenet/scripts/";
  64. var thisScriptURL=thisScriptFolderURL+thisId+".user.js"; //L'url officielle du script
  65. var thisScriptReleaseNotes="http://forum.les-newsgroup.fr/Msg-Historique-des-versions-de-Better-Usenet";
  66. /* script 'Version Control' parameters */
  67.  
  68. /*
  69. *********CHANGELOG*********
  70. //V1.940
  71. //Adaptation FF57 / Greasemonkey4 - Remplacement occurences GM_log par console.log
  72. //Adaptation FF57 / Greasemonkey4 - Remplacement occurences GM_xmlhttpRequest par GM.xmlHttpRequest
  73. //Adaptation FF57 / Greasemonkey4 - Ajout fonction addGlobalStyle(css) et remplacement GM_Addstyle par addGlobalStyle
  74. //Adaptation FF57 / Greasemonkey4 - Suppression GM_registerMenuCommand et fonction relative makeMenuToggle
  75. //Adaptation FF57 / Greasemonkey4 - Remplacement occurences GM_getValue en GM.getValue et GM_setValue en GM.setValue
  76. //Modification - Suppression NZBClub (site HS)
  77. //Modification - Suppression YabSearch (site HS)
  78. //V1.939
  79. //Correction - Binnewz - bug concernant l'affichage des liens NZB sur une page de résultats de recherches
  80. //Correction - Général - Remplacement de GM_log par console.log pour le Debug
  81. // Modification - Betaseries - Utilisation de l'API 2.4 (des corrections de bugs sont à prévoir prochainement dans la récupération des notations BS)
  82. //V1.938
  83. //Correction - Binnewz - l'age de chaque post, intégré aux liens vers les sites nzb, était toujours à 0, merci Nico07 pour le rapport et la correction !
  84. //Correction - Binsearch - la sélection automatique de la ligne de résulat lorsqu'il n'y avait qu'un seul résultat ne fonctionnait pas tout le temps à cause d'un bug avec Binsearch. Le problème est contourné.
  85. //Lien Allocine : modif url duckduckgo (site:allocine.fr => site:allocine.fr/film)
  86. //Cook2: Yubse retiré (site non fonctionnel)
  87. //V1.937
  88. //Cook2: Ajout de DuckDuckGo en dernière tentative pour trouver le film (99% sont trouvés via omdbapi.com en première intension ou imdb.com, seulement 1% échouent et finissent via DuckDuckGo)
  89. ///V1.936
  90. //Cook2: Réécriture complète le la partie récupérant la note IMDb pour ne plus utiliser l'api Google obsolete depuis mai 2016.
  91. //V1.935
  92. //Cook2: Ajout d'un bouton pour ouvrir la page Allociné (Utilise DuckDuckGo)
  93. //V1.934
  94. //Correction - Général - Mise à jour de la fonctionnalité de vérification de mise à jour de Better Usenet
  95. //Ajout - Binnewz - Ajout d'une option pour cacher les résultats signalés comme virus ou avec mot de passe (activée par défaut)
  96. //Ajout - Binnewz - Prise en charge du site mirroir binnewz.biz (comportement identique que pour binnewz.in)
  97. //Correction - Binnewz - Si l'option 'Rendre fixe l'entête des sites gérés' était désactivé, la barre de configuration de Better Usenet sur Binnewz devenait flottante, c'est corrigé. Merci à Benja69 (http://forum.les-newsgroup.fr/Msg-Better-Usenet-Script-Firefox-Chrome-pour-Binnewz?pid=692#pid692)
  98. //Correction - Binnewz - La barre de configuration de Better Usenet chevauchait un bouton "OK" de Binnewz. C'estcorrigé + quelques modifs cosmétiques
  99. //Correction - Binsearch - Le texte recherché est désormais correctement copié dans la barre de recherche flottante
  100. //V1.933
  101. //Correction - Général - Ajout du code du script GM_config directement dans Better Usenet (les crédits pour ce script vont aux même que pour le script officiel GM_config http://userscripts.org:8080/scripts/source/49700.user.js)
  102. //V1.932
  103. //Correction - Général - Application d'une modification pour que Userscript.org soit à nouveau accessible (merci Clipper http://forum.les-newsgroup.fr/showthread.php?tid=13&pid=555#pid555)
  104. //V1.931
  105. //Correction - Binnews - COrrections de Better usenet afin de s'adapter aux modifications récentes de Binnews
  106. //V1.93
  107. //Ajout - Binnews - L'icone de récupération de la note d'une série ou d'un film s'affiche désormais sur les pages de recherches et celle des derniers référencements
  108. //Ajout - Binnewz/NZBClub - Option pour que la partie supérieure de binnewz et nzbclub soit toujours affichée à l'écran (activé par défaut)
  109. //Ajout - NZBClub - Icone 'Get NZB' ajouté dans la première colonne de gauche (beaucoup plus pratique comme ça)
  110. //Modification - Binnews - Correction d'un bug visuel quand un résultat est isolé (en rouge clair) si il indique un password présent
  111. //Modification - Better Usenet - quelques petites modifs cosmétiques et amélioration du code
  112. //Modification - Better Usenet - les liens affichés dans le menu 'Better Usenet' ont changé (ajout du lien vers le site officiel)
  113. //Modification - Binnewz - NZBClub, Yubse et NZBFriends gèrent mal les requetes de recherche dans lesquelles il y a '.part.nzb'. Désormais cette chaine de caractère est retirée lors de la gnération du lien sur Binnewz
  114. //Modification - Binnewz - Dans le menu de configuration, les boutons 'save' et 'close' sont désormais toujour visibles, c'est plus pratique ainsi
  115. //Modification - Binnewz/Binsearch/NZBIndex/NZBClub - Nouvelle option pour rendre fixe la barre de recherche (avec parfois le header complet) - Activé par défaut
  116. //Modification - Binnewz - Correction visuelles du menu général de Binnewz (plus de barre blanche bizarre)
  117. //Correction - NZBClub - Toutes les lignes de résultats n'étaient pas traitées ... c'est ok désormais !
  118. //Correction - NZBClub - La coloration de la date ne se comportait pas comme attendu, c'est réglé
  119. //V1.921
  120. //Correction -- Bug avec le script qui permet de connaître quel navigateur est utilisé
  121. //Correction - NZBClub -- Bug d'affichage de la barre 'Better Usenet'
  122. //V1.92
  123. //Modification -- Utilisation de la ressource 'GM_Config' via @require pour disposer de la dernière version tout le temps
  124. //Modification -- Utilisation de @grant dans les METADATA sur les conseils de la doc Greasemonkey
  125. //Modification - Binnewz -- Modification de la méthode d'affichage du bloc de liens vers les sites NZB : il n'y a desormais plus de perturbations visuelles en passant de ligne en ligne
  126. //Modification - Binnewz -- Plus de récupération auto des notes.
  127. //Modification - Binnewz -- Ajout d'un bouton 'Info' avec chaque bloc de liens NZB pour les films/animes/documentaires/séries. Cet icône déclenche la récupération manuelle de la note
  128. //Modification - Binnewz -- Affichage d'un message sous le titre de l'éléménet si aucune notation n'a pu être trouvée (sûrement un problème de titre comportant des infos superflues)
  129. //Modification - Binnewz -- Modification dans l'algo de recherche de notation de films/animes/docus
  130. //Modification - Binnewz -- Remplacement de toutes les occurences de imdpapi.com par omdpapi.com
  131. //Modification - Binnewz -- Suppression de la fonction 'addNextPageLinks' (suite à modification de la fonctionnalité 'page suivante/précédente' sur Binnewz)
  132. //Modification - Binnewz -- Correction de bugs dans la récupération de la notation des séries
  133. //Modification - Mysterbin -- Suppression de toute occurence de MysterBin car le site MysterBin a fermé
  134. //Modification - Configuration -- NZBClub est séléctionné par défaut pour s'afficher sur Binnewz (aussi la mention '(pas conseillé)' à été retiré)
  135. //Modification - NZBClub -- NZBClub est désormais modifié par Better Usenet comme Binsearch et NZBIndex
  136. //Modification - Général -- Suppression de certaines options liées à des modifications de Binnewz, NZBIndex, Binsearch : ces modifications sont faites désormais par défaut
  137. //Correction - Binsearch -- la dernière case du tableau de résultat était colorée même si l'age ne correspondait pas avec les infos provenant de Binnewz
  138. //Suppression - Binnewz -- Yabsearch a été retiré (ne supporte plus les recherches externes)
  139. //Modification - Binnewz -- Yubse est désormais affiché par défaut en lien NZB sur Binnewz
  140. //Ajout - Binnewz -- Ajout de NZBFriends en lien NZB dans Binnews (désactivé par défaut car pas le plus efficace des indexeurs)
  141. //V1.908
  142. //CHROME-FIREFOX -- Correction - Binnewz : Résolution d'un problème d'affichage des liens NZB sur la page des derniers référencements
  143. //CHROME-FIREFOX -- Correction - Binnewz : Résolution du problème de récupération de l'âge d'un référencement (pour le passer au site NZB afin de surligner la bonne ligne de résultat)
  144. //CHROME-FIREFOX -- Correction - Binnewz : Amélioration de la partie 'Suppression publicité' sur Binnewz (fonctionne correctement sur Chrome aussi) [la publicité sur binnewz est très intrusive depuis peu !]
  145. //CHROME-FIREFOX -- Ajout - Binnewz : Ajout d'une nouvelle option (active par défaut) afin de créer près des liens NZB un lien pour remercier le posteur du référencement
  146. //CHROME -- Correction - Binnewz : Bug sur la partie 'Recherche' et 'Derniers réf'
  147. //CHROME -- Correction - Notation : Bug qui bloquait la récupération de la note d'un film ou d'une série
  148. //CHROME -- Modification - General : Pas de vérification de mise à jour du script si le navigateur est Chrome
  149. //V1.903
  150. //Correction - Binnewz : correction suite à un changement sur le site binnewz
  151. //Modification - General : Ajout d'un lien 'Changelog' à la barre d'options 'Better Usenet'
  152. //V1.901
  153. //Modification - Binnewz : Application d'une hauteur minimale aux lignes des résultats sur Binnewz pour un meilleur confort visuel au passage de la souris
  154. //Modification - Compatibilité : Modification du code pour une prise en charge de Better Usenet dans Chrome
  155. //Problème de compatibilité Chrome : La fonction de sélection utilisée sur Firefox pour sélectionner/désélectionner/inverser les résultats ne fonctionne pas sous Chrome.
  156. //Modification - Options : j'ai retiré l'option de sélection des résultats par simple clic sur une ligne. Elle est intégrée par défaut pour tous les sites gérés
  157. //Modification - Général : Suppression du message d'avertissement au premier lancement du script
  158. //Modification - Général : modification des fonctions permettant de redimensionner les tableau de résultats des sites gérés
  159. //Correction - MysterBin : Correction d'un bug qui bloquait la sélection en un clic des résultats de recherche de MysterBin
  160. //V1.856
  161. //Correction - Binnewz : Erreur qui plantait le script sur Binnewz
  162. //V1.855
  163. //Correction - Binnewz : L'age d'un post inférieur à 2 jours n'était pas recupéré correctement
  164. //Correction - Binnewz : Les icones vers les moteurs NZB n'étaient pas placés correctement sur la page des derniers référencement
  165. //Correction - Binnewz : Les urls vers Binsearch ont été nettoyé (paramètres en doublon)
  166. //Modification - general : regroupement des options 'force ssl' en une unique option (activée par défaut) dans la catégories 'Options générales'
  167. //Modification - general : regroupement des options 'delete add' en une unique option (activée par défaut) dans la catégories 'Options générales'
  168. //V1.851
  169. //Modification - Binnewz : Corrected several bugs with the new pages of Binnewz.in
  170. //V1.850
  171. //Correction - Binnewz : correction d'un bug apparu il y a quelques jours (la faute à 'imdbapi.com' qui a modifié son tableau JSON)
  172. //V1.846
  173. //Correction - Binnewz : corrected a bug when theres no ad displayed
  174. //V1.845
  175. //Correction - Binnewz : Correctly delete ad
  176. //Modification - NZBIndex : Change URL of NZBIndex (now nzbindex.com)
  177. //Modification - NZBIndex : Better Usenet now works with HTTPS version of NZBIndex, with or without subdomain, .nl or .com
  178. //New Option - Binnewz : You can now search NZB files through Allociné
  179. //V1.842
  180. //Correction - Binnewz : Bug with the nzb links added on binnewz
  181. //V1.841
  182. //Correction - Binnewz : Bug with the nzb links added on binnewz (for new users only)
  183. //V1.84
  184. //Modification - Binnewz : Changed the default place of NZB links: now it will be on the title column
  185. //Modification - General : Now the auto update delay in days is 1 day. Up to you to change it but upgrades are fast and useful
  186. //Modification - Binnewz : Little cosmetic changes with the display of second line for ratings (added margin-top & margin-left)
  187. //Correction - Binnewz : Bug with the display of /5 or /10 with text ratings
  188. //Correction - Binnewz : Bug with the auto update feature of Better Usenet in Binnewz
  189. //Correction - Binnewz : Bug with NZB links on the last ref page
  190. //V1.83
  191. //New Option - Binnewz (Asked by community) : Now you can select where to display the NZB links : in the title column, in the file column or in the size column
  192. //New Option - Binnewz (Asked by user solventAbuse) : Now, in Binnewz, for password protected or virus result, you can set if you want Better Usenet to display NZB Links or ratings
  193. //Modification - Binnewz (Asked by user clainlaurent) : Now you can use Autopager plugin with Better Usenet & Binnewz
  194. //Modification - Binnewz : Modified the way binnewz results were processed (originally from Guile93)
  195. //Modification - Binnewz : Now when there is '*' in the filename, it will not automatically be replaced. Because Binsearch can't use it, NZBIndex neither but it accepts space instead of *, and Mysterbin accepts it
  196. //Modification - Binnewz : Added a verification for virus result (like for password protected results) : both are processed the same way
  197. //V1.81
  198. //Correction - Binnewz : There was a bug with the display of NZB Links in search page
  199. //V1.8
  200. //New Option - Debug : Created a Debug section in the config menu.
  201. //New Option - Debug : Added an option to display of debug messages (see debug() calls in source code, you can add your own)
  202. //New Option - Debug : Added an option to show the execution time (in ms) of the script. It will be displayed at the right of the Better Usenet menu
  203. //New Option - Binnewz / Binsearch / NZBIndex / MysterBin : If a result is password protected, the background of the row will be modified
  204. //New Option - Binnewz - By Djeu : You can now select how to display ratings (text mode, graphical mode or both)
  205. //New Option - Binnewz - By Djeu : This is a cosmetic option that lets you add '/10' or '/5' on the note (textmode)
  206. //New Option - MysterBin : MysterBin offers a functionnality which can merge elements in group (not collection) and offers you to see the details of this group, and then you can download the NZB. With this new option, the script creates the group NZB link on the results page
  207. //New Option - MysterBin : MysterBin can assemble elements together like collections. This new option let you select all the rows of these with only one click.
  208. //Modification - Binnewz : Now the NZB links will be displayed inside the next cell ... for cosmetic purpose (ask for an option if you dont like it)
  209. //Modification - Binnewz : Now you can hover a result row anywhere to display the nzb links (still at the same place)
  210. //Modification - Binnewz : Now the links will be hidden if your move your mouse's cursor out of the result's row.
  211. //Modification - Binnewz - By Djeu : Added a new function to format votes with thousand separator ... For cosmetic purpose
  212. //Modification - Binnewz - By Djeu : Others little modifications in source code
  213. //Modification - MysterBin : Changed the way that password protected elements are detected. Now each result containig 'password' in its details (not in the title) will be considered as a password protected element
  214. //Modification : Now the Binnewz informations' block and the highlighting caption inserted on top of Binsearch, NZBIndex and Mysterbin will only be displayed if the appropriate binnewz's option is checked
  215. //Modification : Plus, now the highlighting caption inserted on top of these sites will only be displayed if there is a param 'sinceXdays' or 'fromGroups' in the url and that is not empty
  216. //Correction - MysterBin : Now you can select each row one by one when there is multiples rows for one result (like in collections)
  217. //Correction - MysterBin : a row was selected if the NZB image link was clicked. Row is no more selected from now.
  218. //Correction - MysterBin : bug with the query input
  219. //Correction - Ratings : Bug if using the Cook2 method to display ratings, and if ratings are displayed with 10 stars
  220. //Correction - Binsearch / NZBIndex : Bug if number of results ending with 1 (11, 101, ...)
  221. //Correction - Ratings : Problem with the link on ratings to imdb
  222. //V1.7
  223. //Now if the option 'display votes' in the rating section is unchecked, number of votes will still be displayed when hoovering the note
  224. //Corrected a bug in Binnewz : the MysterBin's link is now displayed correctly when the associated option is checked
  225. //Corrected a bug in Binnewz with the 'deleteAd' function
  226. //V1.69
  227. //Added compatibility with Firefox 4.*
  228. //Added an option to delete the ad on Binnewz (default : false)
  229. //Corrected a bug when the script autocheck the row if only one result (Binsearch, NZBIndex & MysterBin)
  230. //Corrected a bug with the Cook2 feature
  231. //Corrected several bugs with Binsearch when using Firefox 4.* (binsearch source code is different with FF 3.* & FF 4.*, or sometimes FF4.* may hang while theres no problem with FF3.*)
  232. //Corrected a potential bug if 'binsearch_nzbbuttons' options was deactivated
  233. //Corrected a bug with Binnewz when loading the index page
  234. //Changed name of 'proceed_nzbindex_results', 'proceed_mysterbin_results' & 'make_nzb_buttons' functions
  235. //V1.65
  236. //Added an option for the BetaSeries Ratings : Now you can choose if you want to fetch infos for the serie or for the episode - Default: Serie
  237. //Added a one-time-displayed message box to warn user that other activated user scripts can interfere with Better Usenet
  238. //Added an option for MysterBin : Delete the checkbox if result is password protected - Default: True
  239. //Added an option for MysterBin : Delete the NZB image link if result is password protected - Default: True
  240. //Added other indexer buttons on MysterBin if no results
  241. //Added an option for Ratings : its a new way to calculate note depending of the number of votes. By Cook2 - Default: False
  242. //Corrected a bug in Binnewz when the main frame is loaded alone (without top frame)
  243. //Corrected a bug in Binnews (series' category) with the display of the title box of BetaSeries' ratings
  244. //Corrected a bug in NZBIndex modification when there is no result
  245. //V1.6
  246. //Added the GNU GPL License
  247. //Added a new option to Binsearch, NZBIndex, & Mysterbin to select results by clicking a row (source code Johannes la Poutre : http://userscripts.org/scripts/review/3441)
  248. //Changes functions called by buttons like 'Inverse', 'Select All' & 'Deselect All' so that they keep the new selection behavior (adapted a piece of code of Johannes la Poutre)
  249. //Modified the hightlighting caption
  250. //Added a new NZB search engine : MysterBin
  251. // Comes with options you already know : delete_ad, scrolltoresults, force_ssl, resize_tabresults, integrateConfigurationMenu
  252. //Added an 'Unselect All' button to NZBIndex buttons
  253. //Cloned script-added inputs (Unselect All, Search on ..., View only collections) and added them on bottom of NZBIndex
  254. //Added an option for MysterBin to add other NZB Indexers buttons (NZBIndex & Binsearch)
  255. //Added MysterBin to other NZB Indexers buttons (for Binsearch & NZBIndex)
  256. //V1.6 End
  257. //15-03-11 : Added ratings of series' episodes on Binnews (using Betaseries.com API)
  258. //15-03-11 : Modified the configuration menu : You can activate the rating's fetching of IMDB & Betaseries separately. But they share the same options
  259. //12-03-11 : Corrected a bug when updating the script to a new version with the 'Update' link on Binnewz (the script was loaded in the bottom frame instead of being installed) : added the '_parent' target to the link
  260. //12-03-11 : Corrected a cosmetic bug in the InsertBinnewzSelection() function
  261. //10-03-11 : Added reduced base64 img by Cook2
  262. //10-03-11 : Corrected a bug with NZBindex and urls of others pages results
  263. //07-03-11 : Changed the 'support forum' link in the 'Better Usenet' menubar
  264. //07-03-11 : Added an option to NZBIndex to autoload the same search on Binsearch if no result
  265. //07-03-11 : Changed the stars color of the IMDB rating. The more higher is the rating, the more red is the star. (works for 5 or 10 stars rating)
  266. //07-03-11 : Some bug correction and I have moved the NZBIndex link (displayed in binnewz results, if checked) at first place.
  267. //07-03-11 : with the help of Cook2 : done some cosmetic changes to IMDB rating feature
  268. //07-03-11 : thanks to a proposition of Cook2 : added an option to display the IMDB rating with 5 or 10 stars (default : 5 stars)
  269. //03-03-11 : Added an option to Binsearch to show only collections (you need the advanced search to be checked - this feature is not 100% complete for now)
  270. //03-03-11 : Added an option to Binsearch to autoload NZBIndex search page if theres is no result and if there is no results with 'autoload other groups' feature (you need the 'autoload other groups' option to be checked)
  271. //03-03-11 : Added an option for NZBIndex to increase the font size used for "Download" and "View collection" links (nzbindex default : 10 ; script default : 13)
  272. //03-03-11 : Now if theres only one result on Binsearch or NZBIndex, checkbox is auto checked ... you just have to push the 'Create NZB' button
  273. //03-03-11 : Now no modifications on Binsearch on other pages that normal results pages
  274. //03-03-11 : Added the configuration menu to Binnewz website interface (on top right of the results)
  275. //03-03-11 : Removed the configuration link within the Greasemonkey native menu ... now Better Usenet configuration links can only be accessed directly from Binnewz, Binsearch and NZBIndex
  276. //03-03-11 : Added a new option to fetch IMDB ratings & votes and display it on every results in Binnewz from these categories : Movies, VO Movies, Animes, Documentaries. (Only on categorie results, not on search results)
  277. //25-02-11 : Added an option for NZBIndex to add icons near the Size and Age colums to order the results (asc or desc)
  278. //25-02-11 : Added an option for NZBIndex to display details about your search (filename, age and groups (if from binnewz)
  279. //25-02-11 : Added a caption about highlighting colors of results
  280. //25-02-11 : Added the missing 'resize' function to NZBIndex table results
  281. //25-02-11 : Corrected a bug with the highlighting function of NZBindex results
  282. //25-02-11 : Now links to others pages results at bottom of NZBINdex results page will be correct (url parameters added by the script were removed before that correction
  283. //17-02-11 : Added a new option for Binnewz that let you accept a +- 1 day tolerance when determining if a result's age on Binsearch or NZBIndex is matching the Binnews' selection age
  284. //17-02-11 : Added a new color option that applies to age cells highlighting when tolerance occurs.
  285. //17-02-11 : Resolved a problem with NZBIndex age cell highlighting (regexp)
  286. //16-02-11 : Corrected a few bugs
  287. //16-02-11 : Added a modification to NZBIndex to show the number of results hidden (if 'show only collections' is checked)
  288. //15-02-11 : Added an option for NZBIndex to show collections of file only (you can also do this manually with a checkbox)
  289. //15-02-11 : Corrected a few bugs
  290. //14-02-11 : Added a test to correctly highlight an age's cell if it contains minutes and sinceXdays=0
  291. //14-02-11 : Corrected a lot of bugs in the results hightlighting of binsearch & nzbindex (you'd better update !)
  292. //11-02-11 : Bug correction when looking up for groups' of your selection in binnewz
  293. //11-02-11 : Added the script version with the Better Usenet links
  294. //11-02-11 : Added an option for Binsearch and NZBIndex to delete the yellow line inserted when there is old results (default : true)
  295. //11-02-11 : Added a noresult button on NZBIndex if no result found
  296. //11-02-11 : Modified some buttons' text
  297. //11-02-11 : General : Added a _blank target to links in the updater window
  298. //11-02-11 : General : Correted some misfunctions with the updater and other functions
  299. //10-02-11 : Added a feature to NZBIndex to highlight age and/or group columns if they match with the binnewz selection
  300. //10-02-11 : Added an option for NZBIndex to delete the download link if the result is 'password protected'
  301. //10-02-11 : Added an option for NZBIndex to delete the checkbox selection if the result is 'password protected'
  302. //10-02-11 : Added an option for NZBIndex to scroll to the results after loading the page (default : true)
  303. //10-02-11 : Added an option for NZBIndex to resize the results table(default : true)
  304. //10-02-11 : Added an option for NZBIndex to delete the ad banner (default : false)
  305. //09-02-11 : General : Add a new website : nzbindex.nl
  306. //09-02-11 : Added 'Better Usenet' menu on top of nzbindex
  307. //09-02-11 : Added an option for NZBIndex to make the same search on Binsearch (default : true)
  308. //09-02-11 : Bug - Binnewz : Corrected a bug in the search page
  309. //09-02-11 : Added an option for Binsearch to delete the ad banner of page's results (default : false)
  310. //09-02-11 : Added an option to manage the updater delay between automatic check of new update (in days - default : 3)
  311. //09-02-11 : Added an option to manage the updater window autoclose timer (in seconds - default : 0 => no autoclose)
  312. //09-02-11 : Updater : Changed the timer feature. Now the window update will not autoclose after X seconds
  313. //09-02-11 : Updater : Correted a bug
  314. //09-02-11 : Updater : Modified the display of the window
  315. //09-02-11 : Bug correction : Alert if no updates has been removed if automatic checking
  316. //08-02-11 : Bug - Binsearch : A html page was loading after the normal one (a 'now loading' only html page). Now script escapes this page
  317. //08-02-11 : Added a link to the configuration menu on top of Binsearch interface (section nammed 'Better Usenet')
  318. //08-02-11 : Added a link to check for newupdate of 'Better Usenet' and changed the days frequency for the auto update feature (+1 day = 3days now)
  319. //08-02-11 : Removed a feature that was here only for test purpose
  320. //07-02-11 : Added an option for Binsearch & Binnewz that highlight group and age cells on Binsearch if they match with the group/age on Binnewz (need to use the nzb links dynamically create on Binnewz)
  321. //07-02-11 : Changed the 'MAKE NZB LINKS' parts credits
  322. //07-02-11 : Bug - Binsearch : Binsearch displays parts available in red sometimes when theres more parts available than needed. Now it is green.
  323. //05-02-11 : Added an option for Binsearch that scroll to the search results on loading (default : true)
  324. //04-02-11 : Modified the config CSS
  325. //04-02-11 : Added an option for Binsearch that deletes a checkbox selection if there is a password (default : true)
  326. //04-02-11 : Added an option for Binsearch that changes the color of NZB buttons create on every result (default : #EAD7D7)
  327. //04-02-11 : Added an option for Binsearch that displays the number of missing parts (default : true)
  328. //04-02-11 : If a new update is available, now you can close the alert window without having to wait till the countdown finishes or having to click a link within the window
  329. //04-02-11 : Binsearch : If there is no result, remove all buttons and only create 'Search on other/popular groups' and 'Search on other NZBIndexer site'
  330. //04-02-11 : Added a 'Force SSL encryption with Binsearch' [default : true]
  331. // If selected, Binsearch links on Binnewz will be 'https://' and every Binsearch page loaded with http:// will be automatically reloaded with 'https://'
  332. //03-02-11 : Added GM_toolkit
  333. //03-02-11 : Added localization support (fr, en - with a select option) [default : english]
  334. //03-02-11 : Added Script Version Control 0.5 http://userscripts.org/scripts/show/35611
  335. // Now, Every 2 days, the script will verify itself if theres a newer version. If so, youll be able to see the new version, see its source code or install it.
  336. //03-02-11 : Removed GM_config_extender (so removed fadeIn & FadeOut effect on configuration opening/closing)
  337. */
  338.  
  339.  
  340.  
  341.  
  342. /* Instructions ---------------------------------------------------------------------------------------------------
  343.  
  344. GM_config is cross-browser compatible.
  345.  
  346. To use it in a Greasemonkey/Tampermonkey/Violentmonkey script, you can just @require it.
  347.  
  348. If you can't @require it, you will need to manually include the code at the beginning of your user script.
  349.  
  350. In non-Greasemonkey, stored settings will only be accessible on the same domain in which they were saved.
  351.  
  352. ---------------------------------------------------------------------------------------------------------------- */
  353.  
  354.  
  355.  
  356. /* CHANGELOG --------------------------------------------------------------------------
  357.  
  358. 1.2.57
  359. - Fixed TypeError with the "options" setting of a "select" field
  360. The "options" setting needs to be a JSON object, not an array
  361.  
  362. 1.2.56
  363. - started keeping changelog in source
  364. - added type "password"
  365. - fixed error when user doesn't define any sections
  366.  
  367. ------------------------------------------------------------------------------------- */
  368.  
  369.  
  370.  
  371. var GM_config = {
  372. storage: 'GM_config',
  373. init: function() {
  374. // loop through GM_config.init() arguments
  375. for(var i=0,l=arguments.length,arg; i<l; ++i) {
  376. arg=arguments[i];
  377. switch(typeof arg) {
  378. case 'object': for(var j in arg) { // could be a callback functions or settings object
  379. switch(j) {
  380. case "open": GM_config.onOpen=arg[j]; delete arg[j]; break; // called when frame is gone
  381. case "close": GM_config.onClose=arg[j]; delete arg[j]; break; // called when settings have been saved
  382. case "save": GM_config.onSave=arg[j]; delete arg[j]; break; // store the settings objects
  383. default: var settings = arg;
  384. }
  385. } break;
  386. case 'function': GM_config.onOpen = arg; break; // passing a bare function is set to open
  387. // could be custom CSS or the title string
  388. case 'string': if(arg.indexOf('{') !== -1 && arg.indexOf('}') !== -1) var css = arg;
  389. else GM_config.title = arg;
  390. break;
  391. }
  392. }
  393. if(!GM_config.title) GM_config.title = 'Settings - Anonymous Script'; // if title wasn't passed through init()
  394.  
  395. // give the script a unique saving ID for non-firefox browsers
  396. GM_config.storage = GM_config.title.replace(/\W+/g, "").toLowerCase();
  397.  
  398. var stored = GM_config.read(); // read the stored settings
  399. GM_config.passed_values = {};
  400. for(var i in settings) {
  401. GM_config.doSettingValue(settings, stored, i, null, false);
  402. if(settings[i].kids) for(var kid in settings[i].kids) GM_config.doSettingValue(settings, stored, kid, i, true);
  403. }
  404. GM_config.values = GM_config.passed_values;
  405. GM_config.settings = settings;
  406. if (css) GM_config.css.stylish = css;
  407. },
  408. open: function() {
  409. if(document.evaluate("//iframe[@id='GM_config']",document,null,9,null).singleNodeValue) return;
  410. // Create frame
  411. document.body.appendChild((GM_config.frame=GM_config.create('iframe',{id:'GM_config', style:'position: fixed; top: 0; left: 0; opacity: 0; display: none; z-index: 999999; width: 75%; height: 75%; max-height: 95%; max-width: 95%; border:3px ridge #000000; overflow: auto;'})));
  412. GM_config.frame.src = 'about:blank'; // In WebKit src cant be set until it is added to the page
  413. GM_config.frame.addEventListener('load', function() {
  414. var obj = GM_config, doc = this.contentDocument, frameBody = doc.getElementsByTagName('body')[0], create=obj.create, settings=obj.settings, anch, secNo;
  415. obj.frame.contentDocument.getElementsByTagName('head')[0].appendChild(create('style',{type:'text/css',textContent:obj.css.basic + "\n\n" + obj.css.stylish}));
  416.  
  417. // Add header and title
  418. frameBody.appendChild(create('div', {id:'header',className:'config_header block center', innerHTML:obj.title}));
  419.  
  420. // Append elements
  421. anch = frameBody; // define frame body
  422. secNo = 0; // anchor to append elements
  423. for(var i in settings) {
  424. var type, field = settings[i], value = obj.values[i], section = (field.section ? field.section : ["Main Options"]),
  425. headerExists = doc.evaluate(".//div[@class='section_header_holder' and starts-with(@id, 'section_')]", frameBody, null, 9, null).singleNodeValue;
  426.  
  427. if(typeof field.section !== "undefined" || headerExists === null) {
  428. anch = frameBody.appendChild(create('div', {className:'section_header_holder', id:'section_'+secNo, kids:new Array(
  429. create('a', {className:'section_header center', href:"javascript:void(0);", id:'c_section_kids_'+secNo, textContent:section[0], onclick:function(){GM_config.toggle(this.id.substring(2));}}),
  430. create('div', {id:'section_kids_'+secNo, className:'section_kids', style:obj.getValue('section_kids_'+secNo, "")==""?"":"display: none;"})
  431. )}));
  432. if(section[1]) anch.appendChild(create('p', {className:'section_desc center',innerHTML:section[1]}));
  433. secNo++;
  434. }
  435. anch.childNodes[1].appendChild(GM_config.addToFrame(field, i, false));
  436. }
  437.  
  438. // Add save and close buttons
  439. frameBody.appendChild(obj.create('div', {id:'buttons_holder', kids:new Array(
  440. obj.create('button',{id:'saveBtn',textContent:'Save',title:'Save options and close window',className:'saveclose_buttons',onclick:function(){GM_config.close(true)}}),
  441. obj.create('button',{id:'cancelBtn', textContent:'Cancel',title:'Close window',className:'saveclose_buttons',onclick:function(){GM_config.close(false)}}),
  442. obj.create('div', {className:'reset_holder block', kids:new Array(
  443. obj.create('a',{id:'resetLink',textContent:'Restore to default',href:'#',title:'Restore settings to default configuration',className:'reset',onclick:obj.reset})
  444. )}))}));
  445.  
  446. obj.center(); // Show and center it
  447. window.addEventListener('resize', obj.center, false); // Center it on resize
  448. if (obj.onOpen) obj.onOpen(); // Call the open() callback function
  449.  
  450. // Close frame on window close
  451. window.addEventListener('beforeunload', function(){GM_config.remove(this);}, false);
  452. }, false);
  453. },
  454. close: function(save) {
  455. if(save) {
  456. var type, fields = GM_config.settings, typewhite=/radio|text|hidden|password|checkbox/;
  457. for(f in fields) {
  458. var field = GM_config.frame.contentDocument.getElementById('field_'+f), kids=fields[f].kids;
  459. if(typewhite.test(field.type)) type=field.type;
  460. else type=field.tagName.toLowerCase();
  461. GM_config.doSave(f, field, type);
  462. if(kids) for(var kid in kids) {
  463. var field = GM_config.frame.contentDocument.getElementById('field_'+kid);
  464. if(typewhite.test(field.type)) type=field.type;
  465. else type=field.tagName.toLowerCase();
  466. GM_config.doSave(kid, field, type, f);
  467. }
  468. }
  469. if(GM_config.onSave) GM_config.onSave(); // Call the save() callback function
  470. GM_config.save();
  471. }
  472. if(GM_config.frame) GM_config.remove(GM_config.frame);
  473. delete GM_config.frame;
  474. if(GM_config.onClose) GM_config.onClose(); // Call the close() callback function
  475. },
  476. set: function(name,val) {
  477. GM_config.values[name] = val;
  478. },
  479. get: function(name) {
  480. return GM_config.values[name];
  481. },
  482. isGM: (typeof window.opera === "undefined" && typeof window.chrome === "undefined" && typeof GM_info === "object"),
  483. log: function(str) {
  484.  
  485. if(this.isGM) return console.log(str);
  486. else if(window.opera) return window.opera.postError(str);
  487. // else return console.log(str);
  488.  
  489. },
  490. getValue : function(name, d) {
  491. var r, def = (typeof d !== "undefined" ? d : "");
  492. switch(this.isGM === true) {
  493. case true: r = GM_getValue(name, def); break;
  494. case false: r = localStorage.getItem(name) || def; break;
  495. }
  496. return r;
  497. },
  498. setValue : function(name, value) {
  499. switch(this.isGM === true) {
  500. case true: GM_setValue(name, value); break;
  501. case false: localStorage.setItem(name, value); break;
  502. }
  503. },
  504. deleteValue : function(name) {
  505. switch(this.isGM === true) {
  506. case true: GM_deleteValue(name); break;
  507. case false: localStorage.removeItem(name); break;
  508. }
  509. },
  510. save: function(store, obj) {
  511. try {
  512. var val = JSON.stringify(obj || GM_config.values);
  513. GM_config.setValue((store||GM_config.storage),val);
  514. } catch(e) {
  515. GM_config.log("GM_config failed to save settings!\n" + e);
  516. }
  517. },
  518. read: function(store) {
  519. var val = GM_config.getValue((store || GM_config.storage), '{}');
  520. switch(typeof val) {
  521. case "string": var rval = JSON.parse(val); break;
  522. case "object": var rval = val; break;
  523. default: var rval = {};
  524. }
  525. return rval;
  526. },
  527. reset: function(e) {
  528. e.preventDefault();
  529. var type, obj = GM_config, fields = obj.settings;
  530. for(f in fields) {
  531. var field = obj.frame.contentDocument.getElementById('field_'+f), kids=fields[f].kids;
  532. if(field.type=='radio'||field.type=='text'||field.type=='checkbox') type=field.type;
  533. else type=field.tagName.toLowerCase();
  534. GM_config.doReset(field, type, null, f, null, false);
  535. if(kids) for(var kid in kids) {
  536. var field = GM_config.frame.contentDocument.getElementById('field_'+kid);
  537. if(field.type=='radio'||field.type=='text'||field.type=='checkbox') type=field.type;
  538. else type=field.tagName.toLowerCase();
  539. GM_config.doReset(field, type, f, kid, true);
  540. }
  541. }
  542. },
  543. addToFrame : function(field, i, k) {
  544. var elem, obj = this, anch = this.frame, value = obj.values[i], Options = field.options, label = field.label, create=obj.create, isKid = (k !== null && k === true);
  545. switch(field.type) {
  546. case 'textarea':
  547. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  548. create('span', {textContent:label, className:'field_label'}),
  549. create('textarea', {id:'field_'+i,innerHTML:value, cols:(field.cols?field.cols:20), rows:(field.rows?field.rows:2)})
  550. ), className: 'config_var'});
  551. break;
  552. case 'radio':
  553. var boxes = new Array();
  554. for (var j = 0,len = Options.length; j<len; j++) {
  555. boxes.push(create('span', {textContent:Options[j]}));
  556. boxes.push(create('input', {value:Options[j], type:'radio', name:i, checked:Options[j]==value?true:false}));
  557. }
  558. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  559. create('span', {textContent:label, className:'field_label'}),
  560. create('span', {id:'field_'+i, kids:boxes})
  561. ), className: 'config_var'});
  562. break;
  563. case 'select':
  564. var options = [];
  565. if(typeof Options === "object" && typeof Options.push !== "function") for(var j in Options) options.push(create('option',{textContent:Options[j],value:j,selected:(j==value)}));
  566. else options.push(create("option", {textContent:"Error - \"options\" needs to be a JSON object.", value:"error", selected:"selected"}));
  567. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  568. create('span', {textContent:label, className:'field_label'}),
  569. create('select',{id:'field_'+i, kids:options})
  570. ), className: 'config_var'});
  571. break;
  572. case 'checkbox':
  573. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  574. create('label', {textContent:label, className:'field_label', "for":'field_'+i}),
  575. create('input', {id:'field_'+i, type:'checkbox', value:value, checked:value})
  576. ), className: 'config_var'});
  577. break;
  578. case 'button':
  579. var tmp;
  580. elem = create(isKid ? "span" : "div", {kids:new Array(
  581. (tmp=create('input', {id:'field_'+i, type:'button', value:label, size:(field.size?field.size:25), title:field.title||''}))
  582. ), className: 'config_var'});
  583. if(field.script) obj.addEvent(tmp, 'click', field.script);
  584. break;
  585. case 'hidden':
  586. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  587. create('input', {id:'field_'+i, type:'hidden', value:value})
  588. ), className: 'config_var'});
  589. break;
  590. case 'password':
  591. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  592. create('span', {textContent:label, className:'field_label'}),
  593. create('input', {id:'field_'+i, type:'password', value:value, size:(field.size?field.size:25)})
  594. ), className: 'config_var'});
  595. break;
  596. default:
  597. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  598. create('span', {textContent:label, className:'field_label'}),
  599. create('input', {id:'field_'+i, type:'text', value:value, size:(field.size?field.size:25)})
  600. ), className: 'config_var'});
  601. }
  602. if(field.kids) {
  603. var kids=field.kids;
  604. for(var kid in kids) elem.appendChild(obj.addToFrame(kids[kid], kid, true));
  605. }
  606. return elem;
  607. },
  608. doSave : function(f, field, type, oldf) {
  609. var isNum=/^[\d\.]+$/, set = oldf ? GM_config.settings[oldf]["kids"] : GM_config.settings;
  610. switch(type) {
  611. case 'text':
  612. GM_config.values[f] = ((set[f].type=='text') ? field.value : ((isNum.test(field.value) && ",int,float".indexOf(","+set[f].type)!=-1) ? parseFloat(field.value) : false));
  613. if(set[f]===false) {
  614. alert('Invalid type for field: '+f+'\nPlease use type: '+set[f].type);
  615. return;
  616. }
  617. break;
  618. case 'hidden': case 'password':
  619. GM_config.values[f] = field.value.toString();
  620. break;
  621. case 'textarea':
  622. GM_config.values[f] = field.value;
  623. break;
  624. case 'checkbox':
  625. GM_config.values[f] = field.checked;
  626. break;
  627. case 'select':
  628. GM_config.values[f] = field.options[field.selectedIndex].value;
  629. break;
  630. case 'span':
  631. var radios = field.getElementsByTagName('input');
  632. if(radios.length>0) for(var i=radios.length-1; i>=0; i--) {
  633. if(radios[i].checked) GM_config.values[f] = radios[i].value;
  634. }
  635. break;
  636. }
  637. },
  638. doSettingValue : function(settings, stored, i, oldi, k) {
  639. var set = k!=null && k==true && oldi!=null ? settings[oldi]["kids"][i] : settings[i];
  640. if(",save,open,close".indexOf(","+i) == -1) {
  641. // The code below translates to:
  642. // if a setting was passed to init but wasn't stored then
  643. // if a default value wasn't passed through init() then use null
  644. // else use the default value passed through init()
  645. // else use the stored value
  646. try {
  647. var value = (stored[i]==undefined ? (set["default"]==undefined ? null : set["default"]) : stored[i]);
  648. } catch(e) {
  649. var value = (stored[i]=="undefined" ? (set["default"]=="undefined" ? null : set["default"]) : stored[i]);
  650. }
  651.  
  652. // If the value isn't stored and no default was passed through init()
  653. // try to predict a default value based on the type
  654. if (value === null) {
  655. switch(set["type"]) {
  656. case 'radio': case 'select':
  657. value = set.options[0]; break;
  658. case 'checkbox':
  659. value = false; break;
  660. case 'int': case 'float':
  661. value = 0; break;
  662. default:
  663. value = (typeof stored[i]=="function") ? stored[i] : "";
  664. }
  665. }
  666.  
  667. }
  668. GM_config.passed_values[i] = value;
  669. },
  670. doReset : function(field, type, oldf, f, k) {
  671. var isKid = k!=null && k==true, obj=GM_config,
  672. set = isKid ? obj.settings[oldf]["kids"][f] : obj.settings[f];
  673. switch(type) {
  674. case 'text':
  675. field.value = set['default'] || '';
  676. break;
  677. case 'hidden': case 'password':
  678. field.value = set['default'] || '';
  679. break;
  680. case 'textarea':
  681. field.value = set['default'] || '';
  682. break;
  683. case 'checkbox':
  684. field.checked = set['default'] || false;
  685. break;
  686. case 'select':
  687. if(set['default']) {
  688. for(var i=field.options.length-1; i>=0; i--)
  689. if(field.options[i].value==set['default']) field.selectedIndex=i;
  690. }
  691. else field.selectedIndex=0;
  692. break;
  693. case 'span':
  694. var radios = field.getElementsByTagName('input');
  695. if(radios.length>0) for(var i=radios.length-1; i>=0; i--) {
  696. if(radios[i].value==set['default']) {
  697. radios[i].checked=true;
  698. }
  699. }
  700. break;
  701. }
  702. },
  703. values: {},
  704. settings: {},
  705. css: {
  706. basic: 'body {background:#FFFFFF;}\n' +
  707. '.indent40 {margin-left:40%;}\n' +
  708. '* {font-family: arial, tahoma, sans-serif, myriad pro;}\n' +
  709. '.field_label {font-weight:bold; font-size:12px; margin-right:6px;}\n' +
  710. '.block {display:block;}\n' +
  711. '.saveclose_buttons {\n' +
  712. 'margin:16px 10px 10px 10px;\n' +
  713. 'padding:2px 12px 2px 12px;\n' +
  714. '}\n' +
  715. '.reset, #buttons_holder, .reset a {text-align:right; color:#000000;}\n' +
  716. '.config_header {font-size:20pt; margin:0;}\n' +
  717. '.config_desc, .section_desc, .reset {font-size:9pt;}\n' +
  718. '.center {text-align:center;}\n' +
  719. '.section_header_holder {margin-top:8px;}\n' +
  720. '.config_var {margin:0 0 4px 0; display:block;}\n' +
  721. '.config_var {font-size: 13px !important;}\n' +
  722. '.section_header {font-size:13pt; background:#414141; color:#FFFFFF; border:1px solid #000000; margin:0;}\n' +
  723. '.section_desc {font-size:9pt; background:#EFEFEF; color:#575757; border:1px solid #CCCCCC; margin:0 0 6px 0;}\n' +
  724. 'input[type="radio"] {margin-right:8px;}',
  725. stylish: ''
  726. },
  727. create: function(a,b) {
  728. var ret=window.document.createElement(a);
  729. if(b) for(var prop in b) {
  730. if(prop.indexOf('on')==0) ret.addEventListener(prop.substring(2),b[prop],false);
  731. else if(prop=="kids" && (prop=b[prop])) for(var i=0; i<prop.length; i++) ret.appendChild(prop[i]);
  732. else if(",style,accesskey,id,name,src,href,for".indexOf(","+prop.toLowerCase())!=-1) ret.setAttribute(prop, b[prop]);
  733. else ret[prop]=b[prop];
  734. }
  735. return ret;
  736. },
  737. center: function() {
  738. var node = GM_config.frame, style = node.style, beforeOpacity = style.opacity;
  739. if(style.display=='none') style.opacity='0';
  740. style.display = '';
  741. style.top = Math.floor((window.innerHeight/2)-(node.offsetHeight/2)) + 'px';
  742. style.left = Math.floor((window.innerWidth/2)-(node.offsetWidth/2)) + 'px';
  743. style.opacity = '1';
  744. },
  745. run: function() {
  746. var script=GM_config.getAttribute('script');
  747. if(script && typeof script=='string' && script!='') {
  748. func = new Function(script);
  749. window.setTimeout(func, 0);
  750. }
  751. },
  752. addEvent: function(el, ev, scr) {
  753. if(el) el.addEventListener(ev, function() {
  754. typeof scr === 'function' ? window.setTimeout(scr, 0) : eval(scr)
  755. }, false);
  756. },
  757. remove: function(el) {
  758. if(el && el.parentNode) el.parentNode.removeChild(el);
  759. },
  760. toggle : function(e) {
  761. var node=GM_config.frame.contentDocument.getElementById(e);
  762. node.style.display=(node.style.display!='none')?'none':'';
  763. GM_config.setValue(e, node.style.display);
  764. },
  765. };
  766.  
  767.  
  768. //Ajout suite FF57-Greasemonkey4
  769. function addGlobalStyle(css) {
  770. var head, style;
  771. head = document.getElementsByTagName('head')[0];
  772. if (!head) { return; }
  773. style = document.createElement('style');
  774. style.type = 'text/css';
  775. style.innerHTML = css.replace(/;/g, ' !important;');
  776. head.appendChild(style);
  777. }
  778.  
  779.  
  780.  
  781.  
  782. /* EXAMPLE CODE BELOW --------------------------
  783.  
  784. GM_config.init("Test", {
  785. "one" : {
  786. "label" : "Option One",
  787. "type" : "checkbox",
  788. "default" : false
  789. },
  790. "two" : {
  791. "label" : "Option Two",
  792. "type" : "checkbox",
  793. "default" : false
  794. },
  795. "three" : {
  796. "label" : "Option Three",
  797. "type" : "password"
  798. },
  799. "four" : {
  800. "label" : "Option Four",
  801. "type" : "select",
  802. "options" : {
  803. "one" : "One",
  804. "two" : "Two"
  805. }
  806. }
  807. });
  808.  
  809. GM_config.open();
  810.  
  811. ------------------------------------------------- */
  812.  
  813.  
  814.  
  815. //http://userscripts.org/scripts/source/51832.user.js
  816. //Integration de cette ressource dans le script (pour Chrome)
  817.  
  818. // =====================================[ String helpers ]===
  819. // add prototype trim (taken from [uso:script:12107]
  820. String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
  821.  
  822. // ======================================[ Array helpers ]===
  823. /** Is the item part of the array?
  824. * @function in_array
  825. * @param mixed needle
  826. * @param array haystack
  827. * @return boolean
  828. */
  829. function in_array(item,arr) {
  830. for(p=0;p<arr.length;p++) if (item == arr[p]) return true;
  831. return false;
  832. }
  833. /** Return all the keys of an array
  834. * @function array_keys
  835. * @param array arr
  836. * @return array keys
  837. */
  838. function array_keys(arr) {
  839. var keys = new Array();
  840. for (key in arr) keys.push(key);
  841. return keys;
  842. }
  843. // ============================[ Common variables helper ]===
  844. /** Is a given variable already defined?
  845. * Returns FALSE if any of the passed variables is not set,
  846. * TRUE if all passed variables are set. You can pass as many
  847. * arguments as you want, e.g. isset(o.var1,o.var2,o.var3)
  848. * REMEMBER: Checking isset(varname) when varname was not declared yields
  849. * an JS error "varname is not defined". Use window.varname instead.
  850. * @function isset
  851. * @param mixed varname
  852. * @return boolean
  853. */
  854. function isset() {
  855. if (arguments.length===0) return false;
  856. for (var i=0;i<arguments.length;i++) {
  857. if (typeof(arguments[i])=='undefined'||arguments[i]===null) return false;
  858. }
  859. return true;
  860. }
  861. /** Escape RegExp special chars
  862. * @function escapeRegExp
  863. * @param string s
  864. * @return string escaped
  865. * @brief taken from Greasespot code snippets
  866. */
  867. function escapeRegExp(s) {
  868. return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
  869. }
  870. /** Add style with !important rule to override page defaults
  871. * (adds "!important" to each rule)
  872. * @function addForcedStyle
  873. * @param string css
  874. * @brief taken from Greasespot code snippets
  875. */
  876. function addForcedStyle(css) {
  877. addGlobalStyle(css.replace(/;/g,' !important;'));
  878. }
  879. // ========================================[ DOM helpers ]===
  880. /** Get elements by className
  881. * @function getElementsByClassName
  882. * @param string className
  883. * @param optional string tag restrict to specified tag
  884. * @param optional node restrict to childNodes of specified node
  885. * @return Array of nodes
  886. * @author Jonathan Snook, http://www.snook.ca/jonathan
  887. * @author Robert Nyman, http://www.robertnyman.com
  888. */
  889. function getElementsByClassName(className, tag, elm){
  890. var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
  891. var tag = tag || "*";
  892. var elm = elm || document;
  893. var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
  894. var returnElements = [];
  895. var current;
  896. var length = elements.length;
  897. for(var i=0; i<length; i++){
  898. current = elements[i];
  899. if(testClass.test(current.className)){
  900. returnElements.push(current);
  901. }
  902. }
  903. return returnElements;
  904. }
  905. /** Get elements whose id matches the given regexp
  906. * @function getElementsByIdRegExp
  907. * @param RegExp regex
  908. * @param optional string tag restrict to specified tag
  909. * @param optional node restrict to childNodes of specified node
  910. * @return Array nodes
  911. * @author Arthaey Angosii http://userscripts.org:8080/users/4440
  912. * @author Izzy http://userscripts.org:8080/users/izzysoft
  913. */
  914. function getElementsByIdRegExp(regex,tag,elm) {
  915. var matchingElements = [];
  916. if (!regex) return matchingElements;
  917.  
  918. tag = tag || '*';
  919. elm = elm || document;
  920. var elements = (tag=='*' && elm.all)? elm.all : elm.getElementsByTagName(tag);
  921. for (var i = 0; i < elements.length; i++)
  922. if (elements[i].id.match(regex))
  923. matchingElements.push(elements[i]);
  924. return matchingElements;
  925. }
  926.  
  927. /** Append an element to a given node
  928. * @function appendElement
  929. * @param string nodeID ID of parentNode
  930. * @param string tag nodeType
  931. * @param string id ID for the new node
  932. * @param string className
  933. * @param string textVal innerHTML
  934. * @param boolean retEl return the created element?
  935. */
  936. function appendElement(node,tag,id,classnam,textVal,retEl) {
  937. if (!document.getElementById(node)) return;
  938. try {
  939. var el = document.createElement(tag);
  940. } catch(e) {
  941. return;
  942. }
  943. id ? el.id = id : null;
  944. classnam ? el.className = classnam : null;
  945. el.innerHTML = (textVal ? textVal : '');
  946. var retNode = document.getElementById(node).appendChild(el);
  947. if (retEl) return retNode;
  948. }
  949. /** Create new element
  950. * Example call: var styles = createElement('link', {rel: 'stylesheet', type: 'text/css', href: basedir + 'style.css'});
  951. * @function createElement
  952. * @param string type e.g. 'link', 'a', 'p'
  953. * @param object attributes
  954. * @return node
  955. * @brief taken from Greasespot code snippets
  956. */
  957. function createElement(type, attributes){
  958. var node = document.createElement(type);
  959. for (var attr in attributes) if (attributes.hasOwnProperty(attr)){
  960. node.setAttribute(attr, attributes[attr]);
  961. }
  962. return node;
  963. }
  964. /** Insert a node after another
  965. * @function insertAfter
  966. * @param node newNode
  967. * @param node before
  968. * @brief taken from Greasespot code snippets
  969. */
  970. function insertAfter(newNode, node) {
  971. return node.parentNode.insertBefore(newNode, node.nextSibling);
  972. }
  973. /** Remove an element by ID
  974. * @function removeElementById
  975. * @param mixed id string for ID or the node itself
  976. * @return boolean success
  977. */
  978. function removeElementById(id) {
  979. if (!id) return;
  980. var node = (typeof(id)=='string') ? document.getElementById(id) : id;
  981. var res = node.parentNode.removeChild(node);
  982. if (res) return true;
  983. return false;
  984. }
  985. /** Remove an element by name
  986. * @function removeElementByName
  987. * @param string name name of the element to remove (or the node itself)
  988. * @return boolean success
  989. */
  990. function removeElementByName(nam) {
  991. if (!nam) return;
  992. var node = (typeof(id)=='string') ? document.getElementByName(nam) : nam;
  993. var res = node.parentNode.removeChild(node);
  994. if (res) return true;
  995. return false;
  996. }
  997. /** Remove elements by className
  998. * @function removeElementsByClassName
  999. * @param string className
  1000. * @param optional ancestor (default: document)
  1001. * @return boolean success FALSE if one or more elements failed or none found
  1002. */
  1003. function removeElementsByClassName(cname,node) {
  1004. node = node || document;
  1005. var elms = node.getElementsByClassName(cname);
  1006. if (elms.length<1) return false;
  1007. for (var i=0;i<elms.length;i++)
  1008. if ( !removeElementById(elms[i]) ) return false;
  1009. return true;
  1010. }
  1011. /** Remove elements by tag name
  1012. * @function removeElementsByTagName
  1013. * @param string tag name
  1014. * @param optional node ancestor (default: document)
  1015. * @return boolean success FALSE if one or more elements failed or none found
  1016. */
  1017. function removeElementsByTagName(tag,node) {
  1018. if (!tag) return false;
  1019. var node = node || document;
  1020. var elms = node.getElementsByTagName(tag);
  1021. if (elms.length<1) return false;
  1022. for (var i=0;i<elms.length;i++)
  1023. if ( !removeElementById(elms[i]) ) return false;
  1024. return true;
  1025. }
  1026. /** Get next sibling skipping possible whiteSpace(s) in between
  1027. * @function nextSibling
  1028. * @param node startSib
  1029. * @return mixed nextSibling node when found, FALSE otherwise
  1030. * @brief taken from Greasespot code snippets
  1031. */
  1032. function nextSibling(startSib) {
  1033. if (!(nextSib=startSib.nextSibling)) return false;
  1034. while (nextSib.nodeType!=1) if (!(nextSib=nextSib.nextSibling)) return false;
  1035. return nextSib;
  1036. }
  1037. // =======================================[ Translations ]===
  1038. /** Translation class
  1039. * @class GM_trans
  1040. */
  1041. GM_trans = {
  1042. /** Set desired language
  1043. * @method setLang
  1044. * @param string lang 2-char language code
  1045. */
  1046. setLang: function(lng) {
  1047. this.trans.useLang = lng;
  1048. },
  1049. /** Translations
  1050. * @attribute object trans
  1051. */
  1052. trans: {
  1053. useLang: 'en'
  1054. },
  1055. /** Translate a given string
  1056. * @method lang
  1057. * @param string term to translate
  1058. * @param optional array replaces
  1059. * @return string translated term
  1060. */
  1061. lang: function(term) {
  1062. if (!term) return '';
  1063. var res;
  1064. if (this.trans[this.trans.useLang][term]) res = this.trans[this.trans.useLang][term];
  1065. else if (this.trans['en'][term]) res = this.trans['en'][term];
  1066. else return term;
  1067. if (typeof(arguments[1])!="object") return res;
  1068. for (var i=0;i<arguments[1].length;i++) {
  1069. res = res.replace('%'+(i+1),arguments[1][i]);
  1070. }
  1071. return res;
  1072. },
  1073. /** Set translations for a given language
  1074. * @method setTranslations
  1075. * @param string lang 2-char language code
  1076. * @param object trans translations { string term: string translation }
  1077. */
  1078. setTranslations: function(lang,trans) {
  1079. if (typeof(this.trans[lang])!="object") { // new language?
  1080. this.trans[lang] = trans;
  1081. return;
  1082. }
  1083. for (attrname in trans) { this.trans[lang][attrname] = trans[attrname]; }
  1084. }
  1085. }
  1086.  
  1087. // ==============================[ Miscellaneous helpers ]===
  1088. /** Add Script element to the web page
  1089. * @function GMT_addScript
  1090. * @param string script
  1091. * @return boolean success
  1092. * @author JoeSimmons http://userscripts.org:8080/users/JoeSimmons
  1093. * @author Izzy http://userscripts.org:8080/users/izzysoft
  1094. */
  1095. function GMT_addScript(script) {
  1096. if ( script && (h=document.getElementsByTagName('head')[0]) ) {
  1097. var aS = document.createElement('script');
  1098. aS.type = 'text/javascript';
  1099. aS.innerHTML = script;
  1100. var res = h.appendChild(aS);
  1101. if (res) return true;
  1102. }
  1103. return false;
  1104. }
  1105. /** Debug logging
  1106. * Sends the supplied arguments to console.log only if a global variable DEBUG
  1107. * exists and is set to TRUE or 1
  1108. * @function debug
  1109. * @param mixed msg what to log
  1110. */
  1111. function debug(msg) {
  1112. if (typeof(DEBUG)!='undefined' && DEBUG) console.log(msg);
  1113. }
  1114.  
  1115.  
  1116.  
  1117.  
  1118. //http://userscripts.org/scripts/source/49700.user.js
  1119. //Integration de cette ressource dans le script (pour Chrome)
  1120.  
  1121. /* Instructions
  1122. GM_config is now cross-browser compatible.
  1123.  
  1124. To use it in a Greasemonkey-only user script you can just @match it.
  1125.  
  1126. To use it in a cross-browser user script you will need to manually
  1127. include the code at the beginning of your user script. In this case
  1128. it is also very important you change the "storage" value below to
  1129. something unique to prevent collisions between scripts. Also remeber
  1130. that in this case that stored settings will only be accessable on
  1131. the same domain they were saved.
  1132. */
  1133.  
  1134. String.prototype.find = function(s) {
  1135. return (this.indexOf(s) != -1);
  1136. };
  1137.  
  1138. var GM_config = {
  1139. storage: 'GM_config', // This needs to be changed to something unique for localStorage
  1140. init: function() {
  1141. // loop through GM_config.init() arguements
  1142. for(var i=0,l=arguments.length,arg; i<l; ++i) {
  1143. arg=arguments[i];
  1144. switch(typeof arg) {
  1145. case 'object': for(var j in arg) { // could be a callback functions or settings object
  1146. switch(j) {
  1147. case "open": GM_config.onOpen=arg[j]; delete arg[j]; break; // called when frame is gone
  1148. case "close": GM_config.onClose=arg[j]; delete arg[j]; break; // called when settings have been saved
  1149. case "save": GM_config.onSave=arg[j]; delete arg[j]; break; // store the settings objects
  1150. default: var settings = arg;
  1151. }
  1152. } break;
  1153. case 'function': GM_config.onOpen = arg; break; // passing a bare function is set to open
  1154. // could be custom CSS or the title string
  1155. case 'string': if(arg.indexOf('{')!=-1&&arg.indexOf('}')!=-1) var css = arg;
  1156. else GM_config.title = arg;
  1157. break;
  1158. }
  1159. }
  1160. if(!GM_config.title) GM_config.title = 'Settings - Anonymous Script'; // if title wasn't passed through init()
  1161. var stored = GM_config.read(); // read the stored settings
  1162. GM_config.passed_values = {};
  1163. for (var i in settings) {
  1164. GM_config.doSettingValue(settings, stored, i, null, false);
  1165. if(settings[i].kids) for(var kid in settings[i].kids) GM_config.doSettingValue(settings, stored, kid, i, true);
  1166. }
  1167. GM_config.values = GM_config.passed_values;
  1168. GM_config.settings = settings;
  1169. if (css) GM_config.css.stylish = css;
  1170. },
  1171. open: function() {
  1172. if(document.evaluate("//iframe[@id='GM_config']",document,null,9,null).singleNodeValue) return;
  1173. // Create frame
  1174. document.body.appendChild((GM_config.frame=GM_config.create('iframe',{id:'GM_config', style:'position:fixed; top:0; left:0; opacity:0; display:none; z-index:999; width:75%; height:75%; max-height:95%; max-width:95%; border:1px solid #000000; overflow:auto;'})));
  1175. GM_config.frame.src = 'about:blank'; // In WebKit src cant be set until it is added to the page
  1176. GM_config.frame.addEventListener('load', function(){
  1177. var obj = GM_config, frameBody = this.contentDocument.getElementsByTagName('body')[0], create=obj.create, settings=obj.settings;
  1178. obj.frame.contentDocument.getElementsByTagName('head')[0].appendChild(create('style',{type:'text/css',textContent:obj.css.basic+obj.css.stylish}));
  1179.  
  1180. // Add header and title
  1181. frameBody.appendChild(create('div', {id:'header',className:'config_header block center', innerHTML:obj.title}));
  1182.  
  1183. // Append elements
  1184. var anch = frameBody, secNo = 0; // anchor to append elements
  1185. for (var i in settings) {
  1186. var type, field = settings[i], value = obj.values[i];
  1187. if (field.section) {
  1188. anch = frameBody.appendChild(create('div', {className:'section_header_holder', id:'section_'+secNo, kids:new Array(
  1189. create('a', {className:'section_header center', href:"javascript:void(0);", id:'c_section_kids_'+secNo, textContent:field.section[0], onclick:function(){GM_config.toggle(this.id.substring(2));}}),
  1190. create('div', {id:'section_kids_'+secNo, className:'section_kids', style:obj.getValue('section_kids_'+secNo, "none")=="none"?"display: none;":""})
  1191. )}));
  1192. if(field.section[1]) anch.appendChild(create('p', {className:'section_desc center',innerHTML:field.section[1]}));
  1193. secNo++;
  1194. }
  1195. anch.childNodes[1].appendChild(GM_config.addToFrame(field, i, false));
  1196. }
  1197.  
  1198. // Add save and close buttons
  1199. frameBody.appendChild(obj.create('div', {id:'buttons_holder', kids:new Array(
  1200. obj.create('button',{id:'saveBtn',textContent:'Save',title:'Save options and close window',className:'saveclose_buttons',onclick:function(){GM_config.close(true)}}),
  1201. obj.create('button',{id:'cancelBtn', textContent:'Cancel',title:'Close window',className:'saveclose_buttons',onclick:function(){GM_config.close(false)}}),
  1202. obj.create('div', {className:'reset_holder block', kids:new Array(
  1203. obj.create('a',{id:'resetLink',textContent:'Restore to default',href:'#',title:'Restore settings to default configuration',className:'reset',onclick:obj.reset})
  1204. )}))}));
  1205.  
  1206. obj.center(); // Show and center it
  1207. window.addEventListener('resize', obj.center, false); // Center it on resize
  1208. if (obj.onOpen) obj.onOpen(); // Call the open() callback function
  1209.  
  1210. // Close frame on window close
  1211. window.addEventListener('beforeunload', function(){GM_config.remove(this);}, false);
  1212. }, false);
  1213. },
  1214. close: function(save) {
  1215. if(save) {
  1216. var type, fields = GM_config.settings, typewhite=/radio|text|hidden|checkbox/;
  1217. for(f in fields) {
  1218. var field = GM_config.frame.contentDocument.getElementById('field_'+f), kids=fields[f].kids;
  1219. if(!field.className.find("separator")) {
  1220. if(typewhite.test(field.type)) type=field.type;
  1221. else type=field.tagName.toLowerCase();
  1222. GM_config.doSave(f, field, type);
  1223. if(kids) for(var kid in kids) {
  1224. var field = GM_config.frame.contentDocument.getElementById('field_'+kid);
  1225. if(typewhite.test(field.type)) type=field.type;
  1226. else type=field.tagName.toLowerCase();
  1227. GM_config.doSave(kid, field, type, f);
  1228. }
  1229. }
  1230. }
  1231. if(GM_config.onSave) GM_config.onSave(); // Call the save() callback function
  1232. GM_config.save();
  1233. }
  1234. if(GM_config.frame) GM_config.remove(GM_config.frame);
  1235. delete GM_config.frame;
  1236. if(GM_config.onClose) GM_config.onClose(); // Call the close() callback function
  1237. },
  1238. set: function(name,val) {
  1239. GM_config.values[name] = val;
  1240. },
  1241. get: function(name) {
  1242. return GM_config.values[name];
  1243. },
  1244. isGM: typeof GM_getValue != 'undefined' && typeof GM_getValue('a', 'b') != 'undefined',
  1245. log: (window.opera) ? opera.postError : console.log,
  1246. getValue : function(name, def) { return (this.isGM?GM_getValue:(function(name,def){return localStorage.getItem(name)||def}))(name, def||""); },
  1247. setValue : function(name, value) { return (this.isGM?GM_setValue:(function(name,value){return localStorage.setItem(name,value)}))(name, value||""); },
  1248. save: function(store, obj) {
  1249. try {
  1250. var val = JSON.stringify(obj||GM_config.values);
  1251. GM_config.setValue((store||GM_config.storage),val);
  1252. } catch(e) {
  1253. GM_config.log("GM_config failed to save settings!");
  1254. }
  1255. },
  1256. read: function(store) {
  1257. try {
  1258. var val = GM_config.getValue((store||GM_config.storage), '{}'), rval = JSON.parse(val);
  1259. } catch(e) {
  1260. GM_config.log("GM_config failed to read saved settings!");
  1261. rval = {};
  1262. }
  1263. return rval;
  1264. },
  1265. reset: function(e) {
  1266. e.preventDefault();
  1267. var type, obj = GM_config, fields = obj.settings;
  1268. for(f in fields) {
  1269. var field = obj.frame.contentDocument.getElementById('field_'+f), kids=fields[f].kids;
  1270. if(field.type=='radio'||field.type=='text'||field.type=='checkbox') type=field.type;
  1271. else type=field.tagName.toLowerCase();
  1272. GM_config.doReset(field, type, null, f, null, false);
  1273. if(kids) for(var kid in kids) {
  1274. var field = GM_config.frame.contentDocument.getElementById('field_'+kid);
  1275. if(field.type=='radio'||field.type=='text'||field.type=='checkbox') type=field.type;
  1276. else type=field.tagName.toLowerCase();
  1277. GM_config.doReset(field, type, f, kid, true);
  1278. }
  1279. }
  1280. },
  1281. addToFrame : function(field, i, k) {
  1282. var elem, obj = GM_config, anch = GM_config.frame, value = obj.values[i], Options = field.options, label = field.label, create=GM_config.create, isKid = k!=null && k===true;
  1283. switch(field.type) {
  1284. case 'separator': elem = create("span", {textContent:label, id:'field_'+i, className:'field_label separator'});
  1285. break;
  1286. case 'textarea':
  1287. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  1288. create('span', {textContent:label, className:'field_label'}),
  1289. create('textarea', {id:'field_'+i,innerHTML:value, cols:(field.cols?field.cols:20), rows:(field.rows?field.rows:2)})
  1290. ), className: 'config_var'});
  1291. break;
  1292. case 'radio':
  1293. var boxes = new Array();
  1294. for (var j = 0,len = Options.length; j<len; j++) {
  1295. boxes.push(create('span', {textContent:Options[j]}));
  1296. boxes.push(create('input', {value:Options[j], type:'radio', name:i, checked:Options[j]==value?true:false}));
  1297. }
  1298. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  1299. create('span', {textContent:label, className:'field_label'}),
  1300. create('span', {id:'field_'+i, kids:boxes})
  1301. ), className: 'config_var'});
  1302. break;
  1303. case 'select':
  1304. var options = new Array();
  1305. if(!Options.inArray) for(var j in Options) options.push(create('option',{textContent:Options[j],value:j,selected:(j==value)}));
  1306. else options.push(create("option", {textContent:"Error - options needs to be an object type, not an array.",value:"error",selected:"selected"}));
  1307. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  1308. create('span', {textContent:label, className:'field_label'}),
  1309. create('select',{id:'field_'+i, kids:options})
  1310. ), className: 'config_var'});
  1311. break;
  1312. case 'checkbox':
  1313. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  1314. create('label', {textContent:label, className:'field_label', "for":'field_'+i}),
  1315. create('input', {id:'field_'+i, type:'checkbox', value:value, checked:value})
  1316. ), className: 'config_var'});
  1317. break;
  1318. case 'button':
  1319. var tmp;
  1320. elem = create(isKid ? "span" : "div", {kids:new Array(
  1321. (tmp=create('input', {id:'field_'+i, type:'button', value:label, size:(field.size?field.size:25), title:field.title||''}))
  1322. ), className: 'config_var'});
  1323. if(field.script) obj.addEvent(tmp, 'click', field.script);
  1324. break;
  1325. case 'hidden':
  1326. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  1327. create('input', {id:'field_'+i, type:'hidden', value:value})
  1328. ), className: 'config_var'});
  1329. break;
  1330. default:
  1331. elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
  1332. create('span', {textContent:label, className:'field_label'}),
  1333. create('input', {id:'field_'+i, type:'text', value:value, size:(field.size?field.size:25)})
  1334. ), className: 'config_var'});
  1335. }
  1336. if(field.kids) {
  1337. var kids=field.kids;
  1338. for(var kid in kids) elem.appendChild(GM_config.addToFrame(kids[kid], kid, true));
  1339. }
  1340. return elem;
  1341. },
  1342. doSave : function(f, field, type, oldf) {
  1343. var isNum=/^[\d\.]+$/, set = oldf ? GM_config.settings[oldf]["kids"] : GM_config.settings;
  1344. switch(type) {
  1345. case 'text':
  1346. GM_config.values[f] = ((set[f].type=='text') ? field.value : ((isNum.test(field.value) && ",int,float".indexOf(","+set[f].type)!=-1) ? parseFloat(field.value) : false));
  1347. if(set[f]===false) {
  1348. alert('Invalid type for field: '+f+'\nPlease use type: '+set[f].type);
  1349. return;
  1350. }
  1351. break;
  1352. case 'hidden':
  1353. GM_config.values[f] = field.value.toString();
  1354. break;
  1355. case 'textarea':
  1356. GM_config.values[f] = field.value;
  1357. break;
  1358. case 'checkbox':
  1359. GM_config.values[f] = field.checked;
  1360. break;
  1361. case 'select':
  1362. GM_config.values[f] = field.options[field.selectedIndex].value;
  1363. break;
  1364. case 'span':
  1365. var radios = field.getElementsByTagName('input');
  1366. if(radios.length>0) for(var i=radios.length-1; i>=0; i--) {
  1367. if(radios[i].checked) GM_config.values[f] = radios[i].value;
  1368. }
  1369. break;
  1370. }
  1371. },
  1372. doSettingValue : function(settings, stored, i, oldi, k) {
  1373. var set = k!=null && k==true && oldi!=null ? settings[oldi]["kids"][i] : settings[i];
  1374. if(",save,open,close".indexOf(","+i) == -1) {
  1375. // The code below translates to:
  1376. // if a setting was passed to init but wasn't stored then
  1377. // if a default value wasn't passed through init() then use null
  1378. // else use the default value passed through init()
  1379. // else use the stored value
  1380. try {
  1381. var value = (stored[i]==null || typeof stored[i]=="undefined") ? ((set["default"]==null || typeof set["default"]=="undefined") ? null : (set["default"])) : stored[i];
  1382. } catch(e) {
  1383. var value = stored[i]=="undefined" ? (set["default"]=="undefined" ? null : set["default"]) : stored[i];
  1384. }
  1385.  
  1386. // If the value isn't stored and no default was passed through init()
  1387. // try to predict a default value based on the type
  1388. if (value === null) {
  1389. switch(set["type"]) {
  1390. case 'radio': case 'select':
  1391. value = set.options[0]; break;
  1392. case 'checkbox':
  1393. value = false; break;
  1394. case 'int': case 'float':
  1395. value = 0; break;
  1396. default:
  1397. value = (typeof stored[i]=="function") ? stored[i] : "";
  1398. }
  1399. }
  1400.  
  1401. }
  1402. GM_config.passed_values[i] = value;
  1403. },
  1404. doReset : function(field, type, oldf, f, k) {
  1405. var isKid = k!=null && k==true, obj=GM_config,
  1406. set = isKid ? obj.settings[oldf]["kids"][f] : obj.settings[f];
  1407. switch(type) {
  1408. case 'text':
  1409. field.value = set['default'] || '';
  1410. break;
  1411. case 'hidden':
  1412. field.value = set['default'] || '';
  1413. break;
  1414. case 'textarea':
  1415. field.value = set['default'] || '';
  1416. break;
  1417. case 'checkbox':
  1418. field.checked = set['default'] || false;
  1419. break;
  1420. case 'select':
  1421. if(set['default']) {
  1422. for(var i=field.options.length-1; i>=0; i--)
  1423. if(field.options[i].value==set['default']) field.selectedIndex=i;
  1424. }
  1425. else field.selectedIndex=0;
  1426. break;
  1427. case 'span':
  1428. var radios = field.getElementsByTagName('input');
  1429. if(radios.length>0) for(var i=radios.length-1; i>=0; i--) {
  1430. if(radios[i].value==set['default']) radios[i].checked=true;
  1431. }
  1432. break;
  1433. }
  1434. },
  1435. values: {},
  1436. settings: {},
  1437. css: {
  1438. basic: 'body {background:#FFFFFF;}\n' +
  1439. '.indent40 {margin-left:40%;}\n' +
  1440. '* {font-family: arial, tahoma, sans-serif, myriad pro;}\n' +
  1441. '.field_label {font-weight:bold; font-size:12px; margin-right:6px;}\n' +
  1442. '.block {display:block;}\n' +
  1443. '.saveclose_buttons {\n' +
  1444. 'margin:16px 10px 10px 10px;\n' +
  1445. 'padding:2px 12px 2px 12px;\n' +
  1446. '}\n' +
  1447. '.reset, #buttons_holder, .reset a {text-align:right; color:#000000;}\n' +
  1448. '.config_header {font-size:20pt; margin:0;}\n' +
  1449. '.config_desc, .section_desc, .reset {font-size:9pt;}\n' +
  1450. '.center {text-align:center;}\n' +
  1451. '.section_header_holder {margin-top:8px;}\n' +
  1452. '.config_var {margin:0 0 4px 0; display:block;}\n' +
  1453. '.section_header {font-size:13pt; background:#414141; color:#FFFFFF; border:1px solid #000000; margin:0;}\n' +
  1454. '.section_desc {font-size:9pt; background:#EFEFEF; color:#575757; border:1px solid #CCCCCC; margin:0 0 6px 0;}\n' +
  1455. 'input[type="radio"] {margin-right:8px;}\n'+
  1456. '#saveBtn {position:fixed; top:100px; right:175px;}\n'+
  1457. '#cancelBtn {position:fixed; top:100px; right:75px;}\n'+
  1458. '.reset_holder {position:fixed;top:150px;right:100px;}\n',
  1459. stylish: ''},
  1460. create: function(a,b) {
  1461. var ret=window.document.createElement(a);
  1462. if(b) for(var prop in b) {
  1463. if(prop.indexOf('on')==0) ret.addEventListener(prop.substring(2),b[prop],false);
  1464. else if(prop=="kids" && (prop=b[prop])) for(var i=0; i<prop.length; i++) ret.appendChild(prop[i]);
  1465. else if(",style,accesskey,id,name,src,href,for".indexOf(","+prop.toLowerCase())!=-1) ret.setAttribute(prop, b[prop]);
  1466. else ret[prop]=b[prop];
  1467. }
  1468. return ret;
  1469. },
  1470. center: function() {
  1471. var node = GM_config.frame, style = node.style, beforeOpacity = style.opacity;
  1472. if(style.display=='none') style.opacity='0';
  1473. style.display = '';
  1474. style.top = Math.floor((window.innerHeight/2)-(node.offsetHeight/2)) + 'px';
  1475. style.left = Math.floor((window.innerWidth/2)-(node.offsetWidth/2)) + 'px';
  1476. style.opacity = '1';
  1477. },
  1478. run: function() {
  1479. var script=GM_config.getAttribute('script');
  1480. if(script && typeof script=='string' && script!='') {
  1481. func = new Function(script);
  1482. window.setTimeout(func, 0);
  1483. }
  1484. },
  1485. addEvent: function(el,ev,scr) { el.addEventListener(ev, function() { typeof scr == 'function' ? window.setTimeout(scr, 0) : eval(scr) }, false); },
  1486. remove: function(el) { if(el && el.parentNode) el.parentNode.removeChild(el); },
  1487. toggle : function(e) {
  1488. var node=GM_config.frame.contentDocument.getElementById(e);
  1489. node.style.display=(node.style.display!='none')?'none':'';
  1490. GM_config.setValue(e, node.style.display);
  1491. },
  1492. };
  1493.  
  1494.  
  1495.  
  1496. //Browser detection : credits http://www.quirksmode.org/js/detect.html
  1497. var BrowserDetect = {
  1498. init: function () {
  1499. this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
  1500. this.version = this.searchVersion(navigator.userAgent)
  1501. || this.searchVersion(navigator.appVersion)
  1502. || "an unknown version";
  1503. this.OS = this.searchString(this.dataOS) || "an unknown OS";
  1504. },
  1505. searchString: function (data) {
  1506. for (var i=0;i<data.length;i++) {
  1507. var dataString = data[i].string;
  1508. var dataProp = data[i].prop;
  1509. this.versionSearchString = data[i].versionSearch || data[i].identity;
  1510. if (dataString) {
  1511. if (dataString.indexOf(data[i].subString) != -1)
  1512. return data[i].identity;
  1513. }
  1514. else if (dataProp)
  1515. return data[i].identity;
  1516. }
  1517. },
  1518. searchVersion: function (dataString) {
  1519. var index = dataString.indexOf(this.versionSearchString);
  1520. if (index == -1) return;
  1521. return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
  1522. },
  1523. dataBrowser: [
  1524. {
  1525. string: navigator.userAgent,
  1526. subString: "Chrome",
  1527. identity: "Chrome"
  1528. },
  1529. { string: navigator.userAgent,
  1530. subString: "OmniWeb",
  1531. versionSearch: "OmniWeb/",
  1532. identity: "OmniWeb"
  1533. },
  1534. {
  1535. string: navigator.vendor,
  1536. subString: "Apple",
  1537. identity: "Safari",
  1538. versionSearch: "Version"
  1539. },
  1540. {
  1541. prop: window.opera,
  1542. identity: "Opera"
  1543. },
  1544. {
  1545. string: navigator.vendor,
  1546. subString: "iCab",
  1547. identity: "iCab"
  1548. },
  1549. {
  1550. string: navigator.vendor,
  1551. subString: "KDE",
  1552. identity: "Konqueror"
  1553. },
  1554. {
  1555. string: navigator.userAgent,
  1556. subString: "Firefox",
  1557. identity: "Firefox"
  1558. },
  1559. {
  1560. string: navigator.vendor,
  1561. subString: "Camino",
  1562. identity: "Camino"
  1563. },
  1564. { // for newer Netscapes (6+)
  1565. string: navigator.userAgent,
  1566. subString: "Netscape",
  1567. identity: "Netscape"
  1568. },
  1569. {
  1570. string: navigator.userAgent,
  1571. subString: "MSIE",
  1572. identity: "Explorer",
  1573. versionSearch: "MSIE"
  1574. },
  1575. {
  1576. string: navigator.userAgent,
  1577. subString: "Gecko",
  1578. identity: "Mozilla",
  1579. versionSearch: "rv"
  1580. },
  1581. { // for older Netscapes (4-)
  1582. string: navigator.userAgent,
  1583. subString: "Mozilla",
  1584. identity: "Netscape",
  1585. versionSearch: "Mozilla"
  1586. }
  1587. ],
  1588. dataOS : [
  1589. {
  1590. string: navigator.platform,
  1591. subString: "Win",
  1592. identity: "Windows"
  1593. },
  1594. {
  1595. string: navigator.platform,
  1596. subString: "Mac",
  1597. identity: "Mac"
  1598. },
  1599. {
  1600. string: navigator.userAgent,
  1601. subString: "iPhone",
  1602. identity: "iPhone/iPod"
  1603. },
  1604. {
  1605. string: navigator.platform,
  1606. subString: "Linux",
  1607. identity: "Linux"
  1608. }
  1609. ]
  1610.  
  1611. };
  1612.  
  1613. BrowserDetect.init();
  1614.  
  1615. //////-------------------------\\\\\\\
  1616. /////START OF BETTER USENET SCRIPT\\\\\\
  1617. ///////-------------------------////////
  1618.  
  1619. /********** DEBUG **********/
  1620. var DEBUG=GM_config.read().debug_log; //evaluated by every 'debug' function
  1621.  
  1622. //You want to know hwo long took the script ? Activate the option in config menu
  1623. var myDebugDate=new Date();
  1624. startExec=myDebugDate.getSeconds()*1000 + myDebugDate.getMilliseconds();
  1625. /********** SCRIPT VERSION CONTROL 0.5 *************/
  1626. /* Any help about this functions can be found at
  1627. http://sylvain.comte.online.fr/AirCarnet/?post/GreaseMonkey-Script-Update-Control
  1628. */
  1629.  
  1630. //Added by les-newsgroup
  1631. if (GM_config.read()['updater_timer'])
  1632. var GMSUCtime=parseInt(GM_config.read()['updater_timer']);
  1633. else var GMSUCtime=0;
  1634. //GMSUCtime :
  1635. // Delay before alert disapears (seconds)
  1636. // set to 0 if you don't want it to disapear (might be a bit intrusive!)
  1637.  
  1638. //Added by les-newsgroup
  1639. if (GM_config.read()['updater_delay'])
  1640. var GMSUCfreq=parseInt(GM_config.read()['updater_delay']);
  1641. else var GMSUCfreq=3;
  1642. //GMSUCfreq ==> Update control frequency (days)
  1643.  
  1644. /* colorpalettes */
  1645. // feel free to create your own. color in this order : back, highlight, front, light.
  1646. //var cpChrome=new colorPalette("#E1ECFE","#FD2","#4277CF","#FFF"); // but for Firefox ;-)
  1647. //var cpUserscript=new colorPalette("#000","#F80","#FFF","#EEE"); // javascrgeek only
  1648. //var cpFlickr=new colorPalette("#FFF","#FF0084","#0063DC","#FFF"); // pink my blue
  1649. var cpNG=new colorPalette("#616060","#F80","#FFF","#EEE"); // Les-Newsgroup palette
  1650. // choose yours
  1651. var GMSUCPal=cpNG; // colorPalette you prefer
  1652.  
  1653. /* launching script version control */
  1654. if(BrowserDetect.browser!='Chrome') GM_scriptVersionControl();
  1655.  
  1656. // define launch function
  1657. function GM_scriptVersionControl() {
  1658. // test if script should be performed to control new release regarding frequency
  1659. var GMSUCreleaseDate=new Date();
  1660. GMSUCreleaseDate.setFullYear(eval(thisReleaseDate.substring(0,4)),eval(thisReleaseDate.substring(4,6))-1,eval(thisReleaseDate.substring(6,8)));
  1661. var GMSUCtoday=new Date(); var GMSUCdif=Math.floor((GMSUCtoday-GMSUCreleaseDate)/1000/60/60/24);
  1662. if (GMSUCdif%GMSUCfreq==0) {
  1663. GMSUC_Control(0);
  1664. }
  1665. }
  1666.  
  1667. // define control function
  1668. function GMSUC_Control(force) { //force parameter : Added by les-newsgroup
  1669. var scriptId=thisId;var version=thisVersion;
  1670. var scriptMetasUrl=thisScriptFolderURL+scriptId+".meta.js";
  1671. // go to script home page to get official release number and compare it to current one
  1672. GM.xmlHttpRequest({
  1673. method: 'GET',
  1674. url: scriptMetasUrl,
  1675. headers: {
  1676. 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey/0.3',
  1677. 'Accept': 'text/html,application/xml,text/xml',
  1678. },
  1679. onload: function(responseDetails) {
  1680. var textResp=responseDetails.responseText;
  1681. var offRel=/\/\/\s*@version\s*(.*)\s*\n/i.exec(textResp);
  1682. if(offRel==null){ //Ce test est nécessaire car userscripts est quelque fois inaccessible
  1683. if (force) alert("No Updates");
  1684. return 0;
  1685. }
  1686. offRel=offRel[1];
  1687. var scriptName=/\/\/\s*@name\s*(.*)\s*\n/i.exec(textResp)[1];
  1688. if(offRel>version) {
  1689. // Styling
  1690. 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+"}");
  1691. // Lang detection and apply
  1692. var Langues="en, fr";
  1693. var lang=navigator.language;
  1694. var reg=new RegExp(lang,"g");
  1695. if(!Langues.match(lang)) lang="en";
  1696. /* traductions / translations */
  1697. var Txt=new Array();
  1698. for(i=1;i<8;i++) {Txt[i]=new Array();}
  1699. // français
  1700. Txt[1]["fr"]="Vous utilisez la version";
  1701. Txt[2]["fr"]="du script";
  1702. Txt[3]["fr"]="La version officielle est différente";
  1703. Txt[4]["fr"]="installer cette version";
  1704. Txt[5]["fr"]="";
  1705. Txt[6]["fr"]="";
  1706. Txt[7]["fr"]="Page de la version ";
  1707. // english
  1708. Txt[1]["en"]="You're using";
  1709. Txt[2]["en"]="version of";
  1710. Txt[3]["en"]="script. Official release version is different";
  1711. Txt[4]["en"]="install this version";
  1712. Txt[5]["en"]="";
  1713. Txt[6]["en"]="";
  1714. Txt[7]["en"]="Page of version ";
  1715. /* ------------------------------- */
  1716. //Added by Les-Newsgroup
  1717. if (document.getElementById('GMSUC-alerte')==null) { //then we did not create this div yet
  1718. var alerte=document.createElement('div');
  1719. alerte.setAttribute('id','GMSUC-alerte');
  1720. var GMSUCtextAlerte=Txt[1][lang]+" "+version+" "+Txt[2][lang]+" <i><b>"+scriptName+"</b></i>";
  1721. GMSUCtextAlerte+=". "+Txt[3][lang]+" ("+offRel+")";
  1722. GMSUCtextAlerte+="";
  1723. GMSUCtextAlerte+="<table><tr><td><a href='"+thisScriptReleaseNotes+"' target='_blank'>"+Txt[7][lang]+offRel+"</a></td><td><a id='installUpdate' target='_parent' href='"+thisScriptURL+"'>"+Txt[4][lang]+"</a></td></tr><td colspan=3 style='padding:7px;'><a href='#' id='closeUpdater'>Fermer</a></td></tr></table>"
  1724. if(GMSUCtime>0) GMSUCtextAlerte+="<div id='GMSUC-timer'>"+GMSUCtime+" s</div>";
  1725. GMSUCtextAlerte+="<div id='GMSUC-info'>"+Txt[6][lang]+" <a href='http://sylvain.comte.online.fr/AirCarnet/?post/GreaseMonkey-Script-Update-Control'>GM Script Update Control</a></div>";
  1726. document.body.appendChild(alerte);
  1727. document.getElementById('GMSUC-alerte').innerHTML=GMSUCtextAlerte;
  1728. document.getElementById('closeUpdater').addEventListener('click', function(){ document.getElementById('GMSUC-alerte').setAttribute('style','display:none');GMSUCtime=0;}, false );
  1729. document.getElementById('closeUpdater').href = 'javascript:void(0);';
  1730. document.getElementById('installUpdate').addEventListener('click', function(){ document.getElementById('GMSUC-alerte').setAttribute('style','display:none');GMSUCtime=0;}, false );
  1731. }else if(force) document.getElementById("GMSUC-alerte").setAttribute("style","display:visible;");
  1732.  
  1733. if(GMSUCtime>0 && document.getElementById("GMSUC-timer")!=null) {
  1734. function disparition() {
  1735. if(GMSUCtime>0) {
  1736. document.getElementById("GMSUC-timer").innerHTML=GMSUCtime+" s";
  1737. GMSUCtime+=-1;
  1738. setTimeout(disparition,1000)
  1739. }
  1740. else {
  1741. document.getElementById("GMSUC-alerte").setAttribute("style","display:none");
  1742. document.getElementById("GMSUC-timer").innerHTML='';
  1743. }
  1744.  
  1745. }
  1746. disparition();
  1747. }
  1748. }else if (force) alert("No Updates");
  1749. }
  1750. });
  1751. }
  1752.  
  1753. /* Color palette creator */
  1754. function colorPalette(b,h,f,l) {this.back=b;this.high=h;this.front=f;this.light=l;}
  1755.  
  1756. /******* END OF SCRIPT VERSION CONTROL **********/
  1757.  
  1758.  
  1759. /******** BetaSeries **********/
  1760.  
  1761. function cleanup_serie(str) {
  1762. /* Small function to cleanup a string, remove html tags, underscores, weird characters etc. */
  1763. str = str.replace(/[_-]/g, ' ') // _ or - to space
  1764. .replace(/[\(\)\."\[\]\{\}]/g, '')
  1765. .replace(/&amp;/g, 'and')
  1766. .replace(/[:;\?,!-]/g, ' ')
  1767. .replace(/ +/g, ' ') // double spaces
  1768. .replace(/ *$/, '') // remove lonely spaces
  1769. .replace(/^ */, '') // remove lonely spaces
  1770. .replace(/<\/?[^>]+(>|$)/g, ""); // HTML TAGS
  1771.  
  1772. debug(str);
  1773. serie_details = str.match(/^(?:\s*)(.*) (?:s|saison|season) *([0-9]{1,2})(?:[\- ,;]*(?:e|ep|ep\.|episode|episodes) *([0-9]{1,3}))?/i);
  1774. //serie_details[1]:title
  1775. //serie_details[2]:season
  1776. //serie_details[3]:episode
  1777.  
  1778. debug(serie_details[1]);
  1779.  
  1780. return serie_details;
  1781. }
  1782.  
  1783.  
  1784. function betaseriesGetUrl(serie_details, element){
  1785.  
  1786. if (serie_details == null) return 0;
  1787.  
  1788. var serieTitle=serie_details[1];
  1789. var serieUrl='';
  1790.  
  1791. GM.xmlHttpRequest({
  1792. method: 'GET',
  1793. url: 'http://api.betaseries.com/shows/search.json?key=7ecb330c435e&title='+serieTitle,
  1794. headers: {
  1795. 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
  1796. 'Accept': 'application/atom+xml,application/xml,text/xml',
  1797. 'X-BetaSeries-Version': '2.4',
  1798. },
  1799. onload: function(responseDetails) {
  1800. // debug(responseDetails.responseText);
  1801.  
  1802. var arrRes = eval('(' + responseDetails.responseText + ')');
  1803.  
  1804. if (arrRes.root.code=="1" && typeof arrRes.root.shows[0] != 'undefined') { //no error while fetching serie and fetched at least 1 serie
  1805.  
  1806. // debug(arrRes.root.shows[0].url);
  1807. if(typeof arrRes.root.shows[1] == 'undefined') //only one serie fetched, so we assumed that we found the good one ... can't verify it
  1808. serieUrl=arrRes.root.shows[0].url;
  1809. else{//fetched more than 1 serie ... but there can be only one !!
  1810. // var show;
  1811. // var showCount=0;
  1812. for(show in arrRes.root.shows){
  1813. 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
  1814. serieUrl=arrRes.root.shows[show].url;
  1815. break;
  1816. }
  1817. }
  1818. }
  1819.  
  1820. if(serieUrl != ''){
  1821. serie_details.push(serieUrl);
  1822. betaseriesGetInfos(serie_details, element);
  1823. }else
  1824. debug("betaseriesGetUrl() => Aucune correspondance : '"+ serieTitle.replace(' ', '') + "' ====> " + responseDetails.responseText);
  1825.  
  1826. }else{
  1827. debug("betaseriesGetUrl() => Pas de résultats / Erreur : '"+ serieTitle + "' ====> " + responseDetails.responseText);
  1828. void(0);
  1829.  
  1830. //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'
  1831. }
  1832. }
  1833. });
  1834.  
  1835. }
  1836.  
  1837.  
  1838. function betaseriesGetInfos(serie_details, element){
  1839.  
  1840. var serieTitle=serie_details[1];
  1841. var serieSeason=serie_details[2];
  1842. var serieEpisode=serie_details[3];
  1843. var serieUrl=serie_details[4];
  1844.  
  1845. var infosType=GM_config.read()['rating_BS_infos'];
  1846.  
  1847. if(infosType==1 || typeof serieSeason == 'undefined' || typeof serieEpisode == 'undefined') //We're fetching serie's Infos
  1848. var url='http://api.betaseries.com/shows/display/' + serieUrl + '.json?key=7ecb330c435e';
  1849. else
  1850. var url='http://api.betaseries.com/shows/episodes/' + serieUrl + '.json?key=7ecb330c435e&season=' + serieSeason + '&episode=' + serieEpisode;
  1851.  
  1852. debug('betaseriesGetInfos() => season:'+ serieSeason + ' - Episode:' + serieEpisode + ' - Série:' + serieUrl);
  1853.  
  1854. GM.xmlHttpRequest({
  1855. method: 'GET',
  1856. url: url,
  1857. headers: {
  1858. 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
  1859. 'Accept': 'application/atom+xml,application/xml,text/xml',
  1860. 'X-BetaSeries-Version': '2.4',
  1861. },
  1862. onload: function(responseDetails) {
  1863. // debug(responseDetails.responseText);
  1864.  
  1865. var arrRes = eval('(' + responseDetails.responseText + ')');
  1866.  
  1867. if (arrRes.root.code=="1") { //no error while fetching infos
  1868. if(infosType==1 || typeof serieSeason == 'undefined' || typeof serieEpisode == 'undefined'){
  1869. var objInfos=arrRes.root.show;
  1870. }else{
  1871. var objInfos=arrRes.root.seasons[0].episodes[0];
  1872. }
  1873. debug('betaseriesGetInfos() => title:' + objInfos.title + ' - Note:' + objInfos.note.mean + ' - Votes:' + objInfos.note.members + ' - Série:' + serieUrl);
  1874. addratingLinkToElement(element, [objInfos.title, objInfos.note.mean, 'http://www.betaseries.com/episode/' + serieUrl + '/s' + serieSeason + 'e' + serieEpisode, objInfos.note.members.toString()], 2, 2);
  1875. }else {
  1876. debug('betaseriesGetInfos() => Auncue info trouvée!');
  1877. addratingLinkToElement(element, 1, 1, 1, true);
  1878. }
  1879. }
  1880. });
  1881.  
  1882. }
  1883.  
  1884. /********START OF SCRIPT Show IMDB Ratings http://userscripts.org/scripts/review/56362 -- Script by Vigazor -- modified by les-newsgroup*********/
  1885. /* Whats been modified by les-newsgroup ?
  1886. starimage1 & starimage2
  1887.  
  1888. checkMovie()
  1889. - removed this function
  1890.  
  1891. handleDTentry()
  1892. -Split this function into two others (googleRequest & omdbApiRequest ... now googleRequest can call omdbApiRequest several times)
  1893. -Change the regular expression to match regular expression with a dot (7.3) AND or with a comma (7,3)
  1894. - modified the imdb url with the french one (.fr)
  1895. -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
  1896.  
  1897. cleanup()
  1898. - replaced 'and' by 'et' (french for 'and')
  1899. - added some special test to match binnewz typical titles
  1900.  
  1901. addratingLinkToElement()
  1902. -Replaced this function with the one of : 'Nitin Hayaran' (http://userscripts.org/scripts/show/59570)
  1903. -made some modifications
  1904. -added a caption to the stars div
  1905. -other modifications
  1906. -added modifications by Cook2
  1907. */
  1908. var starimage =''+
  1909. 'iVBORw0KGgoAAAANSUhEUgAAAMgAAAAoCAMAAACMwkUuAAAAAXNSR0IArs4c6QAAAARnQU1BAACx'+
  1910. 'jwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAABgUExURQAAAP7+/fv7/Pn5+vf39/789PPz8+3t'+
  1911. '7ebm5uDg4Pn12vDqz/XssuParPLnmtbKjbGcMrqnU8O0bcixN9fAP9zNdt/IPODg4OXOQ+jVV+nZ'+
  1912. 'c+3ZSfLgVPXssvfnbf///6oVmaEAAAAQdFJOUwAECAsPExciLjlFW5GcvtnZ3S3RAAABKElEQVRY'+
  1913. 'w+3ZzXKEIBAE4BlFEUVl1SysmOz7v2UG1/1JKtccmtq+WH63KaC1lCi/cC7W5GFUG5WFceN1DkbK'+
  1914. 'e8MZGGvvf48HZqxUrXUyb+SqlMI0mcv41xiNaZIfampYSy32tBLYiMq7NgxtRM2BGtz4MR22pSfL'+
  1915. 'sd2wjXRqsFKa4OXdBdGklpsiDdk8igzS5Nzch6o1tL3zzr+mysW+8jCyW8s5GMVtyMJsiFuVgdEq'+
  1916. 'aKGt6lo7DOs5xMs6WNu1su0QjaqPeV6W5RxCjBdJtID2eU1rMrrEoiFhxwxqxL1zSXc++gzRJN1N'+
  1917. 'l7AWhGxEp32llmUAN+VkvMQjtlXG7RGGttQBzo3tJPo8N4hWTG6SO+5Oc49scm5uXx2Z+xHaiP/4'+
  1918. 'qYhoOeQbGAy9N11bgA4AAAAASUVORK5CYII=';
  1919.  
  1920. var starimage0 =''+
  1921. 'iVBORw0KGgoAAAANSUhEUgAAAMgAAAAoCAMAAACMwkUuAAAAY1BMVEUAAAD+/v37+/z5+fr39/f+'+
  1922. '/PTz8/Pt7e3m5ubg4OD59drw6s/17LLj2qzy55rWyo2xnDK6p1PDtG3IsTfXwD/czXbfyDzg4ODl'+
  1923. 'zkPo1Vfp2XPt2Uny4FT17LL3523/AAD////+etw4AAAAEHRSTlMABAgLDxMXIi45RVuRnL7Z2d0t'+
  1924. '0QAAARZJREFUeAHt0lFugzAQhGFvMKzXOEASGhOclt7/lB0a2p5hrP4SWs33il2FSS0W6jDXma/C'+
  1925. 'JGTlN+RzNqnARHPOSm3ifaeqeds2w/XeUxpQLaPt+LIppyHoH1rHaqiD/ljDa6ixw4IwGwoHKrmJ'+
  1926. '5VeB25z/fW7c5hRTG7VsntpELZxwfbCO2FDw7lWn1PYfcwS1tdhHHebSMwq/ofIcqrC0lGdLb2gF'+
  1927. 'Jmpr+5iGYb0v5bEOKfUxCqW59u12m+f5viylPFBJhPb+6dA4gXddduxFSM3JeZp2/eYIIjXUv3Re'+
  1928. '1pMjNnTZ/xQayM1PExQ8cltrQARmNjRCxniFRmG203W6Ykl/uZ2JDV2scUjkPFIbljuisir7AriP'+
  1929. 'wKgnaJyBAAAAAElFTkSuQmCC';
  1930.  
  1931.  
  1932. var starimage1=''+
  1933. 'iVBORw0KGgoAAAANSUhEUgAAAGQAAAAoCAMAAAA/pq9xAAAAAXNSR0IArs4c6QAAAARnQU1BAACx'+
  1934. 'jwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAADSUExURQAAAKYwOa1NWa9nM6+GM7GcMrdmb7d5'+
  1935. 'UreSUrqnU7s0P8GObMGjbMO0bcZzN8aXN8ixN8s8SM9wdtCVmtE4QtZAStZ+QNakQNfAP9lSWdui'+
  1936. 'dtu2ndu7dtvFndxudNzNdtzRnd2CO92qO95ES9/IPODg4OJOVOKIROKwROWXV+W6V+XGyeXOQ+do'+
  1937. 'bOimdOjDdOjVV+mtsOnZc+qRSOq6SOrYzOrgzO3ZSe3ozO+cU+/DU/HN0PLgVPSsbvTObvTRtfTh'+
  1938. 'tfXts/fi0vfnbffs0vn00yklNIoAAAABdFJOUwBA5thmAAACCklEQVRIx+2VbVeiQBiGMcHKd5Z4'+
  1939. 'aV0NQ4SK1RSKCncVgv//l/aZmcM4CCEforOn4/3x+nBfPPPMHDjulP845lcws34G0PwKZtbKTDY1'+
  1940. 'sQytjTG0RkZprez7SIqO8LNZ+jzNOtkpp9Sc94rsbwH7U8B+F7BkU43Fb3kWveZZMC+Q+JuwEvPe'+
  1941. 'djnmvm5zzJiv8h/t+JsqLLa93CiR5eZGCWQjP8oaCpMKbAmS+IAtQBIdsAlIgswXh+F65viP6zBJ'+
  1942. 'yli82y1vbe9+uYupJ9puF1PLvVtsI+oJVqvJlWxcT1ZB6rkZDjVNmzmO7z9C/OQD9mswUFX11rY9'+
  1943. '7x7iIc/Pfl9RlKllue4dxEWeH+22KIpXsmwY1xCDeHQBVUKjgwq5D9mYRxqw2EhC2KiJNGCxkIQw'+
  1944. 'qYE0YJGRJB3vRRBQI64sY888jyxYk7KnZhNZsCZlD40GsmANsxXSqDnrI4xYVHvJMGJRrAXDiEWU'+
  1945. 'J+zqL/HpaFp4hF3gE1NV9qmc4xNTFPapnOETE8XMUxHgs1GlfoTxMArSjDOTgAU0o8wkYAGNdCDB'+
  1946. 'ndoRxuOAJivBHiUrwR6RYTq06VwPGsvZGAxjrguWPRuBYcR1wLJnEhgkrgUWRtITemQNw5dS1uW7'+
  1947. 'ZDWDZ8o6zQ5ZTf+JslajRVbTfmB2TC+uXsou6GXeL+WcXub9Us7oZZa+1+/wH/4dffbd60agAAAA'+
  1948. 'AElFTkSuQmCC';
  1949.  
  1950. var starimage2=''+
  1951. 'iVBORw0KGgoAAAANSUhEUgAAAMgAAAAoCAMAAACMwkUuAAAAAXNSR0IArs4c6QAAAARnQU1BAACx'+
  1952. 'jwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAFxUExURQAAAKYwMKdDMKlZMapuMayEMq1NUK9b'+
  1953. 'Tq+QM7FsT7GcMrJ9ULSQUbdmZ7eaUrhzZ7qCaLqnU7s0NLyRab1LNL6har9jNcF8NcGrbMOVNsO0'+
  1954. 'bcajN8ixN8s8PMxVPc9uPs9xcNCHPtCVldE6ONGCcNGgl9NVONOiP9OrmNSUctWmc9W2mNZCQNZw'+
  1955. 'OdawQNeLOdfAP9fCmthcQdi4dNlWUtnKnNp3QdqoOttuU9vDdtxvbtySQtzNdtzRnd2GVN24O95K'+
  1956. 'RN6Db99kRN+fVN+tQ9/IPOCXcODg4OJWTuJ/ReKqceK3VeK9RORvT+SbRuXAcuXGV+XGxuXOQ+du'+
  1957. 'aOeKUOepqOe3R+fMx+jMdOjTyOjVV+mFaemlUemvrenZc+nZyeq5rerHSOvgyuybauzAUu3Gr+3Z'+
  1958. 'Se3lzO3ozO6za+7RsO/QU/DdsfHLbPHOzfLUzvLgVPLy8vPls/TZbvTcz/Xj0PXts/fnbffr0fjw'+
  1959. '0/n003k3aXEAAAABdFJOUwBA5thmAAADh0lEQVRYw+3X21cSQRzA8UVBETXN+w0ITLFABFI0CQVE'+
  1960. 'EUVUMkTzAiZoSmAEBPz1/WbmMDvL8NA57oPr2d/j92k+zGUPgqCOOur850ReS4u8jgYx8lpaRPEt'+
  1961. 'wo6Cm6QqujFV4Y1WxTcV8kJbROmt+YmMKL2po4466ihw/src/rRpv9q0n23ajzbte5v2tU1rPMnb'+
  1962. '6o98q93yrXLBt/IJ34oHfCvstoHknqqytsxjiWvJ2zzX4hcPXIueZLkWOkhzLbB7yf+oidyTnK0e'+
  1963. 'y3BbUgsnuS2p+OLclpS9UW5Lip4QtyUFR4DfkitYTEPGlgJIvaUdAqTW0vYAUmlpOwApt7QgQIot'+
  1964. 'bR0gBckvWq1ebSdy51fVRkOOVi+VUpuxzFGqVKeWWj5/uBpO7h/ma9RSeXjYW/LFt/YeKtRSzmZ3'+
  1965. 'Fr3RjZ1smVqK6XRw3hNaC6aL1FK4vFyfdQSW1y8LTcuXmRmXy7WdSORy5zC5xjPb5+lpp9O5GYtl'+
  1966. 'MkcwGWT5NDlps9lWw+Fkch8miSwfx8ctFsuSzxePb8HEkeXD2JjZbF70eqPRDZgosrwfGTGZTPMe'+
  1967. 'Tyi0BhNClndDQ0ajcdbhCASWYQLffiOJ34CWA6tJoMUQ3XPaih5RQBJDENLcOkQBSRhBSLNrEQUk'+
  1968. 'PgQhbaETUUDiRRDS5joQBSQeBCHNqkEUkDgQpLlN9wYDWg1ejhztTq9HEkxpthudDkkwpdmutVok'+
  1969. 'wZRmO+vsRBJMabbTjg4kwZRmO9ZokARTmFtCVuNKXMnUiMQZSzGNSGzhQ6YRicW3xzQiMXt3mEYk'+
  1970. 'Jk+QaURidKyz1/0tPiEuV1Wm9gafLqeT/ZT04dNls7Gfkl58uiwW9lPSg0+X2cx+Srrx6TKZ2E9J'+
  1971. 'Fz5dRqPkU2KAnxUtxy9T08OWIMqKZEdAAhS3ZEdAAhS7ZEdAApQFyY6ABChzkh0BCVCsLRC8HpdM'+
  1972. 'TY8HKFIIttikEGyxSCHYYpZCsMUkhWCLkWl+WIlfmILVyNNWQLEiTIBEbG5QuIVRkIjNDgq7MAwS'+
  1973. 'sS2AYkEYBInY5kAxJwyARGxWUFiFfpAwkCnDFDnuM/eytAn9BLkq03e0jepGyVWZvKFtWDtMrsr4'+
  1974. 'NW2DnYPkqoyd0TbQMUCuysgpbf2afnJVho6Z+0ofU78s7Q19iMVL0kcfYvGS9NKHWLwkPfQhFi9J'+
  1975. 'N32IxUvSRR9iq/oX7CXOP0hn0ljJajC/AAAAAElFTkSuQmCC';
  1976.  
  1977. // Cook2 : More cleanings
  1978.  
  1979. function cleanup(str) {
  1980. /* Small function to cleanup a string, remove html tags, underscores, weird characters etc. */
  1981. var str1 = str.replace(/ \(?(\+|sur)?(\s*\(a(lt)?.*\.?b.*\.[a-z0-9\.\-_@]+)\s*\)?/ig, '')
  1982. .replace(/(autres? post|\*.*\*)/i, '')
  1983. .replace(/\"/g, '') // "
  1984. //.replace(/\'/g, '') // ' //do not replace '
  1985. .replace(/\./g, ' ') // . to space
  1986. .replace(/_/g, ' ') // _ to space
  1987. .replace(/-/g, ' ') // - to space
  1988. .replace(/:/g, ' ') // : space
  1989. .replace(/\s/g, ' ') // unbreakable space to space
  1990. .replace(/[23]d/gi, '')
  1991. .replace(/films? hd/i, '')
  1992. .replace(/animes? hd/i, '')
  1993. .replace(/\(hsbs\)/i, '')
  1994. .replace(/\{720[ip]\}/i, '')
  1995. .replace(/\{1080[ip]\}/i, '')
  1996. .replace(/\(\D*\)/g, '')
  1997. .replace(/\[.*\]/g, '')
  1998. .replace(/\(/g, ' ') // (
  1999. .replace(/\)/g, ' ') // )
  2000. .replace(/ +/g, ' ') // double spaces
  2001. .replace(/ $/, '') // remove last lonely space
  2002. .replace(/^ /, '') // remove first lonely space
  2003. .replace(/&amp;/g, 'et')
  2004. .replace(/<\/?[^>]+(>|$)/g, ''); // HTML TAGS
  2005.  
  2006. // debug('cleanup( ' + str + ' ) => ' + str1 );
  2007.  
  2008. return str1;
  2009. }
  2010.  
  2011. //This function adds thousand separator to the number paramter
  2012. function formatVotes(nvotes)
  2013. {
  2014.  
  2015. if(isNaN(nvotes)) return;
  2016.  
  2017. var sRegExp=/([0-9]+)([0-9]{3})/i;
  2018. while(sRegExp.test(nvotes))
  2019. {
  2020. nvotes = nvotes.replace(sRegExp, '$1 $2');
  2021. }
  2022. return nvotes;
  2023. }
  2024.  
  2025. function space(num)
  2026. {
  2027. return new Array((num|0) + 1).join("-");
  2028. }
  2029.  
  2030. //This function can search for a movie via two ways : using the site www.omdbapi.com or using the imdb website
  2031. //the 'searchTry' param is used to cycle trough thye different way to get the movie info
  2032. //
  2033. // 0->1 = omdbapi Title + Year -> Data
  2034. // 1->2 = omdbapi Title + (Year-1) -> Data
  2035. // 2->3 = omdbapi Title + (Year+1) -> Data
  2036. // 3->4 = imdb.com Title + Year -> imdbID
  2037. //
  2038. // 10->11 = omdbapi Title -> Data
  2039. // 11->12 = imdb.com Title -> imdbID
  2040. // 12->13 = duckduckgo Title +/- Year -> imdbID/Data
  2041. //
  2042. // 20->21 = omdbapi imdbID -> Data
  2043. // 21->22 = imdb.com imdbID -> Data
  2044.  
  2045. function imdbRequest(searchTitle, element, searchTry)
  2046. {
  2047. searchTry=(searchTry|0) + 1;
  2048.  
  2049. requestImdbID = searchTitle.match(/tt\d{7}/);
  2050. if(requestImdbID)
  2051. if(searchTry<21) searchTry=21; // 20 = omdbapi imdbID -> Data
  2052. cleanTitle = searchTitle.replace(/\s*tt\d{7}\s*/,''); // Title without imdbID
  2053. requestYear = cleanTitle.match(/[0-9]{4}$/);
  2054. if(!requestYear)
  2055. if(searchTry<11) searchTry=11; // 10 = omdbapi Title -> Data
  2056.  
  2057. requestTitle = cleanTitle.replace(/\+[0-9]{4}$/, '').replace(/\+[0-9]{4}$/, ''); // Title without year (eventually 2)
  2058.  
  2059. debug(space(searchTry/10)+'imdbRequest( ['+(searchTry)+'] '+searchTitle+' ) => cleanTitle : ' + cleanTitle + ' requestTitle : ' + requestTitle + ' requestYear : ' + requestYear + ' requestImdbID : ' + requestImdbID);
  2060.  
  2061. if(!requestImdbID && !requestTitle)
  2062. {
  2063. debug(space(searchTry/10)+'imdbRequest( ['+(searchTry)+'] '+searchTitle+' ) => Nothing to search : no Title and no imdbID' );
  2064. return;
  2065. }
  2066.  
  2067. if(searchTry==5) searchTry=11; // keep space for aditional search method
  2068.  
  2069. switch (searchTry)
  2070. {
  2071. case 1: // 0 = omdbapi Title + Year -> Data
  2072. requestUrl='http://www.omdbapi.com/?t=' + requestTitle +'&y='+ requestYear;
  2073. break;
  2074.  
  2075. case 2: // 1 = omdbapi Title + (Year-1) -> Data
  2076. requestUrl='http://www.omdbapi.com/?t=' + requestTitle +'&y='+ ((requestYear|0)-1);
  2077. break;
  2078.  
  2079. case 3: // 2 = omdbapi Title + (Year+1) -> Data
  2080. requestUrl='http://www.omdbapi.com/?t=' + requestTitle +'&y='+ ((requestYear|0)+1);
  2081. break;
  2082.  
  2083. case 4: // 3 = imdb.com Title + Year -> imdbID
  2084. requestUrl='http://www.imdb.com/find?q=' + requestTitle + '+(' + requestYear + ')&s=tt';
  2085. break;
  2086.  
  2087. case 11: // 10 = omdbapi Title -> Data
  2088. requestUrl='http://www.omdbapi.com/?t=' + requestTitle;
  2089. break;
  2090.  
  2091. case 12: // 11 = imdb.com Title -> imdbID
  2092. requestUrl='http://www.imdb.com/find?q=' + requestTitle + '&s=tt';
  2093. break;
  2094.  
  2095. case 13: // 12 = duckduckgo Title +/- Year -> imdbID/Data
  2096. if(requestYear)
  2097. requestUrl='https://duckduckgo.com/?q=!ducky+'+ requestTitle + '+(' + requestYear + ')+site%3Aimdb.com'
  2098. else
  2099. requestUrl='https://duckduckgo.com/?q=!ducky+'+ requestTitle + '+site%3Aimdb.com'
  2100. break;
  2101.  
  2102. case 21: // 20 = omdbapi imdbID -> Data
  2103. requestUrl='http://www.omdbapi.com/?i=' + requestImdbID;
  2104. break;
  2105.  
  2106. case 22: // 21 = imdb.com imdbID -> Data
  2107. requestUrl='http://www.imdb.com/title/' + requestImdbID + '/';
  2108. break;
  2109.  
  2110.  
  2111. default:
  2112. requestUrl='https://duckduckgo.com/?q=!ducky+'+ requestTitle + '+(' + requestYear + ')+site%3Aimdb.com'
  2113. debug(space(searchTry/10)+'imdbRequest( ['+searchTry+'] '+searchTitle+' ) => Last search step requestURL : ' + requestUrl + ' *Title not Found*' );
  2114. addratingLinkToElement(element, [requestTitle.replace(/\+/g, ' ') + " (" + requestYear + ")", 0, requestUrl, 0], 1, 1, true) // Nothing found despite all these efforts
  2115. return;
  2116. }
  2117.  
  2118. debug(space(searchTry/10)+'imdbRequest( ['+searchTry+'] '+searchTitle+' ) => requestURL : ' + requestUrl);
  2119.  
  2120.  
  2121. GM.xmlHttpRequest
  2122. (
  2123. {
  2124. method: 'GET',
  2125. url: requestUrl,
  2126. headers:
  2127. {
  2128. 'User-agent': 'Mozilla/4.0',
  2129. 'Accept': 'application/atom+xml,application/xml,text/xml',
  2130. },
  2131. onload: function(responseDetails)
  2132. {
  2133. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => finalURL : ' + responseDetails.finalUrl);
  2134. //debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => responseText : ' + responseDetails.responseText);
  2135.  
  2136. var res = responseDetails.responseText;
  2137.  
  2138. // Please see https://regex101.com in case you need some help with RegEx
  2139.  
  2140. imdbFind = '<td class="result_text"> <a href="\\/title\\/tt(\\d{7})\\/\\?ref_=fn_.{2}_tt_1" >([^<>]*)<\\/a>[^<>]*\\((\\d{4})\\)[^<>]*<\\/td>';
  2141. var imdbMatch = res.match(imdbFind);
  2142. // debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => IMDb List Page : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
  2143.  
  2144. if (imdbMatch!=null)
  2145. {
  2146. var imdbTitle = '';
  2147. var imdbYear = '';
  2148.  
  2149. var urlMatch = responseDetails.finalUrl.match(/\+\((\d{4})\)/);
  2150.  
  2151. if (urlMatch!=null)
  2152. {
  2153. imdbYear = urlMatch[1];
  2154. imdbTitle = searchTitle.replace(/ tt\d{7}$/, '').replace(/\+(\d{4})$/, '').replace(/\+/g, ' ');
  2155.  
  2156. imdbFind = '<td class="result_text"> <a href="\\/title\\/tt(\\d{7})\\/\\?ref_=fn_.{2}_tt_\\d+" >'+imdbTitle+'<\\/a>[^<>]*\\('+imdbYear+'\\)[^<>]*<\\/td>';
  2157. var imdbMatch = res.toLowerCase().match(imdbFind);
  2158. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => Year : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
  2159.  
  2160. if (imdbMatch==null)
  2161. {
  2162. imdbYear = ((imdbYear|0)-1);
  2163. imdbFind = '<td class="result_text"> <a href="\\/title\\/tt(\\d{7})\\/\\?ref_=fn_.{2}_tt_\\d+" >'+imdbTitle+'<\\/a>[^<>]*\\('+imdbYear+'\\)[^<>]*<\\/td>';
  2164. var imdbMatch = res.toLowerCase().match(imdbFind);
  2165. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => Year-1 : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
  2166. }
  2167.  
  2168. if (imdbMatch==null)
  2169. {
  2170. imdbYear = ((imdbYear|0)+2);
  2171. imdbFind = '<td class="result_text"> <a href="\\/title\\/tt(\\d{7})\\/\\?ref_=fn_.{2}_tt_\\d+" >'+imdbTitle+'<\\/a>[^<>]*\\('+imdbYear+'\\)[^<>]*<\\/td>';
  2172. var imdbMatch = res.toLowerCase().match(imdbFind);
  2173. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => Year+1 : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
  2174. }
  2175.  
  2176. if (imdbMatch==null)
  2177. {
  2178. imdbFind = '<td class="result_text"> <a href="\\/title\\/tt(\\d{7})\\/\\?ref_=fn_.{2}_tt_1" >([^<>]*)<\\/a>[^<>]*\\((\\d{4})\\)[^<>]*<\\/td>';
  2179. var imdbMatch = res.match(imdbFind);
  2180. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => 1st Item : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
  2181. }
  2182. }
  2183. else
  2184. {
  2185. imdbFind = '<td class="result_text"> <a href="\\/title\\/tt(\\d{7})\\/\\?ref_=fn_.{2}_tt_1" >([^<>]*)<\\/a>[^<>]*\\((\\d{4})\\)[^<>]*<\\/td>';
  2186. var imdbMatch = res.match(imdbFind);
  2187. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => No Year : ' + imdbFind + ((imdbMatch!=null)?' *Found*':' *Not Found*'));
  2188. }
  2189. }
  2190.  
  2191. if (imdbMatch!=null)
  2192. {
  2193. imdbID = 'tt'+imdbMatch[1];
  2194. if(!imdbTitle) imdbTitle = imdbMatch[2];
  2195. if(!imdbYear) imdbYear = imdbMatch[3];
  2196. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => imdbID Parsed from IMDb list : ' + imdbID + ' ' + imdbTitle + ' (' + imdbYear + ')');
  2197.  
  2198. imdbRequest(searchTitle + ' ' + imdbID, element, searchTry); // next try with imdbID found
  2199. }
  2200. else
  2201. {
  2202. var titleMatchVF = res.match(/<title>(.*) - IMDb<\/title>/); // <title>La cour de Babel (2013) - IMDb</title>
  2203. var titleMatchVO = res.match(/<meta property='og:title' content="(.*)" \/>/); // <meta property='og:title' content="School of Babel (2013)" />
  2204. var ratingMatch = res.match(/itemprop="ratingValue">([\d\.,]*)<\/span>/); // itemprop="ratingValue">7,2</span>
  2205. var votesMatch = res.match(/itemprop="ratingCount">([\d, ]*)<\/span>/); // itemprop="ratingCount">281</span>
  2206.  
  2207. if ((titleMatchVO!=null && titleMatchVO[1]!='') || ratingMatch!=null || votesMatch!=null)
  2208. {
  2209. var imdbTitle='';
  2210. var imdbRating = 0.0;
  2211. var imdbVotes = 0;
  2212.  
  2213. if (titleMatchVF) imdbTitle = titleMatchVF[1];
  2214. if (titleMatchVF && titleMatchVO) imdbTitle += ' ';
  2215. if (titleMatchVO) imdbTitle += titleMatchVO[1];
  2216.  
  2217. if (ratingMatch) imdbRating = ratingMatch[1].replace(/,/g, '.');
  2218. if (votesMatch) imdbVotes = votesMatch[1].replace(/[, ]/g, '');
  2219.  
  2220. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => imdbRating Parsed from IMDd page : ' + imdbTitle + ' ' + imdbRating + ' (' + imdbVotes + ') ' + responseDetails.finalUrl);
  2221.  
  2222. addratingLinkToElement(element, [imdbTitle, imdbRating, responseDetails.finalUrl, imdbVotes], 1, 1);
  2223. }
  2224. else
  2225. {
  2226. if(res.match('"Response":"True"'))
  2227. {
  2228. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => responseText : ' + responseDetails.responseText);
  2229.  
  2230. var arrRes = eval('(' + responseDetails.responseText + ')');
  2231.  
  2232. imdbTitle = searchTitle.replace(/ tt\d{7}$/, '').replace(/\+(\d{4})$/, '').replace(/\+/g, ' ');
  2233.  
  2234. if (arrRes.Response=='True') //no error while fetching movie
  2235. {
  2236. var imdbUrl='http://www.imdb.com/title/' + arrRes.imdbID + '/combined';
  2237.  
  2238. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => omdbRating Parsed from OMDb Api : ' + arrRes.Title + ' (' + arrRes.Year + ') ' + arrRes.imdbRating + ' (' + arrRes.imdbVotes.replace(',', '') + ') ' + imdbUrl);
  2239.  
  2240. if( arrRes.imdbRating == 'N/A' || typeof arrRes.imdbRating == 'undefined' || arrRes.imdbRating<=0 )
  2241. imdbRequest(searchTitle, element, searchTry); // next try
  2242. else
  2243. addratingLinkToElement(element, [arrRes.Title + " (" + arrRes.Year + ")", arrRes.imdbRating, imdbUrl, arrRes.imdbVotes.replace(/,/g,'')], 1, 1);
  2244. }
  2245. else
  2246. imdbRequest(searchTitle, element, searchTry); // next try
  2247. }
  2248. else
  2249. {
  2250. var imdbMatch = searchTitle.match(/tt(\d{7})$/);
  2251.  
  2252. if (imdbMatch==null) // imdbID is still unknown
  2253. {
  2254. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => responseText : ' + responseDetails.responseText);
  2255.  
  2256. if(dickduckgoMatch = responseDetails.finalUrl.match(/duckduckgo\.com/))
  2257. {
  2258. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => Try to parse imdbID from DuckDuckGo request');
  2259.  
  2260. if(imdbID = responseDetails.responseText.match(/tt\d{7}/))
  2261. {
  2262. debug(space(searchTry/10)+'>imdbOnLoad( ['+searchTry+'] '+searchTitle+' ) => imdbID Parsed from DuckDuckGo request : ' + imdbID);
  2263.  
  2264. imdbRequest(searchTitle + ' ' + imdbID, element, searchTry); // next try with imdbID found
  2265. }
  2266. else
  2267. imdbRequest(searchTitle, element, searchTry); // next try
  2268. }
  2269. else
  2270. imdbRequest(searchTitle, element, searchTry); // next try
  2271. }
  2272. else
  2273. imdbRequest(searchTitle, element, searchTry); // next try
  2274. }
  2275. }
  2276. }
  2277. }
  2278. }
  2279. );
  2280. }
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286. //element: DOM Object
  2287. //ratingLink : rating informations [title, note, url of info page, votes]
  2288. //mediaType : 1 => Imdb
  2289. // 2 => BetaSeries
  2290. //Modifier : 1 => original note is 10based
  2291. // 2 => original note is 5based
  2292.  
  2293. 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
  2294.  
  2295. ratingError=ratingError||false; //set default
  2296.  
  2297. //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
  2298. if (typeof ratingLink[2] != 'undefined' && (ratingLink[2].indexOf('imdb') != -1 || ratingLink[2].indexOf('betaseries') != -1 || ratingLink[2].indexOf('duckduckgo') != -1))
  2299. {
  2300. ratingOpenLink="<a target='_blank' href='" + ratingLink[2] + "'>";
  2301. ratingCloseLink="</a>"
  2302. }
  2303. else
  2304. {
  2305. ratingOpenLink="";
  2306. ratingCloseLink=""
  2307. }
  2308.  
  2309. if (ratingLink && ratingLink != -1)
  2310. {
  2311. ratingElement = "<!-- Container -->";
  2312. if (GM_config.read().rating_twolines)
  2313. {
  2314. ratingElement += "<div style='height:20px; margin-left:10px; margin-top:3px; '>"; // For two lines
  2315. }
  2316. else
  2317. {
  2318. ratingElement += "<div style='float:left;'>"; // For everything on one line AND IMDB stars
  2319. }
  2320.  
  2321. ratingElement+=ratingOpenLink;
  2322.  
  2323. ratingElement += "<!-- Starbar --><div ";
  2324. noresult=false;
  2325. if (ratingError || ratingLink[1] == 'N/A' || typeof ratingLink[1] == 'undefined' || ratingLink[1]<=0 )
  2326. {
  2327. if (ratingError)
  2328. ratingElement+="title='" + (mediaType==2 && GM_trans.lang('rating_serie')==2?GM_trans.lang('episode_title') + ' : ':'') + ratingLink[0].replace(/['"]/g, ' ') + " - " + GM_trans.lang('ratingerror') + "' ";
  2329. else
  2330. ratingElement+="title='" + (mediaType==2 && GM_trans.lang('rating_serie')==2?GM_trans.lang('episode_title') + ' : ':'') + ratingLink[0].replace(/['"]/g, ' ') + " - " + GM_trans.lang('norating') + "' ";
  2331.  
  2332. ratingElement+="style='height:20px; float:left;'>";
  2333.  
  2334. if (GM_config.read().rating_showgreystars)
  2335. ratingElement += "<div style='position:relative;width: " + GM_config.read().rating_shownotation * 100 + "px;height: 20px;background: url(data:image/png;base64," + starimage0 + ") no-repeat 0px 0px;'></div>";
  2336. else
  2337. if (ratingError)
  2338. ratingElement += GM_trans.lang('ratingerror');
  2339. else
  2340. ratingElement += GM_trans.lang('norating');
  2341. noresult=true;
  2342. }
  2343. else
  2344. {
  2345. 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') + "' ";
  2346. ratingElement+="style='height:20px; float:left;'>";
  2347.  
  2348. if (GM_config.read().rating_starmode != 1) // starmode 2 & 3 = Stars only & Rating + stars
  2349. {
  2350.  
  2351. //New rating display mode by Cook2
  2352. if(GM_config.read().rating_displayMode_byCook2)
  2353. {
  2354.  
  2355. starrating = ratingLink[1] * modifier;
  2356. if ( mediaType == 1)
  2357. starrating = (starrating * starrating)/81*6-1; // en fonction du carré de la note en enlevant les extrèmes
  2358. else
  2359. starrating = (starrating * starrating)/100*6-1; // en fonction du carré de la note en enlevant les extrèmes
  2360.  
  2361. 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
  2362.  
  2363. if (starrating <= 0) starrating = 0;
  2364. if (starrating >= 5 * GM_config.read().rating_shownotation) starrating = 5 * GM_config.read().rating_shownotation;
  2365.  
  2366.  
  2367. if (ratingLink[3] != 'N/A' && ratingLink[3] > 0)
  2368. {
  2369. if ( mediaType == 1)
  2370. starvote = Math.sqrt(ratingLink[3])/10;
  2371. else
  2372. starvote = Math.sqrt(ratingLink[3]);
  2373. }
  2374. else
  2375. starvote = 0;
  2376.  
  2377. if (starvote <= 1) starvote = 1;
  2378. if (starvote >= 20) starvote = 20;
  2379. starpos = starvote - 40;
  2380. startop = 20 - starvote;
  2381.  
  2382. imdbrating='';
  2383. if (GM_config.read().rating_showgreystars) imdbrating = "<div style='position:relative;width: " + GM_config.read().rating_shownotation * 100 + "px;height: 20px;background: url(data:image/png;base64," + starimage + ") no-repeat 0px 0px;'>";
  2384. imdbrating += "<div style='position:relative;width: " + 20 * starrating + "px;height: 20px;background: url(data:image/png;base64," + starimage + ") no-repeat 0px -20px'>";
  2385. imdbrating += "<div style='position:relative;width: " + 20 * starrating + "px;height: " + starvote + "px;top: " + startop + "px;background: url(data:image/png;base64," + eval('starimage'+GM_config.read().rating_shownotation) + ") no-repeat 0px " + starpos + "px;'>";
  2386. imdbrating += "</div></div>";
  2387. if (GM_config.read().rating_showgreystars) imdbrating += "</div>";
  2388. ratingElement += imdbrating;
  2389. //End
  2390. }
  2391. else
  2392. {
  2393. imdbrating='';
  2394. if (GM_config.read().rating_showgreystars) imdbrating = "<div style='width: " + GM_config.read().rating_shownotation * 100 + "px;height: 20px;background: url(data:image/png;base64," + starimage2 + ") no-repeat 0px 0px;'>";
  2395. imdbrating += "<div style='width: " + GM_config.read().rating_shownotation * 10 * ratingLink[1] * modifier + "px;height: 20px;background: url(data:image/png;base64," + eval('starimage'+GM_config.read().rating_shownotation) + ") no-repeat 0px -20px;'>";
  2396. imdbrating += "</div>";
  2397. if (GM_config.read().rating_showgreystars) imdbrating += "</div>";
  2398. ratingElement += imdbrating;
  2399. }
  2400. }
  2401. }
  2402.  
  2403. if(GM_config.read().rating_starmode != 2 && !noresult) //rating_starmode = 1 & 3 : Rating & Rating + Stars
  2404. {
  2405. ratingElement += "</div><!-- End Starbar -->";
  2406.  
  2407. ratingElement += ratingCloseLink;
  2408.  
  2409. ratingElement += ratingOpenLink + "<b>";
  2410.  
  2411. ratingElement += "&nbsp;" + ratingLink[1] * modifier;
  2412.  
  2413. //Adding /10 (or /5) on rating display
  2414. if(GM_config.read().rating_displayMode)
  2415. ratingElement += " / " + 5 * Math.abs(modifier-3);
  2416.  
  2417.  
  2418. ratingElement += "</b>" + ratingCloseLink;
  2419.  
  2420.  
  2421. }
  2422. else // normal behavior
  2423. {
  2424. ratingElement+=ratingCloseLink;
  2425. ratingElement += "</div><!-- End Starbar -->";
  2426. }
  2427.  
  2428. if (GM_config.read().rating_showvotes && ratingLink[3] != 'N/A' && typeof ratingLink[3] != 'undefined')
  2429. {
  2430. ratingElement += "&nbsp; (" + formatVotes(ratingLink[3]) + " " + GM_trans.lang('votes') + ") ";
  2431. }
  2432.  
  2433. ratingElement += "</div>&nbsp;";
  2434. newText= element.parentNode.innerHTML + ratingElement;
  2435. element.parentNode.innerHTML = newText;
  2436. }
  2437. }
  2438.  
  2439.  
  2440. //----------------------------------------------
  2441. //----------------------------------------------
  2442. //---------------LOCALIZATION-----------
  2443. //----------------------------------------------
  2444. //----------------------------------------------
  2445.  
  2446. GM_trans.setTranslations('en',{
  2447. //Localization of configuration
  2448. 'ConfigTitle': '\'Better Usenet\' Settings',
  2449. 'script_options':'General settings',
  2450. 'updater_timer':'Seconds to wait before autoclosing the updater window (0=no autoclose timer)',
  2451. 'updater_delay':'Days between new update checking',
  2452. 'noupdate':'No \'Better Usenet\' update',
  2453. 'language_option':'Display language (\'Save\' to apply)',
  2454. 'language_section':'Language',
  2455. 'option_fixedheader':'Make the header (menu + search) fixed',
  2456. 'option_deletead':'Delete the ad banner',
  2457. 'option_forcessl':'Force SSL protocol',
  2458. 'option_scrolltoresults':'Go to search results after loading page',
  2459. 'option_resize':'Change the results table width (%)',
  2460. 'option_othernzbindexerbuttons':'Add a button to do the same search on other NZB Indexers',
  2461. 'option_nocheckboxifpassword':'Delete the selection checkbox if the result is password protected',
  2462. 'option_highlightifpassword':'Highlight a result if it is password protected',
  2463. 'display_binsearch1':'Display a link to Binsearch (popular groups)',
  2464. 'display_binsearch2':'Display a link to Binsearch (other groups) (not recommended)',
  2465. 'display_nzbindex':'Display a link to NZBIndex',
  2466. 'display_nzbfriends':'Display a link to NZBFriends',
  2467. 'display_allocine':'Display a link to Allociné', //Cook2 Allociné added (replace dead Yubse)
  2468. 'display_thxlink':'Display a link to thanks the poster of each release',
  2469. 'display_infolink':'Display a link to retrieve votes for an element',
  2470. 'thxlink_title':'Thank you !',
  2471. 'infolink_title':'Find its ratings',
  2472. 'binnewz_selectedresultcolor':'Color to highlight the \'Age\' and \'Group\' cells if matching',
  2473. 'binnewz_highlighttolerance':'Accept a +-1 day tolerance when trying to determine if \'Age\' cell match Binnewz selection',
  2474. 'binnewz_toleranceresultcolor':'Color to highlight the \'Age\' if matching with tolerance',
  2475. 'binnewz_displaysearchinformations':'Display details of your Binnewz selection on Binsearch and NZBIndex',
  2476. 'binnewz_nzblinks_place':'Display NZB links in the following column',
  2477. 'nzblinks_place_title':'Title ("Titre" in french)',
  2478. 'nzblinks_place_file':'File ("Fichier " in french)',
  2479. 'nzblinks_place_size':'Size ("Taille" in french)',
  2480. 'binnewz_deletenodeifpassword':'Hide results that are password protected or virus',
  2481. 'binnewz_highlightifpassword':'Highlight a result if it is password protected or a virus',
  2482. 'binnewz_donothingifpassword':'Do not display NZB links and do not fetch rating for a result that is password protected or virus',
  2483. 'binsearch_nzbbuttons':'Add a NZB button for each result',
  2484. 'binsearch_nzbbuttoncolor':'NZB button\'s color',
  2485. 'binsearch_nonzbbuttonifpassword':'Do not add a NZB button if Binsearch says the result is password protected',
  2486. 'binsearch_missingpartsdetails_option':'If there is missing parts, display precisly how many are missing',
  2487. 'binsearch_selectbuttons':'Add new selection buttons (Select all / Cancel selection) [Firefox only]',
  2488. '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)',
  2489. 'binsearch_autoloadothersearch':'If there is no result from the selected groups (popular/other), automaticaly do the same search on the other groups (other/popular)',
  2490. 'binsearch_autoloadnzbindex':'If there is really no result on Binsearch, automaticaly do the same search on NZBIndex',
  2491. 'binsearch_delete_oldcontentline':'Delete the yellow line inserted by Binsearch when it displays old results',
  2492. 'binsearch_advancedsearch':'Activate Binsearch\'s advanced search form',
  2493. 'binsearch_showcollections':'Only show collections (you need to activate the advanced search)',
  2494. 'nzbindex_nonzbbuttonifpassword':'Remove the \'download\' link if NZBIndex says the result is password protected',
  2495. 'nzbindex_delete_oldcontentline':'Delete the yellow line inserted by NZBIndex when it displays old results',
  2496. 'nzbindex_onlycollections':'Only display \'collection\' type results (you can still deactivate it with the checkbox on top of results)',
  2497. 'nzbindex_orderbuttons':'Add icons to order results by size or age',
  2498. 'nzbindex_resultLinks_fontSize':'Font size for the "Download" and "View Collection" links (nzbindex default : 10 pixel)',
  2499. 'nzbindex_autoloadbinsearch':'If no result on NZBIndex, do the same search on Binsearch automatically',
  2500. 'rating':'Rating',
  2501. 'rating_imdb':'Fetch rating + votes from IMDB database and display it on every appropriate results on Binnewz (movies, animes, documentaries)',
  2502. 'rating_betaseries':'Fetch rating + votes from BetaSeries database and display it on every appropriate results on Binnewz (series only)',
  2503. 'rating_BS_infos':'Fetching infos from BetaSeries for : ',
  2504. 'rating_starmode':'Display mode for ratings',
  2505. 'rating_shownotation':'The rating will be displayed with :',
  2506. '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',
  2507. 'rating_showgreystars':'When displaying rating with stars, display greystars for rating less than the maximum note',
  2508. 'rating_showvotes':'Also display votes (however votes will still be displayed when hoovering the note)',
  2509. 'rating_twolines':'Display rating form IMDB on another line',
  2510. 'rating_displayMode':'In textmode, display rating + max rating (4/10 or 2/5)',
  2511. 'debug_log':'Afficher les messages de logs (cf la "Console d\'erreurs > Messages")',
  2512. 'debug_time':'Afficher le temps d\'exécution du script (dans la barre de configuration)',
  2513. 'script_link_openingconfiguration':'Settings',
  2514. 'script_link_lookingforupdate':'Check for update',
  2515. 'script_link_forum':'Support Forum',
  2516. 'script_link_siteofficiel':'Official website',
  2517. 'script_link_whatsnew':'Changelog',
  2518. //Localization of user interface
  2519. 'binsearch_missingpartsdetails':'Missing',
  2520. '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',
  2521. 'make_link_title':'Search for a NZB on',
  2522. 'binsearch_selectall_button':'Select all',
  2523. 'binsearch_unselectall_button':'Cancel selection',
  2524. 'noresult_button':'No result',
  2525. 'binsearch_button_populargroups':'Search on popular groups of Binsearch',
  2526. 'binsearch_button_othergroups':'Search on other groups of Binsearch',
  2527. 'othernzbindexer_button':'Search on',
  2528. 'binsearch_autoload_suceeded':'The script \'Better Usenet\' has loaded the other/popular groups results',
  2529. 'nzbindex_str_onlycollections':'Show only collections',
  2530. 'nzbindex_openoptions':'See options',
  2531. 'nzbindex_hiddenresults':' hidden results (no collections)',
  2532. 'binnewz_searchinformations_title':'You\'re searching for :',
  2533. 'filename':'Filename :',
  2534. 'age':'Age',
  2535. 'groups':'Groups :',
  2536. 'or':'or',
  2537. 'days':'days',
  2538. 'caption_title':'Highligting caption :',
  2539. 'caption_selectedresult':'Age/Group match',
  2540. 'caption_toleranceresult':'Age +-1 day',
  2541. 'rating_serie':'the serie',
  2542. 'rating_episode':'the episode',
  2543. 'with':'with',
  2544. 'note':'Rating',
  2545. 'votes':'Votes',
  2546. 'stars':'stars',
  2547. 'episode_title':'Title of this episode',
  2548. 'add_to_selection':'Clic to add to selection',
  2549. 'remove_from_selection':'Clic to remove from selection',
  2550. '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"',
  2551. 'starmode':'Graphical mode',
  2552. 'textmode':'Text mode',
  2553. 'protected_row':'This result is password protected',
  2554. 'debug':'Debug',
  2555. 'norating':'No rating found',
  2556. 'ratingerror':'Error while fetching rating',
  2557. });
  2558.  
  2559.  
  2560. GM_trans.setTranslations('fr',{
  2561. //Traduction de la partie 'Configuration'
  2562. 'ConfigTitle':'Configuration de \'Better Usenet\'',
  2563. 'script_options':'Options générales',
  2564. 'updater_timer':'Nombre de secondes avant la fermeture automatique de la fenêtre d\'information de mise à jour (0=pas de timer)',
  2565. 'updater_delay':'Nombre de jours entre les vérifications automatiques de présence d\'une mise à jour',
  2566. 'noupdate':'Pas de mise à jour de \'Better Usenet\'',
  2567. 'language_option':'Langue d\'affichage (bouton \'Save\' pour appliquer)',
  2568. 'language_section':'Langue',
  2569. 'option_fixedheader':'Rendre fixe l\'entête des sites gérés',
  2570. 'option_deletead':'Supprimer la bannière de publicité',
  2571. 'option_forcessl':'Forcer l\'utilisation du protocole SSL',
  2572. 'option_scrolltoresults':'Aller directement aux résultats de recherche au chargement de la page',
  2573. 'option_resize':'Modifier la taille du tableau des résultats (en %)',
  2574. 'option_othernzbindexerbuttons':'Ajouter un bouton pour faire la même recherche sur les autres sites de NZB',
  2575. 'option_nocheckboxifpassword':'Supprimer la case à cocher si le contenu associé à la ligne est marqué comme protégé par un mot de passe',
  2576. 'option_highlightifpassword':'Change la couleur d\'une ligne si le contenu associé est marqué comme protégé par un mot de passe',
  2577. 'display_binsearch1':'Affiche un lien vers Binsearch (groupes populaires)',
  2578. 'display_binsearch2':'Affiche un lien vers Binsearch (autres groupes) (pas conseillé)',
  2579. 'display_nzbindex':'Affiche un lien vers NZBIndex',
  2580. 'display_nzbfriends':'Affiche un lien vers NZBFriends',
  2581. 'display_allocine':'Affiche un lien vers Allociné', // Cook2
  2582. 'display_thxlink':'Afficher un lien pour chaque référencement afin de remercier le posteur',
  2583. 'display_infolink':'Afficher un lien pour récupérer la notation d\'un élément',
  2584. 'thxlink_title':'Merci au référenceur!',
  2585. 'infolink_title':'Trouver la notation',
  2586. 'binnewz_selectedresultcolor':'Couleur du surlignage de la case \'Age\' ou \'Group\' si correspondance',
  2587. 'binnewz_highlighttolerance':'Accorder une tolérance de +- 1 jour pour le surlignage de la case \'Age\'',
  2588. 'binnewz_toleranceresultcolor':'Couleur du surlignage de la case \'Age\' si il y a eu tolerance à +- 1 jour',
  2589. 'binnewz_displaysearchinformations':'Affiche sur NZBIndex et Binsearch les détails de la sélection faite sur Binnewz',
  2590. 'binnewz_nzblinks_place':'Affiche les liens NZB dans la colonne suivante',
  2591. 'nzblinks_place_title':'Titre',
  2592. 'nzblinks_place_file':'Fichier',
  2593. 'nzblinks_place_size':'Taille',
  2594. '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]',
  2595. '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',
  2596. 'binnewz_donothingifpassword':'Ne pas afficher les liens NZB ni la notation si un mot de passe ou un virus est annoncé par Binnewz',
  2597. 'binsearch_nzbbuttons':'Ajouter un bouton NZB pour chaque résultat',
  2598. 'binsearch_nzbbuttoncolor':'Couleur du bouton NZB',
  2599. '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',
  2600. 'binsearch_missingpartsdetails_option':'Si il y a des parts manquantes, affiche le nombre précis',
  2601. 'binsearch_selectbuttons':'Ajouter des boutons supplémentaires de sélection (Tout sélectionner / Annuler la sélection) [Firefox uniquement]',
  2602. '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)',
  2603. '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)',
  2604. 'binsearch_autoloadnzbindex':'Si il n\'y a vraiment aucun résultat sur Binsearch, faire automatiquement la même recherche sur NZBIndex',
  2605. 'binsearch_delete_oldcontentline':'Supprime la ligne insérée par Binsearch dans les vieux résultats',
  2606. 'binsearch_advancedsearch':'Active la recherche avancée de Binsearch',
  2607. 'binsearch_showcollections':'Affiche uniquement les collections de fichiers (nécessite d\'activer la recherche avancée)',
  2608. 'nzbindex_nonzbbuttonifpassword':'Supprimer le lien \'Download\' si le contenu associé à la ligne est marqué comme protégé par un mot de passe',
  2609. 'nzbindex_delete_oldcontentline':'Supprime la ligne insérée par NZBIndex dans les vieux résultats',
  2610. '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)',
  2611. 'nzbindex_orderbuttons':'Ajouter des icônes pour trier les résultats selon la taille ou l\'âge',
  2612. 'nzbindex_resultLinks_fontSize':'Taille de la police utilisée pour les liens "Download" et "View Collection" (nzbindex défaut : 10 pixel)',
  2613. 'nzbindex_autoloadbinsearch':'Si aucun résultat sur NZBIndex, fait automatiquement la même recherche sur Binsearch',
  2614. 'rating':'Notation',
  2615. '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)',
  2616. '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)',
  2617. 'rating_BS_infos':'Les infos récupérées sur BetaSeries seront pour : ',
  2618. 'rating_starmode':'Mode d\'affichage des notes',
  2619. 'rating_shownotation':'La notation sera affichée sur :',
  2620. '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',
  2621. 'rating_showgreystars':'Quand la note est affichée en mode graphique, affiche des étoiles grises quand la note est inférieure à la note maximale',
  2622. 'rating_showvotes':'Affiche les votes en plus de la note (le nombre de votes sera cependant toujours visible au survol de la souris)',
  2623. 'rating_twolines':'Affiche la notation d\'IMDB sur une ligne supplémentaire',
  2624. 'rating_displayMode':'En mode texte, afficher la note + la note maximale (4/10 or 2/5)',
  2625. 'debug_log':'Afficher les messages de logs (cf la "Console d\'erreurs > Messages")',
  2626. 'debug_time':'Afficher le temps d\'exécution du script (dans la barre de configuration)',
  2627. //Traduction de l'interface (boutons, messages utilisateurs, etc)
  2628. 'script_link_openingconfiguration':'Configuration',
  2629. 'script_link_lookingforupdate':'Maj ? ',
  2630. 'script_link_forum':'Forum de discussion',
  2631. 'script_link_siteofficiel':'Site web officiel',
  2632. 'script_link_whatsnew':'Changelog',
  2633. 'binsearch_missingpartsdetails':'Manque',
  2634. '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\'',
  2635. 'make_link_title':'Chercher le NZB sur',
  2636. 'binsearch_selectall_button':'Tout sélectionner',
  2637. 'binsearch_unselectall_button':'Annuler la sélection',
  2638. 'noresult_button':'Aucun résultat',
  2639. 'binsearch_button_populargroups':'Chercher sur les groupes populaires de Binsearch',
  2640. 'binsearch_button_othergroups':'Chercher sur les autres groupes de Binsearch',
  2641. 'othernzbindexer_button':'Rechercher sur',
  2642. 'binsearch_autoload_suceeded':'Le script \'Better Usenet\' a chargé automatiquement les résultats sur les autres groupes.',
  2643. 'nzbindex_str_onlycollections':'N\'afficher que les collections',
  2644. 'nzbindex_openoptions':'Voir les options',
  2645. 'nzbindex_hiddenresults':' résultats masqués (pas des collections)',
  2646. 'binnewz_searchinformations_title':'Vous recherchez',
  2647. 'filename':'Nom de fichier',
  2648. 'age':'Age',
  2649. 'groups':'Groupes',
  2650. 'or':'ou',
  2651. 'days':'jours',
  2652. 'caption_title':'Légende de la coloration',
  2653. 'caption_selectedresult':'Age/Groupe correspond',
  2654. 'caption_toleranceresult':'Age +-1 jour',
  2655. 'rating_serie':'la série',
  2656. 'rating_episode':'l\'épisode',
  2657. 'with':'avec',
  2658. 'note':'Note',
  2659. 'votes':'Votes',
  2660. 'stars':'étoiles',
  2661. 'episode_title':'Titre de cet épisode',
  2662. 'add_to_selection':'Cliquez pour ajouter à la sélection',
  2663. 'remove_from_selection':'Cliquez pour retirer de la sélection',
  2664. '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"',
  2665. 'starmode':'Mode graphique',
  2666. 'textmode':'Mode Texte',
  2667. 'protected_row':'Ce résultat est protégé par un mot de passe',
  2668. 'debug':'Debug',
  2669. 'norating':'Aucune notation disponible',
  2670. 'ratingerror':'Récupération de la note impossible',
  2671. });
  2672.  
  2673.  
  2674. //Setting Language (if language not set yet, use EN)
  2675. if (GM_config.read()['language_option'])
  2676. GM_trans.setLang(GM_config.read()['language_option']);
  2677. else
  2678. GM_trans.setLang('en');
  2679.  
  2680.  
  2681. //----------------------------------------------
  2682. //----------------------------------------------
  2683. //-------------------CONFIG-----------------
  2684. //----------------------------------------------
  2685. //----------------------------------------------
  2686. /* Remove the 40% wasted space to the left */
  2687. var configStyle = ".field_label {padding-left:15px;}";
  2688. configStyle=configStyle.toString();
  2689.  
  2690. function initConfig() {
  2691. GM_config.init(GM_trans.lang('ConfigTitle'),
  2692. {
  2693. 'language_option':
  2694. {
  2695. section : [GM_trans.lang('language_section')],
  2696. label: GM_trans.lang('language_option'),
  2697. type:'select',
  2698. options:{'fr':'Français','en':'English'},
  2699. default:'fr'
  2700. },
  2701. 'updater_delay':
  2702. {
  2703. section : [GM_trans.lang('script_options')],
  2704. label: GM_trans.lang('updater_delay'),
  2705. type:'text',
  2706. default:'3'
  2707. },
  2708. 'updater_timer':
  2709. {
  2710. label: GM_trans.lang('updater_timer'),
  2711. type:'text',
  2712. default:'0'
  2713. },
  2714. 'searchnzb_forcessl':
  2715. {
  2716. label: GM_trans.lang('option_forcessl'),
  2717. type: 'checkbox',
  2718. default: true
  2719. },
  2720. 'deletead':
  2721. {
  2722. label: GM_trans.lang('option_deletead'),
  2723. type: 'checkbox',
  2724. default: true
  2725. },
  2726. 'option_fixedheader':
  2727. {
  2728. label: GM_trans.lang('option_fixedheader'),
  2729. type: 'checkbox',
  2730. default: true
  2731. },
  2732. 'display_binsearch1':
  2733. {
  2734. label: GM_trans.lang('display_binsearch1'),
  2735. type: 'checkbox',
  2736. default: true
  2737. },
  2738. 'display_binsearch2':
  2739. {
  2740. label: GM_trans.lang('display_binsearch2'),
  2741. type: 'checkbox',
  2742. default: false
  2743. },
  2744. 'display_nzbindex':
  2745. {
  2746. label: GM_trans.lang('display_nzbindex'),
  2747. type: 'checkbox',
  2748. default: true
  2749. },
  2750. 'display_nzbfriends':
  2751. {
  2752. label: GM_trans.lang('display_nzbfriends'),
  2753. type: 'checkbox',
  2754. default: false
  2755. },
  2756. 'display_allocine': // Cook2
  2757. {
  2758. label: GM_trans.lang('display_allocine'),
  2759. type: 'checkbox',
  2760. default: true
  2761. },
  2762. 'display_thxlink':
  2763. {
  2764. label: GM_trans.lang('display_thxlink'),
  2765. type: 'checkbox',
  2766. default: true
  2767. },
  2768. 'binnewz_nzblinks_place':
  2769. {
  2770. label: GM_trans.lang('binnewz_nzblinks_place'),
  2771. type:'select',
  2772. options:{1:GM_trans.lang('nzblinks_place_title'),2:GM_trans.lang('nzblinks_place_file'),3:GM_trans.lang('nzblinks_place_size')},
  2773. default:1
  2774. },
  2775. // 1 : Place NZB links in the size cell
  2776. // 2 : Place NZB links in the file cell
  2777. // 3 : Place NZB links in the title cell
  2778. 'binnewz_resize':
  2779. {
  2780. label: GM_trans.lang('option_resize'),
  2781. type: 'text',
  2782. default: '100'
  2783. },
  2784. 'binnewz_highlighttolerance':
  2785. {
  2786. label: GM_trans.lang('binnewz_highlighttolerance'),
  2787. type: 'checkbox',
  2788. default: true
  2789. },
  2790. 'binnewz_selectedresultcolor':
  2791. {
  2792. label: GM_trans.lang('binnewz_selectedresultcolor'),
  2793. type: 'text',
  2794. default: '#95E07E'
  2795. },
  2796. 'binnewz_toleranceresultcolor':
  2797. {
  2798. label: GM_trans.lang('binnewz_toleranceresultcolor'),
  2799. type: 'text',
  2800. default: '#C7E2BF' //(lesser green)
  2801. },
  2802. 'binnewz_displaysearchinformations':
  2803. {
  2804. label: GM_trans.lang('binnewz_displaysearchinformations'),
  2805. type: 'checkbox',
  2806. default: true
  2807. },
  2808. 'binnewz_deletenodeifpassword':
  2809. {
  2810. label: GM_trans.lang('binnewz_deletenodeifpassword'),
  2811. type: 'checkbox',
  2812. default: true
  2813. },
  2814. 'binnewz_highlightifpassword':
  2815. {
  2816. label: GM_trans.lang('binnewz_highlightifpassword'),
  2817. type: 'checkbox',
  2818. default: true
  2819. },
  2820. 'binnewz_donothingifpassword':
  2821. {
  2822. label: GM_trans.lang('binnewz_donothingifpassword'),
  2823. type: 'checkbox',
  2824. default: true
  2825. },
  2826. 'binsearch_nzbbuttons':
  2827. {
  2828. 'section': ['Binsearch'],
  2829. label: GM_trans.lang('binsearch_nzbbuttons'),
  2830. type: 'checkbox',
  2831. default: true
  2832. },
  2833. 'binsearch_nzbbuttoncolor':
  2834. {
  2835. label: GM_trans.lang('binsearch_nzbbuttoncolor'),
  2836. type: 'text',
  2837. default: '#EAD7D7'
  2838. },
  2839. 'binsearch_nonzbbuttonifpassword':
  2840. {
  2841. label: GM_trans.lang('binsearch_nonzbbuttonifpassword'),
  2842. type: 'checkbox',
  2843. default: true
  2844. },
  2845. 'binsearch_nocheckboxifpassword':
  2846. {
  2847. label: GM_trans.lang('option_nocheckboxifpassword'),
  2848. type: 'checkbox',
  2849. default: true
  2850. },
  2851. 'binsearch_highlightifpassword':
  2852. {
  2853. label: GM_trans.lang('option_highlightifpassword'),
  2854. type: 'checkbox',
  2855. default: true
  2856. },
  2857. 'binsearch_missingpartsdetails':
  2858. {
  2859. label: GM_trans.lang('binsearch_missingpartsdetails_option'),
  2860. type: 'checkbox',
  2861. default: true
  2862. },
  2863. 'binsearch_selectbuttons':
  2864. {
  2865. label: GM_trans.lang('binsearch_selectbuttons'),
  2866. type: 'checkbox',
  2867. default: true
  2868. },
  2869. 'binsearch_noresultbutton':
  2870. {
  2871. label: GM_trans.lang('binsearch_noresultbutton'),
  2872. type: 'checkbox',
  2873. default: true
  2874. },
  2875. 'binsearch_autoloadothersearch':
  2876. {
  2877. label: GM_trans.lang('binsearch_autoloadothersearch'),
  2878. type: 'checkbox',
  2879. default: true
  2880. },
  2881. 'binsearch_resize':
  2882. {
  2883. label: GM_trans.lang('option_resize'),
  2884. type: 'text',
  2885. default: '100'
  2886. },
  2887. 'binsearch_scrolltoresults':
  2888. {
  2889. label: GM_trans.lang('option_scrolltoresults'),
  2890. type: 'checkbox',
  2891. default: true
  2892. },
  2893. 'binsearch_delete_oldcontentline':
  2894. {
  2895. label: GM_trans.lang('binsearch_delete_oldcontentline'),
  2896. type: 'checkbox',
  2897. default: true
  2898. },
  2899. 'binsearch_advancedsearch':
  2900. {
  2901. label: GM_trans.lang('binsearch_advancedsearch'),
  2902. type: 'checkbox',
  2903. default: false
  2904. },
  2905. 'binsearch_showcollections':
  2906. {
  2907. label: GM_trans.lang('binsearch_showcollections'),
  2908. type: 'checkbox',
  2909. default: false
  2910. },
  2911. 'binsearch_autoloadnzbindex':
  2912. {
  2913. label: GM_trans.lang('binsearch_autoloadnzbindex'),
  2914. type: 'checkbox',
  2915. default: true
  2916. },
  2917. 'nzbindex_nonzbbuttonifpassword':
  2918. {
  2919. 'section': ['NZBIndex'],
  2920. label: GM_trans.lang('nzbindex_nonzbbuttonifpassword'),
  2921. type: 'checkbox',
  2922. default: true
  2923. },
  2924. 'nzbindex_nocheckboxifpassword':
  2925. {
  2926. label: GM_trans.lang('option_nocheckboxifpassword'),
  2927. type: 'checkbox',
  2928. default: true
  2929. },
  2930. 'nzbindex_highlightifpassword':
  2931. {
  2932. label: GM_trans.lang('option_highlightifpassword'),
  2933. type: 'checkbox',
  2934. default: true
  2935. },
  2936. 'nzbindex_scrolltoresults':
  2937. {
  2938. label: GM_trans.lang('option_scrolltoresults'),
  2939. type: 'checkbox',
  2940. default: true
  2941. },
  2942. 'nzbindex_delete_oldcontentline':
  2943. {
  2944. label: GM_trans.lang('nzbindex_delete_oldcontentline'),
  2945. type: 'checkbox',
  2946. default: true
  2947. },
  2948. 'nzbindex_onlycollections':
  2949. {
  2950. label: GM_trans.lang('nzbindex_onlycollections'),
  2951. type: 'checkbox',
  2952. default: false
  2953. },
  2954. 'nzbindex_orderbuttons':
  2955. {
  2956. label: GM_trans.lang('nzbindex_orderbuttons'),
  2957. type: 'checkbox',
  2958. default: true
  2959. },
  2960. 'nzbindex_resize':
  2961. {
  2962. label: GM_trans.lang('option_resize'),
  2963. type: 'text',
  2964. default: '100'
  2965. },
  2966. 'nzbindex_resultLinks_fontSize':
  2967. {
  2968. label: GM_trans.lang('nzbindex_resultLinks_fontSize'),
  2969. type: 'text',
  2970. default: '13'
  2971. },
  2972. 'nzbindex_autoloadbinsearch':
  2973. {
  2974. label: GM_trans.lang('nzbindex_autoloadbinsearch'),
  2975. type: 'checkbox',
  2976. default: true
  2977. },
  2978. 'rating_imdb':
  2979. {
  2980. 'section': [GM_trans.lang('rating')],
  2981. label: GM_trans.lang('rating_imdb'),
  2982. type: 'checkbox',
  2983. default: true
  2984. },
  2985. 'rating_betaseries':
  2986. {
  2987. label: GM_trans.lang('rating_betaseries'),
  2988. type: 'checkbox',
  2989. default: true
  2990. },
  2991. 'rating_BS_infos':
  2992. {
  2993. label: GM_trans.lang('rating_BS_infos'),
  2994. type:'select',
  2995. options:{1:GM_trans.lang('rating_serie'),2:GM_trans.lang('rating_episode')},
  2996. default:1
  2997. },
  2998. // 1 : Rating only
  2999. // 2 : Star only
  3000. // 3 : Rating + Star
  3001. 'rating_starmode':
  3002. {
  3003. label: GM_trans.lang('rating_starmode'),
  3004. type:'select',
  3005. options:{1:GM_trans.lang('textmode'),2:GM_trans.lang('starmode'),3:GM_trans.lang('textmode') + ' & ' + GM_trans.lang('starmode')},
  3006. default:2
  3007. },
  3008. 'rating_displayMode_byCook2':
  3009. {
  3010. label: GM_trans.lang('rating_displayMode_byCook2'),
  3011. type: 'checkbox',
  3012. default: false
  3013. },
  3014. 'rating_shownotation':
  3015. {
  3016. label: GM_trans.lang('rating_shownotation'),
  3017. type:'select',
  3018. options:{1:'5 ' + GM_trans.lang('stars'),2:'10 ' + GM_trans.lang('stars')},
  3019. default:1
  3020. },
  3021. 'rating_displayMode':
  3022. {
  3023. label: GM_trans.lang('rating_displayMode'),
  3024. type: 'checkbox',
  3025. default: false
  3026. },
  3027. 'rating_showgreystars':
  3028. {
  3029. label: GM_trans.lang('rating_showgreystars'),
  3030. type: 'checkbox',
  3031. default: true
  3032. },
  3033. 'rating_showvotes':
  3034. {
  3035. label: GM_trans.lang('rating_showvotes'),
  3036. type: 'checkbox',
  3037. default: true
  3038. },
  3039. 'rating_twolines':
  3040. {
  3041. label: GM_trans.lang('rating_twolines'),
  3042. type: 'checkbox',
  3043. default: true
  3044. },
  3045. 'debug_log':
  3046. {
  3047. 'section': [GM_trans.lang('debug')],
  3048. label: GM_trans.lang('debug_log'),
  3049. type: 'checkbox',
  3050. default: false
  3051. },
  3052. 'debug_time':
  3053. {
  3054. label: GM_trans.lang('debug_time'),
  3055. type: 'checkbox',
  3056. default: false
  3057. }
  3058. },
  3059. configStyle, //My CSS modifications (see upper)
  3060. {
  3061. open: function() {},
  3062. save: function() {
  3063. location.reload();
  3064. },
  3065. close: function() {
  3066. //GM_config.fadeIn();
  3067. }
  3068. }
  3069. );
  3070.  
  3071. }
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078. //---------------------------------------------
  3079. //---------------------CSS-------------------
  3080. //---------------------------------------------
  3081.  
  3082. //----------------------------------------------
  3083. //----------------------------------------------
  3084. //--------------------MAIN------------------
  3085. //----------------------------------------------
  3086. //----------------------------------------------
  3087.  
  3088. var website=null;
  3089. var protocol='http://';
  3090. if (document.location.hostname.indexOf('binnews')!=-1) {
  3091. website='binnewz';
  3092. binnewz_url=document.location.hostname;
  3093. if (GM_config.read().searchnzb_forcessl)
  3094. protocol='https://';
  3095. //debug('toto');
  3096. }
  3097. else {
  3098. if (GM_config.read().searchnzb_forcessl){
  3099. protocol='https://';
  3100. if(document.location.protocol=='http:') //If acceeding nzb search engines without SSL while user wants SSL
  3101. document.location.href=document.location.href.replace('http:', 'https:'); //we reload the page with ssl
  3102. }
  3103. if (document.location.hostname.indexOf('binsearch.info')!=-1) {
  3104. //Theres a feature within Binsearch thats displays a 'Now loading' message ... script must not load in that case
  3105. if (document.getElementsByTagName('h1')[0]==null) return;
  3106. website='binsearch';
  3107. }
  3108. else if (document.location.hostname.indexOf('nzbindex.com')!=-1) website='nzbindex';
  3109. }
  3110.  
  3111. initConfig();
  3112. GM_config.save();
  3113.  
  3114.  
  3115. //URL Parameters associative array
  3116. UrlParams=extractUrlParams();
  3117. var query=UrlParams["q"];
  3118. if(typeof query=='undefined') query='';
  3119. //Variables for the Hightlight Option
  3120. var sinceXdays=UrlParams["sinceXdays"];
  3121. if(typeof sinceXdays=='undefined') sinceXdays='';
  3122. var fromGroups=UrlParams["fromGroups"];
  3123. if(typeof fromGroups=='undefined') fromGroups='';
  3124. var showcol=UrlParams["showcol"];
  3125. var myorder=UrlParams["myorder"];
  3126. if(typeof myorder=='undefined') //if NZBIndex is accessed directly with an order param
  3127. if(typeof UrlParams["sort"]!='undefined') myorder=UrlParams["sort"];
  3128. else myorder='';
  3129. var pingpong=UrlParams["pong"];
  3130. if(typeof pingpong=='undefined') pingpong='';
  3131. if(document.styleSheets.length!=0)
  3132. var sty = document.styleSheets[document.styleSheets.length - 1];
  3133. else
  3134. var sty = null;
  3135.  
  3136. if (website=='binsearch') { //Binsearch modifications
  3137.  
  3138. var searchform=document.getElementsByName('r')[0];
  3139. var tabresults=document.getElementById('r2');
  3140. var top_div=tabresults;
  3141. var searchServers=UrlParams["server"];
  3142. var autoload=UrlParams["autoload"];
  3143. var coldetails=UrlParams["b"];
  3144.  
  3145. binsearch_configurationIntegration();
  3146. if (GM_config.read().deletead) Binsearch_DeleteAd();
  3147.  
  3148. if(GM_config.read().option_fixedheader) binsearch_fixedHeader(); //A appeler après binsearch_configurationIntegration();
  3149.  
  3150. 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
  3151. if (tabresults!=null) { //if there is results in Binsearch
  3152.  
  3153. resize_binsearch(GM_config.read().binsearch_resize);
  3154.  
  3155. if(sinceXdays!=null || fromGroups!=null) {
  3156. //Theres a bug with Firefox 4.* and 3.* : Binsearch results source code is not the same
  3157. if(searchform.parentNode.tagName=="TD") //first case : firefox 4
  3158. insertInformations(document.getElementsByClassName('mt')[0].children[0].children[1].children[1], searchform);
  3159. else if(searchform.parentNode.tagName=="FORM") //2nd case : Firefox 3
  3160. insertInformations(document.getElementsByTagName("FORM")[0], searchform);
  3161. }
  3162.  
  3163. //selectTheResult : to know if theres only one result
  3164. //selectTheResult=searchform.getElementsByTagName('table')[searchform.getElementsByTagName('table').length-1].getElementsByTagName('td')[0].textContent.search(/ 1 /)!=-1;
  3165. selectTheResult=((tabresults.getElementsByTagName('input').length))==1;
  3166. if (GM_config.read().binsearch_selectbuttons && BrowserDetect.browser!='Chrome') make_select_buttons();
  3167. if (GM_config.read().binsearch_scrolltoresults) top_div.scrollIntoView();
  3168.  
  3169.  
  3170. if(BrowserDetect.browser!='Chrome'){
  3171. //This part to prepare the 'clickRow' functionnality
  3172. var inputsCol=tabresults.parentNode.parentNode.children;
  3173. for(i=0;i<inputsCol.length;i++){ //We change the javascript function called by some binsearch buttons
  3174. if(inputsCol[i].tagName=="INPUT" && inputsCol[i].value=="Inverse"){
  3175. inputsCol[i].setAttribute('onclick', 'clickTheseRows(document.getElementById("r2"));');
  3176. }
  3177. }
  3178. }//End part
  3179. // add hover effect to all rows
  3180. sty.insertRule("form p table#r2 tr:hover { background-color: #ffb ! important; }", 0);
  3181. // add hover effect to all selected rows
  3182. sty.insertRule("form p table#r2 tr.selected:hover { background-color: #fd7 ! important; }", 0);
  3183.  
  3184. binsearch_process_results(); //processing results
  3185.  
  3186. }else{ //if there is no results
  3187. if (GM_config.read().binsearch_autoloadothersearch) {
  3188. if(binsearch_autoload_othergroups()) //if returns true, it means that an other groups search has already been done.
  3189. if(GM_config.read().binsearch_autoloadnzbindex && pingpong!=1){ //if this option is checked, auto search on NZBIndex (only if not already search on NZBIndex)
  3190. document.location.href=nzbindex_makeurl(document.getElementById('originalQuery').value, "&pong=1");
  3191. }
  3192. }
  3193. binsearch_delete_input(searchform); //delete all buttons ... more logical
  3194. if (GM_config.read().binsearch_noresultbutton) make_noresult_button();
  3195. }
  3196.  
  3197. binsearch_make_othernzbindexer_button();
  3198.  
  3199. }
  3200.  
  3201. }else if (website=='binnewz') { //Binnewz modification
  3202.  
  3203. binnewz_configurationIntegration();
  3204. if(GM_config.read().option_fixedheader) Binnewz_fixedHeader(); //exécuté le plus tôt possible
  3205.  
  3206. var tabresults=document.getElementById('table_results');
  3207. if (tabresults==null)
  3208. tabresults=document.getElementById('tabliste');
  3209.  
  3210.  
  3211. // var tabresults_count=1;
  3212. //tabresults.setAttribute('id','tabliste_' + tabresults_count);
  3213.  
  3214. //We need to know which column is for title or file or ... (this changes regarding the results' category)
  3215. var THCol=tabresults.getElementsByClassName('column_heading marker');
  3216. for(i=0;i<THCol.length;i++){
  3217. if(THCol[i].firstElementChild!=null){
  3218.  
  3219. if(THCol[i].firstElementChild.textContent=="Titre"){
  3220. var titleIndex=i+1;
  3221. continue;
  3222. }
  3223. else if(THCol[i].firstElementChild.textContent=="Newsgroup"){
  3224. var groupsIndex=i+1;
  3225. continue;
  3226. }
  3227. else if(THCol[i].firstElementChild.textContent=="Fichier"){
  3228. var fileIndex=i+1;
  3229. continue;
  3230. }
  3231. else if(THCol[i].firstElementChild.textContent=="Taille"){
  3232. var sizeIndex=i+1;
  3233. continue;
  3234. }
  3235. else if(THCol[i].firstElementChild.innerHTML.indexOf('Merci')!=-1){
  3236. var thanksIndex=i+1;
  3237. continue;
  3238. }
  3239. }
  3240. }
  3241.  
  3242.  
  3243. if(titleIndex!=null){ //On est sur une page normale de liste de référencements
  3244. var resultsType=1;
  3245. var cat_id=UrlParams["cat_id"];
  3246. if (typeof cat_id=='undefined')
  3247. cat_id=document.getElementById('fp_cat_id').value;
  3248. var binnewz_goodCat=['6','23','39','27','48','49','100','101','102','103','104','105','11'];
  3249. var binnewz_tvCat=['7', '26', '44'];
  3250. }else{
  3251. if(document.getElementById('DivRes')!=null) {
  3252. //page de recherche : méthode temporaire (resultsType=2)
  3253. resultsType=2;
  3254. var titleIndex=2;
  3255. var groupsIndex=4;
  3256. var fileIndex=5;
  3257. var sizeIndex=6;
  3258. var thanksIndex=9;
  3259. }else{ //page des derniers référencements (resultsType=3)
  3260. resultsType=3;
  3261. var catIndex=2;
  3262. var titleIndex=4;
  3263. var groupsIndex=6;
  3264. var fileIndex=7;
  3265. var sizeIndex=8;
  3266. var thanksIndex=11;
  3267. }
  3268. }
  3269.  
  3270.  
  3271. if (GM_config.read().deletead) binnewz_DeleteAd();
  3272.  
  3273. if (tabresults!=null){
  3274.  
  3275. display_nzb_links(); //NZB Links on results
  3276. resize_binnewz(tabresults, GM_config.read().binnewz_resize); //Binnewz search results Width Modification
  3277.  
  3278. }
  3279.  
  3280.  
  3281. }else if (website=='nzbindex') { //NZBIndex modification
  3282.  
  3283. var nzbindex_buttons=document.getElementsByClassName('line');
  3284. var nzbindex_results=document.getElementById('results');
  3285. var top_div=nzbindex_results;
  3286. var THead=nzbindex_results.getElementsByTagName('thead')[0];
  3287.  
  3288. nzbindex_configurationIntegration();
  3289.  
  3290. //If results or not we do this
  3291. nzbindex_make_othernzbindexer_button();
  3292. if (GM_config.read().deletead) Nzbindex_DeleteAd();
  3293.  
  3294.  
  3295. if(GM_config.read().option_fixedheader) nzbindex_fixedHeader();
  3296.  
  3297.  
  3298. if (nzbindex_buttons.length>0){ //Only if there are results
  3299. if(BrowserDetect.browser!='Chrome') nzbindex_add_buttons();
  3300. if(sinceXdays!=null || fromGroups!=null) insertInformations(nzbindex_results, nzbindex_results.firstElementChild);
  3301. resize_nzbindex(GM_config.read().nzbindex_resize);
  3302. selectTheResult=THead.firstElementChild.children[1].firstElementChild.childNodes[1].textContent.search(/of 1 /)!=-1; //If true : one result only
  3303. if (GM_config.read().nzbindex_scrolltoresults)
  3304. top_div.scrollIntoView();
  3305. nzbindex_onlycollections();
  3306. if (GM_config.read().nzbindex_orderbuttons)
  3307. nzbindex_orderbuttons();
  3308. nzbindex_otherresultspages_correction();
  3309.  
  3310. //This part to prepare the 'clickRow' functionnality
  3311. if(BrowserDetect.browser!='Chrome'){
  3312. for(j=0;j<nzbindex_buttons.length;j++){ //We change the javascript function called by some nzbindex buttons
  3313. var inputsCol=nzbindex_buttons[j].firstElementChild.getElementsByTagName('INPUT');
  3314. for(i=0;i<inputsCol.length;i++){
  3315. switch(inputsCol[i].value){
  3316. case "Select all":
  3317. inputsCol[i].setAttribute('onclick', 'clickTheseRows(document.getElementById("results").getElementsByTagName("TBODY")[0], 1);');
  3318. eval("index_selectbutton_" + j + "=" + i);
  3319. break;
  3320. case "Inverse":
  3321. inputsCol[i].setAttribute('onclick', 'clickTheseRows(document.getElementById("results").getElementsByTagName("TBODY")[0]);');
  3322. break;
  3323. }
  3324. }
  3325. }
  3326. }
  3327. // add hover effect to all rows
  3328. sty.insertRule("div#results form table tbody tr:hover { background-color: #ffb ! important; }", 0);
  3329. // add hover effect to all selected rows
  3330. sty.insertRule("div#results form table tbody tr.selected:hover { background-color: #fd7 ! important; }", 0);
  3331. //End part
  3332.  
  3333. nzbindex_process_results(); //processing results
  3334.  
  3335. }else{
  3336. if(GM_config.read().nzbindex_autoloadbinsearch && pingpong!=1) //if this option is checked, auto search on Binsearch (only if not already search on Binsearch)
  3337. document.location.href=binsearch_makeurl(document.getElementsByName('q')[0].value, "&pong=1");
  3338. }
  3339. }
  3340.  
  3341. //debug time - this is the end of the main script
  3342. if(GM_config.read().debug_time) insertExecTime(document.getElementById('BU_conf'));
  3343.  
  3344.  
  3345. document.addEventListener("AutoPagerAfterInsert", function (e){
  3346. if(website=="binnewz" && tabresults!=null){
  3347. display_nzb_links();
  3348. resize_binnewz(e.target, GM_config.read().binnewz_resize);
  3349. }else if(website=="binsearch")
  3350. binsearch_process_results();
  3351. }, true);
  3352.  
  3353.  
  3354.  
  3355. //----------------------------------------
  3356. //---------FONCTIONS COMMUNES-------------
  3357. //----------------------------------------
  3358.  
  3359. function createConfigurationMenu(){
  3360.  
  3361. var mymenu=document.createElement('DIV');
  3362. mymenu.id="BU_conf";
  3363. mymenu.innerHTML="<font color='red'><strong>Better Usenet</strong></font> (v" + thisVersion + ") : ";
  3364.  
  3365. //Configuration Link
  3366. var tmp_link=document.createElement('a');
  3367. tmp_link.addEventListener('click', function(){ GM_config.open();}, false );
  3368. tmp_link.href = 'javascript:void(0);';
  3369. tmp_link.innerHTML = GM_trans.lang('script_link_openingconfiguration');
  3370. mymenu.appendChild(tmp_link);
  3371. //
  3372. if(BrowserDetect.browser!='Chrome'){
  3373. mymenu.appendChild(document.createTextNode(' - '));
  3374. //Check update Link
  3375. var tmp_link=document.createElement('a');
  3376. tmp_link.addEventListener('click', function(){ GMSUC_Control(1);}, false );
  3377. tmp_link.href = 'javascript:void(0);';
  3378. tmp_link.innerHTML = GM_trans.lang('script_link_lookingforupdate');
  3379. mymenu.appendChild(tmp_link);
  3380. //
  3381. }
  3382. mymenu.appendChild(document.createTextNode(' - '));
  3383.  
  3384. //Whats new ? Link
  3385. var tmp_link=document.createElement('a');
  3386. tmp_link.href = 'http://forum.les-newsgroup.fr/Msg-Historique-des-versions-de-Better-Usenet?utm_source=betterusenet&utm_medium=menu';
  3387. tmp_link.target= '_blank';
  3388. tmp_link.innerHTML = GM_trans.lang('script_link_whatsnew');
  3389. mymenu.appendChild(tmp_link);
  3390.  
  3391. mymenu.appendChild(document.createTextNode(' - '));
  3392.  
  3393. //Site officiel Link
  3394. var tmp_link=document.createElement('a');
  3395. tmp_link.href = 'http://www.les-newsgroup.fr/?utm_source=betterusenet&utm_medium=menu';
  3396. tmp_link.target= '_blank';
  3397. tmp_link.innerHTML = GM_trans.lang('script_link_siteofficiel');
  3398. mymenu.appendChild(tmp_link);
  3399. //
  3400.  
  3401.  
  3402. //Forum Link
  3403. //var tmp_link=document.createElement('a');
  3404. //tmp_link.href = 'http://forum.les-newsgroup.fr/Msg-Un-nouveau-script-pour-am%C3%A9liorer-Binnews-et-Binsearch-Better-Usenet';
  3405. //tmp_link.href = 'http://forum.les-newsgroup.fr/Forum-Le-script-Better-Usenet-pour-Binnewz-NZBIndex-et-Binsearch';
  3406. //tmp_link.target= '_blank';
  3407. //tmp_link.innerHTML = GM_trans.lang('script_link_forum');
  3408. //mymenu.appendChild(tmp_link);
  3409. //
  3410. //mymenu.appendChild(document.createTextNode(' - '));
  3411.  
  3412. return mymenu;
  3413. }
  3414.  
  3415.  
  3416. function createButton(buttonLabel, queryUrl){
  3417.  
  3418. var resultButton=document.createElement('input');
  3419. resultButton.value=GM_trans.lang('othernzbindexer_button') + ' ' + buttonLabel;
  3420. resultButton.type='button';
  3421. resultButton.name=name;
  3422. resultButton.setAttribute('style', 'color:green; ');
  3423. resultButton.setAttribute('onclick', 'document.location.href="' + queryUrl + '";');
  3424.  
  3425. return resultButton;
  3426.  
  3427. }
  3428.  
  3429. function insertInformations(parentNode, afterNode) {
  3430.  
  3431. //DIV integration
  3432. top_div=document.createElement('div');
  3433. top_div.id="top_div";
  3434. //top_div.set('style',);
  3435. mydiv1=document.createElement('div');
  3436. mydiv1.setAttribute('style', 'float:right; margin:5px; text-align:right;');
  3437. //mydiv1.innerHTML='<u>test</u>';
  3438. if (sinceXdays != '' || fromGroups!='')
  3439. insertSelectedResultsLegend(mydiv1);
  3440.  
  3441. mydiv3=document.createElement('div');
  3442. mydiv3.setAttribute('style', 'float:left;margin:5px; text-align:left;height:auto');
  3443. //mydiv3.innerHTML='<i>test</i>';
  3444. insertBinnewzSelection(mydiv3);
  3445.  
  3446. before_div=document.createElement('div');
  3447. before_div.setAttribute('style', 'display:block;clear:both;');
  3448. top_div.appendChild(mydiv1);
  3449. top_div.appendChild(mydiv3);
  3450. after_div=document.createElement('div');
  3451. after_div.setAttribute('style', 'display:block;clear:both;');
  3452.  
  3453. parentNode.insertBefore(before_div, afterNode);
  3454. parentNode.insertBefore(top_div, afterNode);
  3455. parentNode.insertBefore(after_div, afterNode);
  3456.  
  3457. }
  3458.  
  3459. function insertSelectedResultsLegend(div){
  3460.  
  3461. tmpdiv=document.createElement('div');
  3462. tmpdiv.setAttribute('style', 'float:right;text-align:left;');
  3463. div.appendChild(tmpdiv);
  3464.  
  3465. div.firstElementChild.innerHTML='<b>'+GM_trans.lang('caption_title') + ' :</b><br />';
  3466.  
  3467. tmpspan=document.createElement('span');
  3468. tmpspan.setAttribute('style', 'display:inline-block;width:30px; height:20px; margin-bottom:3px; background-color:'+GM_config.read().binnewz_selectedresultcolor+';');
  3469. tmpspan.innerHTML='&nbsp;'
  3470. div.firstElementChild.appendChild(tmpspan);
  3471. div.firstElementChild.appendChild(document.createTextNode(' : '+GM_trans.lang('caption_selectedresult')));
  3472.  
  3473. div.firstElementChild.innerHTML+='<br>';
  3474.  
  3475. tmpspan=document.createElement('span');
  3476. tmpspan.setAttribute('style', 'display:inline-block;width:30px; height:20px;background-color:'+GM_config.read().binnewz_toleranceresultcolor+';');
  3477. tmpspan.innerHTML='&nbsp;'
  3478. div.firstElementChild.appendChild(tmpspan);
  3479. div.firstElementChild.appendChild(document.createTextNode(' : '+GM_trans.lang('caption_toleranceresult')));
  3480.  
  3481. }
  3482.  
  3483. function insertBinnewzSelection(div) {
  3484.  
  3485. var qInput=document.getElementsByName('q');
  3486. qInput=qInput[0].value;
  3487.  
  3488. div.innerHTML='<b>'+GM_trans.lang('binnewz_searchinformations_title') + ' :</b><br />';
  3489. div.innerHTML+=GM_trans.lang('filename') + ' : <font color="red"><strong>' + qInput + '</strong></font><br />';
  3490. div.innerHTML+=GM_trans.lang('age') + ' : ';
  3491. if (sinceXdays != '') div.innerHTML+='<font color="red"><strong>' + sinceXdays + ' ' + GM_trans.lang('days')+'</strong></font>';
  3492. div.innerHTML+='<br />';
  3493. div.innerHTML+=GM_trans.lang('groups') + ' : <font color="red"><strong>' + fromGroups.replace(/^\|/, '').replace(/\|$/, '').split('|').join(' '+GM_trans.lang('or').toUpperCase()+' ') + '</strong></font><br />';
  3494.  
  3495. }
  3496.  
  3497.  
  3498.  
  3499. //-------------------------------------------
  3500. //-------------------------------------------
  3501. //--------------NZBIndex-----------------
  3502. //-------------------------------------------
  3503. function nzbindex_configurationIntegration(){
  3504.  
  3505. var nzbindexMenu=document.getElementById('menu');
  3506. nzbindexMenu.firstElementChild.setAttribute('style', 'margin:10px;');
  3507.  
  3508. var mymenu=createConfigurationMenu();
  3509. mymenu.setAttribute('style', 'position:relative;left:-50px;font-size: 14px;');
  3510.  
  3511. nzbindexMenu.insertBefore(mymenu, nzbindexMenu.firstElementChild.nextElementSibling);
  3512. }
  3513.  
  3514. function nzbindex_make_othernzbindexer_button() {
  3515.  
  3516. var binsearchButton=createButton('Binsearch', binsearch_makeurl(document.getElementsByName('q')[0].value));
  3517.  
  3518. if (nzbindex_buttons.length>0){
  3519. //Adding Binsearch button
  3520. nzbindex_buttons[0].firstElementChild.appendChild(document.createTextNode(' '));
  3521. nzbindex_buttons[0].firstElementChild.appendChild(binsearchButton);
  3522. nzbindex_buttons[1].firstElementChild.appendChild(document.createTextNode(' '));
  3523. nzbindex_buttons[1].firstElementChild.appendChild(binsearchButton.cloneNode(0));
  3524.  
  3525. }else{
  3526. binsearchButton.setAttribute('style', 'color:red; padding:15px; font-size:17px; font-weight:bold;');
  3527. binsearchButton.value=GM_trans.lang('noresult_button') + ' - ' + binsearchButton.value;
  3528. nzbindex_results.getElementsByTagName('h2')[0].parentNode.replaceChild(binsearchButton, nzbindex_results.getElementsByTagName('h2')[0]);
  3529.  
  3530. }
  3531.  
  3532. }
  3533.  
  3534.  
  3535. function nzbindex_otherresultspages_correction() {
  3536.  
  3537. var TFoot_links=nzbindex_results.getElementsByTagName('tfoot')[0].getElementsByTagName('a');
  3538. for(i=0;i<TFoot_links.length;i++) {
  3539.  
  3540. if(document.location.href.indexOf('p=') != - 1)
  3541. TFoot_links[i].href=document.location.href.replace(/p=[0-9+]/, TFoot_links[i].href.match(/p=[0-9+]/)[0]);
  3542. else
  3543. TFoot_links[i].href=document.location.href + '&' + TFoot_links[i].href.match(/p=[0-9+]/)[0];
  3544. }
  3545. }
  3546.  
  3547. function nzbindex_onlycollections(){
  3548.  
  3549. var new_url=document.location.href;
  3550. var ischecked=false;
  3551.  
  3552. if (GM_config.read().nzbindex_onlycollections) ischecked=true;
  3553. if (typeof showcol !='undefined')
  3554. if (showcol=="1") ischecked=true;
  3555. else if (showcol=="0")ischecked=false;
  3556.  
  3557. if (new_url.indexOf('showcol')!=-1){
  3558. new_url=new_url.replace(/showcol=[0-9]/i,'showcol='+String(ischecked==true?0:1));
  3559. }else {
  3560. new_url=new_url+'&showcol='+String(ischecked==true?0:1);
  3561. }
  3562.  
  3563. nzbindex_showcollections=ischecked;
  3564.  
  3565. var checkbox=document.createElement('input');
  3566. checkbox.type='checkbox';
  3567. checkbox.name='onlycollections';
  3568. checkbox.checked=ischecked;
  3569. checkbox.setAttribute('onchange',"document.location.href='"+new_url+"';");
  3570.  
  3571. nzbindex_buttons[0].firstElementChild.appendChild(document.createTextNode(' '));
  3572. nzbindex_buttons[0].firstElementChild.appendChild(checkbox);
  3573. nzbindex_buttons[0].firstElementChild.appendChild(document.createTextNode(GM_trans.lang('nzbindex_str_onlycollections')));
  3574.  
  3575. nzbindex_buttons[1].firstElementChild.appendChild(document.createTextNode(' '));
  3576. nzbindex_buttons[1].firstElementChild.appendChild(checkbox.cloneNode(0));
  3577. nzbindex_buttons[1].firstElementChild.appendChild(document.createTextNode(GM_trans.lang('nzbindex_str_onlycollections')));
  3578.  
  3579. //display a link to options
  3580. /*
  3581. var tmp_link=document.createElement('a');
  3582. tmp_link.addEventListener('click', function(){ GM_config.open(); }, false );
  3583. tmp_link.href = 'javascript:void(0);';
  3584. tmp_link.innerHTML = '('+GM_trans.lang('nzbindex_openoptions')+')';
  3585. nzbindex_buttons[0].firstElementChild.appendChild(document.createTextNode(' '));
  3586. nzbindex_buttons[0].firstElementChild.appendChild(tmp_link);
  3587. */
  3588.  
  3589. }
  3590.  
  3591. function Nzbindex_DeleteAd() {
  3592.  
  3593. if (document.getElementById('main').children[2].firstElementChild.tagName=='CENTER') document.getElementById('main').removeChild(document.getElementById('main').children[2]);
  3594.  
  3595. }
  3596.  
  3597. function resize_nzbindex(tabwidth){
  3598.  
  3599. nzbindex_results.setAttribute('style', 'width:' + tabwidth + '% !important');
  3600. nzbindex_results.parentNode.setAttribute('style', 'margin-left:' + (100-tabwidth)/2 + '% !important;');
  3601. // nzbindex_results.parentNode.setAttribute('align', 'center');
  3602.  
  3603. }
  3604.  
  3605. //Note: there a mistake in the nzbindex order 'sort=agedesc' param ... 'agedesc' orders Asc (newest first while it whould order the 'bigger' first (the older)
  3606. //So I have inversed the buttonorder icon for Age ordering
  3607. function nzbindex_orderbuttons(){
  3608.  
  3609. var ordersizebutton=document.createElement('img');
  3610. ordersizebutton.setAttribute('style', 'cursor:pointer;');
  3611. var orderagebutton=document.createElement('img');
  3612. orderagebutton.setAttribute('style', 'cursor:pointer;');
  3613. var newsizeorder='';
  3614. var newageorder='';
  3615.  
  3616. var srcimg_desc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMi8xNy8wOCCcqlgAAAQRdEVYdFhNTDpjb20uYWRvYmUueG1wADw/eHBhY2tldCBiZWdpbj0iICAgIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+Cjx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDQuMS1jMDM0IDQ2LjI3Mjk3NiwgU2F0IEphbiAyNyAyMDA3IDIyOjExOjQxICAgICAgICAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4YXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgogICAgICAgICA8eGFwOkNyZWF0b3JUb29sPkFkb2JlIEZpcmV3b3JrcyBDUzM8L3hhcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhhcDpDcmVhdGVEYXRlPjIwMDgtMDItMTdUMDI6MzY6NDVaPC94YXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhhcDpNb2RpZnlEYXRlPjIwMDgtMDMtMjRUMTk6MDA6NDJaPC94YXA6TW9kaWZ5RGF0ZT4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyI+CiAgICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUdUmQAAACYSURBVDiNY/z//z8DJYCJIt3DwwAWZA5j3NTNDAwMPgT0bPm/KNsXqwEMDAw+DEGh+LWvW41iAaoBi3MYGRgY/jMEhkD4f/5AVUGVrV/D8H9RNiOKq5HTASMjVC52yn8GdzcGhq9fIXxubgaGnbsYGBbnMKKnG+wGwAzR14GwL16BuY6BeANghiC8hqEZwwBywMAnpIE3AADrkDbHF5Y+SAAAAABJRU5ErkJggg==";
  3617. var srcimg_asc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMi8xNy8wOCCcqlgAAAQRdEVYdFhNTDpjb20uYWRvYmUueG1wADw/eHBhY2tldCBiZWdpbj0iICAgIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+Cjx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDQuMS1jMDM0IDQ2LjI3Mjk3NiwgU2F0IEphbiAyNyAyMDA3IDIyOjExOjQxICAgICAgICAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4YXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgogICAgICAgICA8eGFwOkNyZWF0b3JUb29sPkFkb2JlIEZpcmV3b3JrcyBDUzM8L3hhcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhhcDpDcmVhdGVEYXRlPjIwMDgtMDItMTdUMDI6MzY6NDVaPC94YXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhhcDpNb2RpZnlEYXRlPjIwMDgtMDMtMjRUMTk6MDA6NDJaPC94YXA6TW9kaWZ5RGF0ZT4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyI+CiAgICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDUdUmQAAACrSURBVDiN3ZIxDoJAEEXfCBXR09hYEmpsTCzxAu5x1gvIEeQQNJwGQ0fGYiMsrDZSkDjN5v/Z+Xk7WVFVltRm0fR/BMS+EJFpt7Buw6URgE8LjwPHHz6d30opjYhIECK+MRAUVsmP0PdORxFUDyiNzANCgsIqWQpdC13nvCSBLAWsApN3TgkuN+WwH7vt05277ejVDXq/DiFzgoq6yQOq+Z1vBL/U+h9p/YAXo6I3eRuo1KYAAAAASUVORK5CYII=";
  3618.  
  3619. //default order button
  3620. //ordersizebutton.src=srcimg_desc;
  3621. newsizeorder='sizedesc';
  3622.  
  3623. //orderagebutton.src=srcimg_desc;
  3624. newageorder='agedesc';
  3625.  
  3626. switch(myorder){
  3627.  
  3628. case 'sizedesc':
  3629. ordersizebutton.src=srcimg_asc;
  3630. newsizeorder='size';
  3631. break;
  3632.  
  3633. case 'size':
  3634. ordersizebutton.src=srcimg_desc;
  3635. newsizeorder='sizedesc';
  3636. break;
  3637.  
  3638. case 'agedesc':
  3639. orderagebutton.src=srcimg_desc;
  3640. newageorder='age';
  3641. break;
  3642.  
  3643. case 'age':
  3644. orderagebutton.src=srcimg_asc;
  3645. newageorder='agedesc';
  3646. break;
  3647.  
  3648. default:
  3649. ordersizebutton.src=srcimg_desc;
  3650. orderagebutton.src=srcimg_asc;
  3651. break;
  3652. }
  3653.  
  3654. //Size order button
  3655. //ordersizebutton.src already set
  3656. ordersizebutton.setAttribute('onClick', 'document.location.href=document.location.href.replace(/sort=[a-z]+/i, "sort='+newsizeorder+'")');
  3657. if (ordersizebutton.src=='') ordersizebutton.src=srcimg_desc; //if no 'myorder' param, the img src had not been defined
  3658.  
  3659. //Age order button
  3660. //orderagebutton.src already set
  3661. orderagebutton.setAttribute('onClick', 'document.location.href=document.location.href.replace(/sort=[a-z]+/i, "sort='+newageorder+'")');
  3662. if (orderagebutton.src=='') orderagebutton.src=srcimg_asc; //if no 'myorder' param, the img src had not been defined
  3663.  
  3664. var ordercolumns=THead.getElementsByTagName('h2');
  3665. ordercolumns[0].setAttribute('style', 'font-size:15px;');
  3666. ordercolumns[0].appendChild(ordersizebutton);
  3667. ordercolumns[2].appendChild(orderagebutton);
  3668.  
  3669.  
  3670. }
  3671.  
  3672.  
  3673. function nzbindex_process_results(){
  3674.  
  3675. if (fromGroups!=''){ //We do this only one time to save some millisec
  3676. fromGroups=fromGroups.replace(/\./g,'')
  3677. var tmp_groups=fromGroups.split('|');
  3678. }
  3679. var TRCollection=nzbindex_results.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
  3680. var TRDeleted=0;
  3681. for(i=0;i<TRCollection.length;i++){
  3682.  
  3683. if (TRCollection[i].firstElementChild.className.indexOf('firstcolumn')!=-1) { //This is a result line (firstcolum is a class for the checkbox cells)
  3684.  
  3685. var resultLine=TRCollection[i].children; //A TD collection
  3686. var links=resultLine[1].getElementsByClassName('info')[0].lastElementChild;
  3687.  
  3688. if (nzbindex_showcollections) //OPTION : Checkbox to show only collections results
  3689. if(links.innerHTML.indexOf('collection')==-1) {//this is not a collection
  3690. TRCollection[i].parentNode.removeChild(TRCollection[i]);
  3691. i--;
  3692. TRDeleted++;
  3693. continue;
  3694. }
  3695.  
  3696. //Prepare this row for the easy-select functionnalities
  3697. rowClickable(TRCollection[i])
  3698.  
  3699. if (links.innerHTML.indexOf('Password')!=-1) {//OPTION : delete checkbox if password
  3700. setProtectedRow(TRCollection[i]); //change the way this row is displayed
  3701. if (GM_config.read().nzbindex_nocheckboxifpassword)
  3702. removeElementsByTagName('input',resultLine[0]);
  3703.  
  3704. if (GM_config.read().nzbindex_nonzbbuttonifpassword) {
  3705. links.replaceChild(links.firstElementChild.firstChild, links.firstElementChild);
  3706. }
  3707. }else if(selectTheResult) //if only one result and no password, we check it
  3708. setRow(TRCollection[i], true);
  3709.  
  3710. //for(var j=0;j<links.getElementsByTagName('a')
  3711. links.setAttribute('style','font-size:' + GM_config.read().nzbindex_resultLinks_fontSize + 'px;');
  3712.  
  3713. if (sinceXdays != ''){
  3714. //OPTION : if age corresponds (special : on nzbindex, age < 1 day is in hour, on Binnewz age < 1 day is 0day) then when hightlight the Age cell
  3715.  
  3716. if (test_sinceXdays(resultLine[4].innerHTML, sinceXdays))
  3717. resultLine[4].setAttribute('bgcolor', GM_config.read().binnewz_selectedresultcolor);
  3718. else { //Here we do a little magic ... see sometimes binnewz displays days like '1day' but binsearch could have indexed the file 2days ago. Its often a matter of 1or 2 days
  3719. //so if the option is checked, we do the same test with +-1 day
  3720. if(GM_config.read().binnewz_highlighttolerance){
  3721. var tolerance_check=false;
  3722. if(sinceXdays>0)
  3723. if (test_sinceXdays(resultLine[4].innerHTML, parseInt(sinceXdays)-1)) tolerance_check=true; //test with -1 day (only if sinceXdays != 0day)
  3724.  
  3725. if (!tolerance_check && test_sinceXdays(resultLine[4].innerHTML, parseInt(sinceXdays)+1)) tolerance_check=true; //test with +1 day
  3726.  
  3727. if (tolerance_check==true) resultLine[4].setAttribute('bgcolor', GM_config.read().binnewz_toleranceresultcolor);
  3728. }
  3729.  
  3730. }
  3731.  
  3732.  
  3733. //Now checking if group corresponds, if so we highlight the groups Cell
  3734. if (typeof tmp_groups != 'undefined'){//check only if groups have been passed within the url (see 'tmp_groups' declaration at start of function)
  3735. var tmp_indic=false;
  3736. var tmp_compare=resultLine[3].getElementsByTagName('a');
  3737. for(j=0;j<tmp_groups.length;j++){
  3738. if (tmp_groups[j]!=''){
  3739. for(k=0;k<tmp_compare.length;k++){
  3740. if(tmp_compare[k].textContent.replace(/[\.\s]/g,'')==tmp_groups[j].replace(/\./g,'')){
  3741. resultLine[3].setAttribute('bgcolor', GM_config.read().binnewz_selectedresultcolor);
  3742. tmp_indic=true;
  3743. break;
  3744. }
  3745. }
  3746. if (tmp_indic) break;
  3747. }
  3748. }
  3749. }
  3750. }
  3751.  
  3752. }else if (TRCollection[i].firstElementChild.className=='oldresults' && GM_config.read().nzbindex_delete_oldcontentline) {
  3753. TRCollection[i].parentNode.removeChild(TRCollection[i]);
  3754. i--;
  3755. continue;
  3756. }
  3757.  
  3758.  
  3759. }
  3760.  
  3761. if (TRDeleted!=0){ //So <tr> have been deleted
  3762.  
  3763. var resultsHidden=document.createElement('p');
  3764. resultsHidden.innerHTML="<font color='red'>" + TRDeleted + GM_trans.lang('nzbindex_hiddenresults') + "<font>";
  3765. THead.firstElementChild.children[1].appendChild(resultsHidden);
  3766.  
  3767. }
  3768.  
  3769. }
  3770.  
  3771. function nzbindex_makeurl(search, otherparams){
  3772.  
  3773. var host='www.nzbindex.com/search/';
  3774. var params='?results=250&sort=age_desc&q='+escape(search);
  3775. if (GM_config.read().nzbindex_onlycollections) params+='&showcol=1';
  3776. params+='&sinceXdays=' + sinceXdays + '&fromGroups=' + fromGroups;
  3777. if(pingpong!='') {
  3778. params+='&pong='+pingpong;
  3779. // alert(params);
  3780. }
  3781. if(typeof otherparams!='undefined') params=params+otherparams
  3782.  
  3783. return 'http://'+host+params
  3784. }
  3785.  
  3786.  
  3787. function nzbindex_add_buttons() {
  3788.  
  3789. //Unselect Button
  3790. var selectButton=document.createElement('input');
  3791. selectButton.name='cancelButton';
  3792. selectButton.type='button';
  3793. selectButton.value="Unselect All";
  3794. if(BrowserDetect.browser!='Chrome') selectButton.setAttribute('onclick','clickTheseRows(document.getElementById("results"), 0);')
  3795.  
  3796. var buttonsCol = document.evaluate( '//input[@value="Select all"]' ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
  3797.  
  3798. //insert top line button
  3799. insertAfter(selectButton, buttonsCol.snapshotItem(0));
  3800. insertAfter(document.createTextNode(' '), buttonsCol.snapshotItem(0));
  3801.  
  3802. //insert bottom line button
  3803. insertAfter(selectButton.cloneNode(0), buttonsCol.snapshotItem(1));
  3804. insertAfter(document.createTextNode(' '), buttonsCol.snapshotItem(1));
  3805. }
  3806.  
  3807.  
  3808.  
  3809. function nzbindex_fixedHeader() {
  3810. //NZBIndex nécessite l'injection d'une fonction pour devenir fixed au scroll
  3811.  
  3812. var scriptCode = new Array(); // this is where we are going to build our new script
  3813.  
  3814. // here's the build of the new script, one line at a time
  3815. scriptCode.push('var fixmeTop = $("#searchform").offset().top;');
  3816. scriptCode.push('$(window).scroll(function() {');
  3817. scriptCode.push('var currentScroll = $(window).scrollTop();');
  3818. scriptCode.push('if (currentScroll >= fixmeTop) {$("#searchform").css({ position: "fixed", top: "10px",left: "50%", marginLeft: "-380px"});');
  3819. scriptCode.push(' } else {$("#searchform").css({ position: "static", marginLeft: "0px"});}});');
  3820.  
  3821. // now, we put the script in a new script element in the DOM
  3822. var scriptNZBIndexFixedHeader = document.createElement('script'); // create the script element
  3823. scriptNZBIndexFixedHeader.innerHTML = scriptCode.join('\n'); // add the script code to it
  3824. scriptCode.length = 0; // recover the memory we used to build the script
  3825.  
  3826.  
  3827. document.getElementsByTagName('head')[0].appendChild(scriptNZBIndexFixedHeader);
  3828.  
  3829. }
  3830.  
  3831.  
  3832. //-------------------------------------------
  3833. //-------------------------------------------
  3834. //-----------BINSEARCH-----------------
  3835. //-------------------------------------------
  3836. function binsearch_configurationIntegration() {
  3837.  
  3838. var binsearchMenu=document.getElementsByTagName('h1')[0].parentNode.nextElementSibling;
  3839. var mymenu=createConfigurationMenu();
  3840. mymenu.setAttribute('style', 'margin-top:10px;font-size: 14px;');
  3841. binsearchMenu.appendChild(mymenu);
  3842. }
  3843.  
  3844.  
  3845. //-----------MAKE NZB BUTTONS------
  3846. function binsearch_process_results() {
  3847.  
  3848. //Original source from this script : binsearch.info download button http://userscripts.org/scripts/show/72182
  3849. //Modified by les-newsgroup.fr
  3850. if (fromGroups!=''){ //We do this only one time to save some millisec
  3851. fromGroups=fromGroups.replace(/\./g,'');
  3852. var tmp_groups=fromGroups.split('|');
  3853. }
  3854.  
  3855. var rows = tabresults.getElementsByTagName('tr');
  3856. for (var i = 1; i < rows.length; i++) {
  3857. if(rows[i].getAttribute('done')=="1") continue;
  3858.  
  3859. var cells = rows[i].getElementsByTagName('td');
  3860. var checkboxCell = cells[1];
  3861. var subjectCell = cells[2];
  3862. var protect=false;
  3863.  
  3864. if (GM_config.read().binsearch_delete_oldcontentline) {//OPTION : Delete the 'old results' yellow line
  3865. if (rows[i].getAttribute('bgcolor')=='#ffffbb') {
  3866. rows[i].parentNode.removeChild(rows[i]);
  3867. i--;
  3868. continue;
  3869. }
  3870. }
  3871.  
  3872. var inputs = checkboxCell.getElementsByTagName('input');
  3873. if (inputs.length <= 0)
  3874. continue;
  3875.  
  3876. //Prepare this row for the easy-select functionnalities
  3877. rowClickable(rows[i]);
  3878.  
  3879. var protect=false;
  3880. var tdspans=subjectCell.getElementsByTagName('span');
  3881. if (tdspans.length>1) {
  3882. var fonttag=tdspans[1].getElementsByTagName('font');
  3883. if (fonttag.length>0) {
  3884.  
  3885. //Password for the result ?
  3886. if (fonttag[0].innerHTML.indexOf('password')!=-1) { //Yes : password
  3887. setProtectedRow(rows[i]); //change the way this row is displayed
  3888. if (GM_config.read().binsearch_nocheckboxifpassword) //delete the checkbox ?
  3889. if (checkboxCell.getElementsByTagName('input')[0].type=='checkbox')
  3890. checkboxCell.removeChild(checkboxCell.getElementsByTagName('input')[0]);
  3891. if (GM_config.read().binsearch_nonzbbuttonifpassword) //OPTION : Block the NZB button creation if passworded
  3892. protect=true;
  3893. // continue; //Go to the next result : do not create NZB button and do not do anything else for this result
  3894. }
  3895.  
  3896. //OPTION : Displays details of missing parts
  3897. if (GM_config.read().binsearch_missingpartsdetails)
  3898. if (fonttag[0].innerHTML.indexOf('/')!=-1) {
  3899. var tmp=fonttag[0].innerHTML.split('/');
  3900. if (parseInt(tmp[1] - tmp[0]) > 0)
  3901. fonttag[0].innerHTML=fonttag[0].innerHTML + ' [' + GM_trans.lang('binsearch_missingpartsdetails') + ' ' + parseInt(tmp[1] - tmp[0]) + ']';
  3902. else{ //if theres is more parts available than it should be, we remove the 'parts available' red color
  3903. //fonttag[0].innerHTML='';
  3904. //fonttag[0].parentNode.innerHTML=fonttag[0].parentNode.innerHTML.replace(', parts available:', '');
  3905. fonttag[0].color='green';
  3906. }
  3907. }
  3908. }
  3909. }
  3910.  
  3911. //OPTION : Highlight the age if it is the same age than the binnewz' selection
  3912. if (sinceXdays != ''){
  3913.  
  3914.  
  3915. resultAge=cells[5].innerHTML;
  3916.  
  3917. if(i==rows.length-1) {//alors on doit faire une manip' sur l dernière cellule car binsearch y à intégrer un commentaire HTML
  3918. resultAge=resultAge.slice(0, resultAge.indexOf('<!--'));
  3919. }
  3920.  
  3921. if (test_sinceXdays(resultAge, sinceXdays))
  3922. cells[5].setAttribute('bgcolor', GM_config.read().binnewz_selectedresultcolor);
  3923. else { //Here we do a little magic ... see sometimes binnewz displays days like '1day' but binsearch had indexed the file 2days ago. Its often a matter of time
  3924. //so if the option is checked, we do the same test with +-1 day
  3925. if(GM_config.read().binnewz_highlighttolerance){
  3926. var tolerance_check=false;
  3927. if(sinceXdays>0)
  3928. if (test_sinceXdays(resultAge, parseInt(sinceXdays)-1)) tolerance_check=true; //test with -1 day (only if sinceXdays != 0day)
  3929.  
  3930. if (!tolerance_check && test_sinceXdays(resultAge, parseInt(sinceXdays)+1)) tolerance_check=true; //test with +1 day
  3931.  
  3932. if (tolerance_check==true) cells[5].setAttribute('bgcolor', GM_config.read().binnewz_toleranceresultcolor);
  3933. }
  3934.  
  3935. }
  3936.  
  3937. //Now checking if group corresponds
  3938. if (typeof tmp_groups != 'undefined'){ //check only if groups have been passed within the url (see 'tmp_groups' declaration at start of function)
  3939. var tmp_indic=false;
  3940. var tmp_compare=cells[4].getElementsByTagName('a');
  3941. for(j=0;j<tmp_groups.length;j++){
  3942. if(tmp_groups[j]!=''){
  3943. for(k=0;k<tmp_compare.length;k++){
  3944. if(tmp_compare[k].textContent.replace(/[\.\s]/g,'')==tmp_groups[j]){
  3945. cells[4].setAttribute('bgcolor', GM_config.read().binnewz_selectedresultcolor);
  3946. tmp_indic=true;
  3947. break;
  3948. }
  3949. }
  3950. if (tmp_indic) break;
  3951.  
  3952. }
  3953. }
  3954. }
  3955. }
  3956.  
  3957. //we make a NZB button if option is checked and if there is no password for this result
  3958. if (GM_config.read().binsearch_nzbbuttons && !protect){
  3959. var id = inputs[0].name;
  3960. //var id = "81119238"; //bad id
  3961. //var id = "81124031"; //bad id
  3962. //var id = "54884922"; //good id
  3963. var filename = subjectCell.getElementsByTagName('span')[0].innerHTML;
  3964.  
  3965. var re = /"(.*)"/;
  3966. var matches = re.exec(filename);
  3967. if (matches)
  3968. filename = matches[1];
  3969. filename = escape(filename);
  3970.  
  3971. var form = document.createElement('FORM');
  3972. form.method = 'POST';
  3973. form.action = '/fcgi/nzb.fcgi?q=' + filename;
  3974.  
  3975. var id_el = document.createElement('input');
  3976. id_el.name = id;
  3977. //id_el.value = 'on';
  3978. id_el.type = 'hidden';
  3979. form.appendChild(id_el);
  3980.  
  3981. var action_el = document.createElement('input');
  3982. action_el.name = 'action';
  3983. action_el.value = 'nzb';
  3984. action_el.type = 'hidden';
  3985. form.appendChild(action_el);
  3986.  
  3987. var submit_el = document.createElement('input');
  3988. submit_el.type = 'submit';
  3989. submit_el.setAttribute('style', 'background-color:' + GM_config.read().binsearch_nzbbuttoncolor + ';');
  3990. submit_el.setAttribute('class', 'b');
  3991. submit_el.style.setProperty('cursor', 'pointer', 'important');
  3992. submit_el.value = 'NZB';
  3993. form.appendChild(submit_el);
  3994.  
  3995. checkboxCell.appendChild(form);
  3996. }
  3997.  
  3998. if(selectTheResult && !protect){ //if only one result and no password, we check it
  3999. setRow(rows[i], true);
  4000. }
  4001.  
  4002. rows[i].setAttribute('done', 1);
  4003.  
  4004. }
  4005.  
  4006. }
  4007.  
  4008.  
  4009. function test_sinceXdays(days_site, days_search){
  4010.  
  4011. switch(website){ //a global variable (see MAIN)
  4012.  
  4013. case 'binsearch':
  4014.  
  4015. return (days_site==String(days_search) + 'd' || (days_search==0 && (days_site.indexOf('h')!=-1) || (days_site.indexOf('m')!=-1)))
  4016.  
  4017. case 'nzbindex':
  4018.  
  4019. //return (days_site.indexOf(String(days_search) + '.')!=-1 || (days_search==0 && days_site.indexOf('hour')!=-1))
  4020. return (days_site.match('[^0-9]' + String(days_search) + '\.[0-9+] day')!=null || (days_search==0 && days_site.indexOf('hour')!=-1))
  4021.  
  4022. }
  4023.  
  4024.  
  4025. }
  4026.  
  4027.  
  4028. //not functionnal now ... need to work on it and maybe merge 2 functions
  4029. function binsearch_onlycollections(){
  4030.  
  4031. //Wont do it for now ... Binsearch already have an 'showcollectionsonly' parameter.
  4032. //If checked in option, links from binnewz to Binsearch will be written with this param and it will work.
  4033. //We would need a function like this one for every time someone who use binsearch, and use this script, and have checked the 'showonlycollections'
  4034. //will access Binsearch directly... in this case, the url nill not contain the good param and Binsearch will not show only collections.
  4035. //And this function could dynamically delete 'nocollection' rows
  4036.  
  4037. }
  4038.  
  4039.  
  4040.  
  4041. function make_select_buttons() {
  4042.  
  4043. var index=binsearch_find_formchild();
  4044.  
  4045. //Select Button
  4046. var selectButton=document.createElement('input');
  4047. selectButton.name='selectButton';
  4048. selectButton.type='button';
  4049. selectButton.value=GM_trans.lang('binsearch_selectall_button');
  4050. selectButton.setAttribute('onclick','clickTheseRows(this.form.getElementsByTagName("input"), 1);')
  4051. selectButton.setAttribute('class', 'b');
  4052.  
  4053. searchform.insertBefore(document.createTextNode(' '), searchform.childNodes[index]);
  4054. searchform.insertBefore(selectButton, searchform.childNodes[index+1]);
  4055.  
  4056. //unselect button
  4057. selectButton=document.createElement('input');
  4058. selectButton.name='unselectButton';
  4059. selectButton.type='button';
  4060. selectButton.value=GM_trans.lang('binsearch_unselectall_button');
  4061. selectButton.setAttribute('onclick','clickTheseRows(this.form.getElementsByTagName("input"), 0);')
  4062. selectButton.setAttribute('class', 'b');
  4063.  
  4064. searchform.insertBefore(document.createTextNode(' '), searchform.childNodes[binsearch_find_formchild()]);
  4065. searchform.insertBefore(selectButton, searchform.childNodes[binsearch_find_formchild()]);
  4066.  
  4067. }
  4068.  
  4069. //This function finds the first child with a 'P' tag and return its index. Its means to be used with a 'insertBefore' function
  4070. function binsearch_find_formchild() {
  4071. i=0;
  4072. for(i; i < searchform.childNodes.length; i++)
  4073. if (searchform.childNodes[i].nodeName=="P") break;
  4074.  
  4075. return i;
  4076.  
  4077. }
  4078.  
  4079. function make_noresult_button() {
  4080.  
  4081. var pnode=document.createElement('p');
  4082. var button_groups=document.createElement('input');
  4083. button_groups.type='button';
  4084. button_groups.setAttribute('class', 'b');
  4085. button_groups.setAttribute('style', 'color:red; padding:15px; font-size:17px;');
  4086. if (typeof searchServers == 'undefined' || searchServers=='' || searchServers=='1') { //most popular groups
  4087. button_groups.value=GM_trans.lang('noresult_button') + ' - ' + GM_trans.lang('binsearch_button_othergroups');
  4088. button_groups.name="othergroups";
  4089. button_groups.setAttribute('onclick', 'document.location.href=document.location.href.replace("server=1","") + "&server=2";');
  4090. }else if(searchServers=='2'){ //other groups
  4091. button_groups.value=GM_trans.lang('noresult_button') + ' - ' + GM_trans.lang('binsearch_button_populargroups');
  4092. button_groups.name="populargroups";
  4093. button_groups.setAttribute('onclick', 'document.location.href=document.location.href.replace("server=2", "server=1");');
  4094. }
  4095. pnode.appendChild(button_groups);
  4096.  
  4097. searchform.replaceChild(pnode, searchform.childNodes[binsearch_find_formchild()]);
  4098.  
  4099. }
  4100.  
  4101. function binsearch_make_othernzbindexer_button() {
  4102.  
  4103. var nzbindexButton=createButton('NZBIndex', nzbindex_makeurl(document.getElementById('originalQuery').value));
  4104. nzbindexButton.setAttribute('class', 'b');
  4105. searchform.insertBefore(document.createTextNode(' '), searchform.childNodes[binsearch_find_formchild()]);
  4106. searchform.insertBefore(nzbindexButton, searchform.childNodes[binsearch_find_formchild()]);
  4107.  
  4108. }
  4109.  
  4110. function binsearch_autoload_othergroups() {
  4111.  
  4112. if (query != '')
  4113. if(autoload != '1') { //only if there is a query and if not already rewritten the pageurl
  4114. if (searchServers==2) { //server=2 : Then we are on the othergroups results page
  4115. document.location.href=document.location.href.replace("&server=2","") + "&server=1&autoload=1";
  4116. }else {
  4117. if (searchServers=='' || searchServers=='1'){
  4118. document.location.href=document.location.href.replace(/server=1?/, "server=2") + "&autoload=1";
  4119. }else {
  4120. document.location.href=document.location.href + "&server=2" + "&autoload=1"; //no 'server' param means popular groups
  4121. }
  4122. }
  4123. }else return true;
  4124. else return false;
  4125.  
  4126. return false; //if we reach this command, then a rewritting of the location is happening now, returning 0 to not autoload nzbindex
  4127. }
  4128.  
  4129.  
  4130.  
  4131. function binsearch_delete_input(parent) {
  4132. removeElementsByTagName('INPUT', parent);
  4133. // for(i=0; i < parent.children.length;i++)
  4134. // if (parent.children[i].nodeName=='INPUT' && parent.children[i].value!=GM_trans.lang('othernzbindexer_button') + ' ' + 'NZBIndex')
  4135. // parent.removeChild(parent.childNodes[i]);
  4136. // else if(parent.childNodes[i].nodeName=='P')
  4137. // binsearch_delete_input(parent.childNodes[i]);
  4138.  
  4139. }
  4140.  
  4141. function resize_binsearch(tabwidth){
  4142.  
  4143. tabresults.setAttribute('style', 'width:' + tabwidth + '% !important; margin-left:'+(100-tabwidth)/2+ '%');
  4144.  
  4145. }
  4146.  
  4147. //Delete the add by removing all iframes
  4148. //Credit : Userscript nammed 'SABnzbd binsearch'
  4149. function Binsearch_DeleteAd() {
  4150. var iframes = document.evaluate('//iframe', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  4151. for (var j = 0; j < iframes.snapshotLength; j++) {
  4152. var iframe_obj = iframes.snapshotItem(j);
  4153. iframe_obj.parentNode.removeChild(iframe_obj);
  4154. }
  4155. }
  4156.  
  4157.  
  4158. function binsearch_makeurl(search, otherparams){
  4159.  
  4160. var host='www.binsearch.info/';
  4161. var params='?q='+escape(search)+'&max=250';
  4162. if (GM_config.read().binsearch_advancedsearch) {
  4163. params=params+'&adv_sort=date';
  4164. if (GM_config.read().binsearch_showcollections) params=params+'&adv_col=on';
  4165. }
  4166. // params+='&sinceXdays=' + sinceXdays + '&fromGroups=' + fromGroups;
  4167. if(typeof otherparams!='undefined') params=params+otherparams
  4168.  
  4169. return protocol+host+params
  4170. }
  4171.  
  4172.  
  4173. function binsearch_fixedHeader() {
  4174.  
  4175. document.getElementsByClassName('mt')[0].getElementsByTagName('TR')[0].setAttribute('style',"position:fixed;display:table;margin-left:-1px;margin-right:-1px; width:100%;");
  4176. document.getElementsByTagName('h2')[0].setAttribute('style',"padding-top:100px;");
  4177.  
  4178. document.getElementsByName('q')[0].id="originalQuery";
  4179.  
  4180. var formElement=document.createElement('FORM');
  4181. formElement.method='action';
  4182. var inputElement=document.createElement('INPUT');
  4183. inputElement.setAttribute('class',"b");
  4184. inputElement.setAttribute('type',"text");
  4185. inputElement.name="q";
  4186. inputElement.id="cloneQuery";
  4187. inputElement.setAttribute('size',"50");
  4188. formElement.appendChild(inputElement);
  4189.  
  4190. inputElement=document.createElement('INPUT');
  4191. inputElement.setAttribute('class',"b");
  4192. inputElement.setAttribute('type', 'submit');
  4193. inputElement.setAttribute('value', 'search');
  4194.  
  4195. formElement.setAttribute('style',"margin-top:8px;margin-left:100px;");
  4196. formElement.appendChild(inputElement);
  4197.  
  4198. document.getElementById('BU_conf').parentNode.appendChild(formElement);
  4199.  
  4200. document.getElementById('cloneQuery').value=document.getElementById('originalQuery').value;
  4201.  
  4202.  
  4203. }
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210. //-------------------------------------------------
  4211. //-------------------------------------------------
  4212. //-------------------BINNEWZ-----------------
  4213. //-------------------------------------------------
  4214. //-------------------------------------------------
  4215. function resize_binnewz(resultsNode, tabwidth){
  4216.  
  4217. resultsNode.setAttribute('style', 'width:'+tabwidth+'% !important; margin:1 !important; margin-left:'+(100-tabwidth)/2+ '%')
  4218.  
  4219. }
  4220.  
  4221. function binnewz_DeleteAd() {
  4222.  
  4223. var mark = document.getElementsByName("haut");
  4224. if (mark != null && typeof mark[0] != 'undefined') {
  4225. if(mark[0].nextElementSibling.tagName=="DIV" && mark[0].nextElementSibling.className=="")
  4226. mark[0].parentNode.removeChild(mark[0].nextElementSibling);
  4227. }
  4228.  
  4229.  
  4230. //Autre tests au cas où
  4231. var frame = document.getElementById("headerContainer");
  4232. if (frame!=null) frame.outerHTML = "";
  4233.  
  4234. frame = document.getElementsByName("banner");
  4235. if (frame!=null && typeof frame[0]!='undefined') frame[0].outerHTML = "";
  4236.  
  4237. divAd = document.getElementById("zzadcontent");
  4238. if (divAd!=null && typeof divAd!='undefined') divAd.parentNode.removeChild(divAd);
  4239.  
  4240. divAd = document.getElementById("zzadfooter");
  4241. if (divAd!=null && typeof divAd!='undefined') divAd.parentNode.removeChild(divAd);
  4242. }
  4243.  
  4244.  
  4245. function binnewz_changeOtherPagesLinks() {
  4246.  
  4247. var temp_var=document.getElementById('fp_country');
  4248. temp_var.id='country';
  4249.  
  4250. var temp_var=document.getElementById('fp_cat_id');
  4251. temp_var.id='cat_id';
  4252.  
  4253. var temp_var=document.getElementById('fp_page');
  4254. temp_var.id='page';
  4255.  
  4256. }
  4257.  
  4258. function binnewz_configurationIntegration(){
  4259.  
  4260. var binnewzMenu=document.getElementById('menu_search');
  4261. if (binnewzMenu==null) {
  4262. if (typeof binnewzMenu=='undefined')
  4263. binnewzMenu=document.getElementById('DivError'); //for Search page
  4264. // binnewzMenu=typeof window.parent.frames[1] != 'undefined' ? window.parent.frames[1].document.getElementById('DivError') : document.getElementById('DivError'); //for Search page
  4265. if (binnewzMenu==null)
  4266. binnewzMenu=document.getElementById('filtre'); //for Search page
  4267. // binnewzMenu=typeof window.parent.frames[1] != 'undefined' ? window.parent.frames[1].document.getElementById('filtre') : document.getElementById('filtre'); //for Search page
  4268. }
  4269. if (binnewzMenu!=null){ //afin d'éviter que le script plante si Binnews modifie son site
  4270. //sinon il faudrait surement afficher quelque chose du genre "prevenez l'auteur du script"
  4271.  
  4272. var myfirstmenu=document.createElement('div');
  4273. myfirstmenu.setAttribute('style', ((GM_config.read().option_fixedheader) ? 'position:fixed' : 'position:absolute') + ';top: 115px;left: 950px;overflow: hidden;vertical-align: top;background-color: #215589;z-index: 100;');
  4274.  
  4275.  
  4276. var mymenu=createConfigurationMenu();
  4277. mymenu.setAttribute('style', 'position:relative;background-color: #EBF8A4;font-size: 14px;vertical-align:top; padding:3px;');
  4278.  
  4279. myfirstmenu.appendChild(mymenu);
  4280. binnewzMenu.parentNode.insertBefore(myfirstmenu, binnewzMenu.nextSibling);
  4281. }
  4282. }
  4283.  
  4284.  
  4285.  
  4286. //-----------------------------------------------
  4287. //---------------MAKE NZB LINKS----------
  4288. //---------------by Guile93 - Gatsu-----------
  4289. //------------modified by les-newsgroup----
  4290. //-----------------------------------------------
  4291. var olddiv; //from the display_nzb_links function
  4292. function display_nzb_links(){
  4293. var binnewz_strpostdays='&sinceXdays='
  4294. var binnewz_postdays='';
  4295. var binnewz_strpostgroups='&fromGroups='
  4296. var binnewz_postgroups=''
  4297.  
  4298. if(document.getElementsByClassName('bigred').length<5) //on est sur une page de résultats par catégroies ou une recherche (les pages là n'ont qu'un appel e la calsse 'bigred' normalement ... c'est bancal mais binnews est mal foutu donc ...)
  4299. if(document.getElementsByClassName("ligneclaire").length>0)
  4300. var search_array = document.evaluate( '//tr[@class[.="ligneclaire" or .="lignefoncee" ] and not(@done)]' ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
  4301. else
  4302. var search_array = document.evaluate( '//tr[@class[.="even" or .="odd" ] and not(@done)]' ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
  4303. else {//on est sur la pages des derniers référencements
  4304. var lfTRs=document.getElementsByClassName('lf');
  4305. for(i=0;i<lfTRs.length;i++)
  4306. lfTRs[i].previousElementSibling.className='le';
  4307.  
  4308. var search_array = document.evaluate( '//tr[@class[.="lf" or .="le" ] and not(@done)]' ,document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
  4309. }
  4310.  
  4311. for (var n=0; n < search_array.snapshotLength; ++n){
  4312. var TR=search_array.snapshotItem(n);
  4313. TR.style.height="31px";
  4314. var TDs=TR.children;
  4315.  
  4316. var titleTD=TDs[titleIndex];
  4317. var groupsTD=TDs[groupsIndex];
  4318. var fileTD=TDs[fileIndex];
  4319. var sizeTD=TDs[sizeIndex];
  4320.  
  4321. if(titleTD.innerHTML.indexOf('cadenas.png')!=-1 || titleTD.innerHTML.indexOf('virus.gif')!=-1){ //password protected or virus result
  4322.  
  4323. if(GM_config.read().binnewz_deletenodeifpassword) {
  4324. TR.parentNode.removeChild(TR);
  4325. continue;
  4326. }
  4327.  
  4328. if(GM_config.read().binnewz_highlightifpassword){
  4329. setProtectedRow(titleTD.parentNode);
  4330. titleTD.style.backgroundColor = "#FDD5D7";
  4331. titleTD.onmouseover=function(){ this.style.background="#FDD5D7";}
  4332. }
  4333.  
  4334. if(GM_config.read().binnewz_donothingifpassword)
  4335. continue;
  4336.  
  4337.  
  4338. }
  4339.  
  4340. var Acol=titleTD.getElementsByTagName('a');
  4341. if (Acol.length>0) //testing if there is binnews link or not, if so, we do nothing and step to the next result line
  4342. {
  4343. var elementTitle=Acol[0].innerHTML.toLowerCase();
  4344. if(Acol[0].href.indexOf(binnewz_url) != -1)
  4345. {
  4346. continue;
  4347. }
  4348. }
  4349. else
  4350. {
  4351. var elementTitle=titleTD.textContent.toLowerCase();
  4352. }
  4353.  
  4354. // Cook2 : get Title
  4355.  
  4356. elementTitle=cleanup(elementTitle);
  4357. elementTitle=elementTitle.replace(/ /g, "+");
  4358. elementTitle=elementTitle.replace("&amp;","&");
  4359.  
  4360. var req=fileTD.innerHTML.replace(/ /g, "+");
  4361. // req=req.split("*").join(" ");
  4362. var req_amp=req.replace("&amp;","&");
  4363. var method1=req_amp;
  4364. var method2=encodeURI(req_amp);
  4365. var method3=encodeURI(req).replace("&amp;","%26");
  4366.  
  4367. //Retrieving post's age
  4368. if(resultsType==3) //pour les derniers refs sur binnewz, on place arbitrairement sinceXDays à 0 jours
  4369. var tmp=0;
  4370. else {
  4371. var tmpsearch=TR;
  4372. while(tmpsearch.className.indexOf('ligne') != -1){
  4373. tmpsearch=tmpsearch.previousElementSibling;
  4374. }
  4375. var tmp=binnewz_getdays(tmpsearch.firstChild);
  4376.  
  4377. }
  4378. if (typeof tmp!='undefined')
  4379. if (tmp!=-1) binnewz_postdays=tmp;
  4380. else binnewz_postdays='';
  4381. //else we use the post days retrieved before
  4382. //Retrieving post's group(s)
  4383. binnewz_postgroups='';
  4384. var tmp_links=groupsTD.getElementsByTagName('a');
  4385. for(i=0; i<tmp_links.length; i++)
  4386. if (tmp_links[i].childElementCount==0) //If not, theres something else than a group name in this link (like the 'not free' img)
  4387. binnewz_postgroups=binnewz_postgroups + tmp_links[i].innerHTML.replace('.','') + '|';
  4388. binnewz_postgroups=binnewz_postgroups.substring(0, binnewz_postgroups.length-1);
  4389.  
  4390. //end
  4391. //By les-newsgroup.fr : Added a test of checked options before every 'make_link()'
  4392. //By les-newsgroup.fr : Added protocol variable (http/https)
  4393. //By les-newsgroup.fr : Added the 'sinceXdays' & 'fromGroups' param
  4394. //By les-newsgroup.fr : Added a float attribute to the links div (optionnable)
  4395. //By les-newsgroup.fr : Modifications in the show/hide functions
  4396. var div = document.createElement("div");
  4397. div.setAttribute('style', 'float:right;');
  4398. if (GM_config.read().display_nzbindex) make_link(div,protocol+"www.nzbindex.com/search/?results=250&sort=age_desc" + binnewz_strpostdays + binnewz_postdays + binnewz_strpostgroups + binnewz_postgroups + "&q="+method3.split("*").join(" "),"NZBindex","data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAWCAYAAAGkkcxkAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABMlJREFUeNpi+P//P4OgoKAsCDOAAEiAwWze/3v37gMZDBxggfcfv/z//v07WAAggBi5ubmF2NjYuMHKp06duuvajTv/GXRm/Wfi5+dnUFeWZXh/NIoBIIAYQfr6+vp2eXh4uIINBQJGRkYGbW1tThYQR0BAgEE7/CgDAzszw+sd/gyiDmshikCqra2ti2RlZZ0YkMDKlStDAAIILCkkJCSLLAEy9u3bt4/Bxh45cuQRSBFIEAR4eHjAaphA5NK9bxiCG64xaEcdY5i55SWDhCgfWBFYkp2dg6E6ThPIY2RgY2djYOPkRzjo69fv/1lYGBm+//zLwMLMxMDDzQmWA9uZnJy4lQEVMK1YsYIBIIAYYR6fMmXKIU9PT1sGPADkUAkJCXagnl9MMMG/f//+2HP2DUN+7xUGTjZGhq/ffzPk910FiTNsPf6SIb/nCgMbC8IPcI2cnJwMT98CFZ19xyAdsJ/h/N2fDFuPvGLg5uZhePDyD8PWw6+AEc8Ht50FxuDg4GBg/cXGwPDxJ8P/G0kMEm5rQKmCgZeXl4GZhZWB4c9foDWcCHeD/AjCQA/v+vPnz398+D8kQDhAFEAAPqpdJWIgit68x6yPL5D8gx/hB2yVQvIXSmprOxt7G7WzkIVlt1UIW0oaK3crQSWanZCAm3hmyAwjKxkIcznh3DPcc2Ys5ZLO3sDinBdN05TmUXfyPF/ixyAxTdNbbLFJtJBlQjd9fJUVsxYT1maqYn+X0dnlC90/flLg+3R+/UoXdys66PHpotAN/kx1FDI5/oendzo5PqTZ4gMkD3gg8SjCdB1nW1GoyE6hQ9F4TiFzpYIPm8QSJNu2t4mWx6RvV6dH1CG0q7dKEploCFwQ/1VET5jcUon7vpyOiUDetECDQOIWrpKpSH3IQ2GueCnWvJKvRfHNuy98dV1LvFxXXZIkNyowrunT3ojp2vMM3O3TbSgq4k8cxxPs7VAAsix7VvWvAKVVTUsbYRB+kt133+xiSOIXxJqLCZQee/MWVMSDBoIEvJlD6Un7J3rw4KE9Fe89pE2P9aTgR7RUD/6EqKCCoifRBtnNhzNvNjHZ1BDIuwy7O/vsDPPxzDT56E4NXzKZzMTj8Xfcm+jjCCF8hULhsFgs7rX60D04M5VKfUyn07OlUqkff2pY0Mj7RQ6P6PXpNYeqxDrl0DINSFHPYblSozlWdbNAzRnQ1L1araFEeo6AsYaLt52qskE16MiS36tg4HDEwsbva8RmdhBb2Edi6Q/Ob2wMhU08lf14u/wXsbldTK6cEF5gdNDCev6yjidZy11ghGy0tVk3h4YhEZAUvEm9a+moUDjzn47x+fuZMmTxN9ozzB7aXRCteBJTCmWjZ4eCyKC7rQm7gtXMBEbeDODbj1O8/3CgUsx/+uiShGXRNL1BmDptDdnGwK4O4XPB3F3EwsR4CLdbi1iYjuHu6hH3/xxVTK4jR8hzo4l3+4D6tPcI+YQGJKLDJqJDJhFUki0/Nr9MI/91CmNBQ+lHIwHlsKYZCAddPEmInr3E7dgZjdGRy+W2eXw4jk17wlHCz7b9Ig192XGaOi+eTzab/dnYMf8dNS5/ZD1S0RPftC7fqLYdRryTRm1W3gMcPPo7bIyKjYdai5NneQAnEnLrIpsAAAAASUVORK5CYII=");
  4399. if (GM_config.read().display_binsearch1) make_link(div,binsearch_makeurl(method1, "&server=1" + binnewz_strpostdays + binnewz_postdays + binnewz_strpostgroups + binnewz_postgroups),"Binsearch","data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAUCAYAAAHpWW1vAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA29JREFUeNokyDERAEEIBLDMK8ASEjGEKvq94lNGEt2d7k4SH1SV3YU/7s7MgAcAAP//YnR0dPzPAAVMDAwMDLt372b48+cPhJOamsrAwsLCAAAAAP//YoCZHBgY+P/s2bP/HRwcUG2Bm8HExLB06VIGQUFBBgYGBgYAAAAA//9sjbENACEMA82XWSFrMAFzZCkGSZfam5HQoef17k4+2a2qMMYofEKyPS9AZl7CNTvnhLv/l2YGETl8PnvvUFVEBNZaINk2AAAA//90jjEKhDAUBSeQ/MJeUniH3CFeKq2Vx7HwJLaSLk1IZ2MjAbeQhXXR184bGHWeV8s3SkTw3lNKYVkWnkIB9D9omoYQAuu6klJCRBjHkeM4UEo9t/5u33eGYaDrOuZ5pm3bG9dvonOOaZqw1hJjJOeMMeZd3LaNvu8BqLVeJ61vEsAHAAD//4STMQqDQBREn0vWbfQ2NhZ2gqCFl9kLWNt5Cy+gd7C2sbL3AMIKH1OEhIgxTv+ZNzP8Uzl3epdzyCgiJElCnucftysdULdtw1pLGIa0bUsQBC+srzYvWxURANI0pa5rsiy7d/yWtRalFFEUMU0T8zyjlLrfsSxLmqYBoCgKnHP/UT8ojwe+7wOwrusp5wnV8zz2fafve7TWiAhd12GMuT40xlBVFSKCc444jhmGgWVZ/jsqpQ4fMY4jWuufczxJK3tdA4I4iv9msJFZk4igUKBTeACdQqP1BDqt3nNIdF5Ao5HwBFuoiUqjEYlQsNmVMHuLm7uRi+vjnnJm/jk5Z87MCZPzg+sECSEwxnA4HDDGEAQBlmWRSCT4PfcsaU+vEcDzPLLZLP1+n0wmQywWw3EcOp0OSqm7Cp7hT8IgCJBSkkql0FoDoLXG9/1QoRAifHTXufqI8B7K5TLj8ZhcLheurVYrJpMJg8EAz/OIx+MPLZfvEm63W7rdLtVqleFwyOVyIZ/P02w2aTQapNNpfN9/OP824Xq9ZjQacT6fcRyHxWIRWlsoFFBK3fTIvywtFou0Wi3m8zn1ep1SqQSAMYbpdMp+v7/5RN8KjRAC27bDPthsNtRqNdrtdnhuuVzS6/WYzWacTqfvRv6E0LZtdrsdlUoFYwxSSiKRCFJKtNYopXBdF9d1sSyLaDT6NKkvKUwmkzd7xhiOx2NYpa/iawAh11DkFRxLSAAAAABJRU5ErkJggg==");
  4400. if (GM_config.read().display_binsearch2) make_link(div,binsearch_makeurl(method1, "&server=2" + binnewz_strpostdays + binnewz_postdays + binnewz_strpostgroups + binnewz_postgroups),"Binsearch \"other groups\"","data:image/x-png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAUCAYAAAHpWW1vAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAfBJREFUeNo0yLENADAQhDDr99+ZFNFRWaggVDlf1g2bDwAA//9ihCrHlEXRCwAAAP//gjH+/////39WVtZ/JIDQxsDAwPDr1y8GbW1tOB8AAAD//2JAdhMy/v//PwMLTAEjIyOKO1Fcw8DAwJCcnMwgIiIC5zPCjIXpRDKBkRHJTnTACAAAAP//jJC7DYAwDESfZ/Eskasow3jxbHAUoAgwkXDr+9uqbqa35+YMOMNWOaP3zhiDOSeZWUGSHgNetmvI1pruv4XfEQG5uwBFRCF+Rv3T9QAAAP//jJNBCsAgDATXnvQighfxlf7Rj/iT7cmSqG0TCChkcZk1Co6FDEkNx/SKc+eUASCEoAbeahN6759za+3T82ySZEqJAFhKYc6ZK+0tjlUoh3vvm/CykKy1/luNMZ4W6d+qrDGGukuhE/nRkuP8ADcAAAD//2JEj3gSshcDKRbhjH9swNHREZ6gpk6dSpEjiLLwwoULDD9+/GBgYGBguHv3LmXeRopEjGIAPQ3CsJaWFgrf1NT0/6dPnzD0IUc6tlRDlIWmpqZw8d27d2NNlvgsZCI1RJycnOBsFxcXhqioKDh/06ZN1A9SZWVluPjMmTNJ9iFRFsIMZGZm/h8fH/8/KioKxSInJyds+RirhXTPhyyESnhqA8AAC9ek9TK4k0AAAAAASUVORK5CYII=");
  4401. div.innerHTML+="&nbsp;";
  4402. if (GM_config.read().display_nzbfriends) make_link(div,"http://www.nzbfriends.com/?q="+method1.replace('.part.nzb',''),"NZBFriends","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVVJREFUOI3FkbFKw1AUhr+WSKUBIbYIWilCBkeRCA6OVhddBLsmmz5CfYT0Fbo1YyL4AMZOilMGVyElFAqlKJ1aKoXGIba3t606if92/nv4zn/ugf9Witgq4YQG1mMV//SK9kDD1D2csCx1mnqAExoztUeq3lRwQgM3somtgOvnMu1BCVMPcCN7btiN5N21KsTWQXpqzNIBClkfVWkuZC5kfXKZgNFYwwnLAvDULUmNtdcTDvMeALlMMPWPNnyON71JKQDdoZwA4KWXQPc0X/LfhtoiYDTWJEhsabx/JPXljkjgRjaNToVcJsDUawIwgUzU6ouViqpIoCpNVtK9L7iRlh5mdRsl03OZgFS9N/XPtmtcFKsAOOEMYCsbSIDv9p+TAOyvC0CrL/bPr/aILflCSz8RkhsDFFUR2Y1szh/upbrRqSwH7K7Ja/wkVWli6t7vjX+tT2Ssd9q5c7BYAAAAAElFTkSuQmCC");
  4403.  
  4404. // Cook2 : Get allocine from DuckDuckGo search (best results)
  4405.  
  4406. div.innerHTML+="&nbsp;&nbsp;&nbsp;&nbsp;";
  4407. if (GM_config.read().display_allocine) make_link(div,"https://duckduckgo.com/?q=!ducky+"+elementTitle+"+site%3Aallocine.fr/film","Allociné","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAQ6gAAEOoBgtMKmAAAABp0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuMTAw9HKhAAAAJFBMVEX///8AAAAGBgY+FAA+PgBdPwBdXQB8VACbaQC6fgDZkwDwqgAI/OSqAAAAAXRSTlMAQObYZgAAAFRJREFUCNdjYMjsYODoLGBgYJi9OyF79wIgo3s3EEyAMBZGQ0S2CgpBGE6JgmDGVuldEKnG2RDFs0WhupZKQRkTBVdDGMsEu6FqhBEmQ0VglkKdAQBiDTOYXTwmxAAAAABJRU5ErkJggg==");
  4408. div.innerHTML+="&nbsp;&nbsp;&nbsp;&nbsp;";
  4409.  
  4410. if (resultsType==1) {
  4411. if (GM_config.read().display_thxlink) make_thxlink(div, TDs[thanksIndex].firstChild.href);
  4412. if (GM_config.read().rating_imdb){ //if option is activated
  4413. if(in_array(cat_id,binnewz_goodCat))
  4414. make_infoLink(div, titleTD, 'movie')
  4415. else if(in_array(cat_id,binnewz_tvCat))
  4416. make_infoLink(div, titleTD, 'tv')
  4417. }
  4418. }else {
  4419. if (GM_config.read().display_thxlink) //sur les pages de recherche et de derniers ref le lien pour commenter et le lien pour remercier sont ensembles
  4420. if(typeof TDs[thanksIndex].children[1] != 'undefined')
  4421. make_thxlink(div, TDs[thanksIndex].children[1].href);
  4422.  
  4423. if (GM_config.read().rating_imdb){
  4424. if(resultsType==2){ //page de recherche
  4425. catTitle=TR.parentNode.parentNode.previousElementSibling.textContent;
  4426. }else if(resultsType==3){ //page des derniers refs
  4427. catTitle=TDs[catIndex].textContent;
  4428. }
  4429.  
  4430. if(catTitle.indexOf('Série')!=-1)
  4431. make_infoLink(div, titleTD, 'tv');
  4432. else if(catTitle.indexOf('Films')!=-1 || catTitle.indexOf('Anime')!=-1)
  4433. make_infoLink(div, titleTD, 'movie');
  4434.  
  4435. }
  4436. }
  4437.  
  4438.  
  4439.  
  4440. div.style.visibility="hidden";
  4441. div.className='linksDiv';
  4442.  
  4443. NZBLinksTD=titleTD;
  4444. switch(GM_config.read().binnewz_nzblinks_place) {
  4445. case "1":
  4446. NZBLinksTD=titleTD;
  4447. break;
  4448. case "2":
  4449. NZBLinksTD=fileTD;
  4450. break;
  4451. case "3":
  4452. NZBLinksTD=sizeTD;
  4453. break;
  4454. }
  4455. NZBLinksTD.setAttribute('style',"vertical-align:text-top; padding-top:5px; padding-right:2px;");
  4456. NZBLinksTD.parentNode.addEventListener( "mouseover", make_visible, false );
  4457. NZBLinksTD.parentNode.addEventListener( "mouseout", make_invisible, false );
  4458. NZBLinksTD.appendChild(div);
  4459.  
  4460. TR.setAttribute('done', 1); //we set a 'done' attribute to avoid re executing this script func with autopager plugins
  4461. }
  4462. }
  4463.  
  4464. function make_link(elem,cible,title,img){
  4465. var newLink = document.createElement("a");
  4466. newLink.href=cible;
  4467. newLink.target="_blank";
  4468. var new_img = document.createElement("img");
  4469. new_img.src=img;
  4470. new_img.title=GM_trans.lang('make_link_title') + ' ' + title;
  4471. new_img.alt=GM_trans.lang('make_link_title') + ' ' + title;
  4472. newLink.appendChild(new_img);
  4473. elem.appendChild(newLink);
  4474. }
  4475.  
  4476. function make_visible(event){
  4477.  
  4478. var targetTR=event.target;
  4479.  
  4480. while(targetTR.nodeName!='TR')
  4481. targetTR=targetTR.parentNode;
  4482.  
  4483. var div=targetTR.getElementsByClassName('linksDiv')[0];
  4484.  
  4485. if(div){
  4486. olddiv=div;
  4487. div.style.visibility="";
  4488. }
  4489. }
  4490.  
  4491. function make_invisible(event){
  4492. if((event.relatedTarget==null || (event.relatedTarget!=olddiv && event.relatedTarget.parentNode.parentNode!=olddiv)) && olddiv != undefined ){
  4493. olddiv.style.visibility="hidden";
  4494. }
  4495. }
  4496.  
  4497. function make_thxlink(div, ThxUrl) {
  4498.  
  4499. var ThxLink = document.createElement("a");
  4500.  
  4501. (function(ThxUrl) { //cette fonction permet d'ajouter un eventListener avec la bonne URL à chaque image 'merci' rajoutée
  4502. ThxLink.addEventListener('click', function() {
  4503. merci(ThxUrl);
  4504. }, false);
  4505. })(ThxUrl);
  4506.  
  4507. ThxLink.href='javascript:void(0);';
  4508. var ThxImg = document.createElement("img");
  4509. ThxImg.src='http://'+binnewz_url+'/_images/merci.gif';
  4510. ThxImg.title=GM_trans.lang('thxlink_title');
  4511. ThxLink.appendChild(ThxImg);
  4512. div.appendChild(ThxLink);
  4513.  
  4514. }
  4515.  
  4516.  
  4517. function make_infoLink(div, titleTD,type) {
  4518.  
  4519. var Acol=titleTD.getElementsByTagName('a');
  4520. if (Acol.length>0){ //testing if there is a link or not
  4521. var elementTitle=Acol[0].innerHTML.toLowerCase();
  4522. var element=titleTD.firstElementChild;
  4523. }else{
  4524. var elementTitle=titleTD.textContent.toLowerCase();
  4525. var element=titleTD.firstChild;
  4526. }
  4527.  
  4528. var infoLink = document.createElement("a");
  4529. infoLink.href='javascript:void(0);';
  4530. var infoImg = document.createElement("img");
  4531. infoImg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAADvUlEQVR4Xt1VbWscZRQ9szOz3dmdbLLJJm6ycXGi0tXGGihlDdhUFNSkRZAWKeKHIJQVP4iCaWl+gIUFzRdLlCAqaFXUD0KInxRfoCgIVgtpg22iJrpss0m67mR3dt7We9nZMCxhoeabZ/Ywl7n3OWfufeZh8b+GMDA2FR86nsuOnLowf/T0u0vHXr64Of7Sxc2Hn39n6eAzb85zbuDoVJxrsRvaJERt4vzpu1KJM/cMxrVONQRBaJQ6jgvTcWBaDm79Y2CtsLWSLxRzKwvn5jiNFgTQgtj+8fCBEzNzRw7fP5sZTmndnQrqABKdAsbuU/DIgQgGYxIYbJzW7tCG92uz6affmIulJ8JtOwh29AfvffzVt48cSk9G1X2wbBd1uvh37HCcxPrAWFwu4NPv89RNHY5LNZTXKzUsXl99b+Wr17NmOW/u1oHYP5rNHkxrk2FFhlGzebEnUkc4EkFPTw8TEYpdeubWG7RsB/uCElLJxCRrsBY8SM1OuodPJAcHk2fjXQoM0/Y1Vwdp4KelIqIdUe4IPy6us2mDTsPEprgjHER3vO+s/sDJLzaufLbKi5sqUurRc6+MZg7lYlGFF+xsamNCbEJ0AYff2m2QOvRMXCYoRJlGdX3p6pk/vz4/A8BudhBSO7snlJDMc/c2pw5G9skEZFlmQpIa5YZhIPf5slcB7hAukwyDskRiXRMAZol600CJhMNDXGg7rn/ncWHhbwh05V4c3THQdR2l8lUYpoVazYFpO7CaXXB3kIZY028gK4oS46Q3HiIQoLtLM67WTIRCIaiqiiau/V5kMdT9h0nwYkGKsaZ/k0Wap2BTi7yCxY2ahVu6ga2yge2qBdu24QcLBwICdgHvFydEvwEqlUrJtrvUimFho1SlU1pFjVoX+CLHtgeo1cAxS62fqaOXS2urBTW5SeI8Tx6PGAjgv8AxK2t88xtY5eIflxy5KyOAhQXsBbXS2iXW9J/kaunGtwuwjaKwN224VrXIWqzpNzCqxd9ubOevfII9gjVYizX9Bg5x4+bPH35gbK58Ax8+ms7gy9wTO2eAwTE/45wfvJY1WIs1Wz8GkdgrBsMP9j/0wnSoZ2gMtwFjY/m7/A9vvUYb/AuAdb+BHzKxj5juHTn1nJocOS4G1Xj7L0Yv6n9dnl+//DG/+TXiTaKFNmCTBDETjPZPktH7qcemf6V/uMLdT81sMznmZ5zjGq711shoh5ZxRYmat3iceJL4LNOLx72c5tWKuE0I3jlRib3EAeKdTC/u9XJSu4P9L+NiwHW8zQYnAAAAAElFTkSuQmCC';
  4532. infoLink.appendChild(infoImg);
  4533. infoImg.title=GM_trans.lang('infolink_title');
  4534. infoLink.display="none";
  4535.  
  4536. if(type=='movie') { //Movie rating
  4537.  
  4538. elementTitle=cleanup(elementTitle);
  4539.  
  4540. //add by cook2 (always put IMDB note)
  4541. imdbRequest(elementTitle.replace(/ /g, "+"), element);
  4542. ///end add
  4543.  
  4544. (function(element) {
  4545. infoLink.addEventListener('click', function() {
  4546. imdbRequest(elementTitle.replace(/ /g, "+"), element);
  4547. }, false);
  4548. })(element);
  4549.  
  4550. infoLink.display="";
  4551.  
  4552. }else if(type=='tv') {
  4553.  
  4554. (function(element) {
  4555. infoLink.addEventListener('click', function() {
  4556. betaseriesGetUrl(cleanup_serie(elementTitle), element);
  4557. }, false);
  4558. })(element);
  4559.  
  4560. infoLink.display="";
  4561. }
  4562.  
  4563. div.appendChild(infoLink);
  4564.  
  4565. }
  4566.  
  4567. //Added by Les-Newsgroup.fr
  4568. function binnewz_getdays(node){
  4569.  
  4570. if (node.className=="data datepost" || node.className=="datepost data" || node.className=='datepost' || node.className=='data'){
  4571. var txtDate=node.getElementsByTagName("span")[0].innerHTML;
  4572. if (txtDate.indexOf('jours')!=-1) //Binnewz affiche soit 'jour' ou 'jours'
  4573. var txt=txtDate.slice(12, -6).trim();
  4574. else var txt=txtDate.slice(12, -5).trim();
  4575. if ((parseInt(txt) % 1)==0) return txt;
  4576. else return -1;
  4577.  
  4578. }else return 0;
  4579.  
  4580. }
  4581.  
  4582.  
  4583. //Global functions
  4584. //Original source : http://forum.alsacreations.com/topic-5-31802-1-Recuperer-un-parametre-durl-en-javascript.html
  4585. function extractUrlParams(){
  4586.  
  4587. var t = location.search.substring(1).split('&');
  4588. var f = [];
  4589. for (var i=0; i<t.length; i++){
  4590. var x = t[ i ].split('=');
  4591. f[x[0]]=x[1];
  4592. }
  4593. return f;
  4594. }
  4595.  
  4596.  
  4597. //Start of the clickRow part
  4598. //Original Script : Binsearch easyclick (c) - by Johannes la Poutre ( http://userscripts.org/scripts/show/3441 )
  4599. //Original source : http://userscripts.org/scripts/review/3441
  4600. //Modified by les-Newsgroup to use it with Binsearch, NZBIndex + added localization + removed the shiftKey selection functionnality
  4601. setRow = function(row, check) {
  4602. row.setAttribute("title", check ? GM_trans.lang('remove_from_selection') : GM_trans.lang('add_to_selection'));
  4603. row.style.color = ((check) ? "#c00" : ""); // empty string reverts color rather than losing the stripes
  4604. row.style.backgroundColor = ((check) ? "#bcd" : "");
  4605. row.className = (check) ? row.className + ' selected' : row.className.replace(' selected', '');
  4606. if(typeof row.getElementsByTagName("input")[0]!='undefined') row.getElementsByTagName("input")[0].checked = check;
  4607. }
  4608.  
  4609. //This is a copy of the previous function. But this one can be called during the execution of this script
  4610. //We need it to automatically check some rows
  4611. function setRow(row, check) {
  4612. row.setAttribute("title", check ? GM_trans.lang('remove_from_selection') : GM_trans.lang('add_to_selection'));
  4613. row.style.color = ((check) ? "#c00" : ""); // empty string reverts color rather than losing the stripes
  4614. row.style.backgroundColor = ((check) ? "#bcd" : "");
  4615. row.className = (check) ? row.className + ' selected' : row.className.replace(' selected', '');
  4616. if(typeof row.getElementsByTagName("input")[0]!='undefined') row.getElementsByTagName("input")[0].checked = check;
  4617. }
  4618.  
  4619. function setProtectedRow(row) {
  4620. row.setAttribute("title", GM_trans.lang('protected_row'));
  4621. // row.style.backgroundColor = "#FDD5D7";
  4622. }
  4623.  
  4624. function rowClickable(r, protect) {
  4625.  
  4626. r.addEventListener("click", function(evt) {
  4627. if (evt.target.tagName == "A" || evt.target.parentNode.tagName == "A") { return false; } // ignore clicks on anchors
  4628. var inp = this.getElementsByTagName("input");
  4629. if (inp.length == 0) { return; } else { inp = inp[0]; }
  4630. if (evt.target != inp){
  4631. if ((evt.target.tagName == "LABEL" || evt.target.parentNode.tagName == "LABEL") && website=='nzbindex') //need this because NZBIndex already check the line if click on the result's label.
  4632. return;
  4633. inp.checked = !inp.checked; //in any other cases
  4634. }
  4635. setRow(this, inp.checked);
  4636.  
  4637. evt.stopPropagation();
  4638. }, true);
  4639. r.setAttribute("style", "cursor:pointer");
  4640. r.setAttribute("title", GM_trans.lang('add_to_selection'));
  4641. // remove silly hover effect
  4642. r.removeAttribute("onmouseover");
  4643. r.removeAttribute("onmouseout");
  4644. }
  4645.  
  4646. //Adding this function to the window so that we can use it with script-created buttons
  4647. unsafeWindow.clickTheseRows = function ($f, mode) {
  4648. if(typeof $f[0]=='undefined') //so this is not a container but a parentNode
  4649. $f=$f.getElementsByTagName('input');
  4650.  
  4651. for ($i=0; $i < $f.length; $i++){
  4652. if ($f[$i].type == "checkbox"){
  4653. if(mode==0 && $f[$i].checked==false)
  4654. continue; //mode:0 => cancel selection : checked=false so no need to click
  4655. else if(mode==1 && $f[$i].checked==true)
  4656. continue; //mode:1 => select all : checked=true so no need to click
  4657. var evt = document.createEvent("MouseEvents");
  4658. evt.initMouseEvent("click", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
  4659. $f[$i].dispatchEvent(evt);
  4660. }
  4661. }
  4662. }
  4663. //End of the ClikRow part
  4664.  
  4665. function insertExecTime(mymenu) {
  4666. if(typeof myDebugDate != 'undefined'){
  4667. myDebugDate=new Date();
  4668. var timeExec=myDebugDate.getSeconds() * 1000 + myDebugDate.getMilliseconds() - startExec;
  4669. mymenu.appendChild(document.createTextNode(' (' + timeExec + 'ms)'));
  4670. }
  4671. }
  4672.  
  4673.  
  4674.  
  4675. //Thank You function for Binnewz
  4676. //url=http://www.binnews.(in|biz)/_bin/thanks.php?i=?????&...
  4677. function merci(ThxUrl) {
  4678. debug(ThxUrl);
  4679. GM.xmlHttpRequest({
  4680. method: 'GET',
  4681. url: ThxUrl,
  4682. // headers: {
  4683. // 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey/0.3',
  4684. // 'Accept': 'text/html,application/xml,text/xml',
  4685. // },
  4686. // onload: function(response) {
  4687. // alert(response.responseText);
  4688. // }
  4689. });
  4690. }
  4691.  
  4692.  
  4693. function Binnewz_fixedHeader() {
  4694.  
  4695. document.getElementById('home').setAttribute('style', 'position:fixed');
  4696. document.getElementById('menu_search').setAttribute('style', 'position:fixed; width:100%;');
  4697. //document.getElementById('menu_subcat').setAttribute('style', 'position:fixed; width:100%; left:560px;');
  4698. document.getElementById('form_subcat').setAttribute('style', 'display:inline-block;');
  4699. document.getElementById('menu_lien').setAttribute('style', 'z-index:99');
  4700.  
  4701. }
  4702.  
  4703.