Skip to content

Commit baf3c10

Browse files
committed
Update live-view.js
1 parent d3777af commit baf3c10

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

live-view/live-view.js

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,54 @@ async function setupLiveView() {
55
// if URL has a file
66
if (linkData.file) {
77

8+
// get file from URL
9+
const fileName = linkData.file;
10+
811
// change selected file
9-
changeSelectedFile(treeLoc.join(), generateSHA(), linkData.file, '', getFileLang(linkData.file),
12+
changeSelectedFile(treeLoc.join(), generateSHA(), fileName, '', getFileLang(fileName),
1013
[0, 0], [0, 0], false);
1114

15+
16+
// if URL has a live view flag
17+
if (linkData.openLive) {
18+
19+
// if on mobile device
20+
if (isMobile) {
21+
22+
// show URL file name
23+
floatLogo.innerText = fileName;
24+
25+
// don't transition bottom float
26+
bottomWrapper.classList.add('notransition');
27+
28+
// expand bottom float
29+
bottomWrapper.classList.add('expanded');
30+
31+
// fix bottom float on safari
32+
if (isSafari) bottomWrapper.classList.add('fromtop');
33+
34+
// restore transition on next frame
35+
onNextFrame(() => {
36+
bottomWrapper.classList.remove('notransition');
37+
});
38+
39+
} else {
40+
41+
// don't transition live view
42+
liveView.classList.add('notransition');
43+
44+
// show live view
45+
liveView.classList.add('visible');
46+
47+
// restore transition on next frame
48+
onNextFrame(() => {
49+
liveView.classList.remove('notransition');
50+
});
51+
52+
}
53+
54+
}
55+
1256
}
1357

1458

@@ -89,50 +133,6 @@ async function setupLiveView() {
89133
// if URL has a file
90134
if (linkData.file) {
91135

92-
// get file from URL
93-
const fileName = linkData.file;
94-
95-
96-
// if URL has a live view flag
97-
if (linkData.openLive) {
98-
99-
// if on mobile device
100-
if (isMobile) {
101-
102-
// show URL file name
103-
floatLogo.innerText = fileName;
104-
105-
// don't transition bottom float
106-
bottomWrapper.classList.add('notransition');
107-
108-
// expand bottom float
109-
bottomWrapper.classList.add('expanded');
110-
111-
// fix bottom float on safari
112-
if (isSafari) bottomWrapper.classList.add('fromtop');
113-
114-
// restore transition on next frame
115-
onNextFrame(() => {
116-
bottomWrapper.classList.remove('notransition');
117-
});
118-
119-
} else {
120-
121-
// don't transition live view
122-
liveView.classList.add('notransition');
123-
124-
// show live view
125-
liveView.classList.add('visible');
126-
127-
// restore transition on next frame
128-
onNextFrame(() => {
129-
liveView.classList.remove('notransition');
130-
});
131-
132-
}
133-
134-
}
135-
136136
function closeLiveView() {
137137

138138
// if URL has a live view flag

0 commit comments

Comments
 (0)