Large

Bierdopje AddOn

By XppX Last update May 17, 2012 — Installed 8,233 times.

There are 28 previous versions of this script.

scr_meta=<><![CDATA[ // auto-update
// ==UserScript==
// ==UserScript==
// @name         Bierdopje AddOn
// @namespace    Bierdopje.eu
// @description  Adds download functionality to Bierdopje.com
// @include      http://*.bierdopje.com*
// @include      http://*.bierdopje.eu*
// @author       XppX
// @version      1.23
// @require      http://sizzlemctwizzle.com/updater.php?id=68881
// ==/UserScript==
]]></>.toString(); // auto-update

/**
Changelog:
1.0:  Initial version of Wesley Lancel
1.1:  Added 720p/Xvid search functions
1.2:  Added more targeted & faster search functions
1.3:  Update for firefox 3.6
1.3.1: Cleaning of code doubled setup speed of script
1.3.2: Removed JS libraries and added check for JQuery which was giving a conflict with the one the site uses
1.3.3: Added WEB-DL & retuned the BINTube search string (the BINTube site has problems if you specify the size minimum)
1.4:  Replaced BinTube (became paid service) by NZBClub, with faster available releases (due to faster background searches)
1.5:  Added new NZB search engine: BINSearch
1.6:  Bierdopje pages for single episodes are now supported as well (.../shows/xxxx/episode/S01E03)
1.6.1:  Opened up the search string a bit (no '.' between show and episodenumber avoids title/no-title problem when searching)
1.7:  Page detection improved: make clear distiction between the single episode and the multiple episodes page
1.8:  Disabled TVNZB because, after having experienced lots of problems, the site is not available anymore (16/04/10)
1.9:  Added "OR" searches for NZBIndex; NZBClub and BinSearch don't support OR;
1.10: Updated scene convention conversion (14/11/10)
1.11: Updated scene convention conversion (09/01/11)
1.12: Updated scene convention conversion (16/04/11) - provided by Milky_Way
1.13: Updated NZBClub call parameters - engine has now other options (01/10/11)
1.14: Changed the country code for NZBIndex as the Dutch version seems to have dissapeared
1.15: Added additional scene conversions, provided by Darkling + changed country code again for NZBIndex
1.16: Added additional scene conversions, provided by Darkling
1.17: Securized the calls to the NZB seekers, provided by Darkling
1.18: Added additional scene conversions, provided by Darkling
1.19: Added additional scene conversions, provided by Darkling
1.20: Removed xvid format in favor of mp4 (non-720p)
1.21: Adapted the search url for binsearch. '-720p' has no effect here. Feedback from Milky_Way.
1.22: Lowered the minimum size for mp4 searches. Feedback from dannygs51.
1.23: Added additional scene conversions, provided by Darkling
**/

//*****************************************************************************************
//*       Page selection
//*****************************************************************************************

//alert ("*** start script ***" );
var homepage = (window.location.href.charAt(window.location.href.length-1) == '/');
if (!homepage && window.location.href.indexOf("/shows") < 0) return false;
var favorites = (window.location.href.indexOf("/shows/episodes") > 0);
var singleEpisode = !homepage && !favorites;
if (singleEpisode) { // just a single episode on the page is possible, let's narrow down the options
	singleEpisode = (window.location.href.indexOf("/shows/") > 0) && (window.location.href.indexOf("/episode/") > 0);
}

//*****************************************************************************************
//*       Javascript Libraries
//*****************************************************************************************

// use the JQuery JS library for querying the page
// Add jQuery explicitely if not yet loaded by the site (in GM the race condition with the site is unavoidable)
if(typeof unsafeWindow.jQuery == 'undefined') 
{
    var GM_JQ = document.createElement('script');
    GM_JQ.src = 'http://cdn.bierdopje.eu/x/jquery.js';
    GM_JQ.type = 'text/javascript';
    document.getElementsByTagName('head')[0].appendChild(GM_JQ);
}

//*****************************************************************************************
//*       Main
//*****************************************************************************************

// play nice: wait until the JQuery lib is loaded
function GM_wait() {
  if(typeof unsafeWindow.jQuery == 'undefined') 
  { 
    window.setTimeout(GM_wait,500); 
  }
  else
  { 
    $ = unsafeWindow.jQuery; 
    //unsafeWindow.jQuery.noConflict();
    modifyPage(); // execute the GM code
  }
}

GM_wait();

//*****************************************************************************************
//*       Helper functions
//*****************************************************************************************

