Merge pull request #352 from okfn/strict-mode

Enable strict mode - thx to @djw.
This commit is contained in:
Rufus Pollock
2013-05-13 09:33:41 -07:00
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) // Note that provision of jQuery is optional (it is **only** needed if you use fetch on a remote file)
(function(my) { (function(my) {
"use strict";
my.__type__ = 'csv'; my.__type__ = 'csv';
// use either jQuery or Underscore Deferred depending on what is available // 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 // ## fetch
// //

View File

@@ -3,6 +3,7 @@ this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.DataProxy = this.recline.Backend.DataProxy || {}; this.recline.Backend.DataProxy = this.recline.Backend.DataProxy || {};
(function(my) { (function(my) {
"use strict";
my.__type__ = 'dataproxy'; my.__type__ = 'dataproxy';
// URL for the dataproxy // URL for the dataproxy
my.dataproxy_url = '//jsonpdataproxy.appspot.com'; 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 // 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 // ## load
// //

View File

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

View File

@@ -3,10 +3,11 @@ this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.GDocs = this.recline.Backend.GDocs || {}; this.recline.Backend.GDocs = this.recline.Backend.GDocs || {};
(function(my) { (function(my) {
"use strict";
my.__type__ = 'gdocs'; my.__type__ = 'gdocs';
// use either jQuery or Underscore Deferred depending on what is available // 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 // ## Google spreadsheet backend
// //

View File

@@ -3,10 +3,11 @@ this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.Memory = this.recline.Backend.Memory || {}; this.recline.Backend.Memory = this.recline.Backend.Memory || {};
(function(my) { (function(my) {
"use strict";
my.__type__ = 'memory'; my.__type__ = 'memory';
// private data - use either jQuery or Underscore Deferred depending on what is available // 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 // ## Data Wrapper
// //

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,6 +4,7 @@ this.recline = this.recline || {};
this.recline.View = this.recline.View || {}; this.recline.View = this.recline.View || {};
(function($, my) { (function($, my) {
"use strict";
// ## SlickGrid Dataset View // ## SlickGrid Dataset View
// //
// Provides a tabular view on a Dataset, based on SlickGrid. // 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 || {}; this.recline.View = this.recline.View || {};
(function($, my) { (function($, my) {
"use strict";
// turn off unnecessary logging from VMM Timeline // turn off unnecessary logging from VMM Timeline
if (typeof VMM !== 'undefined') { if (typeof VMM !== 'undefined') {
VMM.debug = false; VMM.debug = false;

View File

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

View File

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

View File

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

View File

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

View File

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