Skip to content

Commit

Permalink
Release v3.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
lindell committed May 17, 2016
1 parent 2f9f018 commit 7c39418
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 27 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ Download or get the CDN link to the script:
| CODE39 | CODE39 | 3.7 kB | [JsBarcode.code39.min.js][3] |
| EAN / UPC | EAN-13, EAN-8, EAN-5, EAN-2, UPC (A) | 4.2 kB | [JsBarcode.ean-upc.min.js][4] |
| ITF-14 | ITF-14 | 3.5 kB | [JsBarcode.itf-14.min.js][5] |
| MSI | MSI, MSI10, MSI11, MSI1010, MSI1110 | 3.9 kB | [JsBarcode.msi.min.js][6] |
| Pharmacode | Pharmacode | 3.3 kB | [JsBarcode.pharmacode.min.js][7] |
| ITF | ITF | 3.4 kB | [JsBarcode.itf.min.js][6] |
| MSI | MSI, MSI10, MSI11, MSI1010, MSI1110 | 3.9 kB | [JsBarcode.msi.min.js][7] |
| Pharmacode | Pharmacode | 3.3 kB | [JsBarcode.pharmacode.min.js][8] |

### Step 2:
Include the script in your code:
Expand Down Expand Up @@ -189,5 +190,6 @@ For information about how to use the options, see [the wiki page](https://github
[3]: https://cdn.jsdelivr.net/jsbarcode/3.3.3/barcodes/JsBarcode.code39.min.js "jsdelivr code39"
[4]: https://cdn.jsdelivr.net/jsbarcode/3.3.3/barcodes/JsBarcode.ean-upc.min.js "jsdelivr ean/upc"
[5]: https://cdn.jsdelivr.net/jsbarcode/3.3.3/barcodes/JsBarcode.itf-14.min.js "jsdelivr itf-14"
[6]: https://cdn.jsdelivr.net/jsbarcode/3.3.3/barcodes/JsBarcode.msi.min.js "jsdelivr msi"
[7]: https://cdn.jsdelivr.net/jsbarcode/3.3.3/barcodes/JsBarcode.pharmacode.min.js "jsdelivr pharmacode"
[6]: https://cdn.jsdelivr.net/jsbarcode/3.3.3/barcodes/JsBarcode.itf.min.js "jsdelivr itf"
[7]: https://cdn.jsdelivr.net/jsbarcode/3.3.3/barcodes/JsBarcode.msi.min.js "jsdelivr msi"
[8]: https://cdn.jsdelivr.net/jsbarcode/3.3.3/barcodes/JsBarcode.pharmacode.min.js "jsdelivr pharmacode"
119 changes: 100 additions & 19 deletions bin/browser/JsBarcode.all.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,13 @@

var _EAN_UPC = __webpack_require__(22);

var _ITF = __webpack_require__(24);
var _ITF = __webpack_require__(25);

var _MSI = __webpack_require__(29);
var _ITF2 = __webpack_require__(24);

var _pharmacode = __webpack_require__(30);
var _MSI = __webpack_require__(30);

var _pharmacode = __webpack_require__(31);

var _GenericBarcode = __webpack_require__(23);

Expand All @@ -491,6 +493,7 @@
CODE128: _CODE2.CODE128, CODE128A: _CODE2.CODE128A, CODE128B: _CODE2.CODE128B, CODE128C: _CODE2.CODE128C,
EAN13: _EAN_UPC.EAN13, EAN8: _EAN_UPC.EAN8, EAN5: _EAN_UPC.EAN5, EAN2: _EAN_UPC.EAN2, UPC: _EAN_UPC.UPC,
ITF14: _ITF.ITF14,
ITF: _ITF2.ITF,
MSI: _MSI.MSI, MSI10: _MSI.MSI10, MSI11: _MSI.MSI11, MSI1010: _MSI.MSI1010, MSI1110: _MSI.MSI1110,
pharmacode: _pharmacode.pharmacode,
GenericBarcode: _GenericBarcode.GenericBarcode
Expand Down Expand Up @@ -530,7 +533,7 @@
value: true
});

var _optionsFromStrings = __webpack_require__(31);
var _optionsFromStrings = __webpack_require__(32);

var _optionsFromStrings2 = _interopRequireDefault(_optionsFromStrings);

Expand Down Expand Up @@ -604,11 +607,11 @@
value: true
});

var _canvas = __webpack_require__(32);
var _canvas = __webpack_require__(33);

var _canvas2 = _interopRequireDefault(_canvas);

var _svg = __webpack_require__(33);
var _svg = __webpack_require__(34);

var _svg2 = _interopRequireDefault(_svg);

