Tutorial | Show Bit.ly short links on your page.

Powerfull XFileSharing version

Moderator: admin

Do you Like This Mod?

Yes
4
80%
No
1
20%
 
Total votes: 5

Message
Author
krazyloads
Posts: 27
Joined: Oct 05, 2010 12:53 pm

Tutorial | Show Bit.ly short links on your page.

#1 Postby krazyloads » Nov 19, 2010 9:33 am

Hi,

I did a little mod on the script to display short links from bit.ly here it is.

For this you need to signup at bit.ly.

Go to : http://bit.ly/a/your_api_key/

Copy your username and API key .

go to cgi-bin/Templates/upload_results.html

Paste this script on the top of the page.Insert your USERNAME AND API KEY on the 11 and 12 line.

Code: Select all

<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{

//bit_url function
function bit_url(url)
{
var url=url;
var username="USERNAME"; // bit.ly username
var key="YOUR API KEY";
$.ajax({
url:"http://api.bit.ly/v3/shorten",
data:{longUrl:url,apiKey:key,login:username},
dataType:"jsonp",
success:function(v)
{
var bit_url=v.data.url;
$("#result").html('<a href="'+bit_url+'" target="_blank">'+bit_url+'</a>');
}
});
}


$(".tabbertab").ready(function()
{
var url=$("#url").val();
var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var urltest=urlRegex.test(url);
if(urltest)
{
bit_url(url);
}
else
{
alert("Bad URL");
}
});

});
</script>


Now scroll down and find:

Code: Select all

<div class="tabbertab">
<h2><TMPL_VAR lang_download_link></h2>
<textarea id="ic0-<TMPL_VAR file_id>" style="width:98%;" rows=3 onFocus="copy(this);"><TMPL_VAR download_link></textarea>
<div id="c0-<TMPL_VAR file_id>" class="btndiv"><TMPL_VAR lang_copy_clipboard></div>
</div>


Change this To:

Code: Select all

<div class="tabbertab">
<h2><TMPL_VAR lang_download_link></h2>
<textarea id="ic0-<TMPL_VAR file_id>" style="width:98%;" rows=3 onFocus="copy(this);"><TMPL_VAR download_link></textarea>
<input type="hidden" id="url" value="<TMPL_VAR download_link>"/>
<div id="c0-<TMPL_VAR file_id>" class="btndiv"><TMPL_VAR lang_copy_clipboard></div>
</div>


Scroll up to find:

Code: Select all

<tr>
    <td align=right><b><TMPL_VAR lang_file_size>:</b></td>
    <td><TMPL_VAR file_size></td>
</tr>


Paste this after the above code:

Code: Select all

<tr>
<td align=right nowrap><b><TMPL_VAR lang_short_link>:</b></td>
<td><div id="result"></div></td>
</tr>


Thats It, you have a shorturl for all your uploads.
More to come soon.

Hope This Helps.

Demo: http://hivefiles.com

Jesse202
Posts: 246
Joined: May 07, 2010 6:24 pm

#2 Postby Jesse202 » Nov 24, 2010 9:23 pm

that's pretty cool. Not sure if I'll add it though.


Return to “XFileSharing Pro”

Who is online

Users browsing this forum: No registered users and 0 guests