Skip to content

Commit 48d87d7

Browse files
committed
fix jsbin no resources bug
1 parent db718f5 commit 48d87d7

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

launcher.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838

3939
function assembleHtml(head, body, css, js) {
4040
var html = '<!doctype html>\n<html>\n\n';
41-
41+
if(css==='jsbin'){
42+
head = head.replace(/\/lib\//g,'https://blockly.webduino.io/lib/');
43+
body = body.replace(/\/media\//g,'https://blockly.webduino.io/media/');
44+
}
4245
html += ('<head>' +
4346
(head ? '\n ' + head + '\n' : '') +
4447
(css ? '\n <style>' + css + '</style>\n' : '') +
@@ -118,12 +121,11 @@
118121

119122
jsbin: function (config) {
120123
var data = config.data;
121-
122124
if (config.jsPreprocessor) {
123125
data[config.jsPreprocessor] = data.js;
124126
delete data.js;
125127
}
126-
data.html = assembleHtml(data.head, data.body);
128+
data.html = assembleHtml(data.head,data.body,'jsbin');
127129
config.modes = config.modes || 'html,css,js,output';
128130

129131
post('//bin.webduino.io?' + config.modes, data);

templates/demo-area-02.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</template>
2828
<template id="body">
2929
<div id="demo-area-02-light" class="off">
30-
<img src="//blockly.webduino.io/media/off.jpg" id="demo-area-02-off">
31-
<img src="//blockly.webduino.io/media/on.jpg" id="demo-area-02-on">
30+
<img src="/media/off.jpg" id="demo-area-02-off">
31+
<img src="/media/on.jpg" id="demo-area-02-on">
3232
</div>
3333
</template>

templates/demo-area-03.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
</template>
3434
<template id="body">
3535
<div id="demo-area-03-container">
36-
<img src="http://blockly.webduino.io/media/webduino-logo.jpg" id="demo-area-03-image">
36+
<img src="/media/webduino-logo.jpg" id="demo-area-03-image">
3737
</div>
3838
</template>

0 commit comments

Comments
 (0)