From aefee9fa19408631155d065423b2ff75bf35b1eb Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Sat, 19 Jul 2014 14:44:26 +0100 Subject: [PATCH 1/3] use config instead of hardcoded strings --- src/jquery.embedly.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jquery.embedly.js b/src/jquery.embedly.js index 86adcbf..aed8a64 100644 --- a/src/jquery.embedly.js +++ b/src/jquery.embedly.js @@ -8,6 +8,7 @@ // Defaults for Embedly. var defaults = { + domain: 'api.embed.ly', key: null, endpoint: 'oembed', // default endpoint is oembed (preview and objectify available too) secure: null, // use https endpoint vs http @@ -131,7 +132,7 @@ } var base = (secure ? 'https': 'http') + - '://api.embed.ly/' + (method === 'objectify' ? '2/' : '1/') + method; + '://' + options.domain + '/' + (method === 'objectify' ? '2/' : '1/') + method; // Base Query; var query = none(options.query) ? {} : options.query; From 2d7bb7266a153ebaea053be527eb875a6d04e8ae Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Sat, 19 Jul 2014 14:44:46 +0100 Subject: [PATCH 2/3] enable caching by url --- src/jquery.embedly.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/jquery.embedly.js b/src/jquery.embedly.js index aed8a64..9529696 100644 --- a/src/jquery.embedly.js +++ b/src/jquery.embedly.js @@ -198,6 +198,8 @@ $.ajax({ url: self.build(method, batch, options), dataType: 'jsonp', + jsonpCallback: 'embedlyDataCall', + cache: true, success: function(data){ // We zip together the urls and the data so we have the original_url $.each(zip([batch, data]), function(i, obj){ From 9aa22e5cd7bab0a6bb3abb066d92831acab257b7 Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Wed, 13 Aug 2014 23:58:31 +0100 Subject: [PATCH 3/3] use simple json call instead of jsonp --- jquery.embedly.js | 8 ++++---- src/jquery.embedly.js | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/jquery.embedly.js b/jquery.embedly.js index f445b38..27f6672 100644 --- a/jquery.embedly.js +++ b/jquery.embedly.js @@ -11,6 +11,7 @@ // Defaults for Embedly. var defaults = { + domain: 'api.embed.ly', key: null, endpoint: 'oembed', // default endpoint is oembed (preview and objectify available too) secure: null, // use https endpoint vs http @@ -134,7 +135,7 @@ } var base = (secure ? 'https': 'http') + - '://api.embed.ly/' + (method === 'objectify' ? '2/' : '1/') + method; + '://' + options.domain + '/' + (method === 'objectify' ? '2/' : '1/') + method; // Base Query; var query = none(options.query) ? {} : options.query; @@ -194,12 +195,11 @@ // Put everything into batches, even if these is only one. var batches = batch(valid_urls, options.batch), self = this; - // Actually make those calls. - $.each(batches, function(i, batch){ + $.each(batches, function(i, batch) { $.ajax({ url: self.build(method, batch, options), - dataType: 'jsonp', + cache: true, success: function(data){ // We zip together the urls and the data so we have the original_url $.each(zip([batch, data]), function(i, obj){ diff --git a/src/jquery.embedly.js b/src/jquery.embedly.js index 9529696..fe6d83f 100644 --- a/src/jquery.embedly.js +++ b/src/jquery.embedly.js @@ -192,13 +192,10 @@ // Put everything into batches, even if these is only one. var batches = batch(valid_urls, options.batch), self = this; - // Actually make those calls. - $.each(batches, function(i, batch){ + $.each(batches, function(i, batch) { $.ajax({ url: self.build(method, batch, options), - dataType: 'jsonp', - jsonpCallback: 'embedlyDataCall', cache: true, success: function(data){ // We zip together the urls and the data so we have the original_url