Skip to content

Commit

Permalink
Tygs#18 - It is better to shorten URL over SSH since there is the enc…
Browse files Browse the repository at this point in the history
…ryption key - futhermore if you run 0bin over SSH.
  • Loading branch information
Natim committed Jan 19, 2013
1 parent 303905a commit 28bff88
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions zerobin/static/js/behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,19 @@ window.zerobin = {
/** Get a tinyurl using JSONP */
getTinyURL: function(longURL, success) {
var api = 'http://is.gd/create.php?format=json&url=';
$.getJSON(api + encodeURIComponent(longURL) + '&callback=?', function(data){
success(data.shorturl);
});
$.ajax({
url: 'https://www.googleapis.com/urlshortener/v1/url',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
"longUrl": longURL
}),
processData: false,
dataType: 'json'
}).done(function(data){
console.log(data);
success(data.id);
});
},

/** Check for browser support of the named featured. Store the result
Expand Down

0 comments on commit 28bff88

Please sign in to comment.