// ==UserScript==
// @name LinkChecker
// @author mattithjah & z_o_o_m
// @version 0.3.1
// @ujs:published 2008
// ==/UserScript==

$(document).ready(function(){

  $(".checklinks").show();

  $(".checklinks").click(function(){

    var linky = $(this).parent().parent().next().children("td").children("div.code:first");

    var checker = "http://zch002.php5.cz/linkchecker.php?ikona=2&url=";
    var url = "[-()a-z0-9_./]+";
    var masky = new Array(
    "rapidshare\\.(com|de)/files/[0-9]+/" + url,
               "czshare\\.com/download_file\\.php\\?id=[0-9]+(&|&amp;)file=" + url,
               "czshare\\.com/(files/)?[0-9]+/" + url,
               "megaupload\\.com/\\?d=[a-z0-9_.-]+",
               "sendspace\\.com/file/" + url,
               "uploaded\\.to/\\?id=" + url,
               "uploaded\\.to/file/" + url,
               "ul\\.to/[a-z0-9]+" + url,
               "uloz\\.to/[0-9]+/" + url,
               "(download\\.(cz|sk|en)\\.)hellshare\\.com/([0-9a-z]+/)?" + url,
               "(d01\\.)?megashares\\.com/\\?d01=" + url,
               "(d01\\.)?megashares\\.com/dl/[a-z0-9]+" + url,
               "depositfiles\\.(com|net)/(en/)?files/[0-9a-z]+",
               "filefactory\\.com/file/" + url,
               "netload\\.in/[a-z0-9]+"+url,
               ".*edisk\\.cz/(soubor/)?stahni/[0-9]+/" + url,
               "_flyshare\\.cz/[0-9]+,[a-z0-9_.]+",
               "nahraj\\.cz/" + url,
               "mediafire\\.com/(download\.php)?\\?[a-z0-9_.-]+",
               "leteckaposta\\.cz/[0-9]+",
               "gigeshare\\.com/preview/"+url,
               "files\\.to/get/[0-9]+/[a-z0-9]+",
               "zdielanie\\.sk/" + url,
               "flyshare\\.cz/" + url,
               "iskladka\\.cz/download\\.php\\?file=[-.%+\\d\\w]+",
               "(dl1\\.)?upnito\\.sk/download\\.php\\?dwToken=[a-z0-9]+",
               "ulozisko\\.sk/"+url,
               "midload\\.com/(en/)?file/[0-9]+/"+url,
               "rarhost\\.com/download-"+url,
               "([a-z0-9]+\.)easy-share\\.com/[0-9]+"+url,
               "badongo\\.com/file/[0-9]+",
               "axifile\\.com/\\?[0-9]+",
               "axifo\\.com/\\?[0-9]+",
               "fast-load\\.net/(/)?index\\.php\\?pid=[a-z0-9]+",
               "gigasize\\.com/get\\.php\\?d=[a-z0-9]+",
               "gigasize\\.com/get\\.php/[0-9]+/"+url,
               "zshare\\.net/download/[a-z0-9/]+",
               "uploading\\.com/(en/)?files/[a-z0-9]+/"+url,
               "uploading\\.com/get\\.php\\?get=[a-z0-9]+",
               "uloz\\.cz/show/file/"+url,
               "dataup\\.de/[0-9]+/"+url,
               "sharebase\\.de/files/"+url,
               "bagruj\\.cz/[a-z0-9]+/"+url,
               "hotfile\\.com/dl/[0-9]+/[a-z0-9]+/"+url,
               "share-rapid\\.(com|info)/stahuj/[0-9]+/"+url,
               "storage\\.to/get/[a-z0-9]+/"+url
    );

    var obsah = $(linky).html();
    //alert(obsah);
    var re;
    for(i = 0; i < masky.length; i++)
    {
      re = new RegExp("http://((www(2)?\\.))?" + masky[i],"gi");
      obsah = obsah.replace(re,"$&&nbsp;<img src=\"" + checker + "$&.png\">","gi");
    }
    $(this).hide();
    $(linky).html(obsah);
  });
});

//document.onkeydown = keyDown;
//document.onkeyup = keyUp;