1. BlackJACK

    BlackJACK Well-Known Member

    Aug 13, 2010
    341
    This code does NOT support url's starting with https:
    If I change the http to https in the code below, then it does not support the first one
    I'm NO coder. Will appreciate if someone could help me out. Need support for all url's

    Code:
    $(function() {
        var sickw = /^http:\/\/(fileparadox|uploadable|terafile|filefactory|uploadable|ul|ryushare|bitshare|turbobit|secureupload|rapidgator|uploaded|k2s|netload|www.fileparadox|www.uploadable.ch|www.terafile.co|www.filefactory|www.uploadable|www.ul|www.ryushare|www.bitshare|www.turbobit|www.secureupload|www.rapidgator|www.uploaded|www.k2s.cc|www.netload)\.[\S]+$/;
        $('body *').contents().filter(function() {
            return this.nodeType == 3 &&
                $(this).text().trim() !== '' &&
                $(this).text().trim().match(sickw);
        }).each(function() {
            $(this).replaceWith('<a href="' + $(this).text().trim() + '"target="_blank" rel="sickw.com">' + $(this).text().trim() + '</a>');
        });
    });
     
  2. Belinux

    Belinux Well-Known Member

    Dec 5, 2011
    477
    i will sort out your problem, i am little busy yet i will send you code in a day..
     
  3. Hyperz

    Hyperz Well-Known Member Respected

    Feb 8, 2009
    2,229
    Code:
    $(function() {
        var sickw = /^https?:\/\/(fileparadox|uploadable|terafile|filefactory|uploadable|ul|ryushare|bitshare|turbobit|secureupload|rapidgator|uploaded|k2s|netload|www.fileparadox|www.uploadable.ch|www.terafile.co|www.filefactory|www.uploadable|www.ul|www.ryushare|www.bitshare|www.turbobit|www.secureupload|www.rapidgator|www.uploaded|www.k2s.cc|www.netload)\.[\S]+$/;
        $('body *').contents().filter(function() {
            return this.nodeType == 3 &&
                $(this).text().trim() !== '' &&
                $(this).text().trim().match(sickw);
        }).each(function() {
            $(this).replaceWith('<a href="' + $(this).text().trim() + '"target="_blank" rel="sickw.com">' + $(this).text().trim() + '</a>');
        });
    });
     
  4. BlackJACK

    BlackJACK Well-Known Member

    Aug 13, 2010
    341

    Thank you but it's not working. None working now
     
  5. Hyperz

    Hyperz Well-Known Member Respected

    Feb 8, 2009
    2,229
    Then something else is wrong because all I changed there was "http" to "https?" which in regular expressions terms means "http OR https" which is what you were asking for. The "?" character after the letter "s" means "match s, one or zero times", thus making it optional. The regex will fail if it is test against text which has multiple lines. So depending on the context you might need to add multiline and global flags like so:

    Code:
    $(function() {
        var sickw = /^https?:\/\/(fileparadox|uploadable|terafile|filefactory|uploadable|ul|ryushare|bitshare|turbobit|secureupload|rapidgator|uploaded|k2s|netload|www.fileparadox|www.uploadable.ch|www.terafile.co|www.filefactory|www.uploadable|www.ul|www.ryushare|www.bitshare|www.turbobit|www.secureupload|www.rapidgator|www.uploaded|www.k2s.cc|www.netload)\.[\S]+$/mg;
        $('body *').contents().filter(function() {
            return this.nodeType == 3 &&
                $(this).text().trim() !== '' &&
                $(this).text().trim().match(sickw);
        }).each(function() {
            $(this).replaceWith('<a href="' + $(this).text().trim() + '"target="_blank" rel="sickw.com">' + $(this).text().trim() + '</a>');
        });
    });
     
  6. BlackJACK

    BlackJACK Well-Known Member

    Aug 13, 2010
    341
    It's working now. Thanks a lot mate. :)

    MOD's please close the thread.
     

Share This Page