diff --git a/src/backend.ckan.js b/src/backend.ckan.js
index 893067a1..19998cab 100644
--- a/src/backend.ckan.js
+++ b/src/backend.ckan.js
@@ -37,12 +37,13 @@ this.recline.Backend.Ckan = this.recline.Backend.Ckan || {};
// ### fetch
my.fetch = function(dataset) {
+ var wrapper;
if (dataset.endpoint) {
- var wrapper = my.DataStore(dataset.endpoint);
+ wrapper = my.DataStore(dataset.endpoint);
} else {
var out = my._parseCkanResourceUrl(dataset.url);
dataset.id = out.resource_id;
- var wrapper = my.DataStore(out.endpoint);
+ wrapper = my.DataStore(out.endpoint);
}
var dfd = new Deferred();
var jqxhr = wrapper.search({resource_id: dataset.id, limit: 0});
@@ -89,12 +90,13 @@ this.recline.Backend.Ckan = this.recline.Backend.Ckan || {};
};
my.query = function(queryObj, dataset) {
+ var wrapper;
if (dataset.endpoint) {
- var wrapper = my.DataStore(dataset.endpoint);
+ wrapper = my.DataStore(dataset.endpoint);
} else {
var out = my._parseCkanResourceUrl(dataset.url);
dataset.id = out.resource_id;
- var wrapper = my.DataStore(out.endpoint);
+ wrapper = my.DataStore(out.endpoint);
}
var actualQuery = my._normalizeQuery(queryObj, dataset);
var dfd = new Deferred();
diff --git a/src/backend.dataproxy.js b/src/backend.dataproxy.js
index 44db50cf..d16e6553 100644
--- a/src/backend.dataproxy.js
+++ b/src/backend.dataproxy.js
@@ -42,8 +42,8 @@ this.recline.Backend.DataProxy = this.recline.Backend.DataProxy || {};
useMemoryStore: true
});
})
- .fail(function(arguments) {
- dfd.reject(arguments);
+ .fail(function(args) {
+ dfd.reject(args);
});
return dfd.promise();
};
@@ -60,16 +60,16 @@ this.recline.Backend.DataProxy = this.recline.Backend.DataProxy || {};
message: 'Request Error: Backend did not respond after ' + (my.timeout / 1000) + ' seconds'
});
}, my.timeout);
- ourFunction.done(function(arguments) {
+ ourFunction.done(function(args) {
clearTimeout(timer);
- dfd.resolve(arguments);
+ dfd.resolve(args);
})
- .fail(function(arguments) {
+ .fail(function(args) {
clearTimeout(timer);
- dfd.reject(arguments);
+ dfd.reject(args);
})
;
return dfd.promise();
- }
+ };
}(this.recline.Backend.DataProxy));
diff --git a/src/model.js b/src/model.js
index b76986e4..1e8b0bd9 100644
--- a/src/model.js
+++ b/src/model.js
@@ -55,8 +55,8 @@ my.Dataset = Backbone.Model.extend({
if (this.backend !== recline.Backend.Memory) {
this.backend.fetch(this.toJSON())
.done(handleResults)
- .fail(function(arguments) {
- dfd.reject(arguments);
+ .fail(function(args) {
+ dfd.reject(args);
});
} else {
// special case where we have been given data directly
@@ -79,8 +79,8 @@ my.Dataset = Backbone.Model.extend({
.done(function() {
dfd.resolve(self);
})
- .fail(function(arguments) {
- dfd.reject(arguments);
+ .fail(function(args) {
+ dfd.reject(args);
});
}
@@ -198,9 +198,9 @@ my.Dataset = Backbone.Model.extend({
self.trigger('query:done');
dfd.resolve(self.records);
})
- .fail(function(arguments) {
- self.trigger('query:fail', arguments);
- dfd.reject(arguments);
+ .fail(function(args) {
+ self.trigger('query:fail', args);
+ dfd.reject(args);
});
return dfd.promise();
},
@@ -450,7 +450,7 @@ my.Field = Backbone.Model.extend({
if (val && typeof val === 'string') {
val = val.replace(/(https?:\/\/[^ ]+)/g, '$1');
}
- return val
+ return val;
}
}
}
diff --git a/src/view.flot.js b/src/view.flot.js
index 018a2963..b50c6000 100644
--- a/src/view.flot.js
+++ b/src/view.flot.js
@@ -208,13 +208,13 @@ my.Flot = Backbone.View.extend({
// for labels case we only want ticks at the label intervals
// HACK: however we also get this case with Date fields. In that case we
- // could have a lot of values and so we limit to max 30 (we assume)
+ // could have a lot of values and so we limit to max 15 (we assume)
if (this.xvaluesAreIndex) {
var numTicks = Math.min(this.model.records.length, 15);
var increment = this.model.records.length / numTicks;
var ticks = [];
for (i=0; i= 0; i--){
- if (_.indexOf(_.pluck(visibleColumns,'id'),columns[i].id) == -1){
+ if (_.indexOf(_.pluck(visibleColumns,'id'),columns[i].id) === -1){
tempHiddenColumns.push(columns.splice(i,1)[0]);
}
}
@@ -159,18 +158,18 @@ my.SlickGrid = Backbone.View.extend({
this.push = function(model, row) {
models.push(model);
rows.push(row);
- }
-
- this.getLength = function() { return rows.length; }
- this.getItem = function(index) { return rows[index];}
- this.getItemMetadata= function(index) { return {};}
- this.getModel= function(index) { return models[index]; }
- this.getModelRow = function(m) { return models.indexOf(m);}
- this.updateItem = function(m,i) {
- rows[i] = toRow(m);
- models[i] = m
};
- };
+
+ this.getLength = function() {return rows.length; };
+ this.getItem = function(index) {return rows[index];};
+ this.getItemMetadata = function(index) {return {};};
+ this.getModel = function(index) {return models[index];};
+ this.getModelRow = function(m) {return models.indexOf(m);};
+ this.updateItem = function(m,i) {
+ rows[i] = toRow(m);
+ models[i] = m;
+ };
+ }
var data = new RowSet();
@@ -184,7 +183,7 @@ my.SlickGrid = Backbone.View.extend({
var sortInfo = this.model.queryState.get('sort');
if (sortInfo){
var column = sortInfo[0].field;
- var sortAsc = !(sortInfo[0].order == 'desc');
+ var sortAsc = sortInfo[0].order !== 'desc';
this.grid.setSortColumn(column, sortAsc);
}
@@ -218,7 +217,7 @@ my.SlickGrid = Backbone.View.extend({
//
var grid = args.grid;
var model = data.getModel(args.row);
- var field = grid.getColumns()[args.cell]['id'];
+ var field = grid.getColumns()[args.cell].id;
var v = {};
v[field] = args.item[field];
model.set(v);
@@ -279,7 +278,7 @@ my.SlickGrid = Backbone.View.extend({
$menu = $('').appendTo(document.body);
$menu.bind('mouseleave', function (e) {
- $(this).fadeOut(options.fadeSpeed)
+ $(this).fadeOut(options.fadeSpeed);
});
$menu.bind('click', updateColumn);
@@ -296,7 +295,7 @@ my.SlickGrid = Backbone.View.extend({
$input = $('').data('column-id', columns[i].id).attr('id','slick-column-vis-'+columns[i].id);
columnCheckboxes.push($input);
- if (grid.getColumnIndex(columns[i].id) != null) {
+ if (grid.getColumnIndex(columns[i].id) !== null) {
$input.attr('checked', 'checked');
}
$input.appendTo($li);
@@ -323,10 +322,12 @@ my.SlickGrid = Backbone.View.extend({
}
function updateColumn(e) {
- if ($(e.target).data('option') == 'autoresize') {
+ var checkbox;
+
+ if ($(e.target).data('option') === 'autoresize') {
var checked;
if ($(e.target).is('li')){
- var checkbox = $(e.target).find('input').first();
+ checkbox = $(e.target).find('input').first();
checked = !checkbox.is(':checked');
checkbox.attr('checked',checked);
} else {
@@ -346,7 +347,7 @@ my.SlickGrid = Backbone.View.extend({
if (($(e.target).is('li') && !$(e.target).hasClass('divider')) ||
$(e.target).is('input')) {
if ($(e.target).is('li')){
- var checkbox = $(e.target).find('input').first();
+ checkbox = $(e.target).find('input').first();
checkbox.attr('checked',!checkbox.is(':checked'));
}
var visibleColumns = [];
@@ -359,7 +360,6 @@ my.SlickGrid = Backbone.View.extend({
}
});
-
if (!visibleColumns.length) {
$(e.target).attr('checked', 'checked');
return;