|
1 | 1 | (function (root, factory) {
|
2 |
| - if (typeof define === 'function' && define.amd) { |
3 |
| - //Allow using this built library as an AMD module |
4 |
| - //in another project. That other project will only |
5 |
| - //see this AMD call, not the internal modules in |
6 |
| - //the closure below. |
7 |
| - define([], factory); |
8 |
| - } else if (typeof module !== 'undefined') { |
9 |
| - module.exports = factory(); |
| 2 | + var factorySource = factory.toString(); |
| 3 | + |
| 4 | + if (typeof module !== 'undefined') { |
| 5 | + module.exports = factory(factorySource); |
10 | 6 | } else {
|
11 | 7 | //Browser globals case. Just assign the
|
12 | 8 | //result to a property on the global.
|
13 |
| - root.Quagga = factory(); |
| 9 | + root.Quagga = factory(factorySource); |
14 | 10 | }
|
15 |
| -}(this, function () {/** |
| 11 | +}(this, function (__factorySource__) {/** |
16 | 12 | * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
|
17 | 13 | * Available via the MIT or new BSD license.
|
18 | 14 | * see: http://github.com/jrburke/almond for details
|
@@ -7300,8 +7296,9 @@ define('camera_access',["html_utils"], function(HtmlUtils) {
|
7300 | 7296 | }
|
7301 | 7297 | };
|
7302 | 7298 | });
|
7303 |
| -/* jshint undef: true, unused: true, browser:true, devel: true */ |
7304 |
| -/* global define, vec2, importScripts */ |
| 7299 | +/* jshint undef: true, unused: true, browser:true, devel: true, evil: true */ |
| 7300 | +/* global define, vec2 */ |
| 7301 | + |
7305 | 7302 |
|
7306 | 7303 | define('quagga',["code_128_reader", "ean_reader", "input_stream", "image_wrapper", "barcode_locator", "barcode_decoder", "frame_grabber", "html_utils", "config", "events", "camera_access", "image_debug"],
|
7307 | 7304 | function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, BarcodeDecoder, FrameGrabber, HtmlUtils, _config, Events, CameraAccess, ImageDebug) {
|
@@ -7580,8 +7577,13 @@ function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, Ba
|
7580 | 7577 | }
|
7581 | 7578 |
|
7582 | 7579 |
|
7583 |
| - function workerInterface(scriptUrl) { |
7584 |
| - importScripts(scriptUrl); |
| 7580 | + function workerInterface(factory) { |
| 7581 | + if (factory) { |
| 7582 | + var Quagga = factory(); |
| 7583 | + if (!Quagga) { |
| 7584 | + return; |
| 7585 | + } |
| 7586 | + } |
7585 | 7587 | /* jshint ignore:start */
|
7586 | 7588 | var imageWrapper;
|
7587 | 7589 |
|
@@ -7615,18 +7617,15 @@ function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, Ba
|
7615 | 7617 |
|
7616 | 7618 | function generateWorkerBlob() {
|
7617 | 7619 | var blob,
|
7618 |
| - quaggaAbsoluteUrl, |
7619 |
| - scripts = document.getElementsByTagName('script'), |
7620 |
| - regex = new RegExp('\/' + _config.scriptName + '$'); |
7621 |
| - |
7622 |
| - quaggaAbsoluteUrl = Array.prototype.slice.apply(scripts).filter(function(script) { |
7623 |
| - return script.src && script.src.match(regex); |
7624 |
| - }).map(function(script) { |
7625 |
| - return script.src; |
7626 |
| - })[0]; |
| 7620 | + factorySource; |
7627 | 7621 |
|
| 7622 | + /* jshint ignore:start */ |
| 7623 | + if (typeof __factorySource__ !== 'undefined') { |
| 7624 | + factorySource = __factorySource__; |
| 7625 | + } |
| 7626 | + /* jshint ignore:end */ |
7628 | 7627 |
|
7629 |
| - blob = new Blob(['(' + workerInterface.toString() + ')("' + quaggaAbsoluteUrl + '");'], |
| 7628 | + blob = new Blob(['(' + workerInterface.toString() + ')(' + factorySource + ');'], |
7630 | 7629 | {type : 'text/javascript'});
|
7631 | 7630 |
|
7632 | 7631 | return window.URL.createObjectURL(blob);
|
|
0 commit comments