OLD | NEW |
1 /** | 1 /** |
2 * Common JS that talks XHR back to the server and runs the code and receives | 2 * Common JS that talks XHR back to the server and runs the code and receives |
3 * the results. | 3 * the results. |
4 */ | 4 */ |
5 | 5 |
6 /** | 6 /** |
7 * A polyfill for HTML Templates. | 7 * A polyfill for HTML Templates. |
8 * | 8 * |
9 * This just adds in the content attribute, it doesn't stop scripts | 9 * This just adds in the content attribute, it doesn't stop scripts |
10 * from running nor does it stop other side-effects. | 10 * from running nor does it stop other side-effects. |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 if (body.hasOwnProperty('img')) { | 227 if (body.hasOwnProperty('img')) { |
228 img.src = 'data:image/png;base64,' + body.img; | 228 img.src = 'data:image/png;base64,' + body.img; |
229 } else { | 229 } else { |
230 img.src = ''; | 230 img.src = ''; |
231 } | 231 } |
232 // Add the image to the history if we are on a workspace page. | 232 // Add the image to the history if we are on a workspace page. |
233 if (tryHistory) { | 233 if (tryHistory) { |
234 addToHistory(body.hash, 'data:image/png;base64,' + body.img); | 234 addToHistory(body.hash, 'data:image/png;base64,' + body.img); |
235 } else { | 235 } else { |
236 window.history.pushState(null, null, './' + body.hash); | 236 window.history.pushState(null, null, '/c/' + body.hash); |
237 } | 237 } |
238 if (permalink) { | 238 if (permalink) { |
239 permalink.href = '/c/' + body.hash; | 239 permalink.href = '/c/' + body.hash; |
240 } | 240 } |
241 if (embed) { | 241 if (embed) { |
242 var url = document.URL; | 242 var url = document.URL; |
243 url = url.replace('/c/', '/iframe/'); | 243 url = url.replace('/c/', '/iframe/'); |
244 embed.value = '<iframe src="' + url + '" width="740" height="550" style=
"border: solid #00a 5px; border-radius: 5px;"/>' | 244 embed.value = '<iframe src="' + url + '" width="740" height="550" style=
"border: solid #00a 5px; border-radius: 5px;"/>' |
245 } | 245 } |
246 if (embedButton && embedButton.hasAttribute('disabled')) { | 246 if (embedButton && embedButton.hasAttribute('disabled')) { |
(...skipping 26 matching lines...) Expand all Loading... |
273 | 273 |
274 | 274 |
275 // Add the images to the history if we are on a workspace page. | 275 // Add the images to the history if we are on a workspace page. |
276 if (tryHistory && history) { | 276 if (tryHistory && history) { |
277 for (var i=0; i<history.length; i++) { | 277 for (var i=0; i<history.length; i++) { |
278 addToHistory(history[i].hash, '/i/'+history[i].hash+'.png'); | 278 addToHistory(history[i].hash, '/i/'+history[i].hash+'.png'); |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 })(workspaceName); | 282 })(workspaceName); |
OLD | NEW |