Skip to content

Commit deb5a77

Browse files
authored
v1.5.8
1 parent edea8d7 commit deb5a77

6 files changed

Lines changed: 141 additions & 65 deletions

File tree

devlog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
NEKO Code Editor Devlog
22
|-----------------------|
33

4+
Update v1.5.8 04/19/2023:
5+
- Dashboard is now the main page
6+
- Updated creating projects so where if the name exists it adds a number after it
7+
48
Update v1.5.7 04/08/2023:
59
- Added Windows App
610
- Added back buttons

index.html

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313
</head>
1414

1515
<body>
16-
<div class="editor-menu">
16+
<!-- <div class="editor-menu">
1717
<img id="logo" src="./img/favicon.png" />
1818
<button class="btn btn-ls">Login/Signup</button>
19-
<button style="display: none" class="btn btn-db">Dashboard</button>
19+
<button style="display: none" class="btn btn-db">Dashboard</button> -->
2020
<!-- <button class="btn btn-soo">Offline</button> -->
21-
</div>
21+
<!-- </div>
2222
<div class="container">
2323
<h1 id="slogan">The free code editor for you.</h1>
24-
</div>
24+
</div> -->
25+
26+
<p>loading editor...</p>
2527

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

4446
window.localStorage.setItem('offline', 'true');
47+
48+
window.location.replace("./src/views/dashboard.html");
49+
50+
4551

46-
document.querySelector('.btn-ls').onclick = function () {
47-
window.location.href = './src/views/login.html';
48-
};
52+
// document.querySelector('.btn-ls').onclick = function () {
53+
// window.location.href = './src/views/login.html';
54+
// };
4955

50-
document.querySelector('.btn-db').onclick = function () {
51-
window.location.href = './src/views/dashboard.html';
52-
};
56+
// document.querySelector('.btn-db').onclick = function () {
57+
// window.location.href = './src/views/dashboard.html';
58+
// };
5359

54-
if (
55-
getCookie('li') !== '' ||
56-
(window.localStorage.getItem('li') !== null &&
57-
window.localStorage.getItem('li') !== '')
58-
) {
59-
document.querySelector('.btn-ls').style.display = 'none';
60-
document.querySelector('.btn-db').style.display = 'block';
61-
}
60+
// if (
61+
// getCookie('li') !== '' ||
62+
// (window.localStorage.getItem('li') !== null &&
63+
// window.localStorage.getItem('li') !== '')
64+
// ) {
65+
// document.querySelector('.btn-ls').style.display = 'none';
66+
// document.querySelector('.btn-db').style.display = 'block';
67+
// }
6268

63-
function getCookie(cname) {
64-
let name = cname + '=';
65-
let decodedCookie = decodeURIComponent(document.cookie);
66-
let ca = decodedCookie.split(';');
67-
for (let i = 0; i < ca.length; i++) {
68-
let c = ca[i];
69-
while (c.charAt(0) == ' ') {
70-
c = c.substring(1);
71-
}
72-
if (c.indexOf(name) == 0) {
73-
return c.substring(name.length, c.length);
74-
}
75-
}
76-
return '';
77-
}
69+
// function getCookie(cname) {
70+
// let name = cname + '=';
71+
// let decodedCookie = decodeURIComponent(document.cookie);
72+
// let ca = decodedCookie.split(';');
73+
// for (let i = 0; i < ca.length; i++) {
74+
// let c = ca[i];
75+
// while (c.charAt(0) == ' ') {
76+
// c = c.substring(1);
77+
// }
78+
// if (c.indexOf(name) == 0) {
79+
// return c.substring(name.length, c.length);
80+
// }
81+
// }
82+
// return '';
83+
// }
7884

79-
function setCookie(cname, cvalue, exdays) {
80-
const d = new Date();
81-
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
82-
let expires = 'expires=' + d.toUTCString();
83-
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
84-
}
85+
// function setCookie(cname, cvalue, exdays) {
86+
// const d = new Date();
87+
// d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
88+
// let expires = 'expires=' + d.toUTCString();
89+
// document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
90+
// }
8591
</script>
8692
</body>
8793
</html>

src/scripts/account.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var DEV = false;
1+
var DEV = true;
22

