diff --git a/devlog.txt b/devlog.txt index 72f1fba..be0248d 100644 --- a/devlog.txt +++ b/devlog.txt @@ -1,6 +1,10 @@ NEKO Code Editor Devlog |-----------------------| +Update v1.6.0 08/09/2023: + - Updated in-editor console to be more useful + - Updated window resizing + Update v1.5.9 04/19/2023: - Updated "Compressed" feature to have better compression diff --git a/src/scripts/console.js b/src/scripts/console.js index 9b825c2..b5e76e1 100644 --- a/src/scripts/console.js +++ b/src/scripts/console.js @@ -61,3 +61,12 @@ console.clear = function() { } document.getElementById("log").innerHTML = ""; } + +window.onerror = function (error, url, line) { + console.error(error); + return false; +} + +window.onunhandledrejection = function (e) { + console.error(`${e.reason}`); +} diff --git a/src/scripts/loader.js b/src/scripts/loader.js index 2a78cac..fea72d7 100644 --- a/src/scripts/loader.js +++ b/src/scripts/loader.js @@ -1,15 +1,6 @@ import { get, set, del, clear, keys } from '../scripts/db.js'; -var DEV = false; - -window.onerror = function (msg, url, linenumber) { - if (DEV === true) { - alert( - 'Error message: ' + msg + '\nURL: ' + url + '\nLine Number: ' + linenumber - ); - } - return true; -}; +var DEV = true; var queryString = new Array(); window.onload = function () { @@ -181,7 +172,13 @@ function loadcode() { url = scripts[count].src; var splitHost = url.split("/"); - var host = splitHost[2]; + var beforeCheckHost = splitHost[2]; + var host; + if (beforeCheckHost.includes(":")) { + host = beforeCheckHost.split(":")[0]; + } else { + host = beforeCheckHost; + } if (host === window.location.hostname) { paths = url.split('/'); folder = paths[paths.length - 2]; @@ -877,6 +874,7 @@ function loadcode() { var newScript = document.createElement('script'); newScript.innerHTML = code; document.body.appendChild(newScript); + } } else { function makeHttpObject() { @@ -895,7 +893,7 @@ function loadcode() { request.send(null); request.onreadystatechange = function() { if (request.readyState == 4) - window.eval(request.responseText); + alert(request.responseText); }; } } else { @@ -1265,22 +1263,18 @@ function loadcode() { var newBase64Script = document.createElement("script"); var newConsoleScript = document.createElement("script"); var newMsgScript = document.createElement("script"); - var newManifestFile = document.createElement('link'); newLoadScript.src = "../scripts/loader.js"; newLZStringScript.src = "../../lib/lz-string.js"; newBase64Script.src = "../../lib/base64.js"; newConsoleScript.src = "../scripts/console.js"; newMsgScript.innerHTML = "var MSG = function (m) { parent.postMessage(m, '*'); };"; - newManifestFile.rel = "manifest"; - newManifestFile.href = "../../manifest.json"; document.head.appendChild(newLoadScript); document.head.appendChild(newLZStringScript); document.head.appendChild(newBase64Script); document.head.appendChild(newConsoleScript); document.head.appendChild(newMsgScript); - document.head.appendChild(newManifestFile); } else if (access === false) { document.body.innerHTML = 'Access Denied'; } else { diff --git a/src/styles/style.css b/src/styles/style.css index e5f6f7c..7008ebd 100644 --- a/src/styles/style.css +++ b/src/styles/style.css @@ -673,3 +673,7 @@ a { #deleteFile { font-size: 8px; } + +.btn-icon { + margin-left: 0; +} diff --git a/src/views/editor.html b/src/views/editor.html index 5c70f82..023737a 100644 --- a/src/views/editor.html +++ b/src/views/editor.html @@ -40,41 +40,56 @@
- + +
+
+


-


- + +
+
+


-


- + +
+
+


-


- +
-


+
+


+
- + +
+
+


-


- + +
+
+


-


- + +
+
+


-


- +
+
@@ -144,22 +159,91 @@ document.querySelector(".sidenav").style.width = "5%"; } - - if(window.innerHeight > window.innerWidth){ - document.getElementById("portrait-error").style.display = "block"; - document.querySelector(".sidenav").style.display = "none"; - } else { - document.getElementById("portrait-error").style.display = "none"; - document.querySelector(".sidenav").style.display = ""; - } + + let snav = document.querySelector(".sidenav"); + if(window.innerHeight > window.innerWidth){ + snav.style.width = "100%"; + snav.style.height = "3%"; + snav.style.position = "unset"; + snav.style.zIndex = "0"; + snav.style.display = "flex"; + snav.style.textAlign = "center"; + snav.style.paddingTop = "0"; + document.getElementById("container").style.marginLeft = "0"; + document.getElementById("container").style.marginTop = "20px"; + var spacers = document.querySelectorAll(".spacers"); + spacers.forEach(function(spacer) { + spacer.style.display = "none"; + }) + var btnIcons = document.querySelectorAll(".btn-icon"); + btnIcons.forEach(function(btnIcon) { + btnIcon.style.marginLeft = "4rem"; + btnIcon.style.height = "20px"; + btnIcon.style.width = "20px"; + }) + } else { + snav.style.width = "3%"; + snav.style.height = "100%"; + snav.style.position = "absolute"; + snav.style.zIndex = "1"; + snav.style.display = "block"; + snav.style.textAlign = "left"; + snav.style.paddingTop = "20px"; + document.getElementById("container").style.marginLeft = "40px"; + document.getElementById("container").style.marginTop = "0"; + var spacers = document.querySelectorAll(".spacers"); + spacers.forEach(function(spacer) { + spacer.style.display = "block"; + }) + var btnIcons = document.querySelectorAll(".btn-icon"); + btnIcons.forEach(function(btnIcon) { + btnIcon.style.marginLeft = "0"; + btnIcon.style.height = "25px"; + btnIcon.style.width = "25px"; + }) + } window.addEventListener("resize", () => { if(window.innerHeight > window.innerWidth){ - document.getElementById("portrait-error").style.display = "block"; - document.querySelector(".sidenav").style.display = "none"; + snav.style.width = "100%"; + snav.style.height = "3%"; + snav.style.position = "unset"; + snav.style.zIndex = "0"; + snav.style.display = "flex"; + snav.style.textAlign = "center"; + snav.style.paddingTop = "0"; + document.getElementById("container").style.marginLeft = "0"; + document.getElementById("container").style.marginTop = "20px"; + var spacers = document.querySelectorAll(".spacers"); + spacers.forEach(function(spacer) { + spacer.style.display = "none"; + }) + var btnIcons = document.querySelectorAll(".btn-icon"); + btnIcons.forEach(function(btnIcon) { + btnIcon.style.marginLeft = "4rem"; + btnIcon.style.height = "20px"; + btnIcon.style.width = "20px"; + }) } else { - document.getElementById("portrait-error").style.display = "none"; - document.querySelector(".sidenav").style.display = ""; + snav.style.width = "3%"; + snav.style.height = "100%"; + snav.style.position = "absolute"; + snav.style.zIndex = "1"; + snav.style.display = "block"; + snav.style.textAlign = "left"; + snav.style.paddingTop = "20px"; + document.getElementById("container").style.marginLeft = "40px"; + document.getElementById("container").style.marginTop = "0"; + var spacers = document.querySelectorAll(".spacers"); + spacers.forEach(function(spacer) { + spacer.style.display = "block"; + }) + var btnIcons = document.querySelectorAll(".btn-icon"); + btnIcons.forEach(function(btnIcon) { + btnIcon.style.marginLeft = "0"; + btnIcon.style.height = "25px"; + btnIcon.style.width = "25px"; + }) } }) diff --git a/src/views/view.html b/src/views/view.html index 0946c01..0361f36 100644 --- a/src/views/view.html +++ b/src/views/view.html @@ -10,7 +10,6 @@ parent.postMessage(m, '*'); }; -