Akiba is Live Links should be used with BBcode [code] [/ code] ?

kotoro_hd

Banned
Sep 26, 2009
3,776
3
Normally I use the BBCode
Code:
, the Links we have:

[CODE]http://www.akiba-online.com

I think Akiba should add functionality to automatically receive Live Links use
Code:
 to add links.

[B]For example:[/B]

[CODE][URL="http://www.akiba-online.com"]http://www.akiba-online.com[/URL]

To do this simply do the following:

Open Notepad save 1 file livelinks.js with content:

Code:
jQuery.fn.textNodes = function() {
    var ret = [];
    this.contents().each(function() {
        var fn = arguments.callee;
        if(this.nodeType == 3) {
            ret.push(this);
        } else if(this.nodeType==1 &&!(
        this.tagName.toLowerCase()=='script' ||
        this.tagName.toLowerCase()=='head' ||
        this.tagName.toLowerCase()=='iframe' ||
        this.tagName.toLowerCase()=='textarea' ||
        this.tagName.toLowerCase()=='option' ||
        this.tagName.toLowerCase()=='style' ||
        this.tagName.toLowerCase()=='title' ||
        this.tagName.toLowerCase()=='a')){
            jQuery(this).contents().each(fn);
        }
    });
    return ret;
}

jQuery.fn.hfautolink = function() {
    re_link2 = new RegExp('(https?://(?:[A-Z0-9]\.)*(?:[COLOR="Red"]hotfile.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|])', "ig");
    re_link3 = new RegExp('https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]hotfile.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]', "i");
    re_link4 = new RegExp('(https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]sharingmatrix.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|])', "ig");
    re_link5 = new RegExp('https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]sharingmatrix.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]', "i");
    re_link6 = new RegExp('(https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]fileserve.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|])', "ig");
    re_link7 = new RegExp('https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]fileserve.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]', "i");
    re_link8 = new RegExp('(https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]filesonic.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|])', "ig");
    re_link9 = new RegExp('https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]filesonic.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]', "i");
    re_link10 = new RegExp('(https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]rapidshare.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|])', "ig");
    re_link11 = new RegExp('https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]rapidshare.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]', "i");
    re_link12 = new RegExp('(https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]duckload.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|])', "ig");
    re_link13 = new RegExp('https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]duckload.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]', "i");
    re_link14 = new RegExp('(https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]megaupload.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|])', "ig");
    re_link15 = new RegExp('https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]megaupload.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]', "i");
    re_link16 = new RegExp('(https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]oron.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|])', "ig");
    re_link17 = new RegExp('https?://(?:[A-Z0-9]\.)*(?:[COLOR="red"]oron.com[/COLOR])[-()A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]', "i");
    this.each(function(i){
        jQuery.each($(this).textNodes(), function(i, node){
            text = node.nodeValue;
            if(re_link3.test(text)){
                newNode=document.createElement('span');
                text=jQuery('<div/>').text(text).html();
                newNode.innerHTML=text.replace(re_link2, '<a href="$1" target="_blank">$1</a>');
                node.parentNode.replaceChild(newNode, node);
            }
            else if(re_link5.test(text)){
                newNode=document.createElement('span');
                text=jQuery('<div/>').text(text).html();
                newNode.innerHTML=text.replace(re_link4, '<a href="$1" target="_blank">$1</a>');
                node.parentNode.replaceChild(newNode, node);
            }
            else if(re_link7.test(text)){
                newNode=document.createElement('span');
                text=jQuery('<div/>').text(text).html();
                newNode.innerHTML=text.replace(re_link6, '<a href="$1" target="_blank">$1</a>');
                node.parentNode.replaceChild(newNode, node);
            }
            else if(re_link9.test(text)){
                newNode=document.createElement('span');
                text=jQuery('<div/>').text(text).html();
                newNode.innerHTML=text.replace(re_link8, '<a href="$1" target="_blank">$1</a>');
                node.parentNode.replaceChild(newNode, node);
            }
            else if(re_link11.test(text)){
                newNode=document.createElement('span');
                text=jQuery('<div/>').text(text).html();
                newNode.innerHTML=text.replace(re_link10, '<a href="$1" target="_blank">$1</a>');
                node.parentNode.replaceChild(newNode, node);
            }
            else if(re_link13.test(text)){
                newNode=document.createElement('span');
                text=jQuery('<div/>').text(text).html();
                newNode.innerHTML=text.replace(re_link12, '<a href="$1" target="_blank">$1</a>');
                node.parentNode.replaceChild(newNode, node);
            }
            else if(re_link15.test(text)){
                newNode=document.createElement('span');
                text=jQuery('<div/>').text(text).html();
                newNode.innerHTML=text.replace(re_link14, '<a href="$1" target="_blank">$1</a>');
                node.parentNode.replaceChild(newNode, node);
            }
            else if(re_link17.test(text)){
                newNode=document.createElement('span');
                text=jQuery('<div/>').text(text).html();
                newNode.innerHTML=text.replace(re_link16, '<a href="$1" target="_blank">$1</a>');
                node.parentNode.replaceChild(newNode, node);
            }
        });
    });
}

$(function() {
    $("div").hfautolink();
});

The red above. we can replace or add or remove by other Links

Then add the following code in Style at the end of Header Template

Code:
<script  src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"  type="text/javascript"></script>
<script src="livelinks.js" type="text/javascript"></script>
 

chompy

slacker
Staff member
Super Moderator
Emperor
Nov 7, 2006
1,763
616
Thanks for your post

Though we haven't done anything quite as intricate, we have made it so that filehost links will no longer be clipped with the "..." without having to use the code tags.