33 * https://api.typingdna.com/scripts/typingdna.js
44 * https://typingdna.com/scripts/typingdna.js (alternative)
55 *
6- * @version 2.9
6+ * @version 2.10
77 * @author Raul Popa
88 * @copyright SC TypingDNA SRL, http://typingdna.com
99 * @license http://www.apache.org/licenses/LICENSE-2.0
2020 *
2121 * Typical usage:
2222 * var tdna = new TypingDNA(); // creates a new TypingDNA object and starts recording
23- * var typingPattern = tdna.get(); // returns a typing pattern (and continues recording afterwards),
23+ * var typingPattern = tdna.getTypingPattern({type=1, text="Hello5g21?*", extedend=false});
24+ * returns a type 1 typing pattern (and continues recording afterwards)
2425 * optionally you can pass a length, tdna.get(200) will return the pattern based on the last 200 key events.
2526 *
2627 * Optional:
@@ -96,7 +97,7 @@ function TypingDNA() {
9697 TypingDNA . prototype . defaultHistoryLength = TypingDNA . defaultHistoryLength ;
9798 TypingDNA . prototype . maxSeekTime = TypingDNA . maxSeekTime ;
9899 TypingDNA . prototype . maxPressTime = TypingDNA . maxPressTime ;
99- TypingDNA . version = 2.9 ;
100+ TypingDNA . version = 2.10 ;
100101 TypingDNA . flags = 0 ;
101102 TypingDNA . instance = this ;
102103 TypingDNA . document = document ;
@@ -583,6 +584,7 @@ function TypingDNA() {
583584 * Automatically called at initilization. It starts the recording of keystrokes.
584585 */
585586 TypingDNA . start = function ( ) {
587+ TypingDNA . diagramRecording = true ;
586588 return TypingDNA . recording = true ;
587589 }
588590
@@ -591,6 +593,7 @@ function TypingDNA() {
591593 * either call TypingDNA.start() or create a new TypingDNA object again, not recommended.
592594 */
593595 TypingDNA . stop = function ( ) {
596+ TypingDNA . diagramRecording = false ;
594597 return TypingDNA . recording = false ;
595598 }
596599
@@ -608,20 +611,6 @@ function TypingDNA() {
608611 return TypingDNA . mouseRecording = TypingDNA . mouseMoveRecording = false ;
609612 }
610613
611- /**
612- * Starts the recording of a non-fixed diagram typing pattern.
613- */
614- TypingDNA . startDiagram = function ( ) {
615- return TypingDNA . diagramRecording = true ;
616- }
617-
618- /**
619- * Ends the recording of a non-fixed diagram typing pattern.
620- */
621- TypingDNA . stopDiagram = function ( ) {
622- return TypingDNA . diagramRecording = false ;
623- }
624-
625614 /**
626615 * This is the main function that outputs the typing pattern as a String
627616 * {type:Number, text:String, textId:Number, length: Number, extended:Boolean}
@@ -633,8 +622,9 @@ function TypingDNA() {
633622 * * * @param {Boolean } extended (Only for type 1) specifies if full information about what was typed is produced,
634623 * * * including the actual key pressed, if false, only the order of pressed keys is kept (no actual content)
635624 * @return {String } A typing pattern in string form
636- * @example var typingPattern = tdna.getDiagram();
637- * @example var typingPattern = tdna.getDiagram("Hello5g21?*");
625+ * @example var typingPattern = tdna.getTypingPattern({type=1, length=160, extended=true});
626+ * @example var typingPattern = tdna.getTypingPattern({type=1, text="Hello5g21?*", extedend=false});
627+ * @example var typingPattern = tdna.getTypingPattern({type=0, length=180});
638628 */
639629 TypingDNA . getTypingPattern = function ( obj ) {
640630 if ( typeof obj === 'object' ) {
0 commit comments