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' + '\n' + // '\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 bf427e192a596a099e231b7f151642e546180b78 Mon Sep 17 00:00:00 2001 From: Roky97 Date: Sat, 1 Aug 2020 11:05:30 +0200 Subject: [PATCH 04/34] Fix --- resources/css/style.css | 2 +- resources/index.pug | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/resources/css/style.css b/resources/css/style.css index c632bda..510a70e 100644 --- a/resources/css/style.css +++ b/resources/css/style.css @@ -102,7 +102,7 @@ } } -#beta { +.beta { font-family: "Dancing Script", cursive; font-size: 22px; vertical-align: top; diff --git a/resources/index.pug b/resources/index.pug index 13dc36e..ca30f67 100644 --- a/resources/index.pug +++ b/resources/index.pug @@ -9,10 +9,10 @@ - - + + - + @@ -31,7 +31,7 @@
- (Beta) + (Beta)
@@ -70,13 +70,13 @@
-
+
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 @@
+ + + 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 @@ 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('
Output
'); + $(layout).append('
Output
'); 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'; - $('').insertBefore(parent); - $('.tab-content').append('
'); - editors[ideditor] = new ace.edit(ideditor); - setUpAce(ideditor, ""); - $('#tab-execute-new').append(''); - $("[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'; + $('').insertBefore(parent); + $('.tab-content').append('
'); + editors[ideditor] = new ace.edit(ideditor); + setUpAce(ideditor, ""); + $('#tab-execute-new').append(''); + $("[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.