Skip to content

Commit d5f9289

Browse files
committed
Update api-link-parser.js
1 parent e06aaec commit d5f9289

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

api-link-parser.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ function decodeLink(url) {
7979
// show file in live view
8080
linkData.openLive = true;
8181

82+
} else if (isEmbed) { // if link is embed
83+
84+
// show file link
85+
linkData.redirect = baseURL + '/full?dir=' +
86+
linkData.user + ',' + linkData.repo +
87+
',' + linkData.contents +
88+
'&file=' + linkData.file;
89+
90+
linkData.redirectText = 'Open ' + linkData.user + '/' + linkData.repo + ' with Codeit';
91+
8292
} // else, show the file's code
8393

8494
} else { // if linking to directory
@@ -90,6 +100,8 @@ function decodeLink(url) {
90100
linkData.redirect = baseURL + '/full?dir=' +
91101
linkData.user + ',' + linkData.repo +
92102
',' + linkData.contents;
103+
104+
linkData.redirectText = 'Open ' + linkData.user + '/' + linkData.repo + ' with Codeit';
93105

94106
} // else, show directory
95107

@@ -99,6 +111,7 @@ function decodeLink(url) {
99111

100112
// show codeit link
101113
linkData.redirect = baseURL;
114+
linkData.redirectText = 'Open Codeit';
102115

103116
}
104117

@@ -109,8 +122,9 @@ function decodeLink(url) {
109122

110123
// if redirect exists
111124
if (linkData.redirect) {
112-
113-
resp += '/redirect?to=' + linkData.redirect;
125+
126+
resp += '/redirect?to=' + linkData.redirect +
127+
'&text=' + linkData.redirectText;
114128

115129
} else {
116130

0 commit comments

Comments
 (0)