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'
};
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) {
var expected = data["expected_type"];
var expected = data.expected_type;
self._addProperty({
id : data.id,
name: data.name,
@ -370,7 +370,7 @@ ExtendDataPreviewDialog.prototype._constrainProperty = function(path) {
o = o[0];
}
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;
}

View File

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

View File

@ -61,7 +61,7 @@ ScatterplotDialog.prototype._createDialog = function() {
this._elmts.plotSize.change(function() {
try {
self._plot_size = parseInt($(this).val())
self._plot_size = parseInt($(this).val(),10);
self._renderMatrix();
} catch (e) {
alert("Must be a number");
@ -70,7 +70,7 @@ ScatterplotDialog.prototype._createDialog = function() {
this._elmts.dotSize.change(function() {
try {
self._dot_size = parseFloat($(this).val())
self._dot_size = parseFloat($(this).val(),10);
self._renderMatrix();
} catch (e) {
alert("Must be a number");
@ -98,7 +98,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
project: theProject.id
};
$.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'");
return;
}
@ -151,7 +151,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
table += '<tr>';
var div_class = "column_header";
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++) {
var cx = columns[i].name;
var cy = columns[j].name;
@ -215,7 +215,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
index : 0,
batch_size: 4,
images : container.find(".scatterplot img")
})
});
});
} else {
container.html(

View File

@ -289,7 +289,7 @@ ListFacet.prototype._update = function(resetScroll) {
this._elmts.bodyInnerDiv[0].scrollTop = scrollTop;
var getChoice = function(elmt) {
var index = parseInt(elmt.attr("choiceIndex"));
var index = parseInt(elmt.attr("choiceIndex"),10);
if (index == -1) {
return self._blankChoice;
} else if (index == -2) {
@ -356,7 +356,7 @@ ListFacet.prototype._update = function(resetScroll) {
select(choice);
}
});
}
};
window.setTimeout(wireEvents, 100);
};
@ -414,7 +414,7 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
} else if (choice === self._errorChoice) {
edit.fromError = true;
} else {
edit.from = [ originalContent ]
edit.from = [ originalContent ];
}
Gridworks.postProcess(
@ -539,7 +539,7 @@ ListFacet.prototype._editExpression = function() {
var self = this;
var title = (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 o = DataTableView.sampleVisibleRows(column);

View File

@ -239,7 +239,7 @@ RangeFacet.prototype._addCommas = function(nStr) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
};
RangeFacet.prototype.updateState = function(data) {
if ("min" in data && "max" in data) {
@ -339,7 +339,7 @@ RangeFacet.prototype._editExpression = function() {
var self = this;
var title = (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 o = DataTableView.sampleVisibleRows(column);

View File

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

View File

@ -67,6 +67,17 @@ function isThereNewRelease() {
return latestRev > thisRev;
}
function fetchProjects() {
$.getJSON(
"/command/get-all-project-metadata",
null,
function(data) {
renderProjects(data);
},
"json"
);
}
function renderProjects(data) {
var 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) {
$("#" + toHide).hide();
$("#" + toShow).show();

View File

@ -318,13 +318,15 @@ Gridworks.columnNameToColumn = function(columnName) {
Gridworks.preparePool = function(pool) {
for (var id in pool.recons) {
var recon = pool.recons[id];
if (recon.m) {
recon.m = pool.reconCandidates[recon.m];
}
if (recon.c) {
for (var j = 0; j < recon.c.length; j++) {
recon.c[j] = pool.reconCandidates[recon.c[j]];
if (pool.recons.hasOwnProperty(id)) {
var recon = pool.recons[id];
if (recon.m) {
recon.m = pool.reconCandidates[recon.m];
}
if (recon.c) {
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 = {
"type" : typeID
};
if (targetTypeID != null) {
if (targetTypeID !== null) {
params.expects = targetTypeID;
} else if (targetTypeName != null) {
} else if (targetTypeName !== null) {
params.expects = targetTypeName;
}

View File

@ -8,12 +8,14 @@ Freebase.mqlread = function(query, options, onDone) {
if (options) {
for (var n in options) {
var v = options[n];
if (typeof v != "string") {
v = JSON.stringify(v);
if (options.hasOwnProperty(n)) {
var v = options[n];
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') {
// Non-IE
position['width'] = window.outerWidth;
position['height'] = window.outerHeight;
position['top'] = window.screenY;
position['left'] = window.screenX;
position.width = window.outerWidth;
position.height = window.outerHeight;
position.top = window.screenY;
position.left = window.screenX;
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
// IE 6+ in 'standards compliant mode'
position['width'] = document.body.clientWidth;
position['height'] = document.body.clientHeight;
position['top'] = window.screenTop;
position['left'] = window.screenLeft;
position.width = document.body.clientWidth;
position.height = document.body.clientHeight;
position.top = window.screenTop;
position.left = window.screenLeft;
}
return position;
@ -25,8 +25,8 @@
height = height || 500;
var pos = window.Sign.window_position();
var left = Math.floor((pos['width']-width)/2) + pos['left'];
var top = Math.floor((pos['height']-height)/2) + pos['top'];
var left = Math.floor((pos.width - width) / 2) + pos.left;
var top = Math.floor((pos.height - height) / 2) + pos.top;
// Chrome might fix this bug, but until then add some padding
// to the height of the popup for the urlbar
@ -51,7 +51,9 @@
var params_list = [];
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(","));

View File

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

View File

@ -1044,7 +1044,7 @@ DataTableColumnHeaderUI.prototype._doSplitColumn = function() {
var s = bodyElmts.maxColumnsInput[0].value;
if (s) {
var n = parseInt(s);
var n = parseInt(s,10);
if (!isNaN(n)) {
config.maxColumns = n;
}
@ -1061,7 +1061,7 @@ DataTableColumnHeaderUI.prototype._doSplitColumn = function() {
var lengths = [];
$.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.");
return;
}

View File

@ -62,7 +62,7 @@ ProcessWidget.prototype.showUndo = function(historyEntry) {
'<div class="process-panel-inner"><div class="process-panel-undo">' +
'<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>'
).slideDown().delay(5000).slideUp(); ;
).slideDown().delay(5000).slideUp();
var elmts = DOM.bind(this._div);
elmts.description.text(historyEntry.description);

View File

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