Skip to content

Commit ce8f8e5

Browse files
authored
Codet 3.4.3
2 parents 6b04b2c + 53580c2 commit ce8f8e5

File tree

13 files changed

+1045
-633
lines changed

13 files changed

+1045
-633
lines changed

404.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@
5252
-webkit-font-feature-settings: "kern";
5353
font-synthesis: none;
5454
overscroll-behavior: none;
55-
user-select: none;
56-
-webkit-user-select: none;
55+
user-select: text;
56+
-webkit-user-select: text;
5757
-webkit-touch-callout: none;
5858
-webkit-font-smoothing: antialiased;
5959
-webkit-tap-highlight-color: transparent;
6060
-webkit-text-size-adjust: 100%;
6161
-webkit-overflow-scrolling: touch;
62-
-webkit-text-size-adjust: none;
6362
}
6463

6564
</style>

context-menu.js

Lines changed: 66 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,61 @@ contextMenu = {
3535

3636
options.share.addEventListener('click', async () => {
3737

38-
const activeFileName = contextMenu.activeEl.querySelector('.name').textContent
39-
.replaceAll('\n','');
38+
const itemName = contextMenu.activeEl.querySelector('.name').textContent
39+
.replaceAll('\n','');
4040

41-
const link = createLink({
42-
dir: treeLoc,
43-
file: { name: activeFileName },
44-
openLive: false
45-
});
41+
let link;
4642

47-
copy(link).then(() => {
43+
let repoObj;
44+
45+
if (contextMenu.activeEl.classList.contains('file')) {
46+
47+
link = createLink({
48+
dir: treeLoc,
49+
file: { name: itemName },
50+
openLive: false
51+
});
52+
53+
} else if (contextMenu.activeEl.classList.contains('folder')) {
54+
55+
link = createLink({
56+
dir: [treeLoc[0], treeLoc[1], treeLoc[2] + '/' + itemName]
57+
});
58+
59+
} else {
60+
61+
let fullName = getAttr(contextMenu.activeEl, 'fullName');
62+
63+
if (!fullName) {
64+
65+
repoObj = getAttr(contextMenu.activeEl, 'repoObj');
66+
67+
repoObj = JSON.parse(decodeURI(repoObj));
68+
69+
fullName = repoObj.fullName;
70+
71+
} else {
72+
73+
repoObj = modifiedRepos[fullName];
74+
75+
}
76+
77+
[user, repo] = fullName.split('/');
78+
79+
link = createLink({
80+
dir: [user, repo, '']
81+
});
82+
83+
}
4884

49-
const [user, repo] = treeLoc;
50-
const repoObj = modifiedRepos[user + '/' + repo.split(':')[0]];
85+
copy(link).then(() => {
86+
87+
if (!repoObj) {
88+
89+
const [user, repo] = treeLoc;
90+
repoObj = modifiedRepos[user + '/' + repo.split(':')[0]];
91+
92+
}
5193

5294
if (!repoObj.private) {
5395

@@ -61,7 +103,7 @@ contextMenu = {
61103
});
62104

63105
}
64-
106+
65107
});
66108

67109
});
@@ -74,22 +116,30 @@ contextMenu = {
74116

75117
},
76118

77-
addFileListener: (file) => {
119+
addItemListener: (item) => {
78120

79121
if (!isMobile) {
80122

81-
file.addEventListener('contextmenu', async (e) => {
123+
item.addEventListener('contextmenu', async (e) => {
82124

83-
contextMenu.activeEl = file;
84-
file.classList.add('active');
125+
contextMenu.activeEl = item;
126+
item.classList.add('active');
85127

86128
onNextFrame(() => {
87129
moveElToMouse(contextMenu.el, e, 13);
88130
});
89131

90132
contextMenu.el.classList.add('visible', 'animating');
91133

92-
contextMenu.el.classList.toggle('modified', file.classList.contains('modified'));
134+
if (item.classList.contains('file')) {
135+
136+
contextMenu.el.classList.toggle('modified', item.classList.contains('modified'));
137+
138+
} else {
139+
140+
contextMenu.el.classList.remove('modified');
141+
142+
}
93143

94144
window.setTimeout(() => {
95145

0 commit comments

Comments
 (0)