MCPcopy Create free account
hub / github.com/arfct/itty-bitty / fetchCodepen

Function fetchCodepen

docs/v1/edit.js:161–193  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

159
160var TEMPLATE_MARKER = "/*use-itty-bitty-template*/";
161function fetchCodepen(url) {
162 var h, c, j;
163 $.when(
164 $.get({ url: url + ".html", cache: false }, function(html) {
165 h = html;
166 }),
167 $.get({ url: url + ".css", cache: false }, function(css) {
168 c = css;
169 }),
170 $.get({ url: url + ".js", cache: false }, function(js) {
171 j = js;
172 })
173 ).then(function() {
174 var useTemplate = c.indexOf(TEMPLATE_MARKER) >= 0;
175 var string =
176 '<style type="text/css">' +
177 c +
178 "</style>" +
179 h +
180 '<script type="text/javascript">' +
181 j +
182 "</script>";
183 stringToZip(string, function(zip) {
184 setFileName("✒️" + url);
185 var title = QS("#doc-title").innerText;
186 setTimeout(function() {
187 var data = (useTemplate ? "" : DATA_PREFIX_BXZE) + zip;
188 importedFileData = data;
189 updateLink(data, title);
190 }, 300);
191 });
192 });
193}
194
195function handleInput(e) {
196 updateBodyClass();

Callers 1

handlePasteFunction · 0.70

Calls 4

stringToZipFunction · 0.70
setFileNameFunction · 0.70
updateLinkFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected