Skip to content

Commit

Permalink
v1.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
smccle authored Apr 19, 2023
1 parent edea8d7 commit deb5a77
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 65 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.5.8 04/19/2023:
- Dashboard is now the main page
- Updated creating projects so where if the name exists it adds a number after it

Update v1.5.7 04/08/2023:
- Added Windows App
- Added back buttons
Expand Down
84 changes: 45 additions & 39 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
</head>

<body>
<div class="editor-menu">
<!-- <div class="editor-menu">
<img id="logo" src="./img/favicon.png" />
<button class="btn btn-ls">Login/Signup</button>
<button style="display: none" class="btn btn-db">Dashboard</button>
<button style="display: none" class="btn btn-db">Dashboard</button> -->
<!-- <button class="btn btn-soo">Offline</button> -->
</div>
<!-- </div>
<div class="container">
<h1 id="slogan">The free code editor for you.</h1>
</div>
</div> -->

<p>loading editor...</p>

<script>
// if (window.localStorage.getItem('offline') === 'true') {
Expand All @@ -42,46 +44,50 @@ <h1 id="slogan">The free code editor for you.</h1>
// };

window.localStorage.setItem('offline', 'true');

window.location.replace("./src/views/dashboard.html");



document.querySelector('.btn-ls').onclick = function () {
window.location.href = './src/views/login.html';
};
// document.querySelector('.btn-ls').onclick = function () {
// window.location.href = './src/views/login.html';
// };

document.querySelector('.btn-db').onclick = function () {
window.location.href = './src/views/dashboard.html';
};
// document.querySelector('.btn-db').onclick = function () {
// window.location.href = './src/views/dashboard.html';
// };

if (
getCookie('li') !== '' ||
(window.localStorage.getItem('li') !== null &&
window.localStorage.getItem('li') !== '')
) {
document.querySelector('.btn-ls').style.display = 'none';
document.querySelector('.btn-db').style.display = 'block';
}
// if (
// getCookie('li') !== '' ||
// (window.localStorage.getItem('li') !== null &&
// window.localStorage.getItem('li') !== '')
// ) {
// document.querySelector('.btn-ls').style.display = 'none';
// document.querySelector('.btn-db').style.display = 'block';
// }

function getCookie(cname) {
let name = cname + '=';
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return '';
}
// function getCookie(cname) {
// let name = cname + '=';
// let decodedCookie = decodeURIComponent(document.cookie);
// let ca = decodedCookie.split(';');
// for (let i = 0; i < ca.length; i++) {
// let c = ca[i];
// while (c.charAt(0) == ' ') {
// c = c.substring(1);
// }
// if (c.indexOf(name) == 0) {
// return c.substring(name.length, c.length);
// }
// }
// return '';
// }

function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
let expires = 'expires=' + d.toUTCString();
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
}
// function setCookie(cname, cvalue, exdays) {
// const d = new Date();
// d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
// let expires = 'expires=' + d.toUTCString();
// document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
// }
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/scripts/account.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var DEV = false;
var DEV = true;