33
window.onerror = function (msg, url, linenumber) {
44
if (DEV === true) {

src/scripts/dashboard.js

Lines changed: 85 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ async function clearData() {
55
dbs.forEach(db => { window.indexedDB.deleteDatabase(db.name) })
66
}
77

8-
var DEV = false;
8+
var DEV = true;
99

1010
window.onerror = function (msg, url, linenumber) {
1111
if (DEV === true) {
@@ -72,15 +72,29 @@ function getImg(id) {
7272
}
7373

7474
if (
75-
(getCookie('li') === '' || getCookie('li') === undefined) &&
76-
window.localStorage.getItem('offline') !== 'true'
75+
window.localStorage.getItem('offline') === 'true' &&
76+
window.localStorage.getItem('li') === '' ||
77+
window.localStorage.getItem('offline') === 'true' &&
78+
window.localStorage.getItem("li") === null
7779
) {
78-
window.location = '../../index.html';
80+
document.querySelector(".btn-lo").style.display = "none";
81+
document.querySelector(".btn-clear").style.display = "none";
82+
document.querySelector("#account").style.display = "none";
83+
document.querySelector(".btn-logon").style.display = "block";
84+
85+
var newPara = document.createElement('p');
86+
87+
newPara.innerHTML = 'Not logged in. Please <a href="./login.html">log in</a>.';
88+
89+
document.getElementById('load').style.display = 'none';
90+
document.getElementById('newProjectForm').style.display = 'none';
91+
document.querySelector('.projects-container').appendChild(newPara);
7992
} else if (
8093
window.localStorage.getItem('li') !== null &&
8194
window.localStorage.getItem('offline') === 'true'
8295
) {
8396
document.getElementById('account').style.display = 'none';
97+
document.querySelector(".btn-logon").style.display = "none";
8498
var username = window.localStorage.getItem('li');
8599

86100
var data = JSON.parse(window.localStorage.getItem(username));
@@ -194,27 +208,71 @@ document.getElementById('new').onclick = function () {
194208
);
195209
} else if (
196210
document.getElementById('name').value !== '' &&
197-
window.localStorage.getItem('offline') === 'true' &&
198-
pjs.includes(document.getElementById('name').value) !== true
211+
window.localStorage.getItem('offline') === 'true'
199212
) {
200-
set(document.getElementById('name').value, {
201-
name: document.getElementById('name').value,
202-
sources: [],
203-
});
204-
var accountData = JSON.parse(
205-
window.localStorage.getItem(window.localStorage.getItem('li'))
206-
);
207-
if (accountData.editor !== '') {
208-
accountData.editor =
209-
accountData.editor + ':' + document.getElementById('name').value;
210-
} else {
211-
accountData.editor = document.getElementById('name').value;
213+
var editorData;
214+
function trySet(count) {
215+
if (count == 0) {
216+
var checkedData;
217+
get(document.getElementById('name').value).then((val) => {
218+
checkedData = val;
219+
if (checkedData === undefined) {
220+
set(document.getElementById('name').value, {
221+
name: document.getElementById('name').value,
222+
sources: [],
223+
});
224+
editorData = document.getElementById('name').value;
225+
var accountData = JSON.parse(
226+
window.localStorage.getItem(window.localStorage.getItem('li'))
227+
);
228+
if (accountData.editor !== '') {
229+
accountData.editor =
230+
accountData.editor + ':' + editorData;
231+
} else {
232+
accountData.editor = editorData;
233+
}
234+
window.localStorage.setItem(
235+
window.localStorage.getItem('li'),
236+
JSON.stringify(accountData)
237+
);
238+
window.location = './editor.html?id=' + editorData;
239+
} else {
240+
count += 1;
241+
trySet(count)
242+
}
243+
})
244+
} else {
245+
var checkedData;
246+
get(document.getElementById('name').value + count).then((val) => {
247+
checkedData = val;
248+
if (checkedData === undefined) {
249+
set(document.getElementById('name').value + count, {
250+
name: document.getElementById('name').value,
251+
sources: [],
252+
});
253+
editorData = document.getElementById('name').value + count;
254+
var accountData = JSON.parse(
255+
window.localStorage.getItem(window.localStorage.getItem('li'))
256+
);
257+
if (accountData.editor !== '') {
258+
accountData.editor =
259+
accountData.editor + ':' + editorData;
260+
} else {
261+
accountData.editor = editorData;
262+
}
263+
window.localStorage.setItem(
264+
window.localStorage.getItem('li'),
265+
JSON.stringify(accountData)
266+
);
267+
window.location = './editor.html?id=' + editorData;
268+
} else {
269+
count += 1;
270+
trySet(count)
271+
}
272+
})
273+
}
212274
}
213-
window.localStorage.setItem(
214-
window.localStorage.getItem('li'),
215-
JSON.stringify(accountData)
216-
);
217-
window.location = './editor.html?id=' + document.getElementById('name').value
275+
trySet(0);
218276
} else {
219277
alert('please enter a name!');
220278
}
@@ -527,3 +585,7 @@ document.querySelector(".btn-clear").onclick = function() {
527585
}
528586

529587
}
588+
589+
document.querySelector(".btn-logon").onclick = function() {
590+
window.location.replace("./login.html");
591+
}

src/views/dashboard.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@
2727
<body>
2828
<div class="editor-menu">
2929
<img id="logo" src="../../img/favicon.png" />
30+
<button class="btn btn-logon">Log In</button>
3031
<button class="btn btn-lo">Log Out</button>
3132
<button class="btn btn-clear">Clear Data</button>
3233
<button class="btn" data-title="Account Settings" id="account">
3334
Account Settings
3435
</button>
35-
<p id="ver">v1.5.7</p>
36+
<p id="ver">v1.5.8</p>
3637
</div>
3738

3839
<div class="projects-container">
@@ -45,6 +46,9 @@
4546
<p id="load">loading...</p>
4647
</div>
4748
</body>
49+
<script>
50+
window.localStorage.setItem('offline', 'true');
51+
</script>
4852
<script src="../../lib/idb.min.js"></script>
4953
<!-- <script
5054
src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.5.1/gsap.min.js"

src/views/editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
</label>
105105
</div>
106106
<div id="settingsMenu"></div>
107-
<i id="ver" style="font-size: 2rem;">v1.5.7</i>
107+
<i id="ver" style="font-size: 2rem;">v1.5.8</i>
108108
<iframe frameborder="0" id="iframe"></iframe>
109109
<div style="display: none;" class="tocl tocl-4">
110110
<p class="toclp">Console</p>

0 commit comments

Comments
 (0)