From 3d9754f33e1c4a59753ad60eedd3dc4aed5231f3 Mon Sep 17 00:00:00 2001
From: Roky97
Date: Tue, 21 Jul 2020 12:03:39 +0200
Subject: [PATCH 01/34] Update Ace editor
---
resources/index.pug | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index 217bfa0..13dc36e 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -173,7 +173,7 @@
@@ -416,9 +416,9 @@
-
-
-
+
+
+
From e3de474ecf0156c797689df046afc4a4ea75668b Mon Sep 17 00:00:00 2001
From: Roky97
Date: Tue, 21 Jul 2020 12:42:46 +0200
Subject: [PATCH 02/34] Add shortcuts
---
resources/js/script.js | 57 +++++++++++++++++++++++++++++++-----------
1 file changed, 43 insertions(+), 14 deletions(-)
diff --git a/resources/js/script.js b/resources/js/script.js
index 58f542e..b8525e8 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -1572,40 +1572,69 @@ function setUpAce(ideditor, text) {
*/
function inizializeShortcuts() {
if (window.navigator.userAgent.indexOf("Mac") !== -1) {
- key('command + d', function () {
- downloadLoDIEProject();
- return false;
- });
+
key('command + enter', function () {
$('#run').trigger('click');
return false;
});
- key('command + u', function () {
+
+ key('command + s', function () {
+ downloadLoDIEProject();
+ return false;
+ });
+
+ key('command + o', function () {
$('#btn-upload').trigger('click');
return false;
});
+ key('command + shift + s', function () {
+ $('#btn-share').trigger('click');
+ return false;
+ });
+
+ key('command + shift + o', function () {
+ $('#btn-option').trigger('click');
+ return false;
+ });
+
$('[for="run"]').attr('data-original-title', '{ ⌘ + Enter }');
- $('#btn-upload').attr('data-original-title', '{ ⌘ + u }');
- $('[for="btn-download"]').attr('data-original-title', '{ ⌘ + d }');
+ $('#btn-upload').attr('data-original-title', '{ ⌘ + O }');
+ $('[for="btn-download"]').attr('data-original-title', '{ ⌘ + S}');
+ $('#btn-share').attr('data-original-title', '{ ⌘ + ⇧ + S}');
} else {
- key('control + d', function () {
- $('#btn-download').trigger('click');
+
+ key('ctrl + enter', function () {
+ $('#run').trigger('click');
return false;
});
- key('control + enter', function () {
- $('#run').trigger('click');
+
+ key('ctrl + s', function () {
+ downloadLoDIEProject();
return false;
});
- key('control + u', function () {
+
+ key('ctrl + o', function () {
$('#btn-upload').trigger('click');
return false;
});
+ key('ctrl + shift + s', function () {
+ $('#btn-share').trigger('click');
+ return false;
+ });
+
+ key('ctrl + shift + o', function () {
+ $('#btn-option').trigger('click');
+ return false;
+ });
+
$('[for="run"]').attr('data-original-title', '{ ctrl + Enter }');
- $('#btn-upload').attr('data-original-title', '{ ctrl + u }');
- $('[for="btn-download"]').attr('data-original-title', '{ ctrl + d }');
+ $('#btn-upload').attr('data-original-title', '{ ctrl + O }');
+ $('[for="btn-download"]').attr('data-original-title', '{ ctrl + S }');
+ $('#btn-share').attr('data-original-title', '{ ctrl + ⇧ + S}');
+
}
}
From 7b0fb4a1f35f03573bbe220d3da2abd6327cd43b Mon Sep 17 00:00:00 2001
From: Roky97
Date: Sat, 1 Aug 2020 10:09:08 +0200
Subject: [PATCH 03/34] add the shortcuts to the editor
---
resources/js/script.js | 66 +++++++++++++++++++++++++++++++++++-------
1 file changed, 55 insertions(+), 11 deletions(-)
diff --git a/resources/js/script.js b/resources/js/script.js
index b8525e8..409f10a 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -1547,6 +1547,46 @@ function setUpAce(ideditor, text) {
scrollPastEnd: 0.5
});
+ editors[ideditor].commands.addCommand(
+ {
+ name: 'save',
+ bindKey: {win: "ctrl-s", "mac": "cmd-s"},
+ exec: function(editor) {
+ downloadLoDIEProject();
+ }
+ }
+ );
+
+ editors[ideditor].commands.addCommand(
+ {
+ name: 'share',
+ bindKey: {win: "ctrl-shift-s", "mac": "cmd-shift-s"},
+ exec: function(editor) {
+ $('#btn-share').trigger('click');
+ }
+ }
+ );
+
+ editors[ideditor].commands.addCommand(
+ {
+ name: 'open',
+ bindKey: {win: "ctrl-o", "mac": "cmd-o"},
+ exec: function(editor) {
+ $('#btn-upload').trigger('click');
+ }
+ }
+ );
+
+ editors[ideditor].commands.addCommand(
+ {
+ name: 'run-options',
+ bindKey: {win: "ctrl-shift-o", "mac": "cmd-shift-o"},
+ exec: function(editor) {
+ $('#btn-option').trigger('click');
+ }
+ }
+ );
+
inizializeSnippets();
/**
@@ -1578,12 +1618,14 @@ function inizializeShortcuts() {
return false;
});
- key('command + s', function () {
+ key('command + s', function (e) {
+ e.preventDefault();
downloadLoDIEProject();
return false;
});
- key('command + o', function () {
+ key('command + o', function (e) {
+ e.preventDefault();
$('#btn-upload').trigger('click');
return false;
});
@@ -1610,12 +1652,14 @@ function inizializeShortcuts() {
return false;
});
- key('ctrl + s', function () {
+ key('ctrl + s', function (e) {
+ e.preventDefault();
downloadLoDIEProject();
return false;
});
- key('ctrl + o', function () {
+ key('ctrl + o', function (e) {
+ e.preventDefault();
$('#btn-upload').trigger('click');
return false;
});
@@ -1630,11 +1674,10 @@ function inizializeShortcuts() {
return false;
});
- $('[for="run"]').attr('data-original-title', '{ ctrl + Enter }');
- $('#btn-upload').attr('data-original-title', '{ ctrl + O }');
- $('[for="btn-download"]').attr('data-original-title', '{ ctrl + S }');
- $('#btn-share').attr('data-original-title', '{ ctrl + ⇧ + S}');
-
+ $('[for="run"]').attr('data-original-title', '{ CTRL + Enter }');
+ $('#btn-upload').attr('data-original-title', '{ CTRL + O }');
+ $('[for="btn-download"]').attr('data-original-title', '{ CTRL + S }');
+ $('#btn-share').attr('data-original-title', '{ CTRL + ⇧ + S}');
}
}
@@ -1922,7 +1965,7 @@ function inizializePopovers() {
$('.popover-header').last().html('');
$('.popover-body').last().html(
'\n' +
- '
Save the project to:\n
' +
+ '
Save the project to:\n ' +
'
\n' +
'
Local \n' +
// '
Cloud \n' +
@@ -1996,9 +2039,10 @@ function inizializePopovers() {
$('.popover-share').on('inserted.bs.popover', function () {
+ $('.popover-header').last().html('');
$('.popover-body').last().html('' +
'
\n' +
- '
Share the project:\n
' +
+ '
Share the project:\n ' +
'
From 301360b445064566d5bb09e0bf72da534d8a493b Mon Sep 17 00:00:00 2001
From: Roky97
Date: Sun, 2 Aug 2020 12:05:53 +0200
Subject: [PATCH 05/34] Add keyboard shortcut modal
---
resources/css/style.css | 4 ++
resources/index.pug | 66 +++++++++++++++++++++++++++++++--
resources/js/script.js | 81 +++++++++++++++--------------------------
3 files changed, 96 insertions(+), 55 deletions(-)
diff --git a/resources/css/style.css b/resources/css/style.css
index 510a70e..eea24c0 100644
--- a/resources/css/style.css
+++ b/resources/css/style.css
@@ -697,6 +697,10 @@ label[for="run-dot"] {
cursor: pointer;
}
+.keybox, .shortcut-title{
+ font-size: 16px;
+}
+
/*DARK-MODE SECTION*/
body.dark {
diff --git a/resources/index.pug b/resources/index.pug
index ca30f67..2dfe6d9 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -387,6 +387,66 @@
+
+
+
+
+
+
+
+ Open Project/Files
+
+
+
+
+
+
+
+
+ Share
+
+
+
Ctrl/Command
+
Shift
+
S
+
+
+
+
+
+ Open/Close Run Options
+
+
+
Ctrl/Command
+
Shift
+
O
+
+
+
+
+
+
+
+
+
//- Sets the languages
@@ -426,9 +486,9 @@
-
-
-
+
+
+
diff --git a/resources/js/script.js b/resources/js/script.js
index 409f10a..13e1fbb 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -1611,34 +1611,38 @@ function setUpAce(ideditor, text) {
* @description inizialize shortcuts and set title to the tooltips base on the OS
*/
function inizializeShortcuts() {
- if (window.navigator.userAgent.indexOf("Mac") !== -1) {
- key('command + enter', function () {
- $('#run').trigger('click');
- return false;
- });
-
- key('command + s', function (e) {
- e.preventDefault();
- downloadLoDIEProject();
- return false;
- });
-
- key('command + o', function (e) {
- e.preventDefault();
- $('#btn-upload').trigger('click');
- return false;
- });
+ Mousetrap.bind('mod+enter', function () {
+ $('#run').trigger('click');
+ return false;
+ });
+
+ Mousetrap.bind('mod+s', function () {
+ downloadLoDIEProject();
+ return false;
+ });
+
+ Mousetrap.bind('mod+o', function () {
+ $('#btn-upload').trigger('click');
+ return false;
+ });
- key('command + shift + s', function () {
- $('#btn-share').trigger('click');
- return false;
- });
+ Mousetrap.bind('mod+shift+s', function () {
+ $('#btn-share').trigger('click');
+ return false;
+ });
- key('command + shift + o', function () {
- $('#btn-option').trigger('click');
- return false;
- });
+ Mousetrap.bind('mod+shift+o', function () {
+ $('#btn-option').trigger('click');
+ return false;
+ });
+
+ Mousetrap.bind('?', function() {
+ console.log('questioooon');
+ $('#shortcut').modal('show');
+ });
+
+ if (window.navigator.userAgent.indexOf("Mac") !== -1) {
$('[for="run"]').attr('data-original-title', '{ ⌘ + Enter }');
$('#btn-upload').attr('data-original-title', '{ ⌘ + O }');
@@ -1646,33 +1650,6 @@ function inizializeShortcuts() {
$('#btn-share').attr('data-original-title', '{ ⌘ + ⇧ + S}');
} else {
-
- key('ctrl + enter', function () {
- $('#run').trigger('click');
- return false;
- });
-
- key('ctrl + s', function (e) {
- e.preventDefault();
- downloadLoDIEProject();
- return false;
- });
-
- key('ctrl + o', function (e) {
- e.preventDefault();
- $('#btn-upload').trigger('click');
- return false;
- });
-
- key('ctrl + shift + s', function () {
- $('#btn-share').trigger('click');
- return false;
- });
-
- key('ctrl + shift + o', function () {
- $('#btn-option').trigger('click');
- return false;
- });
$('[for="run"]').attr('data-original-title', '{ CTRL + Enter }');
$('#btn-upload').attr('data-original-title', '{ CTRL + O }');
From 0559ca436b80088f2785e1d6fec106f60e87ac5a Mon Sep 17 00:00:00 2001
From: Roky97
Date: Sun, 2 Aug 2020 12:08:22 +0200
Subject: [PATCH 06/34] Add icon on modals
---
resources/index.pug | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index 2dfe6d9..8989484 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -273,7 +273,7 @@
@@ -314,7 +314,7 @@
From 58e4d86ecfe5c9f63fd855d10c9a4e955ba2068d Mon Sep 17 00:00:00 2001
From: Roky97
Date: Mon, 3 Aug 2020 16:29:45 +0200
Subject: [PATCH 08/34] refactor About modal content
---
resources/index.pug | 44 +++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index 47d2cb9..4167e47 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -278,31 +278,28 @@
-
LoIDE is a web-based IDE for Logic Programming.
-
-
-
- It is part of an undergraduate student's work of thesis, and is still at the early stages of development.
-
-
- It currently supports only Answer Set Programming; we encourage any feedback, but we do NOT recommend it for production yet.
-
-
- Use of all solvers and systems is provided under the respective licenses; we refrain from taking any responsibility for any use that goes out of the scopes of such licenses.
-
-
LoIDE is an Open Source project available on
- Github
-
-
-
-
It's released under
- MIT License
-
+
+
+
+ Version:
+
+
+
+
- Version:
-
-
+ LoIDE is a web-based IDE for Logic Programming.
+
+
+
Checkout the LoIDE project website: demacs-unical.github.io/LoIDE/
+
LoIDE is an Open Source project available on Github
+
It's released under MIT License .
+
+
If you have any questions or suggestions, please write an e-mail to: loideABC @mat.unical.it
+
+
Use of all solvers and systems is provided under the respective licenses; we refrain from taking any responsibility for any use that goes out of the scopes of such licenses.
+
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
From f4ba349a125b1a826585978da4c3fe3bf76150d8 Mon Sep 17 00:00:00 2001
From: Roky97
Date: Mon, 3 Aug 2020 16:39:15 +0200
Subject: [PATCH 09/34] Change tooltip names
---
resources/index.pug | 4 ++--
resources/js/script.js | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index 4167e47..18b137e 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -224,7 +224,7 @@
-
+
@@ -250,7 +250,7 @@
Output
-
+
diff --git a/resources/js/script.js b/resources/js/script.js
index 13e1fbb..d49cda3 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -1386,7 +1386,7 @@ function isJosn(str) {
function createTextArea(layout) {
$("#setting-output").remove();
$(".output-container").remove();
- $(layout).append('');
+ $(layout).append('');
setLoideStyleMode();
$('#dwn-output').tooltip();
}
From 3fdc67d31c2e7d58e8811114b93b52c6518085cd Mon Sep 17 00:00:00 2001
From: Roky97
Date: Mon, 3 Aug 2020 20:13:55 +0200
Subject: [PATCH 10/34] run automatically option fix
---
resources/js/script.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/resources/js/script.js b/resources/js/script.js
index d49cda3..2dee433 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -1297,6 +1297,9 @@ function setJSONInput(config) {
if (config.hasOwnProperty('runAuto')) {
$("#run-dot").prop('checked', true);
}
+ else {
+ $("#run-dot").prop('checked', false);
+ }
$('#inputLanguage').val(config.language).change();
$('#inputengine').val(config.engine).change();
$('#inputExecutor').val(config.executor).change();
@@ -1897,7 +1900,7 @@ function resetEditorOptions() {
*/
function resetSolverOptions() {
loadLanguages();
- $("#run-dot").prop('checked', false);
+ $("#run-dot").prop('checked', true);
$('#solver-options').empty();
}
@@ -2815,6 +2818,9 @@ function loadProjectFromLocalStorage() {
if (obj.hasOwnProperty('runAuto')) {
$("#run-dot").prop('checked', true);
}
+ else {
+ $("#run-dot").prop('checked', false);
+ }
}
}
}
From 367a5509e963296a7d00e9e4b96ceb5d68a7322f Mon Sep 17 00:00:00 2001
From: Roky97
Date: Mon, 3 Aug 2020 20:50:47 +0200
Subject: [PATCH 11/34] add some title attribute to buttons
---
resources/index.pug | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index 18b137e..4ec97cc 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -79,7 +79,7 @@
-
+
Run!
@@ -95,13 +95,13 @@
-
+
Appearance
- About
+ About
@@ -148,13 +148,13 @@
Language
-
+
Solver
-
+
Executor
-
+
@@ -163,7 +163,7 @@
- Add option
+ Add option
@@ -173,7 +173,7 @@
@@ -183,7 +183,7 @@
Choose tab to execute
-
Current tab
+
Current tab
@@ -194,7 +194,7 @@
Reset all options
-
Reset
+
Reset
From 025c7777addc71d556611b9680870cdbd957a9c7 Mon Sep 17 00:00:00 2001
From: Roky97
Date: Thu, 6 Aug 2020 11:09:36 +0200
Subject: [PATCH 12/34] Fix style
---
resources/css/style.css | 2 +-
resources/index.pug | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/css/style.css b/resources/css/style.css
index eea24c0..245bb4b 100644
--- a/resources/css/style.css
+++ b/resources/css/style.css
@@ -778,7 +778,7 @@ body.dark .toast-header {
background-color: rgba(144, 144, 144, 0.85);
}
-body.dark .navbar-brand {
+body.dark .navbar-brand, body.dark .about-logo {
filter: invert(100%);
}
diff --git a/resources/index.pug b/resources/index.pug
index 4ec97cc..2f20722 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -279,7 +279,7 @@
-
+
Version:
From 24dbe749e5c4690bc781ae3dc4e29b90e8aeb386 Mon Sep 17 00:00:00 2001
From: Roky97
Date: Thu, 6 Aug 2020 11:19:30 +0200
Subject: [PATCH 13/34] Refactor code
---
app.js | 1 -
resources/js/script.js | 254 ++++++++++++++++++-----------------------
2 files changed, 114 insertions(+), 141 deletions(-)
diff --git a/app.js b/app.js
index 84e733c..26eaa0f 100644
--- a/app.js
+++ b/app.js
@@ -5,7 +5,6 @@ var http = require('http');
var forceSSL = require('express-force-ssl');
var webSocket = require('websocket').w3cwebsocket;
var fs = require('fs');
-var pug = require('pug');
var jpointer = require('json-pointer');
const compression = require('compression');
diff --git a/resources/js/script.js b/resources/js/script.js
index 2dee433..5689766 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -1,5 +1,4 @@
(function ($) {
-
/**
* @description Serialize form as json object
*/
@@ -127,16 +126,14 @@ const defaultDarkTheme = "ace/theme/idle_fingers";
/**
* set up ace editors into object
*/
-editors = {};
+var editors = {};
setUpAce(idEditor, "");
-var searchBoxOpened = false;
-
/**
* @global
* @description default screens sizes and activated status
*/
-var screen = {
+var display = {
small: { size: 576, isActive: false},
medium: { size: 768, isActive: false},
large: { size: 992, isActive: true}
@@ -189,11 +186,11 @@ $(window).resize(function () {
var outputPos = localStorage.getItem("outputPos");
outputPos = outputPos !== null ? outputPos : "east";
- if (window.innerWidth > screen.medium.size) {
+ if (window.innerWidth > display.medium.size) {
if (outputPos == "south") {
layout.removePane("south");
- currentValModel = $('#output-model').text();
- currentValError = $('#output-error').text();
+ let currentValModel = $('#output-model').text();
+ let currentValError = $('#output-error').text();
$(".ui-layout-south").empty();
layout.addPane("east");
createTextArea($('.ui-layout-east'));
@@ -207,8 +204,8 @@ $(window).resize(function () {
} else {
if (outputPos == "east") {
layout.removePane("east");
- currentValModel = $('#output-model').text();
- currentValError = $('#output-error').text();
+ let currentValModel = $('#output-model').text();
+ let currentValError = $('#output-error').text();
$(".ui-layout-east").empty();
layout.addPane("south");
createTextArea($('.ui-layout-south'));
@@ -224,8 +221,8 @@ $(window).resize(function () {
}
setHeightComponents();
var length = $(".nav-tabs").children().length;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].resize();
}
});
@@ -234,7 +231,7 @@ function setSizePanes(){
var outputPos = localStorage.getItem("outputPos");
outputPos = outputPos !== null ? outputPos : "east";
- if(screen.small.isActive){
+ if(display.small.isActive){
if(outputPos == "east"){
layout.sizePane("east", 100);
}
@@ -242,7 +239,7 @@ function setSizePanes(){
layout.sizePane("south", 200);
}
}
- else if(screen.medium.isActive){
+ else if(display.medium.isActive){
if(outputPos == "east"){
layout.sizePane("east", 200);
}
@@ -262,7 +259,7 @@ function setSizePanes(){
function saveOptions() {
$("#run-dot").attr("name", "runAuto");
- form = $('#input').serializeFormJSON();
+ var form = $('#input').serializeFormJSON();
form.tab = [];
$('.check-run-tab.checked').each(function (index, element) {
@@ -273,7 +270,7 @@ function saveOptions() {
delete form.tab;
}
- stringify = JSON.stringify(form);
+ var stringify = JSON.stringify(form);
if (!saveOption("solverOptions", stringify)) {
alert("Sorry, this options will not save in your browser");
}
@@ -306,8 +303,8 @@ $(document).ready(function () {
layout = $('body > .container > form > .layout').layout({
onresize_end: function () {
var length = $(".nav-tabs").children().length;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].resize();
}
},
@@ -421,7 +418,7 @@ $(document).ready(function () {
loadFromURL(); // load program from url
- if (screen.small.isActive) {
+ if (display.small.isActive) {
$('.left-panel').css('overflow-y', 'auto');
}
@@ -436,20 +433,20 @@ $(document).ready(function () {
});
function checkScreenType(){
- if($(window).width() < screen.medium.size){
- screen.small.isActive = true;
- screen.medium.isActive = false;
- screen.large.isActive = false;
+ if($(window).width() < display.medium.size){
+ display.small.isActive = true;
+ display.medium.isActive = false;
+ display.large.isActive = false;
}
- else if($(window).width() < screen.large.size){
- screen.small.isActive = false;
- screen.medium.isActive = true;
- screen.large.isActive = false;
+ else if($(window).width() < display.large.size){
+ display.small.isActive = false;
+ display.medium.isActive = true;
+ display.large.isActive = false;
}
else {
- screen.small.isActive = false;
- screen.medium.isActive = false;
- screen.large.isActive = true;
+ display.small.isActive = false;
+ display.medium.isActive = false;
+ display.large.isActive = true;
}
}
@@ -495,7 +492,7 @@ function inizializeAppareaceSettings(){
$('#font-output').val(defaultFontSize);
}
- actualTheme = localStorage.getItem("theme") == null ? "" : localStorage.getItem("theme");
+ var actualTheme = localStorage.getItem("theme") == null ? "" : localStorage.getItem("theme");
if( actualTheme.length == 0){
if (localStorage.getItem('mode') === 'dark')
setThemeEditors(defaultDarkTheme);
@@ -548,11 +545,11 @@ function checkEmptyTabSelected() {
*/
function callSocketServer(onlyActiveTab) {
$('.tab-pane').each(function (index, element) {
- var id = $(this).find('.ace').attr("id");
+ let id = $(this).find('.ace').attr("id");
editors[id].replaceAll("", { "needle": "'" });
});
if (onlyActiveTab || !addMorePrograms()) {
- var text = editors[idEditor].getValue();
+ let text = editors[idEditor].getValue();
$('#program').val(text); // insert the content of text editor in a hidden input text to serailize
}
var form = $('#input').serializeFormJSON();
@@ -571,7 +568,7 @@ function callSocketServer(onlyActiveTab) {
console.log(response.model); // debug string
$('#output-model').text(response.model); // append the response in the container
- var outputPos = localStorage.getItem("outputPos");
+ let outputPos = localStorage.getItem("outputPos");
outputPos = outputPos !== null ? outputPos : "east";
if(outputPos == "east"){
@@ -781,7 +778,7 @@ function inizializeTabContextmenu() {
$('#change-name-tab-textbox').focus();
var thisTab = $(this);
var idTabEditor = $(this).attr('data-target');
- idEditorToChangeTabName = $(idTabEditor).children().attr('id');
+ var idEditorToChangeTabName = $(idTabEditor).children().attr('id');
$('#change-name-tab').prop('disabled', true);
$('#change-name-tab-textbox').on('input', function () {
@@ -853,21 +850,21 @@ $(document).on('mouseup', '#output-model', function () {
var isPostChartCompliance = postChart.match(/[\(\s\,]/g);
var isSelectedWordCompliance = !selected.match(/[\s\(\)\,]/g);
if (isPreChartCompliance && isPostChartCompliance && isSelectedWordCompliance) {
- var regex = new RegExp('([\\s\\{\\,])(' + selected + ')([\\(\\,\\s])', 'g');
+ let regex = new RegExp('([\\s\\{\\,])(' + selected + ')([\\(\\,\\s])', 'g');
text = text.replace(regex, '$1$2 $3');
$("#output-model").empty();
$("#output-model").html(text);
- var randomColor = Math.floor(Math.random() * 16777215).toString(16);
+ let randomColor = Math.floor(Math.random() * 16777215).toString(16);
$("mark").css("color", "#" + randomColor);
}
});
$(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
- currentTab = e.target;
+ var currentTab = e.target;
if ($(this).hasClass('add-tab')) {
return;
}
- idTab = $(currentTab).attr('data-target');
+ var idTab = $(currentTab).attr('data-target');
idEditor = $(idTab).find('.ace').attr("id");
editors[idEditor].focus();
});
@@ -1034,7 +1031,7 @@ $(document).on('click', '.add-tab', function () { // add new tab
var tabID = addTab($(this), "");
$("[data-target='#" + tabID + "']").trigger('click'); //active last tab inserted
- actualTheme = localStorage.getItem("theme") == null ? "" : localStorage.getItem("theme");
+ var actualTheme = localStorage.getItem("theme") == null ? "" : localStorage.getItem("theme");
if(actualTheme.length == 0){
if (localStorage.getItem('mode') === 'dark')
setThemeEditors(defaultDarkTheme);
@@ -1067,7 +1064,7 @@ $(document).on('click', '.delete-tab', function () { // delete tab
$('.check-run-tab[value="' + ideditor + '"]').remove();
if ($(".nav-tabs").children().length === 1) { // add a new tab if we delete the last
- var parent = $('.add-tab').parent();
+ let parent = $('.add-tab').parent();
idEditor = 'editor1';
ideditor = 'editor1';
$(' L P 1 ').insertBefore(parent);
@@ -1089,7 +1086,7 @@ $(document).on('click', '.delete-tab', function () { // delete tab
// });
$('.tab-content').find("[role='tabpanel']").each(function (index) {
ideditor = 'editor' + (index + 1);
- var currentEditor = $(this).find('.ace').attr('id');
+ let currentEditor = $(this).find('.ace').attr('id');
if (ideditor !== currentEditor) {
$(this).find('.ace').attr("id", ideditor);
editors[ideditor] = editors[currentEditor];
@@ -1109,7 +1106,7 @@ $(document).on('click', '.delete-tab', function () { // delete tab
$('.btn-tab').each(function (index) {
var thisTab = $(this);
var idTabEditor = $(this).attr('data-target');
- idEditorToChangeTabName = $(idTabEditor).children().attr('id');
+ var idEditorToChangeTabName = $(idTabEditor).children().attr('id');
var nameValue = thisTab.children('.name-tab').text();
$('.check-run-tab[value="' + idEditorToChangeTabName + '"]').find('.check-tab-name').text(nameValue);
});
@@ -1127,8 +1124,8 @@ $(document).on('click', '.delete-tab', function () { // delete tab
function addEastLayout(layout) {
layout.removePane("south");
saveOption("outputPos", "east");
- currentValModel = $('#output-model').text();
- currentValError = $('#output-error').text();
+ var currentValModel = $('#output-model').text();
+ var currentValError = $('#output-error').text();
$("#split-up").parent().empty();
layout.addPane("east");
createTextArea($('.ui-layout-east'));
@@ -1146,8 +1143,8 @@ function addEastLayout(layout) {
function addSouthLayout(layout) {
layout.removePane("east");
saveOption("outputPos", "south");
- currentValModel = $('#output-model').text();
- currentValError = $('#output-error').text();
+ var currentValModel = $('#output-model').text();
+ var currentValError = $('#output-error').text();
$("#split").parent().empty();
layout.addPane("south");
createTextArea($('.ui-layout-south'));
@@ -1161,28 +1158,6 @@ function addSouthLayout(layout) {
$('#split').attr('id', 'split-up');
}
-/**
- * @param {string} searchStr - string to search
- * @param {string} str - text where search the string
- * @param {boolean} caseSensitive
- * @returns {array}
- * @description Returns each position of the searched string
- */
-function getIndicesOf(searchStr, str, caseSensitive) {
- var searchStrLen = searchStr.length;
- if (searchStrLen === 0) {
- return [];
- }
- var startIndex = 0,
- index, indices = [];
-
- while ((index = str.indexOf(searchStr, startIndex)) > -1) {
- indices.push(index);
- startIndex = index + searchStrLen;
- }
- return indices;
-}
-
/**
* @param {*} element - container where to search
* @description Returns the start and the end position of the selected string in the output container
@@ -1274,8 +1249,8 @@ function addInputValue(inputClass) {
* @description check if the configration file has the correct property to set. If not, return false and display the content of the file in the text editor
*/
function setJSONInput(config) {
- if (config.hasOwnProperty('language') || config.hasOwnProperty('engine') || config.hasOwnProperty('executor') || config.hasOwnProperty('option')
- || config.hasOwnProperty('program') || config.hasOwnProperty('output_model') || config.hasOwnProperty('output_error') || config.hasOwnProperty('tabname')) {
+ if ({}.hasOwnProperty.call(config,'language') || {}.hasOwnProperty.call(config,'engine') || {}.hasOwnProperty.call(config,'executor') || {}.hasOwnProperty.call(config,'option')
+ || {}.hasOwnProperty.call(config,'program') || {}.hasOwnProperty.call(config,'output_model') || {}.hasOwnProperty.call(config,'output_error') || {}.hasOwnProperty.call(config,'tabname')) {
$('.nav-tabs li:not(:last)').each(function (index, element) {
var id = $(this).find("a").attr("data-target");
$(this).remove();
@@ -1288,13 +1263,13 @@ function setJSONInput(config) {
tabID = addTab($(".add-tab"), config.program[index]);
});
$("[data-target='#" + tabID + "']").trigger('click'); // active last tab inserted
- if (config.hasOwnProperty('tab')) {
+ if ({}.hasOwnProperty.call(config,'tab')) {
$(config.tab).each(function (index, element) {
$('.check-run-tab[value="' + element + '"]').find('.check-icon').toggleClass('invisible');
$('.check-run-tab[value="' + element + '"]').toggleClass('checked');
});
}
- if (config.hasOwnProperty('runAuto')) {
+ if ({}.hasOwnProperty.call(config,'runAuto')) {
$("#run-dot").prop('checked', true);
}
else {
@@ -1398,14 +1373,14 @@ function handleFileSelect(evt) {
evt.stopPropagation();
evt.preventDefault();
- files = document.getElementById("files").files;
+ var files = document.getElementById("files").files;
if (files.length === 0) {
files = evt.dataTransfer.files;
}
if (files.length == 1) {
- var reader = new FileReader();
+ let reader = new FileReader();
reader.onload = function (event) {
var text = event.target.result;
if (isJosn(text)) {
@@ -1439,7 +1414,7 @@ function getValidFileList(files, callback) {
}; // accepted files
// Get the selected files
- for (var i = 0; i < count; i++) { // invoke readers
+ for (let i = 0; i < count; i++) { // invoke readers
checkFile(files[i]);
}
@@ -1455,13 +1430,13 @@ function getValidFileList(files, callback) {
};
reader.readAsText(file);
}
-};
+}
function onDone(data) {
var tabOpened = $('.btn-tab').length;
var tabID;
var openOnFirst = false;
- for (var index = 0; index < data.texts.length; index++) {
+ for (let index = 0; index < data.texts.length; index++) {
if (tabOpened == 1) {
if (index == 0) {
if (editors[idEditor].getValue().trim() === '') {
@@ -1489,17 +1464,16 @@ function onDone(data) {
$('.name-tab').each(function (index) {
if (openOnFirst) {
- var id = index + 1;
$(this).text(data.names[index]);
- var id = index + 1;
- var editor = "editor" + id;
+ let id = index + 1;
+ let editor = "editor" + id;
$('.check-run-tab[value="' + editor + '"]').find('.check-tab-name').text(data.names[index]);
}
else {
if (index > tabOpened - 1) {
$(this).text(data.names[index - tabOpened]);
- var id = index + 1;
- var editor = "editor" + id;
+ let id = index + 1;
+ let editor = "editor" + id;
$('.check-run-tab[value="' + editor + '"]').find('.check-tab-name').text(data.names[index - tabOpened]);
}
}
@@ -1525,7 +1499,7 @@ function setUpAce(ideditor, text) {
ace.config.set("modePath", "js/ace/mode");
editors[ideditor].jumpToMatching();
- actualTheme = localStorage.getItem("theme") == null ? "" : localStorage.getItem("theme");
+ var actualTheme = localStorage.getItem("theme") == null ? "" : localStorage.getItem("theme");
if(actualTheme.length == 0){
if (localStorage.getItem('mode') === 'dark')
editors[ideditor].setTheme(defaultDarkTheme);
@@ -1722,8 +1696,8 @@ function generateIDTab() {
*/
function setTheme(theme) {
var length = $(".nav-tabs").children().length;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].setTheme(theme);
}
}
@@ -1734,8 +1708,8 @@ function setTheme(theme) {
*/
function setFontSizeEditors(size) {
var length = $(".nav-tabs").children().length;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].setFontSize(size + "px");
}
}
@@ -1746,8 +1720,8 @@ function setFontSizeEditors(size) {
*/
function setThemeEditors(theme) {
var length = $(".nav-tabs").children().length;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].setTheme(theme);
}
}
@@ -1836,7 +1810,7 @@ function setOptions(obj) {
function addTab(obj, text, name) {
var id = $(".nav-tabs").children().length;
var tabId = generateIDTab();
- editorId = "editor" + id;
+ var editorId = "editor" + id;
var tabName = name == null ? 'L P ' + id : name;
$(' ' + tabName + ' ').insertBefore($('.add-tab').parent());
$('.tab-content').append('');
@@ -2403,17 +2377,17 @@ function inizializeAutoComplete() {
var langTools = ace.require('ace/ext/language_tools');
inizializeSnippets();
switch (languageChosen) {
- case "asp":
- var splitRegex = /(([a-zA-Z_]+[0-9]*)*)(\(.+?\))/gi;
- var words = editors[idEditor].getValue().match(splitRegex);
+ case "asp": {
+ let splitRegex = /(([a-zA-Z_]+[0-9]*)*)(\(.+?\))/gi;
+ let words = editors[idEditor].getValue().match(splitRegex);
if (words != null) {
- var map = new Map();
+ let map = new Map();
words.forEach(function (word) {
- var name = word.match(/[^_](([a-zA-Z_]+[0-9]*)*)/)[0];
- var arities = word.match(/\(.+?\)/)[0].split(",").length;
+ let name = word.match(/[^_](([a-zA-Z_]+[0-9]*)*)/)[0];
+ let arities = word.match(/\(.+?\)/)[0].split(",").length;
map.set(name, arities);
});
- var completions = [];
+ let completions = [];
map.forEach(function (key, value) {
completions.push({
caption: value,
@@ -2422,7 +2396,7 @@ function inizializeAutoComplete() {
});
});
- var completer = {
+ let completer = {
getCompletions: function (editor, session, pos, prefix, callback) {
callback(null, completions);
}
@@ -2431,7 +2405,7 @@ function inizializeAutoComplete() {
langTools.addCompleter(completer);
}
break;
-
+ }
default:
break;
}
@@ -2445,8 +2419,8 @@ function giveBrackets(value) {
limit = value;
else
limit = 26;
- for (var i = 0; i < limit; i++) {
- var num = i + 1;
+ for (let i = 0; i < limit; i++) {
+ let num = i + 1;
par += "${" + num + ":" + LETTER + "}";
if (i !== limit - 1) {
par += ","
@@ -2462,8 +2436,8 @@ function createURL() {
var length = $(".nav-tabs").children().length;
var empty = true;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
URL += encodeURIComponent(editors[idE].getValue().trim());
if (index < length - 1) {
@@ -2480,7 +2454,7 @@ function createURL() {
else {
// put the name of the tabs
URL += '&tabnames=';
- var idx = 1
+ let idx = 1
$('.name-tab').each(function () {
URL += encodeURIComponent($(this).text());
if (idx < length - 1) {
@@ -2497,9 +2471,9 @@ function createURL() {
saveOptions();
- var opt = localStorage.getItem("solverOptions");
+ let opt = localStorage.getItem("solverOptions");
if (opt !== null) {
- var obj = JSON.parse(opt);
+ let obj = JSON.parse(opt);
if (obj.option != null) {
// put the options
URL += '&options=' + encodeURIComponent(JSON.stringify(obj.option));
@@ -2567,12 +2541,12 @@ function loadFromURL() {
// console.log('options:', options);
// decode params
- for (var i = 0; i < logicPr.length; i++) {
+ for (let i = 0; i < logicPr.length; i++) {
logicPr[i] = decodeURIComponent(logicPr[i]);
}
// console.log('LogicPrograms decoded:', logicPr);
- for (var i = 0; i < tabNames.length; i++) {
+ for (let i = 0; i < tabNames.length; i++) {
tabNames[i] = decodeURIComponent(tabNames[i]);
}
// console.log('TabNames decoded:', tabNames);
@@ -2581,17 +2555,17 @@ function loadFromURL() {
// console.log('Options decoded:', options);
// set params
- for (var index = 1; index <= tabNames.length; index++) {
+ for (let index = 1; index <= tabNames.length; index++) {
if (index > 1)
$('.add-tab').trigger('click');
- var idE = "editor" + index;
+ let idE = "editor" + index;
editors[idE].setValue(logicPr[index - 1]);
}
$('.name-tab').each(function (index) {
$(this).text(tabNames[index]);
- var id = index + 1;
- var editor = "editor" + id;
+ let id = index + 1;
+ let editor = "editor" + id;
$('.check-run-tab[value="' + editor + '"]').find('.check-tab-name').text(tabNames[index]);
});
@@ -2724,8 +2698,8 @@ function setLightStyleToUIElements() {
});
$('#dark-light-mode').addClass('btn-outline-dark');
$('#dark-light-mode').removeClass('btn-outline-light');
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].setTheme(defaultTheme);
}
}
@@ -2745,8 +2719,8 @@ function setDarkStyleToUIElements() {
$('#dark-light-mode').removeClass('btn-outline-dark');
$('#dark-light-mode').addClass('btn-outline-light');
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].setTheme(defaultDarkTheme);
}
}
@@ -2759,8 +2733,8 @@ function saveProjectToLocalStorage() {
tabsName.push($(this).text());
});
var length = $(".nav-tabs").children().length;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
logicProgEditors.push(editors[idE].getValue());
}
@@ -2790,17 +2764,17 @@ function loadProjectFromLocalStorage() {
tabsName = JSON.parse(localStorage.getItem("tabsName"));
logicProgEditors = JSON.parse(localStorage.getItem("logicProgEditors"));
- for (var index = 1; index <= tabsName.length; index++) {
+ for (let index = 1; index <= tabsName.length; index++) {
if (index > 1)
$('.add-tab').trigger('click');
- var idE = "editor" + index;
+ let idE = "editor" + index;
editors[idE].setValue(logicProgEditors[index - 1]);
}
$('.name-tab').each(function (index) {
$(this).text(tabsName[index]);
- var id = index + 1;
- var editor = "editor" + id;
+ let id = index + 1;
+ let editor = "editor" + id;
$('.check-run-tab[value="' + editor + '"]').find('.check-tab-name').text(tabsName[index]);
});
@@ -2815,7 +2789,7 @@ function loadProjectFromLocalStorage() {
if (obj.option != null) {
setOptions(obj);
}
- if (obj.hasOwnProperty('runAuto')) {
+ if ({}.hasOwnProperty.call(obj,'runAuto')) {
$("#run-dot").prop('checked', true);
}
else {
@@ -2841,8 +2815,8 @@ function setTabsName(config) {
var tabsName = config.tabname;
$('.name-tab').each(function (index) {
$(this).text(tabsName[index]);
- var id = index + 1;
- var editor = "editor" + id;
+ let id = index + 1;
+ let editor = "editor" + id;
$('.check-run-tab[value="' + editor + '"]').find('.check-tab-name').text(tabsName[index]);
});
}
@@ -2856,7 +2830,7 @@ function downloadLoDIEProject() {
$("#run-dot").attr("name", "runAuto");
- form = $('#input').serializeFormJSON();
+ var form = $('#input').serializeFormJSON();
form.output_model = model;
form.output_error = errors;
@@ -2870,7 +2844,7 @@ function downloadLoDIEProject() {
delete form.tab;
}
- stringify = JSON.stringify(form);
+ var stringify = JSON.stringify(form);
createFileToDownload(stringify, "local", "LoIDE_Project", "json");
destroyPrograms();
destroyTabsName();
@@ -2892,7 +2866,7 @@ function renameSelectOptionsAndBadge() {
}
function closeRunOptionOnMobile() {
- if ($(window).width() <= screen.small.size) {
+ if ($(window).width() <= display.small.size) {
$('.left-panel').removeClass('left-panel-show');
}
}
@@ -2907,8 +2881,7 @@ function openRunOptions() {
function getHTMLFromJQueryElement(jQueryElement) {
var DOMElement = '';
-
- for (var i = 0; i < jQueryElement.length; i++)
+ for (let i = 0; i < jQueryElement.length; i++)
DOMElement += jQueryElement.get(i).outerHTML;
return DOMElement;
@@ -2916,21 +2889,22 @@ function getHTMLFromJQueryElement(jQueryElement) {
function setAceMode() {
switch ($('#inputLanguage').val()) {
- case 'asp':
- var length = $(".nav-tabs").children().length;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ case 'asp': {
+ let length = $(".nav-tabs").children().length;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].session.setMode("ace/mode/asp");
}
break;
+ }
- default:
- var length = $(".nav-tabs").children().length;
- for (var index = 1; index <= length - 1; index++) {
- var idE = "editor" + index;
+ default: {
+ let length = $(".nav-tabs").children().length;
+ for (let index = 1; index <= length - 1; index++) {
+ let idE = "editor" + index;
editors[idE].session.setMode("ace/mode/text");
}
- break;
+ }
}
}
From ea5415047fb13c844a1528e343c0a60c9ee5db78 Mon Sep 17 00:00:00 2001
From: Roky97
Date: Fri, 7 Aug 2020 11:32:40 +0200
Subject: [PATCH 14/34] Add clear output button
---
resources/index.pug | 5 ++++-
resources/js/script.js | 9 +++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index 2f20722..75b455f 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -252,8 +252,11 @@
+
+
+
-
+
diff --git a/resources/js/script.js b/resources/js/script.js
index 5689766..4bb743c 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -870,7 +870,12 @@ $(document).on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
});
$(document).on('click', '#dwn-output', function () {
- downloadOutput()
+ downloadOutput();
+});
+
+$(document).on('click', '#clear-output', function () {
+ $('#output-model').empty();
+ $('#output-error').empty();
});
$(document).on('click', '#split', function () {
@@ -1364,7 +1369,7 @@ function isJosn(str) {
function createTextArea(layout) {
$("#setting-output").remove();
$(".output-container").remove();
- $(layout).append('
');
+ $(layout).append('
');
setLoideStyleMode();
$('#dwn-output').tooltip();
}
From 4e1ffead3644e3561fe0e9db89b736fb4bd2e59d Mon Sep 17 00:00:00 2001
From: Roky97
Date: Fri, 7 Aug 2020 11:40:44 +0200
Subject: [PATCH 15/34] Add clear tab content
---
resources/js/script.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/resources/js/script.js b/resources/js/script.js
index 4bb743c..b03edda 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -696,6 +696,19 @@ function inizializeTabContextmenu() {
$("[data-target='#" + tabID + "']").trigger('click'); //active last tab inserted
}
},
+ Clear: {
+ name: "Clear content",
+ icon: function (opt, $itemElement, itemKey, item) {
+ // Set the content to the menu trigger selector and add an bootstrap icon to the item.
+ $itemElement.html('' + item.name);
+
+ // Add the context-menu-icon-updated class to the item
+ return 'context-menu-icon-updated';
+ },
+ callback: function (itemKey, opt, e) {
+ editors[idEditor].setValue("");
+ }
+ },
SaveTabContent: {
name: "Save content",
icon: function (opt, $itemElement, itemKey, item) {
From e768c23cd511f40c2c8a6f10f3997fd388d81207 Mon Sep 17 00:00:00 2001
From: Roky97
Date: Fri, 7 Aug 2020 12:28:00 +0200
Subject: [PATCH 16/34] Add delete all tabs button
---
resources/index.pug | 1 +
resources/js/script.js | 161 +++++++++++++++++++++++------------------
2 files changed, 90 insertions(+), 72 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index 75b455f..ab90220 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -224,6 +224,7 @@
+
diff --git a/resources/js/script.js b/resources/js/script.js
index b03edda..a86b479 100644
--- a/resources/js/script.js
+++ b/resources/js/script.js
@@ -1062,78 +1062,8 @@ $(document).on('click', '.add-tab', function () { // add new tab
}
});
-$(document).on('click', '.delete-tab', function () { // delete tab
- var r = confirm("Are you sure you want to delete this file? This cannot be undone.");
- var ids = $(".nav-tabs").children().length - 1;
- var t = $(this).parent().attr('data-target');
- var currentids = $(t).find(".ace").attr("id").substr(6);
- var parse = parseInt(currentids);
- if (r) {
- var prevEditor = $(this).parent().parent().prev();
- if (prevEditor.length === 0) {
- prevEditor = $(this).parent().parent().next();
- }
- var currentID = $(this).closest('a').attr('data-target');
- $(this).parent().parent().remove();
- var ideditor = $(currentID).find('.ace').attr("id");
- $(currentID).remove();
- delete editors[ideditor];
- $("[data-target='" + prevEditor.find("a").attr("data-target") + "']").trigger('click');
- $('.check-run-tab[value="' + ideditor + '"]').remove();
-
- if ($(".nav-tabs").children().length === 1) { // add a new tab if we delete the last
- let parent = $('.add-tab').parent();
- idEditor = 'editor1';
- ideditor = 'editor1';
- $('
L P 1 ').insertBefore(parent);
- $('.tab-content').append('
');
- editors[ideditor] = new ace.edit(ideditor);
- setUpAce(ideditor, "");
- $('#tab-execute-new').append('
L P 1 ');
- $("[data-target='#tab1']").trigger('click');
-
- inizializeTabContextmenu();
- initializeCheckTabToRun();
- setAceMode();
- setElementsColorMode();
- }
- else if (ids !== parse) { // renumber tabs if you delete the previous tab instead of the current one
- // $('.nav-tabs').find('li:not(:last)').each(function (index) {
- // $(this).find('a').text('L P ' + (index + 1));
- // $(this).find('a').append('
');
- // });
- $('.tab-content').find("[role='tabpanel']").each(function (index) {
- ideditor = 'editor' + (index + 1);
- let currentEditor = $(this).find('.ace').attr('id');
- if (ideditor !== currentEditor) {
- $(this).find('.ace').attr("id", ideditor);
- editors[ideditor] = editors[currentEditor];
- delete editors[currentEditor];
- var currentCheck = $('.check-run-tab[value="' + currentEditor + '"]');
- var wasInvisible = false;
- if (currentCheck.find('check-icon').hasClass('invisible')) {
- wasInvisible = true;
- }
- currentCheck.empty();
- currentCheck.attr('value', ideditor);
- currentCheck.append('
L P ' + (index + 1) + ' ');
- if (!wasInvisible) {
- currentCheck.find('check-icon').removeClass('invisible');
- }
- }
- $('.btn-tab').each(function (index) {
- var thisTab = $(this);
- var idTabEditor = $(this).attr('data-target');
- var idEditorToChangeTabName = $(idTabEditor).children().attr('id');
- var nameValue = thisTab.children('.name-tab').text();
- $('.check-run-tab[value="' + idEditorToChangeTabName + '"]').find('.check-tab-name').text(nameValue);
- });
- });
- }
- if ($(".nav-tabs").children().length === 2) {
- idEditor = "editor1";
- }
- }
+$(document).on('click', '.delete-tab', function (e) { // delete tab
+ deleteTab($(this), false);
});
/**
@@ -2114,6 +2044,93 @@ function inizializeToolbar() {
$('#btn-dwn-this-lp').on('click', function () {
downloadCurrentTabContent();
});
+
+ $('#delete-all-tabs').on('click', function () {
+ deleteAllTabs();
+ });
+}
+
+function deleteAllTabs() {
+ var r = confirm("Are you sure you want to delete all tabs? This cannot be undone.");
+ if(r) {
+ $('.delete-tab').each(function(){
+ deleteTab($(this), true);
+ });
+ }
+}
+
+function deleteTab(tab, all) {
+ if (!all) { var r = confirm("Are you sure you want to delete this file? This cannot be undone."); }
+ var ids = $(".nav-tabs").children().length - 1;
+ var t = tab.parent().attr('data-target');
+ var currentids = $(t).find(".ace").attr("id").substr(6);
+ var parse = parseInt(currentids);
+ if (r || all) {
+ var prevEditor = tab.parent().parent().prev();
+ if (prevEditor.length === 0) {
+ prevEditor = tab.parent().parent().next();
+ }
+ var currentID = tab.closest('a').attr('data-target');
+ tab.parent().parent().remove();
+ var ideditor = $(currentID).find('.ace').attr("id");
+ $(currentID).remove();
+ delete editors[ideditor];
+ $("[data-target='" + prevEditor.find("a").attr("data-target") + "']").trigger('click');
+ $('.check-run-tab[value="' + ideditor + '"]').remove();
+
+ if ($(".nav-tabs").children().length === 1) { // add a new tab if we delete the last
+ let parent = $('.add-tab').parent();
+ idEditor = 'editor1';
+ ideditor = 'editor1';
+ $('
L P 1 ').insertBefore(parent);
+ $('.tab-content').append('
');
+ editors[ideditor] = new ace.edit(ideditor);
+ setUpAce(ideditor, "");
+ $('#tab-execute-new').append('
L P 1 ');
+ $("[data-target='#tab1']").trigger('click');
+
+ inizializeTabContextmenu();
+ initializeCheckTabToRun();
+ setAceMode();
+ setElementsColorMode();
+ }
+ else if (ids !== parse) { // renumber tabs if you delete the previous tab instead of the current one
+ // $('.nav-tabs').find('li:not(:last)').each(function (index) {
+ // tab.find('a').text('L P ' + (index + 1));
+ // tab.find('a').append('
');
+ // });
+ $('.tab-content').find("[role='tabpanel']").each(function (index) {
+ ideditor = 'editor' + (index + 1);
+ let currentEditor = tab.find('.ace').attr('id');
+ if (ideditor !== currentEditor) {
+ tab.find('.ace').attr("id", ideditor);
+ editors[ideditor] = editors[currentEditor];
+ delete editors[currentEditor];
+ var currentCheck = $('.check-run-tab[value="' + currentEditor + '"]');
+ var wasInvisible = false;
+ if (currentCheck.find('check-icon').hasClass('invisible')) {
+ wasInvisible = true;
+ }
+ currentCheck.empty();
+ currentCheck.attr('value', ideditor);
+ currentCheck.append('
L P ' + (index + 1) + ' ');
+ if (!wasInvisible) {
+ currentCheck.find('check-icon').removeClass('invisible');
+ }
+ }
+ $('.btn-tab').each(function (index) {
+ var thisTab = tab;
+ var idTabEditor = tab.attr('data-target');
+ var idEditorToChangeTabName = $(idTabEditor).children().attr('id');
+ var nameValue = thisTab.children('.name-tab').text();
+ $('.check-run-tab[value="' + idEditorToChangeTabName + '"]').find('.check-tab-name').text(nameValue);
+ });
+ });
+ }
+ if ($(".nav-tabs").children().length === 2) {
+ idEditor = "editor1";
+ }
+ }
}
function downloadCurrentTabContent() {
From c5a7df6e33e995db5164dd5938d80edae2eaca3c Mon Sep 17 00:00:00 2001
From: Roky97
Date: Fri, 7 Aug 2020 16:06:04 +0200
Subject: [PATCH 17/34] Change command text to its symbol
---
resources/index.pug | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index ab90220..1f6f030 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -404,7 +404,7 @@
Open Project/Files
-
Ctrl/Command
+
Ctrl/⌘
O
@@ -414,7 +414,7 @@
Save Project
-
Ctrl/Command
+
Ctrl/⌘
S
@@ -424,7 +424,7 @@
Share
-
Ctrl/Command
+
Ctrl/⌘
Shift
S
@@ -435,7 +435,7 @@
Open/Close Run Options
-
Ctrl/Command
+
Ctrl/⌘
Shift
O
@@ -446,7 +446,7 @@
Run Project
-
Ctrl/Command
+
Ctrl/⌘
Enter
From e6156a615afe4c2734db17ccdd18192df07dc50f Mon Sep 17 00:00:00 2001
From: Roky97
Date: Fri, 7 Aug 2020 16:34:02 +0200
Subject: [PATCH 18/34] Refactor about modal
---
resources/index.pug | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/resources/index.pug b/resources/index.pug
index 1f6f030..d73e680 100644
--- a/resources/index.pug
+++ b/resources/index.pug
@@ -290,20 +290,20 @@
-
- LoIDE is a web-based IDE for Logic Programming.
+
+ LoIDE is a web-based IDE for Logic Programming
- Checkout the LoIDE project website: demacs-unical.github.io/LoIDE/
+ Checkout the LoIDE project website: demacs-unical.github.io/LoIDE
LoIDE is an Open Source project available on Github
- It's released under MIT License .
+ It's released under MIT License
- If you have any questions or suggestions, please write an e-mail to: loideABC @mat.unical.it
+ If you have any questions or suggestions, please write an e-mail to loideABC @mat.unical.it
- Use of all solvers and systems is provided under the respective licenses; we refrain from taking any responsibility for any use that goes out of the scopes of such licenses.
+ Use of all solvers and systems is provided under the respective licenses; we refrain from taking any responsibility for any use that goes out of the scopes of such licenses.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.