more jslint cleanups
git-svn-id: http://google-refine.googlecode.com/svn/trunk@434 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
cc2209074b
commit
4a139842d4
@ -14,11 +14,13 @@ function ReconDialog(column, types) {
|
||||
delete defaultTypes[this.id];
|
||||
});
|
||||
for (var id in defaultTypes) {
|
||||
if (defaultTypes.hasOwnProperty(id)) {
|
||||
this._types.push({
|
||||
id: id,
|
||||
name: defaultTypes[id].name
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this._createDialog();
|
||||
}
|
||||
|
@ -131,9 +131,9 @@ ListFacet.prototype.render = function() {
|
||||
$('<div>').text(this._data.error).addClass("facet-body-message").appendTo(bodyDiv);
|
||||
bodyDiv.appendTo(container);
|
||||
} else {
|
||||
var selectionCount = this._selection.length
|
||||
+ (this._blankChoice !== null && this._blankChoice.s ? 1 : 0)
|
||||
+ (this._errorChoice !== null && this._errorChoice.s ? 1 : 0);
|
||||
var selectionCount = this._selection.length +
|
||||
(this._blankChoice !== null && this._blankChoice.s ? 1 : 0) +
|
||||
(this._errorChoice !== null && this._errorChoice.s ? 1 : 0);
|
||||
|
||||
if (selectionCount > 0) {
|
||||
var reset = function() {
|
||||
|
@ -1,23 +1,3 @@
|
||||
function onLoad() {
|
||||
$.getJSON(
|
||||
"/command/get-all-project-metadata",
|
||||
null,
|
||||
function(data) {
|
||||
renderProjects(data);
|
||||
$("#upload-file-button").click(onClickUploadFileButton);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
if (isThereNewRelease()) {
|
||||
$('<div id="version-message">' +
|
||||
'New version "' + GridworksReleases.releases[0].description + '" <a href="' + GridworksReleases.homepage + '">available for download here</a>.' +
|
||||
'</div>').appendTo(document.body);
|
||||
}
|
||||
}
|
||||
|
||||
$(onLoad);
|
||||
|
||||
function onClickUploadFileButton(evt) {
|
||||
var projectName = $("#project-name-input")[0].value;
|
||||
if (! $.trim(projectName).length) {
|
||||
@ -35,6 +15,36 @@ function onClickUploadFileButton(evt) {
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(d) {
|
||||
var yesterday = Date.today().add({ days: -1 });
|
||||
var today = Date.today();
|
||||
var tomorrow = Date.today().add({ days: 1 });
|
||||
if (d.between(today, tomorrow)) {
|
||||
return "Today " + d.toString("h:mm tt");
|
||||
} else if (d.between(yesterday, today)) {
|
||||
return "Yesterday " + d.toString("h:mm tt");
|
||||
} else {
|
||||
return d.toString("ddd, MMM d, yyyy");
|
||||
}
|
||||
}
|
||||
|
||||
function isThereNewRelease() {
|
||||
var thisRevision = GridworksVersion.revision;
|
||||
|
||||
var revision_pattern = /r([0-9]+)/;
|
||||
|
||||
if (!revision_pattern.test(thisRevision)) { // probably "trunk"
|
||||
return false;
|
||||
}
|
||||
|
||||
var latestRevision = GridworksReleases.releases[0].revision;
|
||||
|
||||
var thisRev = parseInt(revision_pattern.exec(thisRevision)[1],10);
|
||||
var latestRev = parseInt(revision_pattern.exec(GridworksReleases.releases[0].revision)[1],10);
|
||||
|
||||
return latestRev > thisRev;
|
||||
}
|
||||
|
||||
function renderProjects(data) {
|
||||
var projects = [];
|
||||
for (var n in data.projects) {
|
||||
@ -97,32 +107,22 @@ function renderProjects(data) {
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(d) {
|
||||
var yesterday = Date.today().add({ days: -1 });
|
||||
var today = Date.today();
|
||||
var tomorrow = Date.today().add({ days: 1 });
|
||||
if (d.between(today, tomorrow)) {
|
||||
return "Today " + d.toString("h:mm tt");
|
||||
} else if (d.between(yesterday, today)) {
|
||||
return "Yesterday " + d.toString("h:mm tt");
|
||||
} else {
|
||||
return d.toString("ddd, MMM d, yyyy");
|
||||
function onLoad() {
|
||||
$.getJSON(
|
||||
"/command/get-all-project-metadata",
|
||||
null,
|
||||
function(data) {
|
||||
renderProjects(data);
|
||||
$("#upload-file-button").click(onClickUploadFileButton);
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
||||
if (isThereNewRelease()) {
|
||||
$('<div id="version-message">' +
|
||||
'New version "' + GridworksReleases.releases[0].description + '" <a href="' + GridworksReleases.homepage + '">available for download here</a>.' +
|
||||
'</div>').appendTo(document.body);
|
||||
}
|
||||
}
|
||||
|
||||
function isThereNewRelease() {
|
||||
var thisRevision = GridworksVersion.revision;
|
||||
|
||||
var revision_pattern = /r([0-9]+)/;
|
||||
|
||||
if (!revision_pattern.test(thisRevision)) { // probably "trunk"
|
||||
return false;
|
||||
}
|
||||
|
||||
var latestRevision = GridworksReleases.releases[0].revision;
|
||||
|
||||
var thisRev = parseInt(revision_pattern.exec(thisRevision)[1],10);
|
||||
var latestRev = parseInt(revision_pattern.exec(GridworksReleases.releases[0].revision)[1],10);
|
||||
|
||||
return latestRev > thisRev;
|
||||
}
|
||||
$(onLoad);
|
||||
|
@ -10,65 +10,6 @@ Gridworks.reportException = function(e) {
|
||||
}
|
||||
};
|
||||
|
||||
function onLoad() {
|
||||
var params = URL.getParameters();
|
||||
if ("project" in params) {
|
||||
theProject = {
|
||||
id: parseInt(params.project,10)
|
||||
};
|
||||
|
||||
var uiState = {};
|
||||
if ("ui" in params) {
|
||||
try {
|
||||
uiState = JSON.parse(params.ui);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
Gridworks.reinitializeProjectData(function() {
|
||||
initializeUI(uiState);
|
||||
});
|
||||
}
|
||||
}
|
||||
$(onLoad);
|
||||
|
||||
function initializeUI(uiState) {
|
||||
document.title = theProject.metadata.name + " - Gridworks";
|
||||
|
||||
var path = $("#path");
|
||||
|
||||
$('<span class="app-path-section">' +
|
||||
'<a href="#">' + theProject.metadata.name + '</a> project' +
|
||||
'</span>').appendTo(path);
|
||||
|
||||
$('<a href="javascript:{}">current view</a>')
|
||||
.mouseenter(function() {
|
||||
this.href = Gridworks.getPermanentLink();
|
||||
})
|
||||
.appendTo($('<span class="app-path-section"></span>').appendTo(path));
|
||||
|
||||
var body = $("#body").empty().html(
|
||||
'<div bind="viewPanel" class="view-panel"></div>' +
|
||||
'<div bind="facetPanel" class="facet-panel"></div>' +
|
||||
'<div bind="historyPanel" class="history-panel"></div>' +
|
||||
'<div bind="processPanel" class="process-panel"></div>' +
|
||||
'<div class="menu-bar-container" bind="menuBarContainer"><div bind="menuBarPanel" class="menu-bar"></div></div>'
|
||||
);
|
||||
ui = DOM.bind(body);
|
||||
|
||||
ui.menuBarContainer.css("top", $("#header").outerHeight() + "px");
|
||||
ui.menuBar = new MenuBar(ui.menuBarPanel); // construct the menu first so we can resize everything else
|
||||
|
||||
resize();
|
||||
|
||||
ui.browsingEngine = new BrowsingEngine(ui.facetPanel, uiState.facets || []);
|
||||
ui.processWidget = new ProcessWidget(ui.processPanel);
|
||||
ui.historyWidget = new HistoryWidget(ui.historyPanel);
|
||||
ui.dataTableView = new DataTableView(ui.viewPanel);
|
||||
|
||||
$(window).bind("resize", resizeAll);
|
||||
}
|
||||
|
||||
function resize() {
|
||||
var header = $("#header");
|
||||
var footer = $("#footer");
|
||||
@ -108,6 +49,43 @@ function resizeAll() {
|
||||
ui.dataTableView.resize();
|
||||
}
|
||||
|
||||
function initializeUI(uiState) {
|
||||
document.title = theProject.metadata.name + " - Gridworks";
|
||||
|
||||
var path = $("#path");
|
||||
|
||||
$('<span class="app-path-section">' +
|
||||
'<a href="#">' + theProject.metadata.name + '</a> project' +
|
||||
'</span>').appendTo(path);
|
||||
|
||||
$('<a href="javascript:{}">current view</a>')
|
||||
.mouseenter(function() {
|
||||
this.href = Gridworks.getPermanentLink();
|
||||
})
|
||||
.appendTo($('<span class="app-path-section"></span>').appendTo(path));
|
||||
|
||||
var body = $("#body").empty().html(
|
||||
'<div bind="viewPanel" class="view-panel"></div>' +
|
||||
'<div bind="facetPanel" class="facet-panel"></div>' +
|
||||
'<div bind="historyPanel" class="history-panel"></div>' +
|
||||
'<div bind="processPanel" class="process-panel"></div>' +
|
||||
'<div class="menu-bar-container" bind="menuBarContainer"><div bind="menuBarPanel" class="menu-bar"></div></div>'
|
||||
);
|
||||
ui = DOM.bind(body);
|
||||
|
||||
ui.menuBarContainer.css("top", $("#header").outerHeight() + "px");
|
||||
ui.menuBar = new MenuBar(ui.menuBarPanel); // construct the menu first so we can resize everything else
|
||||
|
||||
resize();
|
||||
|
||||
ui.browsingEngine = new BrowsingEngine(ui.facetPanel, uiState.facets || []);
|
||||
ui.processWidget = new ProcessWidget(ui.processPanel);
|
||||
ui.historyWidget = new HistoryWidget(ui.historyPanel);
|
||||
ui.dataTableView = new DataTableView(ui.viewPanel);
|
||||
|
||||
$(window).bind("resize", resizeAll);
|
||||
}
|
||||
|
||||
Gridworks.reinitializeProjectData = function(f) {
|
||||
Ajax.chainGetJSON(
|
||||
"/command/get-project-metadata?" + $.param({ project: theProject.id }), null,
|
||||
@ -306,3 +284,30 @@ Gridworks.getPermanentLink = function() {
|
||||
];
|
||||
return "project.html?" + params.join("&");
|
||||
};
|
||||
|
||||
/*
|
||||
* Loader
|
||||
*/
|
||||
|
||||
function onLoad() {
|
||||
var params = URL.getParameters();
|
||||
if ("project" in params) {
|
||||
theProject = {
|
||||
id: parseInt(params.project,10)
|
||||
};
|
||||
|
||||
var uiState = {};
|
||||
if ("ui" in params) {
|
||||
try {
|
||||
uiState = JSON.parse(params.ui);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
Gridworks.reinitializeProjectData(function() {
|
||||
initializeUI(uiState);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(onLoad);
|
||||
|
@ -219,8 +219,10 @@ HistoryWidget.prototype._showApplyOperationsDialog = function() {
|
||||
var elmts = DOM.bind(html);
|
||||
|
||||
$('<button></button>').text("Apply").click(function() {
|
||||
var json;
|
||||
|
||||
try {
|
||||
var json = JSON.parse(elmts.textarea[0].value);
|
||||
json = JSON.parse(elmts.textarea[0].value);
|
||||
} catch (e) {
|
||||
alert("The JSON you pasted is invalid.");
|
||||
return;
|
||||
|
@ -275,8 +275,10 @@ SchemaAlignmentDialog.UILink.prototype._showPropertySuggestPopup = function(elmt
|
||||
self._configureTarget();
|
||||
};
|
||||
|
||||
var divSearch;
|
||||
|
||||
if (suggestions.length > 0) {
|
||||
var divSearch = $('<div>').addClass("schema-alignment-link-menu-type-search2").html('<div>Search for a property or pick one below</div>').appendTo(menu);
|
||||
divSearch = $('<div>').addClass("schema-alignment-link-menu-type-search2").html('<div>Search for a property or pick one below</div>').appendTo(menu);
|
||||
|
||||
function createSuggestion(suggestion) {
|
||||
var menuItem = MenuSystem.createMenuItem().appendTo(menu);
|
||||
@ -289,7 +291,7 @@ SchemaAlignmentDialog.UILink.prototype._showPropertySuggestPopup = function(elmt
|
||||
createSuggestion(suggestions[i]);
|
||||
}
|
||||
} else {
|
||||
var divSearch = $('<div>').addClass("schema-alignment-link-menu-type-search").html('<div>Search for a property</div>').appendTo(menu);
|
||||
divSearch = $('<div>').addClass("schema-alignment-link-menu-type-search").html('<div>Search for a property</div>').appendTo(menu);
|
||||
}
|
||||
var input = $('<input />').appendTo($('<div>').appendTo(divSearch));
|
||||
|
||||
|
@ -131,6 +131,7 @@ DataTableView.prototype._renderDataTable = function(table) {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var renderColumnGroups = function(groups, keys) {
|
||||
var nextLayer = [];
|
||||
|
||||
@ -143,8 +144,8 @@ DataTableView.prototype._renderDataTable = function(table) {
|
||||
var foundGroup = false;
|
||||
|
||||
for (var g = 0; g < groups.length; g++) {
|
||||
var columnGroup = groups[g];
|
||||
if (columnGroup.startColumnIndex == c) {
|
||||
var cg = groups[g];
|
||||
if (cg.startColumnIndex == c) {
|
||||
foundGroup = true;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user