Enabled strict mode, and fixed issues raised.

This commit is contained in:
Dan Wilson 2013-05-13 16:53:55 +01:00
parent 773e03c9c7
commit b72dd0fb62
17 changed files with 32 additions and 18 deletions

View File

@ -4,10 +4,11 @@ this.recline.Backend.CSV = this.recline.Backend.CSV || {};
// Note that provision of jQuery is optional (it is **only** needed if you use fetch on a remote file)
(function(my) {
"use strict";
my.__type__ = 'csv';
// use either jQuery or Underscore Deferred depending on what is available
var Deferred = _.isUndefined(this.jQuery) ? _.Deferred : jQuery.Deferred;
var Deferred = _.isUndefined(window.jQuery) ? _.Deferred : jQuery.Deferred;
// ## fetch
//

View File

@ -3,6 +3,7 @@ this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.DataProxy = this.recline.Backend.DataProxy || {};
(function(my) {
"use strict";
my.__type__ = 'dataproxy';
// URL for the dataproxy
my.dataproxy_url = '//jsonpdataproxy.appspot.com';
@ -12,7 +13,7 @@ this.recline.Backend.DataProxy = this.recline.Backend.DataProxy || {};
// use either jQuery or Underscore Deferred depending on what is available
var Deferred = _.isUndefined(this.jQuery) ? _.Deferred : jQuery.Deferred;
var Deferred = _.isUndefined(window.jQuery) ? _.Deferred : jQuery.Deferred;
// ## load
//

View File

@ -3,10 +3,11 @@ this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.ElasticSearch = this.recline.Backend.ElasticSearch || {};
(function($, my) {
"use strict";
my.__type__ = 'elasticsearch';
// use either jQuery or Underscore Deferred depending on what is available
var Deferred = _.isUndefined(this.jQuery) ? _.Deferred : jQuery.Deferred;
var Deferred = _.isUndefined(window.jQuery) ? _.Deferred : jQuery.Deferred;
// ## ElasticSearch Wrapper
//
@ -200,8 +201,8 @@ this.recline.Backend.ElasticSearch = this.recline.Backend.ElasticSearch || {};
fields: fieldData
});
})
.fail(function(arguments) {
dfd.reject(arguments);
.fail(function(args) {
dfd.reject(args);
});
return dfd.promise();
};

View File

@ -3,10 +3,11 @@ this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.GDocs = this.recline.Backend.GDocs || {};
(function(my) {
"use strict";
my.__type__ = 'gdocs';
// use either jQuery or Underscore Deferred depending on what is available
var Deferred = _.isUndefined(this.jQuery) ? _.Deferred : jQuery.Deferred;
var Deferred = _.isUndefined(window.jQuery) ? _.Deferred : jQuery.Deferred;
// ## Google spreadsheet backend
//

View File

@ -3,10 +3,11 @@ this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.Memory = this.recline.Backend.Memory || {};
(function(my) {
"use strict";
my.__type__ = 'memory';
// private data - use either jQuery or Underscore Deferred depending on what is available
var Deferred = _.isUndefined(this.jQuery) ? _.Deferred : jQuery.Deferred;
var Deferred = _.isUndefined(window.jQuery) ? _.Deferred : jQuery.Deferred;
// ## Data Wrapper
//

View File

@ -3,9 +3,10 @@ this.recline = this.recline || {};
this.recline.Model = this.recline.Model || {};
(function(my) {
"use strict";
// use either jQuery or Underscore Deferred depending on what is available
var Deferred = _.isUndefined(this.jQuery) ? _.Deferred : jQuery.Deferred;
var Deferred = _.isUndefined(window.jQuery) ? _.Deferred : jQuery.Deferred;
// ## <a id="dataset">Dataset</a>
my.Dataset = Backbone.Model.extend({
@ -298,7 +299,7 @@ my.Record = Backbone.Model.extend({
//
// NB: if field is undefined a default '' value will be returned
getFieldValue: function(field) {
val = this.getFieldValueUnrendered(field);
var val = this.getFieldValueUnrendered(field);
if (field && !_.isUndefined(field.renderer)) {
val = field.renderer(val, field, this.toJSON());
}

View File

@ -4,7 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
// ## Graph view for a Dataset using Flot graphing library.
//
// Initialization arguments (in a hash in first parameter):

View File

@ -4,6 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
// ## (Data) Grid Dataset View
//
// Provides a tabular view on a Dataset.

View File

@ -4,7 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
// ## Map view for a Dataset using Leaflet mapping library.
//
// This view allows to plot gereferenced records on a map. The location
@ -123,7 +123,7 @@ my.Map = Backbone.View.extend({
// }
infobox: function(record) {
var html = '';
for (key in record.attributes){
for (var key in record.attributes){
if (!(this.state.get('geomField') && key == this.state.get('geomField'))){
html += '<div><strong>' + key + '</strong>: '+ record.attributes[key] + '</div>';
}
@ -172,8 +172,7 @@ my.Map = Backbone.View.extend({
// Also sets up the editor fields and the map if necessary.
render: function() {
var self = this;
htmls = Mustache.render(this.template, this.model.toTemplateJSON());
var htmls = Mustache.render(this.template, this.model.toTemplateJSON());
$(this.el).html(htmls);
this.$map = this.el.find('.panel.map');
this.redraw();
@ -326,7 +325,7 @@ my.Map = Backbone.View.extend({
if (!(docs instanceof Array)) docs = [docs];
_.each(docs,function(doc){
for (key in self.features._layers){
for (var key in self.features._layers){
if (self.features._layers[key].feature.properties.cid == doc.cid){
self.features.removeLayer(self.features._layers[key]);
}
@ -560,7 +559,7 @@ my.MapMenu = Backbone.View.extend({
// Also sets up the editor fields and the map if necessary.
render: function() {
var self = this;
htmls = Mustache.render(this.template, this.model.toTemplateJSON());
var htmls = Mustache.render(this.template, this.model.toTemplateJSON());
$(this.el).html(htmls);
if (this._geomReady() && this.model.fields.length){

View File

@ -5,6 +5,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
// ## MultiView
//
// Manage multiple views together along with query editor etc. Usage:
@ -519,7 +520,7 @@ my.parseQueryString = function(q) {
// Parse the query string out of the URL hash
my.parseHashQueryString = function() {
q = my.parseHashUrl(window.location.hash).query;
var q = my.parseHashUrl(window.location.hash).query;
return my.parseQueryString(q);
};

View File

@ -4,6 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
// ## SlickGrid Dataset View
//
// Provides a tabular view on a Dataset, based on SlickGrid.

View File

@ -4,6 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
// turn off unnecessary logging from VMM Timeline
if (typeof VMM !== 'undefined') {
VMM.debug = false;

View File

@ -4,6 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
// ## FacetViewer
//

View File

@ -20,7 +20,8 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
my.Fields = Backbone.View.extend({
className: 'recline-fields-view',
template: ' \

View File

@ -4,6 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
my.FilterEditor = Backbone.View.extend({
className: 'recline-filter-editor well',

View File

@ -4,6 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
my.QueryEditor = Backbone.View.extend({
className: 'recline-query-editor',

View File

@ -4,6 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {};
(function($, my) {
"use strict";
my.ValueFilter = Backbone.View.extend({
className: 'recline-filter-editor well',