mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-12 21:21:42 +08:00
Removing dependency on script-name
This commit is contained in:
+6
-10
@@ -1,15 +1,11 @@
|
|||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
var factorySource = factory.toString();
|
||||||
//Allow using this built library as an AMD module
|
|
||||||
//in another project. That other project will only
|
if (typeof module !== 'undefined') {
|
||||||
//see this AMD call, not the internal modules in
|
module.exports = factory(factorySource);
|
||||||
//the closure below.
|
|
||||||
define([], factory);
|
|
||||||
} else if (typeof module !== 'undefined') {
|
|
||||||
module.exports = factory();
|
|
||||||
} else {
|
} else {
|
||||||
//Browser globals case. Just assign the
|
//Browser globals case. Just assign the
|
||||||
//result to a property on the global.
|
//result to a property on the global.
|
||||||
root.Quagga = factory();
|
root.Quagga = factory(factorySource);
|
||||||
}
|
}
|
||||||
}(this, function () {
|
}(this, function (__factorySource__) {
|
||||||
Vendored
+23
-24
@@ -1,18 +1,14 @@
|
|||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
var factorySource = factory.toString();
|
||||||
//Allow using this built library as an AMD module
|
|
||||||
//in another project. That other project will only
|
if (typeof module !== 'undefined') {
|
||||||
//see this AMD call, not the internal modules in
|
module.exports = factory(factorySource);
|
||||||
//the closure below.
|
|
||||||
define([], factory);
|
|
||||||
} else if (typeof module !== 'undefined') {
|
|
||||||
module.exports = factory();
|
|
||||||
} else {
|
} else {
|
||||||
//Browser globals case. Just assign the
|
//Browser globals case. Just assign the
|
||||||
//result to a property on the global.
|
//result to a property on the global.
|
||||||
root.Quagga = factory();
|
root.Quagga = factory(factorySource);
|
||||||
}
|
}
|
||||||
}(this, function () {/**
|
}(this, function (__factorySource__) {/**
|
||||||
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
|
* @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
|
||||||
* Available via the MIT or new BSD license.
|
* Available via the MIT or new BSD license.
|
||||||
* see: http://github.com/jrburke/almond for details
|
* see: http://github.com/jrburke/almond for details
|
||||||
@@ -7300,8 +7296,9 @@ define('camera_access',["html_utils"], function(HtmlUtils) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
/* jshint undef: true, unused: true, browser:true, devel: true */
|
/* jshint undef: true, unused: true, browser:true, devel: true, evil: true */
|
||||||
/* global define, vec2, importScripts */
|
/* global define, vec2 */
|
||||||
|
|
||||||
|
|
||||||
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"],
|
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"],
|
||||||
function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, BarcodeDecoder, FrameGrabber, HtmlUtils, _config, Events, CameraAccess, ImageDebug) {
|
function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, BarcodeDecoder, FrameGrabber, HtmlUtils, _config, Events, CameraAccess, ImageDebug) {
|
||||||
@@ -7580,8 +7577,13 @@ function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, Ba
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function workerInterface(scriptUrl) {
|
function workerInterface(factory) {
|
||||||
importScripts(scriptUrl);
|
if (factory) {
|
||||||
|
var Quagga = factory();
|
||||||
|
if (!Quagga) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
/* jshint ignore:start */
|
/* jshint ignore:start */
|
||||||
var imageWrapper;
|
var imageWrapper;
|
||||||
|
|
||||||
@@ -7615,18 +7617,15 @@ function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, Ba
|
|||||||
|
|
||||||
function generateWorkerBlob() {
|
function generateWorkerBlob() {
|
||||||
var blob,
|
var blob,
|
||||||
quaggaAbsoluteUrl,
|
factorySource;
|
||||||
scripts = document.getElementsByTagName('script'),
|
|
||||||
regex = new RegExp('\/' + _config.scriptName + '$');
|
|
||||||
|
|
||||||
quaggaAbsoluteUrl = Array.prototype.slice.apply(scripts).filter(function(script) {
|
/* jshint ignore:start */
|
||||||
return script.src && script.src.match(regex);
|
if (typeof __factorySource__ !== 'undefined') {
|
||||||
}).map(function(script) {
|
factorySource = __factorySource__;
|
||||||
return script.src;
|
}
|
||||||
})[0];
|
/* jshint ignore:end */
|
||||||
|
|
||||||
|
blob = new Blob(['(' + workerInterface.toString() + ')(' + factorySource + ');'],
|
||||||
blob = new Blob(['(' + workerInterface.toString() + ')("' + quaggaAbsoluteUrl + '");'],
|
|
||||||
{type : 'text/javascript'});
|
{type : 'text/javascript'});
|
||||||
|
|
||||||
return window.URL.createObjectURL(blob);
|
return window.URL.createObjectURL(blob);
|
||||||
|
|||||||
+17
-14
@@ -1,5 +1,6 @@
|
|||||||
/* jshint undef: true, unused: true, browser:true, devel: true */
|
/* jshint undef: true, unused: true, browser:true, devel: true, evil: true */
|
||||||
/* global define, vec2, importScripts */
|
/* global define, vec2 */
|
||||||
|
|
||||||
|
|
||||||
define(["code_128_reader", "ean_reader", "input_stream", "image_wrapper", "barcode_locator", "barcode_decoder", "frame_grabber", "html_utils", "config", "events", "camera_access", "image_debug"],
|
define(["code_128_reader", "ean_reader", "input_stream", "image_wrapper", "barcode_locator", "barcode_decoder", "frame_grabber", "html_utils", "config", "events", "camera_access", "image_debug"],
|
||||||
function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, BarcodeDecoder, FrameGrabber, HtmlUtils, _config, Events, CameraAccess, ImageDebug) {
|
function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, BarcodeDecoder, FrameGrabber, HtmlUtils, _config, Events, CameraAccess, ImageDebug) {
|
||||||
@@ -278,8 +279,13 @@ function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, Ba
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function workerInterface(scriptUrl) {
|
function workerInterface(factory) {
|
||||||
importScripts(scriptUrl);
|
if (factory) {
|
||||||
|
var Quagga = factory();
|
||||||
|
if (!Quagga) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
/* jshint ignore:start */
|
/* jshint ignore:start */
|
||||||
var imageWrapper;
|
var imageWrapper;
|
||||||
|
|
||||||
@@ -313,18 +319,15 @@ function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, Ba
|
|||||||
|
|
||||||
function generateWorkerBlob() {
|
function generateWorkerBlob() {
|
||||||
var blob,
|
var blob,
|
||||||
quaggaAbsoluteUrl,
|
factorySource;
|
||||||
scripts = document.getElementsByTagName('script'),
|
|
||||||
regex = new RegExp('\/' + _config.scriptName + '$');
|
|
||||||
|
|
||||||
quaggaAbsoluteUrl = Array.prototype.slice.apply(scripts).filter(function(script) {
|
/* jshint ignore:start */
|
||||||
return script.src && script.src.match(regex);
|
if (typeof __factorySource__ !== 'undefined') {
|
||||||
}).map(function(script) {
|
factorySource = __factorySource__;
|
||||||
return script.src;
|
}
|
||||||
})[0];
|
/* jshint ignore:end */
|
||||||
|
|
||||||
|
blob = new Blob(['(' + workerInterface.toString() + ')(' + factorySource + ');'],
|
||||||
blob = new Blob(['(' + workerInterface.toString() + ')("' + quaggaAbsoluteUrl + '");'],
|
|
||||||
{type : 'text/javascript'});
|
{type : 'text/javascript'});
|
||||||
|
|
||||||
return window.URL.createObjectURL(blob);
|
return window.URL.createObjectURL(blob);
|
||||||
|
|||||||
Reference in New Issue
Block a user