Skip to content

add some caching support by disabling random data generated by jQuery #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jquery.embedly.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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){
Expand Down
8 changes: 4 additions & 4 deletions src/jquery.embedly.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -191,12 +192,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){
Expand Down