fixing a bunch of jslint issues
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2303 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
fffd24d64b
commit
b413833ca1
@ -436,7 +436,7 @@
|
||||
/>
|
||||
<jslint>
|
||||
<formatter type="plain" destfile="${reports.dir}/jslint.txt" />
|
||||
<fileset dir="${webapp.dir}/scripts">
|
||||
<fileset dir="${webapp.dir}/modules/core/scripts">
|
||||
<include name="**/*.js" />
|
||||
</fileset>
|
||||
</jslint>
|
||||
|
@ -45,7 +45,7 @@ function CustomTabularExporterDialog(options) {
|
||||
|
||||
this._columnOptionMap = {};
|
||||
this._createDialog(options);
|
||||
};
|
||||
}
|
||||
|
||||
CustomTabularExporterDialog.formats = {
|
||||
'csv': {
|
||||
@ -77,7 +77,7 @@ CustomTabularExporterDialog.prototype._createDialog = function(options) {
|
||||
this._elmts = DOM.bind(this._dialog);
|
||||
this._level = DialogSystem.showDialog(this._dialog);
|
||||
|
||||
if (CustomTabularExporterDialog.uploadTargets.length == 0) {
|
||||
if (CustomTabularExporterDialog.uploadTargets.length === 0) {
|
||||
this._elmts.uploadTabHeader.remove();
|
||||
this._elmts.uploadTabBody.remove();
|
||||
}
|
||||
@ -208,7 +208,7 @@ CustomTabularExporterDialog.prototype._configureUIFromOptionCode = function(opti
|
||||
this._elmts.outputColumnHeadersCheckbox.attr('checked', (options.outputColumnHeaders) ? 'checked' : '');
|
||||
this._elmts.outputBlankRowsCheckbox.attr('checked', (options.outputBlankRows) ? 'checked' : '');
|
||||
|
||||
if (options.columns != null) {
|
||||
if (options.columns !== null) {
|
||||
var self = this;
|
||||
this._elmts.columnList.find('.custom-tabular-exporter-dialog-column input[type="checkbox"]').attr('checked', '');
|
||||
$.each(options.columns, function() {
|
||||
@ -371,7 +371,7 @@ CustomTabularExporterDialog.prototype._getOptionCode = function() {
|
||||
};
|
||||
|
||||
CustomTabularExporterDialog.prototype._upload = function() {
|
||||
var id = this._dialog.find('input[name="custom-tabular-exporter-upload-format"]:checked').val()
|
||||
var id = this._dialog.find('input[name="custom-tabular-exporter-upload-format"]:checked').val();
|
||||
for (var i = 0; i < CustomTabularExporterDialog.uploadTargets.length; i++) {
|
||||
var target = CustomTabularExporterDialog.uploadTargets[i];
|
||||
if (id == target.id) {
|
||||
|
@ -373,7 +373,8 @@ ExpressionPreviewDialog.Widget.prototype._renderStarredExpressions = function(da
|
||||
var entry = data.expressions[i];
|
||||
renderEntry(entry);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ExpressionPreviewDialog.Widget.prototype._scheduleUpdate = function() {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
|
@ -63,7 +63,7 @@ TemplatingExporterDialog.prototype._getSavedTemplate = function(f) {
|
||||
"/command/core/get-preference?" + $.param({ project: theProject.id, name: "exporters.templating.template" }),
|
||||
null,
|
||||
function(data) {
|
||||
if (data.value != null) {
|
||||
if (data.value !== null) {
|
||||
f(JSON.parse(data.value));
|
||||
} else {
|
||||
f(null);
|
||||
@ -147,7 +147,7 @@ TemplatingExporterDialog.prototype._export = function() {
|
||||
.attr("name", name)
|
||||
.attr("value", value)
|
||||
.appendTo(form);
|
||||
}
|
||||
};
|
||||
|
||||
appendField("engine", JSON.stringify(ui.browsingEngine.getJSON()));
|
||||
appendField("project", theProject.id);
|
||||
|
@ -491,7 +491,7 @@ ListFacet.prototype._getMetaExpression = function() {
|
||||
JSON.stringify(this._config.expression),
|
||||
JSON.stringify(this._config.columnName)
|
||||
].join(', ') + ')';
|
||||
}
|
||||
};
|
||||
|
||||
ListFacet.prototype._doEdit = function() {
|
||||
new ClusteringDialog(this._config.columnName, this._config.expression);
|
||||
@ -697,7 +697,7 @@ ListFacet.prototype._setChoiceCountLimit = function(choiceCount) {
|
||||
var limit = Math.ceil(choiceCount / 1000) * 1000;
|
||||
var s = window.prompt('Set the maximum number of choices shown in each text facet (too many will slow down the application)', limit);
|
||||
if (s) {
|
||||
var n = parseInt(s);
|
||||
var n = parseInt(s,10);
|
||||
|
||||
if (!isNaN(n)) {
|
||||
var self = this;
|
||||
|
@ -274,7 +274,7 @@ TimeRangeFacet.prototype.steps = [
|
||||
1000*31556952, // year (average Gregorian year)
|
||||
1000*31556952*10, // decade
|
||||
1000*31556952*100, // century
|
||||
1000*31556952*1000, // millennium
|
||||
1000*31556952*1000 // millennium
|
||||
];
|
||||
|
||||
TimeRangeFacet.prototype._setRangeIndicators = function() {
|
||||
|
@ -45,7 +45,7 @@ Refine.selectActionArea = function(id) {
|
||||
var actionArea = Refine.actionAreas[i];
|
||||
if (id == actionArea.id) {
|
||||
actionArea.tabElmt.addClass('selected');
|
||||
actionArea.bodyElmt.css('visibility', 'visible').css('z-index', '55');;
|
||||
actionArea.bodyElmt.css('visibility', 'visible').css('z-index', '55');
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -86,10 +86,10 @@ $(function() {
|
||||
if ("releases" in window) {
|
||||
if (isThereNewRelease()) {
|
||||
var container = $('<div id="notification-container">')
|
||||
.appendTo(document.body)
|
||||
.appendTo(document.body);
|
||||
var notification = $('<div id="notification">')
|
||||
.text('New version! ')
|
||||
.appendTo(container)
|
||||
.appendTo(container);
|
||||
$('<a>')
|
||||
.addClass('notification-action')
|
||||
.attr("href", releases.homepage)
|
||||
|
@ -248,7 +248,9 @@ Refine.CreateProjectUI.prototype.showImportJobError = function(message, stack) {
|
||||
|
||||
Refine.CreateProjectUI.composeErrorMessage = function(job) {
|
||||
var messages = [];
|
||||
$.each(job.config.errors, function() { messages.push(this.message) });
|
||||
$.each(job.config.errors, function() {
|
||||
messages.push(this.message);
|
||||
});
|
||||
return messages.join('\n');
|
||||
};
|
||||
|
||||
|
@ -256,7 +256,7 @@ Refine.DefaultImportingController.prototype.getPreviewData = function(callback,
|
||||
Refine.DefaultImportingController.prototype._createProject = function() {
|
||||
if ((this._formatParserUI) && this._formatParserUI.confirmReadyToCreateProject()) {
|
||||
var projectName = $.trim(this._parsingPanelElmts.projectNameInput[0].value);
|
||||
if (projectName.length == 0) {
|
||||
if (projectName.length === 0) {
|
||||
window.alert("Please name the project.");
|
||||
this._parsingPanelElmts.projectNameInput.focus();
|
||||
return;
|
||||
|
@ -121,7 +121,7 @@ Refine.DefaultImportingController.prototype._renderFileSelectionPanelFileTable =
|
||||
var renderFile = function(fileRecord, index) {
|
||||
var id = "import-file-selection-" + Math.round(Math.random() * 1000000);
|
||||
var tr = fileTable.insertRow(fileTable.rows.length);
|
||||
$(tr).addClass(index % 2 == 0 ? 'even' : 'odd');
|
||||
$(tr).addClass((index % 2 === 0) ? 'even' : 'odd');
|
||||
|
||||
var createLabeledCell = function(className) {
|
||||
var td = $('<td>').appendTo(tr);
|
||||
@ -308,7 +308,7 @@ Refine.DefaultImportingController.prototype._updateFileSelectionSummary = functi
|
||||
};
|
||||
|
||||
Refine.DefaultImportingController.prototype._commitFileSelection = function() {
|
||||
if (this._job.config.fileSelection.length == 0) {
|
||||
if (this._job.config.fileSelection.length === 0) {
|
||||
alert("Please select at least one file.");
|
||||
return;
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ Refine.OpenProjectUI = function(elmt) {
|
||||
this._elmts = DOM.bind(elmt);
|
||||
|
||||
$("#project-file-input").change(function() {
|
||||
if ($("#project-name-input")[0].value.length == 0) {
|
||||
if ($("#project-name-input")[0].value.length === 0) {
|
||||
var fileName = this.files[0].fileName;
|
||||
if (fileName) {
|
||||
$("#project-name-input")[0].value = fileName.replace(/\.\w+/, "").replace(/[_-]/g, " ");
|
||||
$("#project-name-input")[0].value = fileName.replace(/\.\w+/, "").replace(/[_\-]/g, " ");
|
||||
}
|
||||
$("#project-name-input").focus().select();
|
||||
}
|
||||
@ -54,7 +54,7 @@ Refine.OpenProjectUI = function(elmt) {
|
||||
});
|
||||
|
||||
$("#upload-file-button").click(function(evt) {
|
||||
return self._onClickUploadFileButton(evt)
|
||||
return self._onClickUploadFileButton(evt);
|
||||
});
|
||||
|
||||
$('#projects-workspace-open').click(function() {
|
||||
@ -83,7 +83,7 @@ Refine.OpenProjectUI.prototype.resize = function() {
|
||||
|
||||
this._elmts.workspaceControls
|
||||
.css("bottom", "0px")
|
||||
.css("width", (width - DOM.getHPaddings(this._elmts.workspaceControls)) + "px")
|
||||
.css("width", (width - DOM.getHPaddings(this._elmts.workspaceControls)) + "px");
|
||||
};
|
||||
|
||||
Refine.OpenProjectUI.prototype._fetchProjects = function() {
|
||||
@ -163,12 +163,12 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
|
||||
.css("visibility", "hidden")
|
||||
.click(function() {
|
||||
var name = window.prompt("New project name:", project.name);
|
||||
if (name == null) {
|
||||
if (name === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = $.trim(name);
|
||||
if (project.name == name || name.length == 0) {
|
||||
if (project.name == name || name.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ Refine.OpenProjectUI.prototype._renderProjects = function(data) {
|
||||
if (data && typeof data.code != 'undefined' && data.code == "ok") {
|
||||
nameLink.text(name);
|
||||
} else {
|
||||
alert("Failed to rename project: " + data.message)
|
||||
alert("Failed to rename project: " + data.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -47,10 +47,10 @@ Refine.ExcelParserUI = function(controller, jobID, job, format, config,
|
||||
this._initialize();
|
||||
this._updatePreview();
|
||||
};
|
||||
Refine.DefaultImportingController.parserUIs["ExcelParserUI"] = Refine.ExcelParserUI;
|
||||
Refine.DefaultImportingController.parserUIs.ExcelParserUI = Refine.ExcelParserUI;
|
||||
|
||||
Refine.ExcelParserUI.prototype.dispose = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
@ -68,7 +68,7 @@ Refine.ExcelParserUI.prototype.getOptions = function() {
|
||||
|
||||
var parseIntDefault = function(s, def) {
|
||||
try {
|
||||
var n = parseInt(s);
|
||||
var n = parseInt(s,10);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
@ -80,7 +80,7 @@ Refine.ExcelParserUI.prototype.getOptions = function() {
|
||||
|
||||
this._optionContainerElmts.sheetRecordContainer.find('input').each(function() {
|
||||
if (this.checked) {
|
||||
options.sheets.push(parseInt(this.getAttribute('index')));
|
||||
options.sheets.push(parseInt(this.getAttribute('index'),10));
|
||||
}
|
||||
});
|
||||
|
||||
@ -178,7 +178,7 @@ Refine.ExcelParserUI.prototype._initialize = function() {
|
||||
};
|
||||
|
||||
Refine.ExcelParserUI.prototype._scheduleUpdatePreview = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ Refine.FixedWidthParserUI = function(controller, jobID, job, format, config,
|
||||
this._initialize();
|
||||
this.updatePreview();
|
||||
};
|
||||
Refine.DefaultImportingController.parserUIs["FixedWidthParserUI"] = Refine.FixedWidthParserUI;
|
||||
Refine.DefaultImportingController.parserUIs.FixedWidthParserUI = Refine.FixedWidthParserUI;
|
||||
|
||||
Refine.FixedWidthParserUI.prototype.dispose = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
@ -72,18 +72,15 @@ Refine.FixedWidthParserUI.prototype.getOptions = function() {
|
||||
options.columnNames = columnNames;
|
||||
}
|
||||
|
||||
switch (this._optionContainer.find("input[name='row-separator']:checked")[0].value) {
|
||||
case 'new-line':
|
||||
if (this._optionContainer.find("input[name='row-separator']:checked")[0].value === "new-line") {
|
||||
options.lineSeparator = "\n";
|
||||
break;
|
||||
default:
|
||||
options.lineSeparator = String.decodeSeparator(
|
||||
this._optionContainerElmts.rowSeparatorInput[0].value);
|
||||
} else {
|
||||
options.lineSeparator = String.decodeSeparator(this._optionContainerElmts.rowSeparatorInput[0].value);
|
||||
}
|
||||
|
||||
var parseIntDefault = function(s, def) {
|
||||
try {
|
||||
var n = parseInt(s);
|
||||
var n = parseInt(s,10);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
@ -191,7 +188,7 @@ Refine.FixedWidthParserUI.prototype._getColumnWidths = function() {
|
||||
var newColumnWidths = [];
|
||||
var a = $.trim(this._optionContainerElmts.columnWidthsInput[0].value).replace(/,\s+/g, ',').split(',');
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
var n = parseInt(a[i]);
|
||||
var n = parseInt(a[i],10);
|
||||
if (!isNaN(n)) {
|
||||
newColumnWidths.push(n);
|
||||
}
|
||||
@ -200,7 +197,7 @@ Refine.FixedWidthParserUI.prototype._getColumnWidths = function() {
|
||||
};
|
||||
|
||||
Refine.FixedWidthParserUI.prototype._scheduleUpdatePreview = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
@ -266,7 +263,7 @@ Refine.FixedWidthPreviewTable.prototype._render = function() {
|
||||
var addCell = function(tr) {
|
||||
var index = tr.cells.length;
|
||||
var td = tr.insertCell(index);
|
||||
td.className = (index % 2 == 0) ? 'even' : 'odd';
|
||||
td.className = (index % 2 === 0) ? 'even' : 'odd';
|
||||
return td;
|
||||
};
|
||||
|
||||
@ -373,7 +370,7 @@ Refine.FixedWidthPreviewTable.prototype._render = function() {
|
||||
var newColumnWidths = [];
|
||||
for (var i = 0; i < columnCharIndexes.length; i++) {
|
||||
var charIndex = columnCharIndexes[i];
|
||||
var columnWidth = (i == 0) ? charIndex : (charIndex - columnCharIndexes[i - 1]);
|
||||
var columnWidth = (i === 0) ? charIndex : (charIndex - columnCharIndexes[i - 1]);
|
||||
if (columnWidth > 0) {
|
||||
newColumnWidths.push(columnWidth);
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ Refine.JsonParserUI = function(controller, jobID, job, format, config,
|
||||
this._initialize();
|
||||
this._showPickRecordNodesUI();
|
||||
};
|
||||
Refine.DefaultImportingController.parserUIs["JsonParserUI"] = Refine.JsonParserUI;
|
||||
Refine.DefaultImportingController.parserUIs.JsonParserUI = Refine.JsonParserUI;
|
||||
|
||||
Refine.JsonParserUI.prototype.dispose = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
@ -72,7 +72,7 @@ Refine.JsonParserUI.prototype.getOptions = function() {
|
||||
|
||||
var parseIntDefault = function(s, def) {
|
||||
try {
|
||||
var n = parseInt(s);
|
||||
var n = parseInt(s,10);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
@ -162,7 +162,7 @@ Refine.JsonParserUI.prototype._showPickRecordNodesUI = function() {
|
||||
|
||||
var elementNode = null;
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
if (elementNode != null) {
|
||||
if (elementNode !== null) {
|
||||
$('<span>').addClass('punctuation').text(',').appendTo(elementNode);
|
||||
}
|
||||
elementNode = $('<div>').addClass('node').addClass('indented').appendTo(container);
|
||||
@ -178,7 +178,7 @@ Refine.JsonParserUI.prototype._showPickRecordNodesUI = function() {
|
||||
var elementNode = null;
|
||||
for (var key in o) {
|
||||
if (o.hasOwnProperty(key)) {
|
||||
if (elementNode != null) {
|
||||
if (elementNode !== null) {
|
||||
$('<span>').addClass('punctuation').text(',').appendTo(elementNode);
|
||||
}
|
||||
elementNode = $('<div>').addClass('node').addClass('indented').appendTo(container);
|
||||
@ -197,7 +197,7 @@ Refine.JsonParserUI.prototype._showPickRecordNodesUI = function() {
|
||||
registerEvents(container, parentPath);
|
||||
};
|
||||
var renderNode = function(node, container, parentPath) {
|
||||
if (node == null) {
|
||||
if (node === null) {
|
||||
$('<span>').addClass('literal').text('null').appendTo(container);
|
||||
} else {
|
||||
if ($.isPlainObject(node)) {
|
||||
@ -214,7 +214,7 @@ Refine.JsonParserUI.prototype._showPickRecordNodesUI = function() {
|
||||
};
|
||||
|
||||
Refine.JsonParserUI.prototype._scheduleUpdatePreview = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ Refine.LineBasedParserUI = function(controller, jobID, job, format, config,
|
||||
this._initialize();
|
||||
this._updatePreview();
|
||||
};
|
||||
Refine.DefaultImportingController.parserUIs["LineBasedParserUI"] = Refine.LineBasedParserUI;
|
||||
Refine.DefaultImportingController.parserUIs.LineBasedParserUI = Refine.LineBasedParserUI;
|
||||
|
||||
Refine.LineBasedParserUI.prototype.confirmReadyToCreateProject = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
Refine.LineBasedParserUI.prototype.dispose = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
@ -69,7 +69,7 @@ Refine.LineBasedParserUI.prototype.getOptions = function() {
|
||||
|
||||
var parseIntDefault = function(s, def) {
|
||||
try {
|
||||
var n = parseInt(s);
|
||||
var n = parseInt(s,10);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
@ -80,13 +80,10 @@ Refine.LineBasedParserUI.prototype.getOptions = function() {
|
||||
};
|
||||
options.linesPerRow = parseIntDefault(this._optionContainerElmts.linesPerRowInput[0].value, 1);
|
||||
|
||||
switch (this._optionContainer.find("input[name='row-separator']:checked")[0].value) {
|
||||
case 'new-line':
|
||||
if (this._optionContainer.find("input[name='row-separator']:checked")[0].value === "new-line") {
|
||||
options.lineSeparator = "\n";
|
||||
break;
|
||||
default:
|
||||
options.lineSeparator = String.decodeSeparator(
|
||||
this._optionContainerElmts.rowSeparatorInput[0].value);
|
||||
} else {
|
||||
options.lineSeparator = String.decodeSeparator(this._optionContainerElmts.rowSeparatorInput[0].value);
|
||||
}
|
||||
|
||||
if (this._optionContainerElmts.ignoreCheckbox[0].checked) {
|
||||
@ -166,7 +163,7 @@ Refine.LineBasedParserUI.prototype._initialize = function() {
|
||||
};
|
||||
|
||||
Refine.LineBasedParserUI.prototype._scheduleUpdatePreview = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ Refine.RdfTriplesParserUI = function(controller, jobID, job, format, config,
|
||||
this._initialize();
|
||||
this._updatePreview();
|
||||
};
|
||||
Refine.DefaultImportingController.parserUIs["RdfTriplesParserUI"] = Refine.RdfTriplesParserUI;
|
||||
Refine.DefaultImportingController.parserUIs.RdfTriplesParserUI = Refine.RdfTriplesParserUI;
|
||||
|
||||
Refine.RdfTriplesParserUI.prototype.confirmReadyToCreateProject = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
Refine.RdfTriplesParserUI.prototype.dispose = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
@ -92,7 +92,7 @@ Refine.RdfTriplesParserUI.prototype._initialize = function() {
|
||||
};
|
||||
|
||||
Refine.RdfTriplesParserUI.prototype._scheduleUpdatePreview = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ Refine.SeparatorBasedParserUI = function(controller, jobID, job, format, config,
|
||||
this._initialize();
|
||||
this._updatePreview();
|
||||
};
|
||||
Refine.DefaultImportingController.parserUIs["SeparatorBasedParserUI"] = Refine.SeparatorBasedParserUI;
|
||||
Refine.DefaultImportingController.parserUIs.SeparatorBasedParserUI = Refine.SeparatorBasedParserUI;
|
||||
|
||||
Refine.SeparatorBasedParserUI.prototype.dispose = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
@ -65,14 +65,12 @@ Refine.SeparatorBasedParserUI.prototype.getOptions = function() {
|
||||
encoding: $.trim(this._optionContainerElmts.encodingInput[0].value)
|
||||
};
|
||||
|
||||
switch (this._optionContainer.find("input[name='row-separator']:checked")[0].value) {
|
||||
case 'new-line':
|
||||
if (this._optionContainer.find("input[name='row-separator']:checked")[0].value === "new-line") {
|
||||
options.lineSeparator = "\n";
|
||||
break;
|
||||
default:
|
||||
options.lineSeparator = String.decodeSeparator(
|
||||
this._optionContainerElmts.rowSeparatorInput[0].value);
|
||||
} else {
|
||||
options.lineSeparator = String.decodeSeparator(this._optionContainerElmts.rowSeparatorInput[0].value);
|
||||
}
|
||||
|
||||
switch (this._optionContainer.find("input[name='column-separator']:checked")[0].value) {
|
||||
case 'comma':
|
||||
options.separator = ",";
|
||||
@ -87,7 +85,7 @@ Refine.SeparatorBasedParserUI.prototype.getOptions = function() {
|
||||
|
||||
var parseIntDefault = function(s, def) {
|
||||
try {
|
||||
var n = parseInt(s);
|
||||
var n = parseInt(s,10);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
@ -198,7 +196,7 @@ Refine.SeparatorBasedParserUI.prototype._initialize = function() {
|
||||
};
|
||||
|
||||
Refine.SeparatorBasedParserUI.prototype._scheduleUpdatePreview = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ Refine.XmlParserUI = function(controller, jobID, job, format, config,
|
||||
this._initialize();
|
||||
this._showPickRecordElementsUI();
|
||||
};
|
||||
Refine.DefaultImportingController.parserUIs["XmlParserUI"] = Refine.XmlParserUI;
|
||||
Refine.DefaultImportingController.parserUIs.XmlParserUI = Refine.XmlParserUI;
|
||||
|
||||
Refine.XmlParserUI.prototype.dispose = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
@ -71,7 +71,7 @@ Refine.XmlParserUI.prototype.getOptions = function() {
|
||||
};
|
||||
var parseIntDefault = function(s, def) {
|
||||
try {
|
||||
var n = parseInt(s);
|
||||
var n = parseInt(s,10);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
@ -210,7 +210,7 @@ Refine.XmlParserUI.prototype._showPickRecordElementsUI = function() {
|
||||
};
|
||||
|
||||
Refine.XmlParserUI.prototype._scheduleUpdatePreview = function() {
|
||||
if (this._timerID != null) {
|
||||
if (this._timerID !== null) {
|
||||
window.clearTimeout(this._timerID);
|
||||
this._timerID = null;
|
||||
}
|
||||
|
@ -33,63 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
var preferenceUIs = [];
|
||||
|
||||
function onLoad() {
|
||||
$.post(
|
||||
"/command/core/get-all-preferences",
|
||||
null,
|
||||
populatePreferences,
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
$(onLoad);
|
||||
|
||||
function populatePreferences(prefs) {
|
||||
var body = $("#body-info").empty();
|
||||
|
||||
$('<h1>').text("Preferences").appendTo(body);
|
||||
|
||||
var table = $('<table>')
|
||||
.addClass("list-table")
|
||||
.addClass("preferences")
|
||||
.html('<tr><th>Key</th><th>Value</th><th></th></tr>')
|
||||
.appendTo(body)[0];
|
||||
|
||||
for (var k in prefs) {
|
||||
var tr = table.insertRow(table.rows.length);
|
||||
preferenceUIs.push(new PreferenceUI(tr, k, prefs[k]));
|
||||
}
|
||||
|
||||
var trLast = table.insertRow(table.rows.length);
|
||||
var tdLast0 = trLast.insertCell(0);
|
||||
trLast.insertCell(1);
|
||||
trLast.insertCell(2);
|
||||
$('<button class="button">').text("Add Preference").appendTo(tdLast0).click(function() {
|
||||
var key = window.prompt("Preference key:");
|
||||
if (key) {
|
||||
var value = window.prompt("Preference key value:");
|
||||
if (value != null) {
|
||||
var tr = table.insertRow(table.rows.length - 1);
|
||||
preferenceUIs.push(new PreferenceUI(tr, key, value));
|
||||
|
||||
$.post(
|
||||
"/command/core/set-preference",
|
||||
{
|
||||
name : key,
|
||||
value : JSON.stringify(value)
|
||||
},
|
||||
function(o) {
|
||||
if (o.code == "error") {
|
||||
alert(o.message);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function PreferenceUI(tr, key, value) {
|
||||
var self = this;
|
||||
|
||||
@ -97,13 +40,13 @@ function PreferenceUI(tr, key, value) {
|
||||
$(td0).text(key);
|
||||
|
||||
var td1 = tr.insertCell(1);
|
||||
$(td1).text(value != null ? value : "");
|
||||
$(td1).text((value !== null) ? value : "");
|
||||
|
||||
var td2 = tr.insertCell(2);
|
||||
|
||||
$('<button class="button">').text("Edit").appendTo(td2).click(function() {
|
||||
var newValue = window.prompt("Change value of preference key " + key, value);
|
||||
if (newValue != null) {
|
||||
if (newValue !== null) {
|
||||
$(td1).text(newValue);
|
||||
$.post(
|
||||
"/command/core/set-preference",
|
||||
@ -147,3 +90,60 @@ function PreferenceUI(tr, key, value) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function populatePreferences(prefs) {
|
||||
var body = $("#body-info").empty();
|
||||
|
||||
$('<h1>').text("Preferences").appendTo(body);
|
||||
|
||||
var table = $('<table>')
|
||||
.addClass("list-table")
|
||||
.addClass("preferences")
|
||||
.html('<tr><th>Key</th><th>Value</th><th></th></tr>')
|
||||
.appendTo(body)[0];
|
||||
|
||||
for (var k in prefs) {
|
||||
var tr = table.insertRow(table.rows.length);
|
||||
preferenceUIs.push(new PreferenceUI(tr, k, prefs[k]));
|
||||
}
|
||||
|
||||
var trLast = table.insertRow(table.rows.length);
|
||||
var tdLast0 = trLast.insertCell(0);
|
||||
trLast.insertCell(1);
|
||||
trLast.insertCell(2);
|
||||
$('<button class="button">').text("Add Preference").appendTo(tdLast0).click(function() {
|
||||
var key = window.prompt("Preference key:");
|
||||
if (key) {
|
||||
var value = window.prompt("Preference key value:");
|
||||
if (value !== null) {
|
||||
var tr = table.insertRow(table.rows.length - 1);
|
||||
preferenceUIs.push(new PreferenceUI(tr, key, value));
|
||||
|
||||
$.post(
|
||||
"/command/core/set-preference",
|
||||
{
|
||||
name : key,
|
||||
value : JSON.stringify(value)
|
||||
},
|
||||
function(o) {
|
||||
if (o.code == "error") {
|
||||
alert(o.message);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
$.post(
|
||||
"/command/core/get-all-preferences",
|
||||
null,
|
||||
populatePreferences,
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
$(onLoad);
|
||||
|
@ -173,12 +173,12 @@ Refine.reinitializeProjectData = function(f) {
|
||||
|
||||
Refine._renameProject = function() {
|
||||
var name = window.prompt("New project name:", theProject.metadata.name);
|
||||
if (name == null) {
|
||||
if (name === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = $.trim(name);
|
||||
if (theProject.metadata.name == name || name.length == 0) {
|
||||
if (theProject.metadata.name == name || name.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ Refine.fetchRows = function(start, limit, onDone, sorting) {
|
||||
engine: JSON.stringify(ui.browsingEngine.getJSON())
|
||||
};
|
||||
if (sorting) {
|
||||
body.sorting = JSON.stringify(sorting)
|
||||
body.sorting = JSON.stringify(sorting);
|
||||
}
|
||||
|
||||
$.post(
|
||||
|
@ -227,7 +227,7 @@ BrowsingEngine.prototype.removeFacet = function(facet) {
|
||||
|
||||
if (update) {
|
||||
Refine.update({ engineChanged: true });
|
||||
} else if (this._facets.length == 0) {
|
||||
} else if (this._facets.length === 0) {
|
||||
this._elmts.help.show();
|
||||
this._elmts.header.hide();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ ExtensionBar.MenuItems = [
|
||||
|
||||
ExtensionBar.addExtensionMenu = function(what) {
|
||||
MenuSystem.appendTo(ExtensionBar.MenuItems, [], what);
|
||||
}
|
||||
};
|
||||
|
||||
ExtensionBar.appendTo = function(path, what) {
|
||||
MenuSystem.appendTo(ExtensionBar.MenuItems, path, what);
|
||||
|
@ -133,7 +133,7 @@ HistoryPanel.prototype._render = function() {
|
||||
|
||||
elmts.filterInput.keyup(function() {
|
||||
var filter = $.trim(this.value.toLowerCase());
|
||||
if (filter.length == 0) {
|
||||
if (filter.length === 0) {
|
||||
elmts.bodyDiv.find(".history-entry").removeClass("filtered-out");
|
||||
} else {
|
||||
elmts.bodyDiv.find(".history-entry").each(function() {
|
||||
|
@ -138,7 +138,7 @@ ProcessPanel.prototype._render = function(newData) {
|
||||
this._div.fadeOut(200);
|
||||
} else {
|
||||
this._div.fadeIn(200);
|
||||
var cancelmessage = "Cancel"
|
||||
var cancelmessage = "Cancel";
|
||||
var noticeDiv = $('<div id="notification"></div>').appendTo(this._div);
|
||||
var descriptionSpan = $('<span></span>').appendTo(noticeDiv);
|
||||
var statusDiv = $('<div></div>').appendTo(noticeDiv);
|
||||
|
@ -56,7 +56,7 @@ ReconStandardServicePanel.prototype._guessTypes = function(f) {
|
||||
|
||||
if (self._types.length === 0 && "defaultTypes" in self._service) {
|
||||
var defaultTypes = {};
|
||||
$.each(self._service["defaultTypes"], function() {
|
||||
$.each(self._service.defaultTypes, function() {
|
||||
defaultTypes[this.id] = this.name;
|
||||
});
|
||||
$.each(self._types, function() {
|
||||
|
@ -114,7 +114,7 @@ DOM.loadHTML = function(module, path) {
|
||||
success: function(html) {
|
||||
DOM._loadedHTML[fullPath] = html;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
return DOM._loadedHTML[fullPath];
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ Encoding.selectEncoding = function(input, onDone) {
|
||||
var generateEncodingList = function(container, filter) {
|
||||
var table = $('<table>').html('<tr><th>Encoding</th><th>Aliases</th></tr>').appendTo(container)[0];
|
||||
$.each(Refine.encodings, function() {
|
||||
if (filter == null || this.code in filter) {
|
||||
if (filter === null || this.code in filter) {
|
||||
renderEncoding(table, this);
|
||||
}
|
||||
});
|
||||
|
@ -81,4 +81,4 @@ function formatRelativeDate(d) {
|
||||
var diff = Math.floor(today.getYear() - d.getYear());
|
||||
return (diff == 1) ? "a year ago" : diff + " years ago";
|
||||
}
|
||||
};
|
||||
}
|
@ -95,8 +95,7 @@ URL.looksLikeUrl = function(s) {
|
||||
if (sep >= URL.minSchemeLength) {
|
||||
var scheme = s.substring(0, sep).toLowerCase();
|
||||
if (scheme in URL.schemes) {
|
||||
return URL.schemes[scheme] == 0 ||
|
||||
s.substring(sep + 1, sep + 3) == "//";
|
||||
return (URL.schemes[scheme] === 0) || (s.substring(sep + 1, sep + 3) == "//");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,12 +124,12 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
|
||||
},
|
||||
{},
|
||||
(
|
||||
this._dataTableView._getSortingCriterionForColumn(this._column.name) == null ?
|
||||
this._dataTableView._getSortingCriterionForColumn(this._column.name) === null ?
|
||||
{
|
||||
id: "core/sort",
|
||||
"label": "Sort...",
|
||||
"click": function() {
|
||||
self._showSortingCriterion(null, self._dataTableView._getSortingCriteriaCount() > 0)
|
||||
self._showSortingCriterion(null, self._dataTableView._getSortingCriteriaCount() > 0);
|
||||
}
|
||||
} :
|
||||
{
|
||||
@ -204,18 +204,18 @@ DataTableColumnHeaderUI.prototype.createSortingMenu = function() {
|
||||
var self = this;
|
||||
var criterion = this._dataTableView._getSortingCriterionForColumn(this._column.name);
|
||||
var criteriaCount = this._dataTableView._getSortingCriteriaCount();
|
||||
var hasOtherCriteria = criterion == null ? (criteriaCount > 0) : criteriaCount > 1;
|
||||
var hasOtherCriteria = (criterion === null) ? (criteriaCount > 0) : criteriaCount > 1;
|
||||
|
||||
var items = [
|
||||
{
|
||||
"label": "Sort...",
|
||||
"click": function() {
|
||||
self._showSortingCriterion(criterion, hasOtherCriteria)
|
||||
self._showSortingCriterion(criterion, hasOtherCriteria);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
if (criterion != null) {
|
||||
if (criterion !== null) {
|
||||
items.push({
|
||||
"label": "Reverse",
|
||||
"click": function() {
|
||||
|
@ -426,13 +426,13 @@ DataTableView.prototype._renderDataTables = function(table, headerTable) {
|
||||
DataTableView.prototype._adjustDataTables = function() {
|
||||
var dataTable = this._div.find('.data-table');
|
||||
var headerTable = this._div.find('.data-header-table');
|
||||
if (dataTable.length == 0 || headerTable.length == 0) {
|
||||
if (dataTable.length === 0 || headerTable.length === 0) {
|
||||
return;
|
||||
}
|
||||
dataTable = dataTable[0];
|
||||
headerTable = headerTable[0];
|
||||
|
||||
if (dataTable.rows.length == 0) {
|
||||
if (dataTable.rows.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -726,14 +726,14 @@ DataTableView.prototype._createSortingMenu = function(elmt) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
var createSubmenu = function(criterion) {
|
||||
var columnHeaderUI = getColumnHeaderUI(criterion.column);
|
||||
if (columnHeaderUI != null) {
|
||||
if (columnHeaderUI !== null) {
|
||||
items.push({
|
||||
"label" : "By " + criterion.column,
|
||||
"submenu" : columnHeaderUI.createSortingMenu()
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
for (var i = 0; i < this._sorting.criteria.length; i++) {
|
||||
|
@ -306,9 +306,9 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
|
||||
var doTransposeRowsIntoColumns = function() {
|
||||
var rowCount = window.prompt("How many rows to transpose?", "2");
|
||||
if (rowCount != null) {
|
||||
if (rowCount !== null) {
|
||||
try {
|
||||
rowCount = parseInt(rowCount);
|
||||
rowCount = parseInt(rowCount,10);
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
|
@ -213,13 +213,13 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
var s = "[" + elmts.lengthsTextarea[0].value + "]";
|
||||
try {
|
||||
var a = JSON.parse(s);
|
||||
} catch (e) {
|
||||
alert("The given field lengths are not properly formatted.");
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
alert("No field length is specified.");
|
||||
@ -227,6 +227,11 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
}
|
||||
|
||||
config.fieldLengths = JSON.stringify(lengths);
|
||||
|
||||
} catch (e) {
|
||||
alert("The given field lengths are not properly formatted.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Refine.postCoreProcess(
|
||||
|
@ -52,7 +52,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
null,
|
||||
{ cellsChanged: true, columnStatsChanged: true }
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
var doReconMatchBestCandidates = function() {
|
||||
Refine.postCoreProcess(
|
||||
@ -161,9 +161,9 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
}
|
||||
});
|
||||
|
||||
if (config.toColumnName.length == 0) {
|
||||
if (config.toColumnName.length === 0) {
|
||||
alert("Please select some other column to copy to.");
|
||||
} else if (config.judgment.length == 0) {
|
||||
} else if (config.judgment.length === 0) {
|
||||
alert("Please select at least one kind of judgment to copy.");
|
||||
} else {
|
||||
Refine.postCoreProcess(
|
||||
|
Loading…
Reference in New Issue
Block a user