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

add build

This commit is contained in:
Kushagra Gour
2017-11-19 02:09:49 +05:30
parent d2026d026e
commit 709c59f1b4
3 changed files with 455 additions and 250 deletions

29
dist/script.js vendored
View File

@@ -26,7 +26,9 @@ if ('serviceWorker' in navigator) {
// It won't be able to control pages unless it's located at the same level or higher than them.
// *Don't* register service worker file in, e.g., a scripts/ sub-directory!
// See https://github.com/slightlyoff/ServiceWorker/issues/468
navigator.serviceWorker.register('service-worker.js').then(function(reg) {
navigator.serviceWorker
.register('service-worker.js')
.then(function(reg) {
// updatefound is fired if service-worker.js changes.
reg.onupdatefound = function() {
// The updatefound event implies that reg.installing is set; see
@@ -50,12 +52,15 @@ if ('serviceWorker' in navigator) {
break;
case 'redundant':
console.error('The installing service worker became redundant.');
console.error(
'The installing service worker became redundant.'
);
break;
}
};
};
}).catch(function(e) {
})
.catch(function(e) {
console.error('Error during service worker registration:', e);
});
});
@@ -1628,7 +1633,9 @@ globalConsoleContainerEl
contents +=
'<script src="' +
// chrome.extension.getURL('lib/screenlog.js') +
(chrome.extension
? chrome.extension.getURL('lib/screenlog.js')
: `${location.origin}/lib/screenlog.js`) +
'"></script>';
if (jsMode === JsModes.ES6) {
@@ -1638,7 +1645,7 @@ globalConsoleContainerEl
'"></script>';
}
if (js) {
if (js !== undefined) {
contents += '<script>\n' + js + '\n//# sourceURL=userscript.js';
} else {
var origin = chrome.i18n.getMessage()
@@ -1706,7 +1713,8 @@ globalConsoleContainerEl
}
function createPreviewFile(html, css, js) {
var contents = getCompleteHtml(html, css);
const shouldInlineJs = !window.webkitRequestFileSystem;
var contents = getCompleteHtml(html, css, shouldInlineJs ? js : '');
var blob = new Blob([contents], { type: 'text/plain;charset=UTF-8' });
var blobjs = new Blob([js], { type: 'text/plain;charset=UTF-8' });
@@ -1716,6 +1724,14 @@ globalConsoleContainerEl
trackEvent.hasTrackedCode = true;
}
if (shouldInlineJs) {
frame.src = frame.src;
setTimeout(() => {
frame.contentDocument.open();
frame.contentDocument.write(contents);
frame.contentDocument.close();
}, 10);
} else {
// we need to store user script in external JS file to prevent inline-script
// CSP from affecting it.
writeFile('script.js', blobjs, function() {
@@ -1732,6 +1748,7 @@ globalConsoleContainerEl
});
});
}
}
scope.setPreviewContent = function(isForced) {
if (!prefs.preserveConsoleLogs) {

304
dist/service-worker.js vendored

File diff suppressed because one or more lines are too long

2
dist/style.css vendored
View File

@@ -977,4 +977,4 @@ while the theme CSS file is loading */
color: #D1EDFF;
}
.cm-s-midnight .CodeMirror-gutters { background: #0F192A; border-right: 1px solid; }
.cm-s-midnight .CodeMirror-activeline-background { background: #253540; color: blue; }
.cm-s-midnight .CodeMirror-activeline-background { background: #253540; }