RegisterRegister    SearchSearch   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AJAX upload progress bar

File sharing script

File mirror script

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

 
Post new topic   Reply to topic    SibSoft Ltd Forum Index -> XFileSharing Pro
View previous topic :: View next topic  

Do you Like This Mod?
Yes
80%
 80%  [ 4 ]
No
20%
 20%  [ 1 ]
Total Votes : 5

Author Message
krazyloads



Joined: 05 Oct 2010
Posts: 27

PostPosted: Nov 19, 2010 9:33 am    Post subject: Tutorial | Show Bit.ly short links on your page. Reply with quote

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:
<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:
<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:
<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:
<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:
<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
Back to top
View user's profile Send private message
Jesse202



Joined: 07 May 2010
Posts: 150

PostPosted: Nov 24, 2010 9:23 pm    Post subject: Reply with quote

that's pretty cool. Not sure if I'll add it though.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SibSoft Ltd Forum Index -> XFileSharing Pro All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group