Fixed autosavelabel.

This commit is contained in:
Alexander Kastius
2016-09-01 11:47:49 +02:00
parent 5f61c24dc6
commit 7903447a31

View File

@ -35,7 +35,7 @@ var CodeOceanEditor = {
lastCopyText: null, lastCopyText: null,
autosaveTimer: null, autosaveTimer: null,
autosaveLabel: $("#autosave-label span"), autosaveLabel: "#autosave-label span",
ENTER_KEY_CODE: 13, ENTER_KEY_CODE: 13,
@ -100,7 +100,8 @@ var CodeOceanEditor = {
showOutput: function(event) { showOutput: function(event) {
event.preventDefault(); event.preventDefault();
this.showTab(1); this.showTab(0);
this.showOutputBar();
$('#output').scrollTo($(this).attr('href')); $('#output').scrollTo($(this).attr('href'));
}, },
@ -144,10 +145,8 @@ var CodeOceanEditor = {
handleKeyPress: function (event) { handleKeyPress: function (event) {
if (event.which === this.ALT_1_KEY_CODE) { if (event.which === this.ALT_1_KEY_CODE) {
this.showWorkspaceTab(event); this.showWorkspaceTab(event);
} else if (event.which === this.ALT_2_KEY_CODE) {
this.showTab(1);
} else if (event.which === this.ALT_3_KEY_CODE) { } else if (event.which === this.ALT_3_KEY_CODE) {
this.showTab(2); this.showTab(1);
} else if (event.which === this.ALT_R_KEY_CODE) { } else if (event.which === this.ALT_R_KEY_CODE) {
$('#run').trigger('click'); $('#run').trigger('click');
} else if (event.which === this.ALT_S_KEY_CODE) { } else if (event.which === this.ALT_S_KEY_CODE) {
@ -190,9 +189,10 @@ var CodeOceanEditor = {
autosave: function () { autosave: function () {
var date = new Date(); var date = new Date();
this.autosaveLabel.parent().css("visibility", "visible"); var autosaveLabel = $(this.autosaveLabel);
this.autosaveLabel.text(date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds()); autosaveLabel.parent().css("visibility", "visible");
this.autosaveLabel.text(date.toLocaleTimeString()); autosaveLabel.text(date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds());
autosaveLabel.text(date.toLocaleTimeString());
this.autosaveTimer = null; this.autosaveTimer = null;
this.createSubmission($('#autosave'), null); this.createSubmission($('#autosave'), null);
}, },
@ -270,16 +270,37 @@ var CodeOceanEditor = {
var frame = $('[data-file-id="' + active_file.id + '"]').parent(); var frame = $('[data-file-id="' + active_file.id + '"]').parent();
this.showFrame(frame); this.showFrame(frame);
this.toggleButtonStates(); this.toggleButtonStates();
}); }.bind(this));
}, },
initializeFileTreeButtons: function () { initializeFileTreeButtons: function () {
$('#create-file').on('click', this.showFileDialog.bind(this)); $('#create-file').on('click', this.showFileDialog.bind(this));
$('#create-file-collapsed').on('click', this.showFileDialog.bind(this));
$('#destroy-file').on('click', this.confirmDestroy.bind(this)); $('#destroy-file').on('click', this.confirmDestroy.bind(this));
$('#destroy-file-collapsed').on('click', this.confirmDestroy.bind(this));
$('#download').on('click', this.downloadCode.bind(this)); $('#download').on('click', this.downloadCode.bind(this));
$('#download-collapsed').on('click', this.downloadCode.bind(this));
$('#request-for-comments').on('click', this.requestComments.bind(this)); $('#request-for-comments').on('click', this.requestComments.bind(this));
}, },
initializeSideBarCollapse: function() {
$('#sidebar-collapsed').addClass('hidden');
$('#sidebar-collapse-collapsed').on('click',this.handleSideBarToggle.bind(this));
$('#sidebar-collapse').on('click',this.handleSideBarToggle.bind(this))
},
handleSideBarToggle: function() {
$('#sidebar').toggleClass('sidebar-col').toggleClass('sidebar-col-collapsed');/**
$('#frames').toggleClass('editor-col')
if (main_area.hasClass('col-sm-10')) {
main_area.removeClass('col-sm-10').addClass('col-sm-11');
} else if (main_area.hasClass('col-sm-11')) {
main_area.removeClass('col-sm-11').addClass('col-sm-10');
}*/
$('#sidebar-collapsed').toggleClass('hidden');
$('#sidebar-uncollapsed').toggleClass('hidden');
},
initializeRegexes: function () { initializeRegexes: function () {
this.regex_for_language.set("ace/mode/python", /File "(.+?)", line (\d+)/g); this.regex_for_language.set("ace/mode/python", /File "(.+?)", line (\d+)/g);
this.regex_for_language.set("ace/mode/java", /(.*\.java):(\d+):/g); this.regex_for_language.set("ace/mode/java", /(.*\.java):(\d+):/g);
@ -454,7 +475,8 @@ var CodeOceanEditor = {
this.clearOutput(); this.clearOutput();
$('#hint').fadeOut(); $('#hint').fadeOut();
$('#flowrHint').fadeOut(); $('#flowrHint').fadeOut();
this.showTab(1); this.showTab(0);
this.showOutputBar();
}, },
isActiveFileBinary: function () { isActiveFileBinary: function () {
@ -544,6 +566,26 @@ var CodeOceanEditor = {
}); });
}, },
initializeOutputBarToggle: function() {
$('#toggle-sidebar-output').on('click',this.hideOutputBar.bind(this));
$('#toggle-sidebar-output-collapsed').on('click',this.showOutputBar.bind(this));
},
showOutputBar: function() {
if ($('#sidebar').hasClass('sidebar-col')) {
this.handleSideBarToggle();
}
$('#output_sidebar_collapsed').addClass('hidden');
$('#output_sidebar_uncollapsed').removeClass('hidden');
$('#output_sidebar').removeClass('output-col-collapsed').addClass('output-col');
},
hideOutputBar: function() {
$('#output_sidebar_collapsed').removeClass('hidden');
$('#output_sidebar_uncollapsed').addClass('hidden');
$('#output_sidebar').removeClass('output-col').addClass('output-col-collapsed');
},
initializeEverything: function() { initializeEverything: function() {
this.initializeRegexes(); this.initializeRegexes();
this.initializeCodePilot(); this.initializeCodePilot();
@ -552,6 +594,8 @@ var CodeOceanEditor = {
this.initializeEditors(); this.initializeEditors();
this.initializeEventHandlers(); this.initializeEventHandlers();
this.initializeFileTree(); this.initializeFileTree();
this.initializeSideBarCollapse();
this.initializeOutputBarToggle();
this.initializeTooltips(); this.initializeTooltips();
this.initPrompt(); this.initPrompt();
this.renderScore(); this.renderScore();