mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Fixing tinyurl support
This commit is contained in:
parent
15b203eb11
commit
8635c90b04
@ -142,15 +142,10 @@ zerobin = {
|
|||||||
},
|
},
|
||||||
/** Get a tinyurl using JSONP */
|
/** Get a tinyurl using JSONP */
|
||||||
getTinyURL: function(longURL, success) {
|
getTinyURL: function(longURL, success) {
|
||||||
|
|
||||||
callback = 'zerobin_tiny_url_callback';
|
|
||||||
window[callback] = function(response){
|
|
||||||
success(response.tinyurl);
|
|
||||||
delete window[callback];
|
|
||||||
};
|
|
||||||
|
|
||||||
var api = 'http://json-tinyurl.appspot.com/?url=';
|
var api = 'http://json-tinyurl.appspot.com/?url=';
|
||||||
$.getJSON(api + encodeURIComponent(longURL) + '&callback=' + callback);
|
$.getJSON(api + encodeURIComponent(longURL) + '&callback=?', function(data){
|
||||||
|
success(data.tinyurl);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
support: {
|
support: {
|
||||||
@ -379,7 +374,7 @@ if (content && key) {
|
|||||||
clip.setText(tinyurl);
|
clip.setText(tinyurl);
|
||||||
$('#copy-success').hide();
|
$('#copy-success').hide();
|
||||||
zerobin.message('success',
|
zerobin.message('success',
|
||||||
'<a href="' + tinyurk + '">' + tinyurk + '</a>',
|
'<a href="' + tinyurl + '">' + tinyurl + '</a>',
|
||||||
'Short url'
|
'Short url'
|
||||||
)
|
)
|
||||||
$('#short-url').text('Get short url');
|
$('#short-url').text('Get short url');
|
||||||
|
Loading…
Reference in New Issue
Block a user