Class: ScriptelEasyScript

ScriptelEasyScript

This class can be used to add event handlers to your web pages that are capable of intercepting, parsing and rendering signature streams from the Scriptel ScripTouch EasyScript series of devices.

new ScriptelEasyScript()

Constructor, creates a new instance of this class.

Members

cardSwipeProtocol :CardSwipeProtocol

The protocol to be used to decode the magnetic strip string.

cardSwipeProtocols :array.<SignatureProtocol>

The list of all available card parsing algorithms.

configurationCallback :function

This callback function is called after capturing, but prior to processing any keyboard data. This can be used to "reconfigure" the keyboard API prior to processing to switch keyboard specifications, protocols, etc.

fromKeyboardSpec :string

This variable should be set to the keyboard layout you expect input to be coming in from. Defaults to "US".

internationalKeyboard :InternationalKeyboard

This object is used to support international keyboards.

libraryBuildDate :string

This property stores the date on which this library was built.

libraryVersion :string

This property stores the current version of this library.

signatureProtocol :SignatureProtocol

The protocol to be used to decode the signature string.

signatureProtocols :array.<SignatureProtocol>

The list of all available signature parsing algorithms.

toKeyboardSpec :string

Deprecated

Methods

addSignatureListener(e)

This method adds a signature listener to an arbitrary DOM element. The listener will listen for key presses and attempt to intercept anything that looks like a signature stream. Most commonly the listener will be attached to the document object.
Parameters:
Name Type Description
e DOMElement Element from the DOM to attach the event listener to.

checkFinancialCardChecksum(cardNumber) → {boolean}

This method uses Luhn's algorithm to verify the checksum on a financial card identification number.
Parameters:
Name Type Description
cardNumber string The identification number of a financial card.
Returns:
True if the number passes the checksum, false otherwise.
Type
boolean

checkFinancialCardType(cardNumber) → {string}

This method uses pattern matching to attempt to identify the issuer for a financial card.
Parameters:
Name Type Description
cardNumber string The identification number of a financial card.
Returns:
String describing the card issuer, false if no matches are found.
Type
string

drawSegmentOnCanvas(point1, point2, canvas, style)

This method takes two points from a signature and Canvas and attempts to draw the signature on the canvas.
Parameters:
Name Type Description
point1 ScriptelCoordinate one of the two points of the line segment
point2 ScriptelCoordinate one of the two points of the line segment
canvas DOMElement DOM element pointing to a canvas that the signature should be drawn on.
style object.<string, string> Map of attributes to set on the canvas. For example strokeStyle:blue will change the line color to blue. For a list of other attributes see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#Attributes.

drawSignatureOnCanvas(sig, canvas, style)

This method takes a ScriptelSignature and Canvas and attempts to draw the signature on the canvas.
Parameters:
Name Type Description
sig ScriptelSignature Signature to draw on the canvas.
canvas DOMElement DOM element pointing to a canvas that the signature should be drawn on.
style object.<string, string> Map of attributes to set on the canvas. For example strokeStyle:blue will change the line color to blue. For a list of other attributes see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#Attributes.

getBase64EncodedSVG(sig, scaleFactor)

This method takes a signature and converts it to a Base64 encoded data url containing a Scalable Vector Graphics image.
Parameters:
Name Type Description
sig ScriptelSignature Signature to encode.
scaleFactor number Number by which to uniformally scale the signature up or down.

mapKey()

This method attempts to map an international keyboard press based on browser events.

parseCard(buffer) → {ScriptelCardSwipe}

This method attempts to parse a card swipe using the registered card swipe protocol.
Parameters:
Name Type Description
buffer string Card swipe string from the EasyScript device.
Returns:
Parsed card swipe data.
Type
ScriptelCardSwipe

parseFinancialTrackOne(trackData) → {FinancialTrackOneData}

