mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-02 12:19:11 +00:00
Don't use a fixed ID
This commit is contained in:
parent
049797b7cf
commit
0f51406c08
@ -14,6 +14,8 @@ barcodereader widget for reading barcodes
|
|||||||
|
|
||||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||||
|
|
||||||
|
var nextID = 0;
|
||||||
|
|
||||||
var BarCodeReaderWidget = function(parseTreeNode,options) {
|
var BarCodeReaderWidget = function(parseTreeNode,options) {
|
||||||
this.initialise(parseTreeNode,options);
|
this.initialise(parseTreeNode,options);
|
||||||
};
|
};
|
||||||
@ -32,12 +34,15 @@ BarCodeReaderWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.computeAttributes();
|
this.computeAttributes();
|
||||||
// Make the child widgets
|
// Make the child widgets
|
||||||
this.makeChildWidgets();
|
this.makeChildWidgets();
|
||||||
|
// Generate an ID for this element
|
||||||
|
var id = "capture-widget-internal-" + nextID;
|
||||||
|
nextID += 1;
|
||||||
// Create the DOM node and render children
|
// Create the DOM node and render children
|
||||||
var domNode = this.document.createElement("div");
|
var domNode = this.document.createElement("div");
|
||||||
domNode.className = "tc-readcode-widget";
|
domNode.className = "tc-readcode-widget";
|
||||||
domNode.setAttribute("width","300px");
|
domNode.setAttribute("width","300px");
|
||||||
domNode.setAttribute("height","300px");
|
domNode.setAttribute("height","300px");
|
||||||
domNode.id = "capture"
|
domNode.id = id;
|
||||||
parent.insertBefore(domNode,nextSibling);
|
parent.insertBefore(domNode,nextSibling);
|
||||||
this.renderChildren(domNode,null);
|
this.renderChildren(domNode,null);
|
||||||
this.domNodes.push(domNode);
|
this.domNodes.push(domNode);
|
||||||
@ -58,7 +63,7 @@ BarCodeReaderWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
console.log("Scan error",errorMessage);
|
console.log("Scan error",errorMessage);
|
||||||
}
|
}
|
||||||
var html5QrcodeScanner = new __Html5QrcodeLibrary__.Html5QrcodeScanner(
|
var html5QrcodeScanner = new __Html5QrcodeLibrary__.Html5QrcodeScanner(
|
||||||
"capture",
|
id,
|
||||||
{
|
{
|
||||||
fps: 10,
|
fps: 10,
|
||||||
qrbox: 250
|
qrbox: 250
|
||||||
|
Loading…
Reference in New Issue
Block a user