// Replace some titles that are described differently by the release groups
function cleanTitle(title)
{
  var strOut = title.toLowerCase();
    
  strOut = strOut.replace(/[-\s]/g, ".");

  //Change some titles that don't meet the scene convention
  
  strOut = strOut.replace("the.river.2011", "the.river");
  strOut = strOut.replace("hawaii.five.0.2010", "hawaii.five-0");
  strOut = strOut.replace("the.cape.2010", "the.cape.2011");
  strOut = strOut.replace("spartacus.blood.and.sand", "spartacus"); 
  strOut = strOut.replace("csi.crime.scene.investigation", "csi");
  strOut = strOut.replace("csi.ny", "csi.new.york");
  strOut = strOut.replace("parental.discretion.advised", "life.unexpected");
  strOut = strOut.replace("bbc.life", "life");
  strOut = strOut.replace("the.jay.leno.show", "jay.leno"); 
  strOut = strOut.replace("merlin.2008", "merlin"); 
  strOut = strOut.replace("chaos.2011", "chaos");  
  strOut = strOut.replace("mr.sunshine.2010", "mr.sunshine.2011"); 
  strOut = strOut.replace("ride.along", "the.chicago.code");  
  strOut = strOut.replace("the.killing.2011", "the.killing");
  strOut = strOut.replace("rizzoli..isles", "rizzoli.and.isles");
  strOut = strOut.replace("two.broke.girls", "2.broke.girls");
  strOut = strOut.replace("franklin..bash", "franklin.and.bash");
  strOut = strOut.replace("castle.2009", "castle");
  strOut = strOut.replace("once.upon.a.time.2011", "once.upon.a.time");
  strOut = strOut.replace("the.new.girl", "new.girl");
  strOut = strOut.replace("xiii.2011", "xiii.The.Series");
  strOut = strOut.replace("mike..molly", "mike.and.molly");
  strOut = strOut.replace("touch.2011", "touch");
  strOut = strOut.replace("scandal.2011", "scandal");
  strOut = strOut.replace("boss.2011", "boss");
  strOut = strOut.replace("king.2011", "king");
  strOut = strOut.replace("last.man.standing.2011", "last.man.standing"); 
   
// Upper case the first character of each word in a string

  var arrStr = strOut.split('.');
  strOut = '';

  for (i=0;i<arrStr.length;i++)
  {
     // split string
     firstChar = arrStr[i].substring(0,1);
     remainChar = arrStr[i].substring(1);

     // convert case
     firstChar = firstChar.toUpperCase(); 
     remainChar = remainChar.toLowerCase();

     strOut += firstChar + remainChar + '.';
  }

  // return string, but drop the last char
  return strOut.substring(0, strOut.length - 1);
}

// Store the episode reference in the given episode array
function storeEpisode(reference, episode, idx)
{
    var matchEps = reference.match(/shows\/([\w-]*)\/episode\/([\w-]*)/);
    if (matchEps == null || matchEps.length != 3 ) return false;
    
    idx++;

    episode[idx] = new Array(3); // Multi-dimensional Array
    episode[idx][0] = cleanTitle(matchEps[1]); // name
    episode[idx][1] = matchEps[2].substr(1,2); // season S99exx
    episode[idx][2] = matchEps[2].substr(4,2); // episode sxxE99
    
    return true;
}

//*****************************************************************************************
//*       GM Code: Client-Side Page Modification
//*****************************************************************************************

// query and modify the page