This method attempts to parse track one of a financial card based on the specification outlined here: http://en.wikipedia.org/wiki/Magnetic_stripe_card. Since there are many, many issuers this algorithm may not work for all financial cards.
Parameters:
Name Type Description
trackData string The track data to parse.
Returns:
Parsed track information on success, false on error.
Type
FinancialTrackOneData

parseFinancialTrackTwo(trackData) → {FinancialTrackTwoData}

This method attempts to parse track two of a financial card based on the specification outlined here: http://en.wikipedia.org/wiki/Magnetic_stripe_card. Since there are many, many issuers this algorithm may not work for all financial cards.
Parameters:
Name Type Description
trackData string The track data to parse.
Returns:
Parsed track information on success, false on error.
Type
FinancialTrackTwoData

parseIdentificationTrackOne(trackData) → {IdentificationTrackOneData}

This method attempts to parse track one of an identification card based on the specification outlined here: http://www.aamva.org/?aspxerrorpath=/NR/rdonlyres/66260AD6-64B9-45E9-A253-B8AA32241BE0/0/2005DLIDCardSpecV2FINAL.pdf Since many states issue these cards this may not work for all states with magnetic stripe data.
Parameters:
Name Type Description
trackData string The track data to parse.
Returns:
Parsed track information on success, false on error.
Type
IdentificationTrackOneData

parseIdentificationTrackThree(trackData) → {IdentificationTrackThreeData}

This method attempts to parse track three of an identification card based on the specification outlined here: http://www.aamva.org/?aspxerrorpath=/NR/rdonlyres/66260AD6-64B9-45E9-A253-B8AA32241BE0/0/2005DLIDCardSpecV2FINAL.pdf Since many states issue these cards this may not work for all states with magnetic stripe data.
Parameters:
Name Type Description
trackData string The track data to parse.
Returns:
Parsed track information on success, false on error.
Type
IdentificationTrackThreeData

parseIdentificationTrackTwo(trackData) → {IdentificationTrackTwoData}

This method attempts to parse track two of an identification card based on the specification outlined here: http://www.aamva.org/?aspxerrorpath=/NR/rdonlyres/66260AD6-64B9-45E9-A253-B8AA32241BE0/0/2005DLIDCardSpecV2FINAL.pdf Since many states issue these cards this may not work for all states with magnetic stripe data.
Parameters:
Name Type Description
trackData string The track data to parse.
Returns:
Parsed track information on success, false on error.
Type
IdentificationTrackTwoData

parseSignature(sig) → {ScriptelSignature}

This method parses an encoded ScripTouch series EasyScript string and returns an object representing the decoded contents. Errors are detected and exceptions are thrown if there is a problem decoding the stream.
Parameters:
Name Type Description
sig string Signature to parse.
Returns:
Parsed signature.
Type
ScriptelSignature

registerSignatureCallback(f)

This method registers a callback function that will be called when a registered signature listener intercepts and successfully parses an entire signature stream or card data. The function will be passed a ScriptelSignature object or a ScriptelCardSwipe object.
Parameters:
Name Type Description
f function Function to be called upon receipt of a signature.
Returns:
the function passed in

registerStreamingCallback(f)

This method registers a callback function that will be called when a registered signature listener intercepts and successfully parses a piece of signature data. The function will be passed one of the following object types: ScriptelSignatureMetaData, ScriptelCoordinate, ScriptelNewStroke, ScriptelCancelSignature, ScriptelSignatureComplete
Parameters:
Name Type Description
f function Function to be called upon receipt of a signature.

removeSignatureListener(e)

This method removes the event listener from a specified DOM object. This is useful if you're no longer interested in intercepting signatures.
Parameters:
Name Type Description
e DOMElement Element from the DOM to detach the event listener from.

translateCharacterTo() → {string}

Stub, no longer necessary, here for legecy reasons only.
Returns:
String containing the translated character.
Type
string

unregisterSignatureCallback(f)

This method unregisters a signature callback.
Parameters:
Name Type Description
f function Function to unregister.

unregisterStreamingCallback(f)

This method unregisters a callback.
Parameters:
Name Type Description
f function Function to unregister.