From 8635c90b04eafe65bc96032f478efc6926d9bd34 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 1 May 2012 22:36:51 +0700 Subject: [PATCH] Fixing tinyurl support --- static/js/behavior.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/static/js/behavior.js b/static/js/behavior.js index db70aaf..02ecfdd 100644 --- a/static/js/behavior.js +++ b/static/js/behavior.js @@ -142,15 +142,10 @@ zerobin = { }, /** Get a tinyurl using JSONP */ 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='; - $.getJSON(api + encodeURIComponent(longURL) + '&callback=' + callback); + $.getJSON(api + encodeURIComponent(longURL) + '&callback=?', function(data){ + success(data.tinyurl); + }); }, support: { @@ -379,7 +374,7 @@ if (content && key) { clip.setText(tinyurl); $('#copy-success').hide(); zerobin.message('success', - '' + tinyurk + '', + '' + tinyurl + '', 'Short url' ) $('#short-url').text('Get short url');