From 73e7a261218d085478a96583cd5e084bb26b8de5 Mon Sep 17 00:00:00 2001 From: apocheau Date: Mon, 7 Dec 2015 15:14:42 +0100 Subject: [PATCH] v0.0.3 --- bower.json | 4 ++-- dist/angular-barcode.js | 2 +- dist/angular-barcode.min.js | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 7417dcb..3daf568 100644 --- a/bower.json +++ b/bower.json @@ -1,8 +1,8 @@ { "name": "angular-barcode", - "version": "0.0.2", + "version": "0.0.3", "main": [ - "./dist/barcode.min.js" + "./dist/angular-barcode.min.js" ], "description": "Barcode generator for AngularJS apps", "repository": { diff --git a/dist/angular-barcode.js b/dist/angular-barcode.js index 0deac05..bca1ff9 100644 --- a/dist/angular-barcode.js +++ b/dist/angular-barcode.js @@ -1,6 +1,6 @@ /** * angular barcode - * @version v0.0.1 - 2015-12-07 * @link https://github.com/ryanmc2033/angular-barcode + * @version v0.0.3 - 2015-12-07 * @link https://github.com/ryanmc2033/angular-barcode * @author Ryan McLaughlin * @license MIT License, http://www.opensource.org/licenses/MIT */angular.module('barcode', []).directive('barcode', [ diff --git a/dist/angular-barcode.min.js b/dist/angular-barcode.min.js index 5f5a76b..906938a 100644 --- a/dist/angular-barcode.min.js +++ b/dist/angular-barcode.min.js @@ -1,6 +1,6 @@ /** * angular barcode - * @version v0.0.1 - 2015-12-07 * @link https://github.com/ryanmc2033/angular-barcode + * @version v0.0.3 - 2015-12-07 * @link https://github.com/ryanmc2033/angular-barcode * @author Ryan McLaughlin * @license MIT License, http://www.opensource.org/licenses/MIT */angular.module("barcode",[]).directive("barcode",["BarcodeService","Code39Service","Code128BService","Code128CService","EanService","Itf14NumberService","ItfNumberService","UpcService",function(a,b,c,d,e,f,g,h){function i(i,j,k){var l={width:2,height:100,quite:10,displayValue:!1,font:"monospace",textAlign:"center",fontSize:12,backgroundColor:"",lineColor:"#000"},m=j.find("canvas")[0],n=[];if(n=a.merge(l,i.options),!m.getContext)return image;var o="";switch(k.type){case"upc":o=h;break;case"ean":o=e;break;case"code39":o=b;break;case"code128b":o=c;break;case"code128c":o=d;break;case"itf":o=g;break;case"itf14":o=f}if(""!==o){var p=o.encoded(k.string);if(!angular.isUndefined(p)){var q=function(a){var b,c;c=n.height,r.font=n.fontSize+"px "+n.font,r.textBaseline="bottom",r.textBaseline="top","left"==n.textAlign?(b=n.quite,r.textAlign="left"):"right"==n.textAlign?(b=m.width-n.quite,r.textAlign="right"):(b=m.width/2,r.textAlign="center"),r.fillText(a,b,c)},r=m.getContext("2d");m.width=p.length*n.width+2*n.quite,m.height=n.height+(n.displayValue?1.3*n.fontSize:0),r.clearRect(0,0,m.width,m.height),n.backgroundColor&&(r.fillStyle=n.backgroundColor,r.fillRect(0,0,m.width,m.height)),r.fillStyle=n.lineColor;for(var s=0;s",link:j}}]),angular.module("barcode").factory("BarcodeService",[function(){"use strict";var a={};return a.merge=function(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c},a}]),angular.module("barcode").factory("Code128Service",[function(){"use strict";var a={},b=[[" ","11011001100",0],["!","11001101100",1],['"',"11001100110",2],["#","10010011000",3],["$","10010001100",4],["%","10001001100",5],["&","10011001000",6],["'","10011000100",7],["(","10001100100",8],[")","11001001000",9],["*","11001000100",10],["+","11000100100",11],[",","10110011100",12],["-","10011011100",13],[".","10011001110",14],["/","10111001100",15],["0","10011101100",16],["1","10011100110",17],["2","11001110010",18],["3","11001011100",19],["4","11001001110",20],["5","11011100100",21],["6","11001110100",22],["7","11101101110",23],["8","11101001100",24],["9","11100101100",25],[":","11100100110",26],[";","11101100100",27],["<","11100110100",28],["=","11100110010",29],[">","11011011000",30],["?","11011000110",31],["@","11000110110",32],["A","10100011000",33],["B","10001011000",34],["C","10001000110",35],["D","10110001000",36],["E","10001101000",37],["F","10001100010",38],["G","11010001000",39],["H","11000101000",40],["I","11000100010",41],["J","10110111000",42],["K","10110001110",43],["L","10001101110",44],["M","10111011000",45],["N","10111000110",46],["O","10001110110",47],["P","11101110110",48],["Q","11010001110",49],["R","11000101110",50],["S","11011101000",51],["T","11011100010",52],["U","11011101110",53],["V","11101011000",54],["W","11101000110",55],["X","11100010110",56],["Y","11101101000",57],["Z","11101100010",58],["[","11100011010",59],["\\","11101111010",60],["]","11001000010",61],["^","11110001010",62],["_","10100110000",63],["`","10100001100",64],["a","10010110000",65],["b","10010000110",66],["c","10000101100",67],["d","10000100110",68],["e","10110010000",69],["f","10110000100",70],["g","10011010000",71],["h","10011000010",72],["i","10000110100",73],["j","10000110010",74],["k","11000010010",75],["l","11001010000",76],["m","11110111010",77],["n","11000010100",78],["o","10001111010",79],["p","10100111100",80],["q","10010111100",81],["r","10010011110",82],["s","10111100100",83],["t","10011110100",84],["u","10011110010",85],["v","11110100100",86],["w","11110010100",87],["x","11110010010",88],["y","11011011110",89],["z","11011110110",90],["{","11110110110",91],["|","10101111000",92],["}","10100011110",93],["~","10001011110",94],[String.fromCharCode(127),"10111101000",95],[String.fromCharCode(128),"10111100010",96],[String.fromCharCode(129),"11110101000",97],[String.fromCharCode(130),"11110100010",98],[String.fromCharCode(131),"10111011110",99],[String.fromCharCode(132),"10111101110",100],[String.fromCharCode(133),"11101011110",101],[String.fromCharCode(134),"11110101110",102],[String.fromCharCode(135),"11010000100",103],[String.fromCharCode(136),"11010010000",104],[String.fromCharCode(137),"11010011100",105]],c="1100011101011",d=/^[!-~ ]+$/;return a.valid=function(a){return-1==a.search(d)?!1:!0},a.calculateCode128=function(b,d,e,f){var g="";return g+=a.encodingById(e),g+=d(b),g+=a.encodingById(f(b,e)),g+=c},a.encodingById=function(a){for(var c=0;cc;c+=2)b+=parseInt(a[c]);for(var d=1;12>d;d+=2)b+=3*parseInt(a[d]);return(10-b%10)%10}function d(a){return-1==a.search(m)?!1:a[12]==c(a)}var e={};e.valid=function(a){return d(a)},e.encoded=function(b){return d(b)?a(b):""};var f={0:"0001101",1:"0011001",2:"0010011",3:"0111101",4:"0100011",5:"0110001",6:"0101111",7:"0111011",8:"0110111",9:"0001011"},g={0:"0100111",1:"0110011",2:"0011011",3:"0100001",4:"0011101",5:"0111001",6:"0000101",7:"0010001",8:"0001001",9:"0010111"},h={0:"1110010",1:"1100110",2:"1101100",3:"1000010",4:"1011100",5:"1001110",6:"1010000",7:"1000100",8:"1001000",9:"1110100"},i={0:"LLLLLL",1:"LLGLGG",2:"LLGGLG",3:"LLGGGL",4:"LGLLGG",5:"LGGLLG",6:"LGGGLL",7:"LGLGLG",8:"LGLGGL",9:"LGGLGL"},j="101",k="101",l="01010",m=/^[0-9]{13}$/;return e}]),angular.module("barcode").factory("Itf14NumberService",[function(){"use strict";function a(a){var d="";13==a.length&&(a+=c(a)),d+=g;for(var e=0;14>e;e+=2)d+=b(a.substr(e,2));return d+=h}function b(a){for(var b="",c=f[a[0]],d=f[a[1]],e=0;5>e;e++)b+="1"==c[e]?"111":"1",b+="1"==d[e]?"000":"0";return b}function c(a){for(var b=0,c=0;13>c;c++)b+=parseInt(a[c])*(3-c%2*2);return 10-b%10}function d(a){return-1==a.search(i)?!1:14==a.length?a[13]==c(a):!0}var e={};e.valid=function(a){return d(a)},e.encoded=function(b){return d(b)?a(b):""};var f={0:"00110",1:"10001",2:"01001",3:"11000",4:"00101",5:"10100",6:"01100",7:"00011",8:"10010",9:"01010"},g="1010",h="11101",i=/^[0-9]{13,14}$/;return e}]),angular.module("barcode").factory("ItfNumberService",[function(){"use strict";function a(a){var c="";c+=f;for(var d=0;df;f++)b+="1"==c[f]?"111":"1",b+="1"==d[f]?"000":"0";return b}function c(a){return-1!==a.search(h)}var d={};d.valid=function(a){return c(a)},d.encoded=function(b){return c(b)?a(b):""};var e={0:"00110",1:"10001",2:"01001",3:"11000",4:"00101",5:"10100",6:"01100",7:"00011",8:"10010",9:"01010"},f="1010",g="11101",h=/^([0-9][0-9])+$/;return d}]),angular.module("barcode").factory("UpcService",[function(){"use strict";function a(a){var c="",d=a[0],e=a.substr(1,7),f=a.substr(7,6);return c+=j,c+=b(e,i[d]),c+=l,c+=b(f,"RRRRRR"),c+=k}function b(a,b){for(var c="",d=0;dc;c+=2)b+=parseInt(a[c]);for(var d=1;12>d;d+=2)b+=3*parseInt(a[d]);return(10-b%10)%10}function d(a){return-1==a.search(m)?!1:a[12]==c(a)}var e={};e.valid=function(a){return d("0"+a)},e.encoded=function(b){return d("0"+b)?a("0"+b):""};var f={0:"0001101",1:"0011001",2:"0010011",3:"0111101",4:"0100011",5:"0110001",6:"0101111",7:"0111011",8:"0110111",9:"0001011"},g={0:"0100111",1:"0110011",2:"0011011",3:"0100001",4:"0011101",5:"0111001",6:"0000101",7:"0010001",8:"0001001",9:"0010111"},h={0:"1110010",1:"1100110",2:"1101100",3:"1000010",4:"1011100",5:"1001110",6:"1010000",7:"1000100",8:"1001000",9:"1110100"},i={0:"LLLLLL",1:"LLGLGG",2:"LLGGLG",3:"LLGGGL",4:"LGLLGG",5:"LGGLLG",6:"LGGGLL",7:"LGLGLG",8:"LGLGGL",9:"LGGLGL"},j="101",k="101",l="01010",m=/^[0-9]{13}$/;return e}]); \ No newline at end of file diff --git a/package.json b/package.json index 419c66a..7b85c29 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "angular-barcode", "description": "angular barcode", - "version": "0.0.2", + "version": "0.0.3", "filename": "barcode.min.js", "main": "./dist/barcode.min.js", "homepage": "https://github.com/ryanmc2033/angular-barcode",