JSLint: foo == 0, foo == null --> !foo
git-svn-id: http://google-refine.googlecode.com/svn/trunk@424 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
94aa2e0168
commit
41a52f135d
@ -121,7 +121,7 @@ ExpressionPreviewDialog.Widget = function(
|
|||||||
|
|
||||||
ExpressionPreviewDialog.Widget.prototype.getExpression = function(commit) {
|
ExpressionPreviewDialog.Widget.prototype.getExpression = function(commit) {
|
||||||
var s = $.trim(this.expression || "");
|
var s = $.trim(this.expression || "");
|
||||||
if (s.length == 0) {
|
if (!s.length) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ ExtendDataPreviewDialog.getAllProperties = function(typeID, onDone) {
|
|||||||
processProperties(this.properties, null);
|
processProperties(this.properties, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cvtProperties.length == 0) {
|
if (!cvtProperties.length) {
|
||||||
onDone(allProperties);
|
onDone(allProperties);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ ReconDialog.prototype._onDoHeuristic = function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == null) {
|
if (!type) {
|
||||||
alert("Please specify a type.");
|
alert("Please specify a type.");
|
||||||
} else {
|
} else {
|
||||||
var columnDetails = [];
|
var columnDetails = [];
|
||||||
@ -282,7 +282,7 @@ ReconDialog.prototype._onDoStrict = function() {
|
|||||||
|
|
||||||
if (namespaceChoice.value == "other") {
|
if (namespaceChoice.value == "other") {
|
||||||
var suggest = this._elmts.strictNamespaceInput.data("data.suggest");
|
var suggest = this._elmts.strictNamespaceInput.data("data.suggest");
|
||||||
if (suggest == null) {
|
if (!suggest) {
|
||||||
alert("Please specify a namespace.");
|
alert("Please specify a namespace.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ ListFacet.prototype.render = function() {
|
|||||||
bodyDiv.addClass("facet-body-scrollable");
|
bodyDiv.addClass("facet-body-scrollable");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._data == null) {
|
if (!this._data) {
|
||||||
$('<div>').text("Loading...").addClass("facet-body-message").appendTo(bodyDiv);
|
$('<div>').text("Loading...").addClass("facet-body-message").appendTo(bodyDiv);
|
||||||
bodyDiv.appendTo(container);
|
bodyDiv.appendTo(container);
|
||||||
} else if ("error" in this._data) {
|
} else if ("error" in this._data) {
|
||||||
|
@ -108,7 +108,7 @@ TextSearchFacet.prototype._remove = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TextSearchFacet.prototype._scheduleUpdate = function() {
|
TextSearchFacet.prototype._scheduleUpdate = function() {
|
||||||
if (this._timerID == null) {
|
if (!this._timerID) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._timerID = window.setTimeout(function() {
|
this._timerID = window.setTimeout(function() {
|
||||||
self._timerID = null;
|
self._timerID = null;
|
||||||
|
@ -20,7 +20,7 @@ $(onLoad);
|
|||||||
|
|
||||||
function onClickUploadFileButton(evt) {
|
function onClickUploadFileButton(evt) {
|
||||||
var projectName = $("#project-name-input")[0].value;
|
var projectName = $("#project-name-input")[0].value;
|
||||||
if ($.trim(projectName).length == 0) {
|
if (! $.trim(projectName).length) {
|
||||||
window.alert("You must specify a project name.");
|
window.alert("You must specify a project name.");
|
||||||
|
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@ -46,7 +46,7 @@ function renderProjects(data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projects.length == 0) {
|
if (!projects.length) {
|
||||||
$('#body-empty').show();
|
$('#body-empty').show();
|
||||||
$('#create-project-panel').remove().appendTo($('#body-empty-create-project-panel-container'));
|
$('#create-project-panel').remove().appendTo($('#body-empty-create-project-panel-container'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -25,7 +25,7 @@ HistoryWidget.prototype._render = function() {
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var collapsedMessage =
|
var collapsedMessage =
|
||||||
(this._data.past.length == 0 ?
|
(!this._data.past.length ?
|
||||||
"" :
|
"" :
|
||||||
(this._data.past.length == 1 ? "1 change - " : (this._data.past.length + " changes - "))
|
(this._data.past.length == 1 ? "1 change - " : (this._data.past.length + " changes - "))
|
||||||
) + 'hover to see';
|
) + 'hover to see';
|
||||||
@ -60,7 +60,7 @@ HistoryWidget.prototype._render = function() {
|
|||||||
return a;
|
return a;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this._data.past.length == 0) {
|
if (!this._data.past.length) {
|
||||||
elmts.pastDiv.html('<div class="history-panel-message">No change to undo</div>');
|
elmts.pastDiv.html('<div class="history-panel-message">No change to undo</div>');
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0; i < this._data.past.length; i++) {
|
for (var i = 0; i < this._data.past.length; i++) {
|
||||||
@ -69,7 +69,7 @@ HistoryWidget.prototype._render = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._data.future.length == 0) {
|
if (!this._data.future.length) {
|
||||||
elmts.futureDiv.html('<div class="history-panel-message">No change to redo</div>');
|
elmts.futureDiv.html('<div class="history-panel-message">No change to redo</div>');
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0; i < this._data.future.length; i++) {
|
for (var i = 0; i < this._data.future.length; i++) {
|
||||||
|
@ -149,7 +149,7 @@ MenuBar.prototype._deactivateMenu = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
MenuBar.prototype._doExportTripleloader = function() {
|
MenuBar.prototype._doExportTripleloader = function() {
|
||||||
if (theProject.protograph == null) {
|
if (!theProject.protograph) {
|
||||||
alert(
|
alert(
|
||||||
"You haven't done any schema alignment yet,\nso there is no triple to export.\n\n" +
|
"You haven't done any schema alignment yet,\nso there is no triple to export.\n\n" +
|
||||||
"Use the Schemas > Edit Schema Alignment Skeleton...\ncommand to align your data with Freebase schemas first."
|
"Use the Schemas > Edit Schema Alignment Skeleton...\ncommand to align your data with Freebase schemas first."
|
||||||
|
@ -100,7 +100,7 @@ ProcessWidget.prototype._render = function(newData) {
|
|||||||
|
|
||||||
this._div.empty();
|
this._div.empty();
|
||||||
|
|
||||||
if (newData.processes.length == 0) {
|
if (!newData.processes.length) {
|
||||||
this._div.hide();
|
this._div.hide();
|
||||||
} else {
|
} else {
|
||||||
this._div.show();
|
this._div.show();
|
||||||
@ -154,7 +154,7 @@ ProcessWidget.prototype._render = function(newData) {
|
|||||||
}
|
}
|
||||||
this._data = newData;
|
this._data = newData;
|
||||||
|
|
||||||
if (this._data.processes.length > 0 && this._timerID == null) {
|
if (this._data.processes.length && !this._timerID) {
|
||||||
this._timerID = window.setTimeout(function() {
|
this._timerID = window.setTimeout(function() {
|
||||||
self._timerID = null;
|
self._timerID = null;
|
||||||
self.update();
|
self.update();
|
||||||
|
@ -420,7 +420,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ((!("columnName" in self._node) || self._node.columnName == null) && columnIndex == 0) {
|
if ((!("columnName" in self._node) || !self._node.columnName) && columnIndex == 0) {
|
||||||
radio.attr("checked", "true");
|
radio.attr("checked", "true");
|
||||||
} else if (column.name == self._node.columnName) {
|
} else if (column.name == self._node.columnName) {
|
||||||
radio.attr("checked", "true");
|
radio.attr("checked", "true");
|
||||||
@ -597,7 +597,7 @@ SchemaAlignmentDialog.UINode.prototype._showNodeConfigDialog = function() {
|
|||||||
};
|
};
|
||||||
} else if (node.nodeType == "value") {
|
} else if (node.nodeType == "value") {
|
||||||
node.value = $.trim(elmts.valueNodeTypeValueInput[0].value);
|
node.value = $.trim(elmts.valueNodeTypeValueInput[0].value);
|
||||||
if (node.value.length == 0) {
|
if (!node.value.length) {
|
||||||
alert("Please specify the value to use.");
|
alert("Please specify the value to use.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -635,7 +635,7 @@ SchemaAlignmentDialog.UINode.prototype.getJSON = function() {
|
|||||||
var getLinks = false;
|
var getLinks = false;
|
||||||
|
|
||||||
if (this._node.nodeType.match(/^cell-as-/)) {
|
if (this._node.nodeType.match(/^cell-as-/)) {
|
||||||
if (!("columnName" in this._node) || this._node.columnName == null) {
|
if (!("columnName" in this._node) || !this._node.columnName) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,7 +655,7 @@ SchemaAlignmentDialog.UINode.prototype.getJSON = function() {
|
|||||||
lang: "lang" in this._node ? this._node.lang : "/lang/en"
|
lang: "lang" in this._node ? this._node.lang : "/lang/en"
|
||||||
};
|
};
|
||||||
} else if (this._node.nodeType == "cell-as-key") {
|
} else if (this._node.nodeType == "cell-as-key") {
|
||||||
if (!("namespace" in this._node) || this._node.namespace == null) {
|
if (!("namespace" in this._node) || !this._node.namespace) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
result = {
|
result = {
|
||||||
@ -665,7 +665,7 @@ SchemaAlignmentDialog.UINode.prototype.getJSON = function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else if (this._node.nodeType == "topic") {
|
} else if (this._node.nodeType == "topic") {
|
||||||
if (!("topic" in this._node) || this._node.topic == null) {
|
if (!("topic" in this._node) || !this._node.topic) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
result = {
|
result = {
|
||||||
@ -674,7 +674,7 @@ SchemaAlignmentDialog.UINode.prototype.getJSON = function() {
|
|||||||
};
|
};
|
||||||
getLinks = true;
|
getLinks = true;
|
||||||
} else if (this._node.nodeType == "value") {
|
} else if (this._node.nodeType == "value") {
|
||||||
if (!("value" in this._node) || this._node.value == null) {
|
if (!("value" in this._node) || !this._node.value) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
result = {
|
result = {
|
||||||
@ -684,7 +684,7 @@ SchemaAlignmentDialog.UINode.prototype.getJSON = function() {
|
|||||||
lang: "lang" in this._node ? this._node.lang : "/lang/en"
|
lang: "lang" in this._node ? this._node.lang : "/lang/en"
|
||||||
};
|
};
|
||||||
} else if (this._node.nodeType == "anonymous") {
|
} else if (this._node.nodeType == "anonymous") {
|
||||||
if (!("type" in this._node) || this._node.type == null) {
|
if (!("type" in this._node) || !this._node.type) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
result = {
|
result = {
|
||||||
@ -694,7 +694,7 @@ SchemaAlignmentDialog.UINode.prototype.getJSON = function() {
|
|||||||
getLinks = true;
|
getLinks = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if (!result) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (getLinks) {
|
if (getLinks) {
|
||||||
|
@ -129,7 +129,7 @@ function SchemaAlignmentDialog(protograph, onDone) {
|
|||||||
this._originalProtograph = protograph || { rootNodes: [] };
|
this._originalProtograph = protograph || { rootNodes: [] };
|
||||||
this._protograph = cloneDeep(this._originalProtograph); // this is what can be munched on
|
this._protograph = cloneDeep(this._originalProtograph); // this is what can be munched on
|
||||||
|
|
||||||
if (this._protograph.rootNodes.length == 0) {
|
if (!this._protograph.rootNodes.length) {
|
||||||
this._protograph.rootNodes.push(SchemaAlignment.createNewRootNode());
|
this._protograph.rootNodes.push(SchemaAlignment.createNewRootNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ MenuSystem = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
MenuSystem.showMenu = function(elmt, onDismiss) {
|
MenuSystem.showMenu = function(elmt, onDismiss) {
|
||||||
if (MenuSystem._overlay == null) {
|
if (!MenuSystem._overlay) {
|
||||||
MenuSystem._overlay = $('<div> </div>')
|
MenuSystem._overlay = $('<div> </div>')
|
||||||
.addClass("menu-overlay")
|
.addClass("menu-overlay")
|
||||||
.appendTo(document.body)
|
.appendTo(document.body)
|
||||||
|
@ -26,11 +26,11 @@ DataTableCellUI.prototype._render = function() {
|
|||||||
.mouseenter(function() { editLink.css("visibility", "visible"); })
|
.mouseenter(function() { editLink.css("visibility", "visible"); })
|
||||||
.mouseleave(function() { editLink.css("visibility", "hidden"); });
|
.mouseleave(function() { editLink.css("visibility", "hidden"); });
|
||||||
|
|
||||||
if (cell == null || ("v" in cell && cell.v == null)) {
|
if (!cell || ("v" in cell && cell.v == null)) {
|
||||||
$('<span>').html(" ").appendTo(divContent);
|
$('<span>').html(" ").appendTo(divContent);
|
||||||
} else if ("e" in cell) {
|
} else if ("e" in cell) {
|
||||||
$('<span>').addClass("data-table-error").text(cell.e).appendTo(divContent);
|
$('<span>').addClass("data-table-error").text(cell.e).appendTo(divContent);
|
||||||
} else if (!("r" in cell) || cell.r == null) {
|
} else if (!("r" in cell) || !cell.r) {
|
||||||
$('<span>').text(cell.v).appendTo(divContent);
|
$('<span>').text(cell.v).appendTo(divContent);
|
||||||
} else {
|
} else {
|
||||||
var r = cell.r;
|
var r = cell.r;
|
||||||
@ -315,7 +315,7 @@ DataTableCellUI.prototype._previewCandidateTopic = function(id, elmt) {
|
|||||||
DataTableCellUI.prototype._startEdit = function(elmt) {
|
DataTableCellUI.prototype._startEdit = function(elmt) {
|
||||||
self = this;
|
self = this;
|
||||||
|
|
||||||
var originalContent = this._cell == null || ("v" in this._cell && this._cell.v == null) ? "" : this._cell.v;
|
var originalContent = !this._cell || ("v" in this._cell && this._cell.v == null) ? "" : this._cell.v;
|
||||||
|
|
||||||
var menu = MenuSystem.createMenu().addClass("data-table-cell-editor").width("400px");
|
var menu = MenuSystem.createMenu().addClass("data-table-cell-editor").width("400px");
|
||||||
menu.html(
|
menu.html(
|
||||||
@ -374,7 +374,7 @@ DataTableCellUI.prototype._startEdit = function(elmt) {
|
|||||||
value = ("true" == text);
|
value = ("true" == text);
|
||||||
} else if (type == "date") {
|
} else if (type == "date") {
|
||||||
value = Date.parse(text);
|
value = Date.parse(text);
|
||||||
if (value == null) {
|
if (!value) {
|
||||||
alert("Not a valid date.");
|
alert("Not a valid date.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -667,7 +667,7 @@ DataTableColumnHeaderUI.prototype._doReconcile = function() {
|
|||||||
data.types = data.types.slice(0, 20);
|
data.types = data.types.slice(0, 20);
|
||||||
|
|
||||||
var ids = $.map(data.types, function(elmt) { return elmt.id; });
|
var ids = $.map(data.types, function(elmt) { return elmt.id; });
|
||||||
if (ids.length == 0) {
|
if (!ids.length) {
|
||||||
dismissBusy();
|
dismissBusy();
|
||||||
new ReconDialog(self._column, []);
|
new ReconDialog(self._column, []);
|
||||||
} else {
|
} else {
|
||||||
@ -824,7 +824,7 @@ DataTableColumnHeaderUI.prototype._doAddColumn = function(initialExpression) {
|
|||||||
|
|
||||||
footerElmts.okButton.click(function() {
|
footerElmts.okButton.click(function() {
|
||||||
var columnName = $.trim(bodyElmts.columnNameInput[0].value);
|
var columnName = $.trim(bodyElmts.columnNameInput[0].value);
|
||||||
if (columnName.length == 0) {
|
if (!columnName.length) {
|
||||||
alert("You must enter a column name.");
|
alert("You must enter a column name.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user