wang867gmail.com / show imgcrl img

// ==UserScript==
// @name        show imgcrl img
// @namespace   http://*/*
// @description show imgcrl img
// @version     1.1
// @grant       none
// ==/UserScript==
// for tpb
// supported site: 
// imgcrl.org

/*var frames=document.getElementsByTagName("iframe"),j=0, frame;
while ( frame = frames[j++]){
    alert(frame.width);
    if (freme.width == 469){
        frame.width = '1024';
    }
}
*/
var flag = 0;
var lnks=document.getElementsByTagName("a"), i=0, lnk;
var pattern = /^http\:\/\/imgcrl\.org\/v\/(.*)\/$/;
var pattern2 = /^http\:\/\/imagecurl\.org\/.*\=(.*)\.jpg$/;

while (lnk = lnks[i++])
{
    if (lnk.href.match(pattern)) {
        lnk.id = 'gg';
        lnk.target = "_self";
        lnk.href = lnk.href.replace(pattern, 'http://imagecurl.org/images/$1.jpg');
        var newimg = lnk.href; 
        flag = 1;
    }
   if (lnk.href.match(pattern2)) {
        lnk.id = 'gg';
        lnk.target = "_self";
        lnk.href = lnk.href.replace(pattern2, 'http://imagecurl.org/images/$1.jpg');
        var newimg = lnk.href; 
        flag = 1;
    }
}

if (flag == 1){
    var img = document.createElement("img");
    img.src = newimg;
    var src = document.getElementById("header");
    src.appendChild(img);
}