window.onerror = function (msg, url, linenumber) {
if (DEV === true) {
Expand Down
108 changes: 85 additions & 23 deletions src/scripts/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ async function clearData() {
dbs.forEach(db => { window.indexedDB.deleteDatabase(db.name) })
}

var DEV = false;
var DEV = true;

window.onerror = function (msg, url, linenumber) {
if (DEV === true) {
Expand Down Expand Up @@ -72,15 +72,29 @@ function getImg(id) {
}

if (
(getCookie('li') === '' || getCookie('li') === undefined) &&
window.localStorage.getItem('offline') !== 'true'
window.localStorage.getItem('offline') === 'true' &&
window.localStorage.getItem('li') === '' ||
window.localStorage.getItem('offline') === 'true' &&
window.localStorage.getItem("li") === null
) {
window.location = '../../index.html';
document.querySelector(".btn-lo").style.display = "none";
document.querySelector(".btn-clear").style.display = "none";
document.querySelector("#account").style.display = "none";
document.querySelector(".btn-logon").style.display = "block";

var newPara = document.createElement('p');

newPara.innerHTML = 'Not logged in. Please <a href="./login.html">log in</a>.';

document.getElementById('load').style.display = 'none';
document.getElementById('newProjectForm').style.display = 'none';
document.querySelector('.projects-container').appendChild(newPara);
} else if (
window.localStorage.getItem('li') !== null &&
window.localStorage.getItem('offline') === 'true'
) {
document.getElementById('account').style.display = 'none';
document.querySelector(".btn-logon").style.display = "none";
var username = window.localStorage.getItem('li');

var data = JSON.parse(window.localStorage.getItem(username));
Expand Down Expand Up @@ -194,27 +208,71 @@ document.getElementById('new').onclick = function () {
);
} else if (
document.getElementById('name').value !== '' &&
window.localStorage.getItem('offline') === 'true' &&
pjs.includes(document.getElementById('name').value) !== true
window.localStorage.getItem('offline') === 'true'
) {
set(document.getElementById('name').value, {
name: document.getElementById('name').value,
sources: [],
});
var accountData = JSON.parse(
window.localStorage.getItem(window.localStorage.getItem('li'))
);
if (accountData.editor !== '') {
accountData.editor =
accountData.editor + ':' + document.getElementById('name').value;
} else {
accountData.editor = document.getElementById('name').value;
var editorData;
function trySet(count) {
if (count == 0) {
var checkedData;
get(document.getElementById('name').value).then((val) => {
checkedData = val;
if (checkedData === undefined) {
set(document.getElementById('name').value, {
name: document.getElementById('name').value,
sources: [],
});
editorData = document.getElementById('name').value;
var accountData = JSON.parse(
window.localStorage.getItem(window.localStorage.getItem('li'))
);
if (accountData.editor !== '') {
accountData.editor =
accountData.editor + ':' + editorData;
} else {
accountData.editor = editorData;
}
window.localStorage.setItem(
window.localStorage.getItem('li'),
JSON.stringify(accountData)
);
window.location = './editor.html?id=' + editorData;
} else {
count += 1;
trySet(count)
}
})
} else {
var checkedData;
get(document.getElementById('name').value + count).then((val) => {
checkedData = val;
if (checkedData === undefined) {
set(document.getElementById('name').value + count, {
name: document.getElementById('name').value,
sources: [],
});
editorData = document.getElementById('name').value + count;
var accountData = JSON.parse(
window.localStorage.getItem(window.localStorage.getItem('li'))
);
if (accountData.editor !== '') {
accountData.editor =
accountData.editor + ':' + editorData;
} else {
accountData.editor = editorData;
}
window.localStorage.setItem(
window.localStorage.getItem('li'),
JSON.stringify(accountData)
);
window.location = './editor.html?id=' + editorData;
} else {
count += 1;
trySet(count)
}
})
}
}
window.localStorage.setItem(
window.localStorage.getItem('li'),
JSON.stringify(accountData)
);
window.location = './editor.html?id=' + document.getElementById('name').value
trySet(0);
} else {
alert('please enter a name!');
}
Expand Down Expand Up @@ -527,3 +585,7 @@ document.querySelector(".btn-clear").onclick = function() {
}

}

document.querySelector(".btn-logon").onclick = function() {
window.location.replace("./login.html");
}
6 changes: 5 additions & 1 deletion src/views/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
<body>
<div class="editor-menu">
<img id="logo" src="../../img/favicon.png" />
<button class="btn btn-logon">Log In</button>
<button class="btn btn-lo">Log Out</button>
<button class="btn btn-clear">Clear Data</button>
<button class="btn" data-title="Account Settings" id="account">
Account Settings
</button>
<p id="ver">v1.5.7</p>
<p id="ver">v1.5.8</p>
</div>

<div class="projects-container">
Expand All @@ -45,6 +46,9 @@
<p id="load">loading...</p>
</div>
</body>
<script>
window.localStorage.setItem('offline', 'true');
</script>
<script src="../../lib/idb.min.js"></script>
<!-- <script
src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/gsap.min.js"
Expand Down
2 changes: 1 addition & 1 deletion src/views/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</label>
</div>
<div id="settingsMenu"></div>
<i id="ver" style="font-size: 2rem;">v1.5.7</i>
<i id="ver" style="font-size: 2rem;">v1.5.8</i>
<iframe frameborder="0" id="iframe"></iframe>
<div style="display: none;" class="tocl tocl-4">
<p class="toclp">Console</p>
Expand Down

0 comments on commit deb5a77

Please sign in to comment.