function modifyPage() {
  var episode = new Array();
  var searchTag = new Array(2);
  var count = -1;
  var numValue = 0;
  
  if (singleEpisode) { // the page only contains a single episode reference

    if (storeEpisode(window.location.href, episode, count)) { count++; }

  } else { // specific scan for homepage and favorties: show/episodes
	  
	  $('a').each (function (i) {
	    if (homepage || favorites)
	    {
	      if (this.parentNode.parentNode.id.indexOf("episode-") != 0) return true;
	    }
	    if (storeEpisode(this.href, episode, count)) { count++; }
	  });
	}
  
  if (count < 0) { return true; }

  // now create the icons together with the search requests and hope they stay in sync with the form page
  count = -1;
  
  // search url's & arguments for NZBindex
  var NZBindex_URL       = "https://www.nzbindex.com/search/?q=";
  var NZBindex_ARG_720p  = "&age=&max=25&sort=agedesc&minsize=600&maxsize=5120&poster=&nfo=&hidespam=1&more=0";
  var NZBindex_ARG_480p  = "&age=&max=25&sort=agedesc&minsize=150&maxsize=1024&poster=&nfo=&hidespam=1&more=0";

  // search url's & arguments for NZBClub
  var NZBClub_URL        = "https://www.nzbclub.com/nzbsearch.aspx?ss=";
  var NZBClub_ARG_720p   = "&sz=20&sze=9&rpp=25&st=1&sp=1&sn=1";
  var NZBClub_ARG_480p   = "&sz=16&ez=22&rpp=25&st=1&sp=1&sn=1";
  
  // search url's & arguments for BINSearch
  var BINSearch_URL        = "https://binsearch.info/index.php?q=";
  var BINSearch_ARG_720p   = "&m=&max=25&adv_g=&adv_age=999&adv_sort=date&adv_col=on&minsize=600&maxsize=5120&font=small&postdate=";
  var BINSearch_ARG_480p   = "&m=&max=25&adv_g=&adv_age=999&adv_sort=date&adv_col=on&minsize=150&maxsize=1024&font=small&postdate=";

  // menu items
  var NZBindex_WEBDL  = '';
  var NZBindex_720p   = '';
  var NZBindex_480p   = '';
  var NZBClub_WEBDL   = '';
  var NZBClub_720p    = '';
  var NZBClub_480p    = '';
  var BINSearch_WEBDL = '';
  var BINSearch_720p  = '';
  var BINSearch_480p  = '';
       
  $('.specbtn').each (function (i) {
    if (this.src.substr(-11) == 'us_gray.gif' || this.src.substr(-6) == 'us.gif')
    {
      count++;

      searchTag[0] = episode[count][0]+"+S"+episode[count][1]+"E"+episode[count][2];
      numValue     = +episode[count][1];
      searchTag[1] = episode[count][0]+"+&quot;S"+episode[count][1]+"E"+episode[count][2]+"&quot;|&quot;"+numValue+"x"+episode[count][2]+"&quot;";
      
      // search strings
      NZBindex_WEBDL = "<a href=" + NZBindex_URL + searchTag[1] + "+720p++WEB-DL" + NZBindex_ARG_720p + " target=_blank>NZBindex</a>";
      NZBindex_720p  = "<a href=" + NZBindex_URL + searchTag[1] + "+720p++x264"   + NZBindex_ARG_720p + " target=_blank>NZBindex</a>";
      NZBindex_480p  = "<a href=" + NZBindex_URL + searchTag[1] + "+HDTV+-720p"   + NZBindex_ARG_480p + " target=_blank>NZBindex</a>";
      NZBClub_WEBDL  = "<a href=" + NZBClub_URL  + searchTag[0] + "+720p+WEB-DL"  + NZBClub_ARG_720p  + " target=_blank>NZBClub</a>";
      NZBClub_720p   = "<a href=" + NZBClub_URL  + searchTag[0] + "+720p+x264"    + NZBClub_ARG_720p  + " target=_blank>NZBClub</a>";
      NZBClub_480p   = "<a href=" + NZBClub_URL  + searchTag[0] + "+HDTV+-720p"   + NZBClub_ARG_480p  + " target=_blank>NZBClub</a>";
      BINSearch_WEBDL  = "<a href=" + BINSearch_URL  + searchTag[0] + "+720p+WEB-DL" + BINSearch_ARG_720p + " target=_blank>BINSearch</a>";
      BINSearch_720p   = "<a href=" + BINSearch_URL  + searchTag[0] + "+720p+x264"   + BINSearch_ARG_720p + " target=_blank>BINSearch</a>";
      BINSearch_480p   = "<a href=" + BINSearch_URL  + searchTag[0] + "+HDTV"  + BINSearch_ARG_480p + " target=_blank>BINSearch</a>";
      
      // create pop-up menu
      $(this).after('&nbsp;<img src=\"/g/if/icons/drive_go.gif\" onclick=\
        "Tip(\'WEB-DL HDTV<br>- '+NZBindex_WEBDL+'<br>- '+NZBClub_WEBDL+'<br>- '+BINSearch_WEBDL
             +'<br>720p HDTV.x264<br>- '+NZBindex_720p+'<br>- '+NZBClub_720p+'<br>- '+BINSearch_720p
             +'<br>480p HDTV.x264<br>- '+NZBindex_480p+'<br>- '+NZBClub_480p+'<br>- '+BINSearch_480p
             +'\',TITLE,\'Download '+episode[count][0]+' [S'+episode[count][1]+'E'+episode[count][2]+']\');"\
        class=\"specbtn\" border=\"0\" />');
    }
  });
}