Skip to content

Commit 6491290

Browse files
authored
Merge pull request #228 from codeitcodes/patch-1
2 parents 75a5d84 + 9dec76c commit 6491290

File tree

17 files changed

+205
-92
lines changed

17 files changed

+205
-92
lines changed

404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
text-rendering: optimizeLegibility;
5151
font-feature-settings: "kern";
5252
-webkit-font-feature-settings: "kern";
53-
touch-action: manipulation;
53+
font-synthesis: none;
5454
overscroll-behavior: none;
5555
user-select: none;
5656
-webkit-user-select: none;

api/oembed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function handler(request, response) {
2929
"width": 700,
3030
"height": 480,
3131
"html": embedHTML,
32-
"version": "1.0",
32+
"version": "2.0",
3333
"cache_age": 3600,
3434
"provider_name": "Codeit",
3535
"provider_url": "https://codeit.codes/"

bottomfloat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ function checkBottomFloat() {
134134
bottomWrapper.classList.add('hidden');
135135

136136
// if scrolled to bottom of codeit
137-
if ((st + cd.offsetHeight) >= cd.scrollHeight) {
137+
if (cd.scrollTop >= (cd.scrollHeight - cd.offsetHeight)) {
138138

139139
// set timeout
140140
window.setTimeout(() => {
141141

142142
// if still on bottom of codeit
143-
if ((cd.scrollTop + cd.offsetHeight) >= cd.scrollHeight) {
143+
if (cd.scrollTop >= (cd.scrollHeight - cd.offsetHeight)) {
144144

145145
// show bottom float
146146
bottomWrapper.classList.remove('hidden');

codedrop.js

Lines changed: 106 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,71 @@ function processFile(file) {
119119

120120
showMessage('Opening file...', -1);
121121

122+
123+
cd.style.display = 'none';
124+
125+
if (liveToggle.classList.contains('visible')) {
126+
127+
liveToggle.classList.remove('visible');
128+
129+
}
130+
131+
if (liveView.classList.contains('file-open')) {
132+
133+
liveView.classList.add('notransition');
134+
liveView.classList.remove('file-open');
135+
136+
onNextFrame(() => {
137+
liveView.classList.remove('notransition');
138+
});
139+
140+
}
141+
142+
// clear existing selections in HTML
143+
if (fileWrapper.querySelector('.selected')) {
144+
fileWrapper.querySelector('.selected').classList.remove('selected');
145+
}
146+
147+
// if adding a new file, remove it
148+
if (fileWrapper.querySelector('.focused')) {
149+
150+
fileWrapper.querySelector('.focused').classList.add('hidden');
151+
152+
window.setTimeout(() => {
153+
fileWrapper.querySelector('.focused').remove();
154+
}, 180);
155+
156+
}
157+
158+
159+
// show all files in HTML
160+
let files = fileWrapper.querySelectorAll('.item[style="display: none;"]');
161+
files.forEach(file => {
162+
file.style.display = ''
163+
});
164+
165+
header.classList.remove('searching');
166+
167+
168+
// if previous file selection exists
169+
if (selectedFile.sha) {
170+
171+
// get previous selection in modifiedFiles array
172+
let selectedItem = modifiedFiles[selectedFile.sha];
173+
174+
// if previous selection was modified
175+
if (selectedItem) {
176+
177+
// save previous selection in localStorage
178+
updateModFileContent(selectedFile.sha, selectedFile.content);
179+
updateModFileCaretPos(selectedFile.sha, selectedFile.caretPos);
180+
updateModFileScrollPos(selectedFile.sha, selectedFile.scrollPos);
181+
182+
}
183+
184+
}
185+
186+
122187
const reader = new FileReader();
123188

124189
reader.addEventListener('load', (event) => {
@@ -188,11 +253,11 @@ function processFile(file) {
188253
updateLineNumbersHTML();
189254

190255
if (liveToggle.classList.contains('visible')) {
191-
256+
192257
liveToggle.classList.remove('visible');
193-
258+
194259
}
195-
260+
196261
if (liveView.classList.contains('file-open')) {
197262

198263
liveView.classList.add('notransition');
@@ -201,9 +266,11 @@ function processFile(file) {
201266
onNextFrame(() => {
202267
liveView.classList.remove('notransition');
203268
});
204-
269+
205270
}
206271

272+
cd.style.display = '';
273+
207274

208275
hideMessage();
209276

@@ -233,28 +300,31 @@ body.addEventListener('drop', (ev) => {
233300

234301

235302
if (ev.dataTransfer.items) {
303+
304+
// if dropped item isn't a file, reject it
305+
if (ev.dataTransfer.items[0] &&
306+
ev.dataTransfer.items[0].kind === 'file') {
236307

237-
// use DataTransferItemList interface to access the file(s)
238-
for (var i = 0; i < ev.dataTransfer.items.length; i++) {
239-
240-
// if dropped items aren't files, reject them
241-
if (ev.dataTransfer.items[i].kind === 'file') {
242-
243-
var file = ev.dataTransfer.items[i].getAsFile();
244-
processFile(file);
245-
246-
}
308+
// process file
309+
const file = ev.dataTransfer.items[0].getAsFile();
310+
processFile(file);
247311

248312
}
313+
314+
/*
315+
// run on all files
316+
for (let i = 0; i < ev.dataTransfer.items.length; i++) {
317+
*/
249318

250319
} else {
251-
252-
// use DataTransfer interface to access the file(s)
253-
for (var i = 0; i < ev.dataTransfer.files.length; i++) {
254-
255-
processFile(ev.dataTransfer.files[i]);
256-
257-
}
320+
321+
// process file
322+
processFile(ev.dataTransfer.files[0]);
323+
324+
/*
325+
// run on all files
326+
for (let i = 0; i < ev.dataTransfer.files.length; i++) {
327+
*/
258328

259329
}
260330

@@ -264,19 +334,25 @@ body.addEventListener('dragover', (ev) => {
264334

265335
// prevent default behavior (prevent file from being opened)
266336
ev.preventDefault();
337+
338+
// if dropping a file
339+
if (ev.dataTransfer.items[0] &&
340+
ev.dataTransfer.items[0].kind === 'file') {
267341

268-
// show drop indication
342+
// show drop indication
269343

270-
if (!liveView.classList.contains('file-open')) {
271-
272-
cd.classList.add('focus');
273-
274-
} else {
275-
276-
liveView.classList.add('focus');
344+
if (!liveView.classList.contains('file-open')) {
345+
346+
cd.classList.add('focus');
347+
348+
} else {
349+
350+
liveView.classList.add('focus');
351+
352+
}
277353

278354
}
279-
355+
280356
})
281357

282358
body.addEventListener('dragleave', (ev) => {

dark-theme.css

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,27 @@ body:not(.mobile) ::-webkit-scrollbar-thumb:active {
4747
.cd-wrapper .autocomplete {
4848
background: hsl(218deg 23% 35%);
4949
color: #a6c3d4;
50-
margin-top: 22.5px;
51-
margin-top: 23px;
50+
margin-top: 21px;
5251
margin-left: -3px;
5352
font-family: 'Mono Sans', 'Roboto Mono', consolas, lucida console, courier new, monospace;
5453
line-height: 1.5;
5554
padding: 0;
5655
box-shadow: none;
5756
position: fixed;
5857
z-index: 1000;
59-
border-radius: 7px;
58+
border-radius: 8px;
59+
border-radius: 7.5px;
6060
border: 1px solid hsl(219deg 22% 38%);
61+
border: 2.5px solid transparent;
6162
pointer-events: none;
6263
overflow-y: overlay;
6364
min-width: 62px;
64-
/* max-width: 190px; */
65-
max-height: 252px;
65+
/* max-width: 190px;
66+
max-height: 224px;
67+
max-height: 129px; */
68+
max-height: 140px;
69+
/* box-shadow: 0px 3px 6px 1px hsl(221deg 16% 20%); */
70+
box-shadow: 0px 3px 6px 1px hsl(221deg 16% 21%);
6671
display: none;
6772
}
6873

@@ -72,7 +77,7 @@ body:not(.mobile) ::-webkit-scrollbar-thumb:active {
7277

7378
.cd-wrapper .autocomplete .icon {
7479
padding: 2px;
75-
border-radius: 4px;
80+
border-radius: 5px;
7681
white-space: nowrap;
7782
overflow-x: overlay;
7883
}
@@ -94,9 +99,11 @@ body:not(.mobile) .autocomplete::-webkit-scrollbar-track {
9499
}
95100

96101
body:not(.mobile) .autocomplete::-webkit-scrollbar-thumb {
97-
border-top-width: 9px;
98-
border-bottom-width: 9px;
99102
background-color: rgb(249 249 249 / 15%);
103+
border-top-width: 5px;
104+
border-bottom-width: 5px;
105+
border-left-width: 5px;
106+
border-right-width: 3px;
100107
}
101108

102109
.cd-wrapper .top-hit {
@@ -351,3 +358,4 @@ span.inline-color::after {
351358
span.inline-color-wrapper:hover span.inline-color::after {
352359
box-shadow: 0 0 0 1px hsl(221deg 12% 67%), inset 0 0 0 1px #313744;
353360
}
361+

filebrowser.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ async function renderSidebarHTML() {
383383
// stop loading
384384
stopLoading();
385385

386-
showMessage('Whoops, your Github login expired.', 5000);
386+
showMessage('Whoops, your Git login expired.', 5000);
387387

388388
sidebar.classList.add('intro');
389389

@@ -2648,10 +2648,20 @@ if (isDev) {
26482648
// load git token from clipboard
26492649
async function loadGitToken() {
26502650

2651-
gitToken = await readClipboard();
2651+
const clipboardText = (await readClipboard()).split(',');
26522652

2653+
if (clipboardText.length !== 2) return;
2654+
2655+
gitToken = clipboardText[0];
2656+
2657+
// save git token in local storage
26532658
saveGitTokenLS(gitToken);
26542659

2660+
loggedUser = clipboardText[1];
2661+
2662+
// save logged user in local storage
2663+
setStorage('loggedUser', loggedUser);
2664+
26552665
hideDialog();
26562666

26572667
// close intro and learn pages

full.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ body.expanded .sidebar-toggle svg .left {
731731
transform: none;
732732
overflow-x: hidden;
733733
overflow-y: overlay;
734+
overscroll-behavior-y: contain;
734735
pointer-events: none;
735736
box-shadow: inset -1px 0 0 0 #ffffff3d;
736737
padding-left: env(safe-area-inset-left);
@@ -1559,7 +1560,7 @@ body:not(.mobile) .sidebar .header .title .branch-icon:active {
15591560

15601561
body.mobile .sidebar .button {
15611562
transition: .1s var(--ease-function);
1562-
transition-property: background, color;
1563+
transition-property: background, color, box-shadow;
15631564
}
15641565

15651566
.sidebar .button.secondary {
@@ -2532,7 +2533,7 @@ html, body {
25322533
text-rendering: optimizeLegibility;
25332534
font-feature-settings: "kern";
25342535
-webkit-font-feature-settings: "kern";
2535-
touch-action: none;
2536+
font-synthesis: none;
25362537
overscroll-behavior: none;
25372538
user-select: none;
25382539
-webkit-user-select: none;

homepage/homepage.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4896,16 +4896,21 @@ body {
48964896

48974897
}
48984898

4899-
body {
4899+
html, body {
49004900
text-rendering: optimizeLegibility;
49014901
font-feature-settings: "kern";
49024902
-webkit-font-feature-settings: "kern";
4903+
touch-action: none;
4904+
font-synthesis: none;
4905+
overscroll-behavior: none;
4906+
user-select: text;
4907+
-webkit-user-select: text;
4908+
-webkit-touch-callout: none;
49034909
-webkit-font-smoothing: antialiased;
49044910
-webkit-tap-highlight-color: transparent;
49054911
-webkit-text-size-adjust: 100%;
49064912
-webkit-overflow-scrolling: touch;
4907-
overscroll-behavior: none;
4908-
overscroll-behavior-y: contain;
4913+
-webkit-text-size-adjust: none;
49094914
}
49104915

49114916
::selection {

0 commit comments

Comments
 (0)