1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-05-06 18:45:31 +02:00

fix js not showing inline in downloaded file. fixes #53

This commit is contained in:
Kushagra Gour 2017-01-28 00:38:46 +05:30
parent 8ea24447a9
commit 2d091a292a

View File

@ -611,7 +611,7 @@ settingsBtn, onboardModal, notificationsBtn, onboardShowInTabOptionBtn, onboardD
});
}
function getCompleteHtml(html, css) {
function getCompleteHtml(html, css, js) {
var externalJs = externalJsTextarea.value.split('\n').reduce(function (scripts, url) {
return scripts + (url ? '\n<script src="' + url + '"></script>' : '');
}, '');
@ -623,10 +623,16 @@ settingsBtn, onboardModal, notificationsBtn, onboardShowInTabOptionBtn, onboardD
+ '<style id="webmakerstyle">\n' + css + '\n</style>\n'
+ '</head>\n'
+ '<body>\n' + html + '\n'
+ externalJs + '\n<script src="'
+ 'filesystem:chrome-extension://'
+ chrome.i18n.getMessage('@@extension_id') + '/temporary/' + 'script.js' + '">\n'
+ '</script></body>\n</html>';
+ externalJs + '\n';
if (js) {
contents += '<script>\n' + js + '\n//# sourceURL=userscript.js';
} else {
contents += '<script src="'
+ 'filesystem:chrome-extension://'
+ chrome.i18n.getMessage('@@extension_id') + '/temporary/' + 'script.js' + '">'
}
contents += '\n</script>\n</body>\n</html>';
return contents;
}
@ -658,7 +664,7 @@ settingsBtn, onboardModal, notificationsBtn, onboardShowInTabOptionBtn, onboardD
}
function createPreviewFile(html, css, js) {
var contents = getCompleteHtml(html, css, js);
var contents = getCompleteHtml(html, css);
var blob = new Blob([ contents ], { type: "text/plain;charset=UTF-8" });
var blobjs = new Blob([ js ], { type: "text/plain;charset=UTF-8" });