bunch of fixes to make jslint happier (can't make it shut up because it's *really* obnoxious)

git-svn-id: http://google-refine.googlecode.com/svn/trunk@596 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-05-05 00:26:26 +00:00
parent 860172f751
commit e669f0f542
15 changed files with 73 additions and 65 deletions

View File

@ -135,11 +135,11 @@ ExtendDataPreviewDialog.prototype._show = function(properties) {
type: '/type/property' type: '/type/property'
}; };
if ("reconConfig" in this._column && "type" in this._column.reconConfig) { if ("reconConfig" in this._column && "type" in this._column.reconConfig) {
suggestConfig.schema = this._column.reconConfig.type.id suggestConfig.schema = this._column.reconConfig.type.id;
} }
this._elmts.addPropertyInput.suggestP(suggestConfig).bind("fb-select", function(evt, data) { this._elmts.addPropertyInput.suggestP(suggestConfig).bind("fb-select", function(evt, data) {
var expected = data["expected_type"]; var expected = data.expected_type;
self._addProperty({ self._addProperty({
id : data.id, id : data.id,
name: data.name, name: data.name,
@ -370,7 +370,7 @@ ExtendDataPreviewDialog.prototype._constrainProperty = function(path) {
o = o[0]; o = o[0];
} }
if (!$.isPlainObject(o)) { if (!$.isPlainObject(o)) {
alert("The JSON you enter must be an object, that is, it is of this form { ... }.") alert("The JSON you enter must be an object, that is, it is of this form { ... }.");
return; return;
} }

View File

@ -183,7 +183,7 @@ FreebaseLoadingDialog.prototype._load = function() {
var get_peacock_url = function(url) { var get_peacock_url = function(url) {
return "http://peacock.freebaseapps.com/stats/data.labs/" + url.split("/").slice(-2).join("/"); return "http://peacock.freebaseapps.com/stats/data.labs/" + url.split("/").slice(-2).join("/");
} };
var doLoad = function() { var doLoad = function() {
var dismissBusy = DialogSystem.showBusy(); var dismissBusy = DialogSystem.showBusy();
@ -238,7 +238,7 @@ FreebaseLoadingDialog.prototype._load = function() {
} else { } else {
doLoad(); doLoad();
} }
} };
FreebaseLoadingDialog.prototype._dismiss = function() { FreebaseLoadingDialog.prototype._dismiss = function() {
DialogSystem.dismissUntil(this._level - 1); DialogSystem.dismissUntil(this._level - 1);

View File

@ -61,7 +61,7 @@ ScatterplotDialog.prototype._createDialog = function() {
this._elmts.plotSize.change(function() { this._elmts.plotSize.change(function() {
try { try {
self._plot_size = parseInt($(this).val()) self._plot_size = parseInt($(this).val(),10);
self._renderMatrix(); self._renderMatrix();
} catch (e) { } catch (e) {
alert("Must be a number"); alert("Must be a number");
@ -70,7 +70,7 @@ ScatterplotDialog.prototype._createDialog = function() {
this._elmts.dotSize.change(function() { this._elmts.dotSize.change(function() {
try { try {
self._dot_size = parseFloat($(this).val()) self._dot_size = parseFloat($(this).val(),10);
self._renderMatrix(); self._renderMatrix();
} catch (e) { } catch (e) {
alert("Must be a number"); alert("Must be a number");
@ -98,7 +98,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
project: theProject.id project: theProject.id
}; };
$.getJSON("/command/get-columns-info?" + $.param(params),function(data) { $.getJSON("/command/get-columns-info?" + $.param(params),function(data) {
if (data == null || typeof data.length == 'undefined') { if (data === null || typeof data.length == 'undefined') {
container.html("Error calling 'get-columns-info'"); container.html("Error calling 'get-columns-info'");
return; return;
} }
@ -151,7 +151,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
table += '<tr>'; table += '<tr>';
var div_class = "column_header"; var div_class = "column_header";
if (columns[i].name == self._column) div_class += " current_column"; if (columns[i].name == self._column) div_class += " current_column";
table += '<td class="' + div_class + '" colspan="' + (i + 1) + '">' + columns[i].name + '</td>' table += '<td class="' + div_class + '" colspan="' + (i + 1) + '">' + columns[i].name + '</td>';
for (var j = i + 1; j < columns.length; j++) { for (var j = i + 1; j < columns.length; j++) {
var cx = columns[i].name; var cx = columns[i].name;
var cy = columns[j].name; var cy = columns[j].name;
@ -215,7 +215,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
index : 0, index : 0,
batch_size: 4, batch_size: 4,
images : container.find(".scatterplot img") images : container.find(".scatterplot img")
}) });
}); });
} else { } else {
container.html( container.html(

View File

@ -289,7 +289,7 @@ ListFacet.prototype._update = function(resetScroll) {
this._elmts.bodyInnerDiv[0].scrollTop = scrollTop; this._elmts.bodyInnerDiv[0].scrollTop = scrollTop;
var getChoice = function(elmt) { var getChoice = function(elmt) {
var index = parseInt(elmt.attr("choiceIndex")); var index = parseInt(elmt.attr("choiceIndex"),10);
if (index == -1) { if (index == -1) {
return self._blankChoice; return self._blankChoice;
} else if (index == -2) { } else if (index == -2) {
@ -356,7 +356,7 @@ ListFacet.prototype._update = function(resetScroll) {
select(choice); select(choice);
} }
}); });
} };
window.setTimeout(wireEvents, 100); window.setTimeout(wireEvents, 100);
}; };
@ -414,7 +414,7 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
} else if (choice === self._errorChoice) { } else if (choice === self._errorChoice) {
edit.fromError = true; edit.fromError = true;
} else { } else {
edit.from = [ originalContent ] edit.from = [ originalContent ];
} }
Gridworks.postProcess( Gridworks.postProcess(
@ -539,7 +539,7 @@ ListFacet.prototype._editExpression = function() {
var self = this; var self = this;
var title = (this._config.columnName) ? var title = (this._config.columnName) ?
("Edit Facet's Expression based on Column " + this._config.columnName) : ("Edit Facet's Expression based on Column " + this._config.columnName) :
"Edit Facet's Expression" "Edit Facet's Expression";
var column = Gridworks.columnNameToColumn(this._config.columnName); var column = Gridworks.columnNameToColumn(this._config.columnName);
var o = DataTableView.sampleVisibleRows(column); var o = DataTableView.sampleVisibleRows(column);

View File

@ -239,7 +239,7 @@ RangeFacet.prototype._addCommas = function(nStr) {
x1 = x1.replace(rgx, '$1' + ',' + '$2'); x1 = x1.replace(rgx, '$1' + ',' + '$2');
} }
return x1 + x2; return x1 + x2;
} };
RangeFacet.prototype.updateState = function(data) { RangeFacet.prototype.updateState = function(data) {
if ("min" in data && "max" in data) { if ("min" in data && "max" in data) {
@ -339,7 +339,7 @@ RangeFacet.prototype._editExpression = function() {
var self = this; var self = this;
var title = (this._config.columnName) ? var title = (this._config.columnName) ?
("Edit Facet's Expression based on Column " + this._config.columnName) : ("Edit Facet's Expression based on Column " + this._config.columnName) :
"Edit Facet's Expression" "Edit Facet's Expression";
var column = Gridworks.columnNameToColumn(this._config.columnName); var column = Gridworks.columnNameToColumn(this._config.columnName);
var o = DataTableView.sampleVisibleRows(column); var o = DataTableView.sampleVisibleRows(column);

View File

@ -9,7 +9,7 @@ function ScatterplotFacet(div, config, options) {
ScatterplotFacet.prototype.update = function() { ScatterplotFacet.prototype.update = function() {
this._plotAreaSelector.update(); this._plotAreaSelector.update();
} };
ScatterplotFacet.prototype.reset = function() { ScatterplotFacet.prototype.reset = function() {
delete this._config.from_x; delete this._config.from_x;
@ -45,8 +45,8 @@ ScatterplotFacet.prototype.getJSON = function() {
}; };
ScatterplotFacet.prototype.hasSelection = function() { ScatterplotFacet.prototype.hasSelection = function() {
return ("from_x" in this._config && this._config.from_x != 0) || return ("from_x" in this._config && this._config.from_x !== 0) ||
("from_y" in this._config && this._config.from_y != 0) || ("from_y" in this._config && this._config.from_y !== 0) ||
("to_x" in this._config && this._config.to_x != this._config.l) || ("to_x" in this._config && this._config.to_x != this._config.l) ||
("to_y" in this._config && this._config.to_y != this._config.l); ("to_y" in this._config && this._config.to_y != this._config.l);
}; };
@ -123,7 +123,7 @@ ScatterplotFacet.prototype._initializeUI = function() {
parent: this._elmts.plotDiv, parent: this._elmts.plotDiv,
fadeSpeed: 70, fadeSpeed: 70,
onSelectEnd: function(elmt, selection) { onSelectEnd: function(elmt, selection) {
if (selection.height == 0 || selection.width == 0) { if (selection.height === 0 || selection.width === 0) {
self.reset(); self.reset();
} else { } else {
self._config.from_x = selection.x1; self._config.from_x = selection.x1;
@ -198,11 +198,13 @@ ScatterplotFacet.prototype._formulateCurrentImageUrl = function() {
ScatterplotFacet.prototype._formulateBaseImageUrl = function() { ScatterplotFacet.prototype._formulateBaseImageUrl = function() {
return this._formulateImageUrl({},{ color: "888888", dot : this._config.dot * 0.9 }); return this._formulateImageUrl({},{ color: "888888", dot : this._config.dot * 0.9 });
} };
ScatterplotFacet.prototype._formulateImageUrl = function(engineConfig, conf) { ScatterplotFacet.prototype._formulateImageUrl = function(engineConfig, conf) {
for (var p in conf) { for (var p in conf) {
this._config[p] = conf[p]; if (conf.hasOwnProperty(p)) {
this._config[p] = conf[p];
}
} }
var params = { var params = {
project: theProject.id, project: theProject.id,
@ -246,7 +248,7 @@ ScatterplotFacet.prototype.changePlot = function() {
this._elmts.plotBaseImg.attr("src", this._formulateBaseImageUrl()); this._elmts.plotBaseImg.attr("src", this._formulateBaseImageUrl());
this._elmts.plotImg.attr("src", this._formulateCurrentImageUrl()); this._elmts.plotImg.attr("src", this._formulateCurrentImageUrl());
this._updateRest(); this._updateRest();
} };
ScatterplotFacet.prototype.render = function() { ScatterplotFacet.prototype.render = function() {
if (!this._initializedUI) { if (!this._initializedUI) {

View File

@ -67,6 +67,17 @@ function isThereNewRelease() {
return latestRev > thisRev; return latestRev > thisRev;
} }
function fetchProjects() {
$.getJSON(
"/command/get-all-project-metadata",
null,
function(data) {
renderProjects(data);
},
"json"
);
}
function renderProjects(data) { function renderProjects(data) {
var projects = []; var projects = [];
for (var n in data.projects) { for (var n in data.projects) {
@ -138,17 +149,6 @@ function renderProjects(data) {
} }
} }
function fetchProjects() {
$.getJSON(
"/command/get-all-project-metadata",
null,
function(data) {
renderProjects(data);
},
"json"
);
}
function showHide(toHide, toShow) { function showHide(toHide, toShow) {
$("#" + toHide).hide(); $("#" + toHide).hide();
$("#" + toShow).show(); $("#" + toShow).show();

View File

@ -318,13 +318,15 @@ Gridworks.columnNameToColumn = function(columnName) {
Gridworks.preparePool = function(pool) { Gridworks.preparePool = function(pool) {
for (var id in pool.recons) { for (var id in pool.recons) {
var recon = pool.recons[id]; if (pool.recons.hasOwnProperty(id)) {
if (recon.m) { var recon = pool.recons[id];
recon.m = pool.reconCandidates[recon.m]; if (recon.m) {
} recon.m = pool.reconCandidates[recon.m];
if (recon.c) { }
for (var j = 0; j < recon.c.length; j++) { if (recon.c) {
recon.c[j] = pool.reconCandidates[recon.c[j]]; for (var j = 0; j < recon.c.length; j++) {
recon.c[j] = pool.reconCandidates[recon.c[j]];
}
} }
} }
} }

View File

@ -131,9 +131,9 @@ SchemaAlignmentDialog.UILink._getPropertiesOfType = function(typeID, targetTypeI
var params = { var params = {
"type" : typeID "type" : typeID
}; };
if (targetTypeID != null) { if (targetTypeID !== null) {
params.expects = targetTypeID; params.expects = targetTypeID;
} else if (targetTypeName != null) { } else if (targetTypeName !== null) {
params.expects = targetTypeName; params.expects = targetTypeName;
} }

View File

@ -8,12 +8,14 @@ Freebase.mqlread = function(query, options, onDone) {
if (options) { if (options) {
for (var n in options) { for (var n in options) {
var v = options[n]; if (options.hasOwnProperty(n)) {
if (typeof v != "string") { var v = options[n];
v = JSON.stringify(v); if (typeof v != "string") {
v = JSON.stringify(v);
}
queryEnv[n] = v;
} }
queryEnv[n] = v;
} }
} }

View File

@ -5,16 +5,16 @@
if (typeof(window.innerWidth) == 'number') { if (typeof(window.innerWidth) == 'number') {
// Non-IE // Non-IE
position['width'] = window.outerWidth; position.width = window.outerWidth;
position['height'] = window.outerHeight; position.height = window.outerHeight;
position['top'] = window.screenY; position.top = window.screenY;
position['left'] = window.screenX; position.left = window.screenX;
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
// IE 6+ in 'standards compliant mode' // IE 6+ in 'standards compliant mode'
position['width'] = document.body.clientWidth; position.width = document.body.clientWidth;
position['height'] = document.body.clientHeight; position.height = document.body.clientHeight;
position['top'] = window.screenTop; position.top = window.screenTop;
position['left'] = window.screenLeft; position.left = window.screenLeft;
} }
return position; return position;
@ -25,8 +25,8 @@
height = height || 500; height = height || 500;
var pos = window.Sign.window_position(); var pos = window.Sign.window_position();
var left = Math.floor((pos['width']-width)/2) + pos['left']; var left = Math.floor((pos.width - width) / 2) + pos.left;
var top = Math.floor((pos['height']-height)/2) + pos['top']; var top = Math.floor((pos.height - height) / 2) + pos.top;
// Chrome might fix this bug, but until then add some padding // Chrome might fix this bug, but until then add some padding
// to the height of the popup for the urlbar // to the height of the popup for the urlbar
@ -51,7 +51,9 @@
var params_list = []; var params_list = [];
for (var key in params) { for (var key in params) {
params_list.push(key + "=" + params[key]); if (params.hasOwnProperty(key)) {
params_list.push(key + "=" + params[key]);
}
} }
return window.open(url, windowname || "", params_list.join(",")); return window.open(url, windowname || "", params_list.join(","));

View File

@ -104,7 +104,7 @@ DataTableCellUI.prototype._render = function() {
if (candidate.score < 1) { if (candidate.score < 1) {
score = Math.round(candidate.score * 1000) / 1000; score = Math.round(candidate.score * 1000) / 1000;
} else { } else {
score = Math.round(candidate.score) score = Math.round(candidate.score);
} }
$('<span></span>').addClass("data-table-recon-score").text("(" + score + ")").appendTo(li); $('<span></span>').addClass("data-table-recon-score").text("(" + score + ")").appendTo(li);
}; };
@ -311,7 +311,7 @@ DataTableCellUI.topicBlockParams = {
"mode" : "content", "mode" : "content",
"blocks" : JSON.stringify([ "blocks" : JSON.stringify([
{ {
"block" : "full_info", "block" : "full_info"
}, },
{ {
"block" : "article_props" "block" : "article_props"

View File

@ -1044,7 +1044,7 @@ DataTableColumnHeaderUI.prototype._doSplitColumn = function() {
var s = bodyElmts.maxColumnsInput[0].value; var s = bodyElmts.maxColumnsInput[0].value;
if (s) { if (s) {
var n = parseInt(s); var n = parseInt(s,10);
if (!isNaN(n)) { if (!isNaN(n)) {
config.maxColumns = n; config.maxColumns = n;
} }
@ -1061,7 +1061,7 @@ DataTableColumnHeaderUI.prototype._doSplitColumn = function() {
var lengths = []; var lengths = [];
$.each(a, function(i,n) { if (typeof n == "number") lengths.push(n); }); $.each(a, function(i,n) { if (typeof n == "number") lengths.push(n); });
if (lengths.length == 0) { if (lengths.length === 0) {
alert("No field length is specified."); alert("No field length is specified.");
return; return;
} }

View File

@ -62,7 +62,7 @@ ProcessWidget.prototype.showUndo = function(historyEntry) {
'<div class="process-panel-inner"><div class="process-panel-undo">' + '<div class="process-panel-inner"><div class="process-panel-undo">' +
'<a href="javascript:{}" bind="undo">Undo</a> <span bind="description"></span>' + '<a href="javascript:{}" bind="undo">Undo</a> <span bind="description"></span>' +
'</div><div style="text-align: right; padding-right: 1em;"><a href="javascript:{}" bind="close">close</a></div></div>' '</div><div style="text-align: right; padding-right: 1em;"><a href="javascript:{}" bind="close">close</a></div></div>'
).slideDown().delay(5000).slideUp(); ; ).slideDown().delay(5000).slideUp();
var elmts = DOM.bind(this._div); var elmts = DOM.bind(this._div);
elmts.description.text(historyEntry.description); elmts.description.text(historyEntry.description);

View File

@ -39,7 +39,7 @@ SliderWidget.prototype.update = function(min, max, step, from, to) {
to: to to: to
}; };
this._update(); this._update();
} };
SliderWidget.prototype._initializeUI = function() { SliderWidget.prototype._initializeUI = function() {
this._elmt.addClass("slider-widget"); this._elmt.addClass("slider-widget");