mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Merge 18_shorten_over_https
This commit is contained in:
commit
6fffdc0371
@ -201,11 +201,20 @@
|
||||
},
|
||||
|
||||
/** 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);
|
||||
});
|
||||
getTinyURL: function(longURL, success) {
|
||||
$.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
|
||||
|
2
zerobin/static/js/main.min.js
vendored
2
zerobin/static/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user