Expand Down Expand Up @@ -1925,6 +1928,84 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var ITF = function () {
function ITF(string) {
_classCallCheck(this, ITF);

this.string = string;

this.binaryRepresentation = {
"0": "00110",
"1": "10001",
"2": "01001",
"3": "11000",
"4": "00101",
"5": "10100",
"6": "01100",
"7": "00011",
"8": "10010",
"9": "01010"
};
}

ITF.prototype.valid = function valid() {
return this.string.search(/^([0-9]{2})+$/) !== -1;
};

ITF.prototype.encode = function encode() {
// Always add the same start bits
var result = "1010";

// Calculate all the digit pairs
for (var i = 0; i < this.string.length; i += 2) {
result += this.calculatePair(this.string.substr(i, 2));
}

// Always add the same end bits
result += "11101";

return {
data: result,
text: this.string
};
};

// Calculate the data of a number pair


ITF.prototype.calculatePair = function calculatePair(numberPair) {
var result = "";

var number1Struct = this.binaryRepresentation[numberPair[0]];
var number2Struct = this.binaryRepresentation[numberPair[1]];

// Take every second bit and add to the result
for (var i = 0; i < 5; i++) {
result += number1Struct[i] == "1" ? "111" : "1";
result += number2Struct[i] == "1" ? "000" : "0";
}

return result;
};

return ITF;
}();

exports.ITF = ITF;

/***/ },
/* 25 */
/***/ function(module, exports) {

"use strict";
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var ITF14 = function () {
function ITF14(string) {
_classCallCheck(this, ITF14);
Expand Down Expand Up @@ -2008,7 +2089,7 @@
exports.ITF14 = ITF14;

/***/ },
/* 25 */
/* 26 */
/***/ function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -2050,7 +2131,7 @@
exports.default = MSI10;

/***/ },
/* 26 */
/* 27 */
/***/ function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -2093,7 +2174,7 @@
exports.default = MSI1010;

/***/ },
/* 27 */
/* 28 */
/***/ function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -2135,7 +2216,7 @@
exports.default = MSI11;

/***/ },
/* 28 */
/* 29 */
/***/ function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -2178,7 +2259,7 @@
exports.default = MSI1110;

/***/ },
/* 29 */
/* 30 */
/***/ function(module, exports, __webpack_require__) {

"use strict";
Expand All @@ -2193,19 +2274,19 @@

var _MSI2 = _interopRequireDefault(_MSI);

var _MSI3 = __webpack_require__(25);
var _MSI3 = __webpack_require__(26);

var _MSI4 = _interopRequireDefault(_MSI3);

var _MSI5 = __webpack_require__(27);
var _MSI5 = __webpack_require__(28);

var _MSI6 = _interopRequireDefault(_MSI5);

var _MSI7 = __webpack_require__(26);
var _MSI7 = __webpack_require__(27);

var _MSI8 = _interopRequireDefault(_MSI7);

var _MSI9 = __webpack_require__(28);
var _MSI9 = __webpack_require__(29);

var _MSI10 = _interopRequireDefault(_MSI9);

Expand All @@ -2218,7 +2299,7 @@
exports.MSI1110 = _MSI10.default;

/***/ },
/* 30 */
/* 31 */
/***/ function(module, exports) {

"use strict";
Expand Down Expand Up @@ -2277,7 +2358,7 @@
exports.pharmacode = pharmacode;

/***/ },
/* 31 */
/* 32 */
/***/ function(module, exports) {

"use strict";
Expand Down Expand Up @@ -2308,7 +2389,7 @@
}

/***/ },
/* 32 */
/* 33 */
/***/ function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -2480,7 +2561,7 @@
}

/***/ },
/* 33 */
/* 34 */
/***/ function(module, exports, __webpack_require__) {

"use strict";
Expand Down
4 changes: 2 additions & 2 deletions bin/browser/JsBarcode.all.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bin/browser/barcodes/JsBarcode.itf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions bin/node/barcodes/ITF/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var ITF = function () {
function ITF(string) {
_classCallCheck(this, ITF);

this.string = string;

this.binaryRepresentation = {
"0": "00110",
"1": "10001",
"2": "01001",
"3": "11000",
"4": "00101",
"5": "10100",
"6": "01100",
"7": "00011",
"8": "10010",
"9": "01010"
};
}

ITF.prototype.valid = function valid() {
return this.string.search(/^([0-9]{2})+$/) !== -1;
};

ITF.prototype.encode = function encode() {
// Always add the same start bits
var result = "1010";

// Calculate all the digit pairs
for (var i = 0; i < this.string.length; i += 2) {
result += this.calculatePair(this.string.substr(i, 2));
}

// Always add the same end bits
result += "11101";

return {
data: result,
text: this.string
};
};

// Calculate the data of a number pair


ITF.prototype.calculatePair = function calculatePair(numberPair) {
var result = "";

var number1Struct = this.binaryRepresentation[numberPair[0]];
var number2Struct = this.binaryRepresentation[numberPair[1]];

// Take every second bit and add to the result
for (var i = 0; i < 5; i++) {
result += number1Struct[i] == "1" ? "111" : "1";
result += number2Struct[i] == "1" ? "000" : "0";
}

return result;
};

return ITF;
}();

exports.ITF = ITF;
Loading

0 comments on commit 7c39418

Please sign in to comment.