Skip to content

Commit

Permalink
v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
smccle committed Aug 9, 2023
1 parent dd9c7b2 commit 6bdf04b
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 44 deletions.
4 changes: 4 additions & 0 deletions devlog.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
9 changes: 9 additions & 0 deletions src/scripts/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
26 changes: 10 additions & 16 deletions src/scripts/loader.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -877,6 +874,7 @@ function loadcode() {
var newScript = document.createElement('script');
newScript.innerHTML = code;
document.body.appendChild(newScript);

}
} else {
function makeHttpObject() {
Expand All @@ -895,7 +893,7 @@ function loadcode() {
request.send(null);
request.onreadystatechange = function() {
if (request.readyState == 4)
window.eval(request.responseText);
alert(request.responseText);
};
}
} else {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -673,3 +673,7 @@ a {
#deleteFile {
font-size: 8px;
}

.btn-icon {
margin-left: 0;
}
138 changes: 111 additions & 27 deletions src/views/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,56 @@
</script>
<div class="sidenav">
<div data-title="Dashboard">
<img src="../../img/dashboard.png" width="25px" height="25px" class="btn-db2" style="cursor: pointer;">
<img src="../../img/dashboard.png" width="25px" height="25px" class="btn-icon btn-db2" style="cursor: pointer;">
</div>
<div class="spacers">
<br><br><br>
</div>
<br><br><br>
<div data-title="Run">
<img src="../../img/run.png" width="25px" height="25px" class="btn-run" style="cursor: pointer;">
<img src="../../img/run.png" width="25px" height="25px" class="btn-icon btn-run" style="cursor: pointer;">
</div>
<div class="spacers">
<br><br><br>
</div>
<br><br><br>
<div data-title="Open In New Tab">
<img src="../../img/oint.png" width="25px" height="25px" class="btn-ont" style="cursor: pointer;">
<img src="../../img/oint.png" width="25px" height="25px" class="btn-icon btn-ont" style="cursor: pointer;">
</div>
<div class="spacers">
<br><br><br>
</div>
<br><br><br>
<div data-title="Save">
<img src="../../img/save.png" width="25px" height="25px" class="btn-so" style="cursor: pointer;">
<img src="../../img/save.png" width="25px" height="25px" class="btn-icon btn-so" style="cursor: pointer;">
</div>
<!-- <br><br><br>
<div data-title="Share">
<img src="https://cdn-icons-png.flaticon.com/512/2958/2958791.png" width="25px" height="25px" class="btn-share" style="cursor: pointer;">
</div> -->
<br><br><br>
<div class="spacers">
<br><br><br>
</div>
<div data-title="Devlog">
<img src="../../img/devlog.png" width="25px" height="25px" class="btn-dev" style="cursor: pointer;">
<img src="../../img/devlog.png" width="25px" height="25px" class="btn-icon btn-dev" style="cursor: pointer;">
</div>
<div class="spacers">
<br><br><br>
</div>
<br><br><br>
<div data-title="Download Project">
<img src="../../img/download.png" width="25px" height="25px" class="btn-download" style="cursor: pointer;">
<img src="../../img/download.png" width="25px" height="25px" class="btn-icon btn-download" style="cursor: pointer;">
</div>
<div class="spacers">
<br><br><br>
</div>
<br><br><br>
<div data-title="Import Project">
<img src="../../img/import.png" width="25px" height="25px" class="btn-import" style="cursor: pointer;">
<img src="../../img/import.png" width="25px" height="25px" class="btn-icon btn-import" style="cursor: pointer;">
</div>
<div class="spacers">
<br><br><br>
</div>
<br><br><br>
<div data-title="Settings">
<img src="../../img/settings.png" width="25px" height="25px" class="btn-setting" style="cursor: pointer; display: none;">
<img src="../../img/settings.png" width="25px" height="25px" class="btn-icon btn-setting" style="cursor: pointer; display: none;">
</div>
</div>

<div id="container">
<div class="left">
<select style="color: #fff; display: none;" class="btn folder-picker"></select>
Expand Down Expand Up @@ -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";
})
}
})
</script>
Expand Down
1 change: 0 additions & 1 deletion src/views/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
parent.postMessage(m, '*');
};
</script>
<link rel="manifest" href="../../manifest.json" />
</head>

<body></body>
Expand Down

0 comments on commit 6bdf04b

Please sign in to comment.