diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-04-20 03:09:25 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-04-24 16:14:29 +0200 |
commit | 82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch) | |
tree | 965f6eb89b84d65a62b49008fd972c004832ccd1 /thirdparty/URI.js/build.js | |
parent | e6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff) |
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules
into one file (plus commons chunks) for every entry point. This results
in a much smaller extension size (almost half). Furthermore we use
yarn/npm even for extension run-time dependencies. This relieves us
from manually vendoring and building dependencies. It's also easier to
understand for new developers familiar with node.
Diffstat (limited to 'thirdparty/URI.js/build.js')
-rw-r--r-- | thirdparty/URI.js/build.js | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/thirdparty/URI.js/build.js b/thirdparty/URI.js/build.js deleted file mode 100644 index 21d0bb531..000000000 --- a/thirdparty/URI.js/build.js +++ /dev/null @@ -1,78 +0,0 @@ -(function($, undefined){ - window.URL = window.webkitURL || window.URL; - window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder; - -function build(files) { - var $out = $('#output'), - $progress = $('#prog'), - sources = [], - connections = [], - source; - - $out.parent().hide(); - $progress.show().prop('value', 1).text('Loading Files'); - - for (var i = 0, length = files.length; i < length; i++) { - sources.push(""); - (function(i, file){ - connections.push($.get("src/" + file, function(data) { - sources[i] = data; - }, "text")); - })(i, files[i]); - } - - $.when.apply($, connections).done(function() { - $progress.prop('value', 2).text('Compiling Scripts'); - $.post('https://closure-compiler.appspot.com/compile', { - js_code: sources.join("\n\n"), - compilation_level: "SIMPLE_OPTIMIZATIONS", - output_format: "text", - output_info: "compiled_code" - }, function(data) { - var code = "/*! URI.js v1.18.2 http://medialize.github.io/URI.js/ */\n/* build contains: " + files.join(', ') + " */\n" + data; - $progress.hide(); - $out.val(code).parent().show(); - $out.prev().find('a').remove(); - $out.prev().prepend(download(code)); - }).error(function() { - alert("Your browser is incapable of cross-domain communication.\nPlease see instructions for manual build below."); - }); - }); -}; - -function download(code) { - var blob = new Blob([code], {type: 'text\/javascript'}); - - var a = document.createElement('a'); - a.download = 'URI.js'; - a.href = window.URL.createObjectURL(blob); - a.textContent = 'Download'; - a.dataset.downloadurl = ['text/javascript', a.download, a.href].join(':'); - - return a; -}; - -$(function(){ - $('#builder').on('submit', function(e) { - var $this = $(this), - $files = $this.find('input:checked'), - files = []; - - e.preventDefault(); - e.stopImmediatePropagation(); - - if (!$files.length) { - alert("please choose at least one file!"); - return; - } - - $files.each(function() { - var val = $(this).val(); - val.length && files.push(val); - }); - - build(files); - }); -}); - -})(jQuery); |