Global

Members

(constant) addBlocks

adds two blocks of text together side by side (must be the same number of rows)

Source:

(constant) allTheReceipts :Object

object to hold all the different kinds of receipts. see ./README.md

Type:
  • Object
Source:

(constant) br :RegExp

regex to find break tags

Type:
  • RegExp
Source:

(constant) browserReceipts :Array.<String>

receipt data in browser-friendly form. an array of strings using  's and
's

Type:
  • Array.<String>
Source:

(constant) browserReceipts :Array.<String>

receipt data in browser-friendly form. an array of strings using  's and
's

Type:
  • Array.<String>
Source:

(constant) browserReceipts :Array.<String>

receipt data in browser-friendly form. an array of strings using  's and
's

Type:
  • Array.<String>
Source:

(constant) browserReceipts :Array.<String>

receipt data in browser-friendly form. an array of strings using  's and
's

Type:
  • Array.<String>
Source:

(constant) browserReceipts :Array.<String>

receipt data in browser-friendly form. an array of strings using  's and
's

Type:
  • Array.<String>
Source:

(constant) browserReceipts :Array.<String>

receipt data in browser-friendly form. an array of strings using  's and
's

Type:
  • Array.<String>
Source:

(constant) config :Object

config

Type:
  • Object
Source:

(constant) keyword :string

associates this set of receipts with a key word

Type:
  • string
Source:

(constant) keyword :string

TODO 2/4:

  1. pick a keyword. Check ./README.md to see which words are already in use
  2. add your new keyword to ./README.md

associates this set of receipts with a key word

Type:
  • string
Source:

(constant) keyword :string

associate this set of receipts with a key word

Type:
  • string
Source:

(constant) keyword :string

TODO 2/4:

  1. pick a keyword. Check ./README.md to see which words are already in use
  2. add your new keyword to ./README.md

associates this set of receipts with a key word

Type:
  • string
Source:

(constant) keyword :string

associates this set of receipts with a key word

Type:
  • string
Source:

(constant) keywords

export a list of all the keywords

Source:

(constant) printLines

function to print a given set of lines without instantiating a PrintHandler object.

Source:

(constant) printLoop

an object to handle the loop.
I know this is a weird way to do this, but i'm just exploring and learning right now

Source:

(constant) printerReceipts :Array.<Array.<String>>

receipt data in printer-friendly form. a 2d array of strings using regular spaces and \n

Type:
  • Array.<Array.<String>>
Source:

(constant) printerReceipts :Array.<Array.<String>>

receipt data in printer-friendly form. a 2d array of strings using regular spaces and \n

Type:
  • Array.<Array.<String>>
Source:

(constant) printerReceipts :Array.<Array.<String>>

receipt data in printer-friendly form. a 2d array of strings using regular spaces and \n

Type:
  • Array.<Array.<String>>
Source:

(constant) printerReceipts :Array.<Array.<String>>

receipt data in printer-friendly form. a 2d array of strings using regular spaces and \n

Type:
  • Array.<Array.<String>>
Source:

(constant) printerReceipts :Array.<Array.<String>>

receipt data in printer-friendly form. a 2d array of strings using regular spaces and \n

Type:
  • Array.<Array.<String>>
Source:

(constant) printerReceipts :Array.<Array.<String>>

receipt data in printer-friendly form. a 2d array of strings using regular spaces and \n

Type:
  • Array.<Array.<String>>
Source:

receipt1

create each of the seven receipts

Source:

receipt9

create each of the seven receipts

Source:

receiptRope

This set is for the second set of banners.
They are
1 rope
2 timestamp blocks
3 timestamp overlap arrow
4 leo's diamonds + clouds
5 cloud w/ pateca
6 bird facing R / triangles / bugs
7 chevron / coinbox align R
-- then --
8 chevron / coinbox align L
9 bird facing L / triangles / bugs
10 cloud w/ pateca
11 leo's diamons + clouds
12 timestamp overlap arrow
13 timestamp blocks
14 rope

Source:

(constant) receiptSets

a list of all the receipt sets imported from the /receipt_sets directory

Source:

(constant) reverseTimestamps

reverses all the timestamps in a string; useful after horizontally flipping a sprite

Source:

(constant) spriteHolder :Map.<Sprite, object>

used to store information about incomplete sprites.
each sprite class maps to an object that holds key information.

Type:
  • Map.<Sprite, object>
Source:

(constant) sprites

list of sprites to choose from

Source:

Methods

addHorizontalSpaceToRows(rows, width) → {Array.<string>}

add a number of spaces to each row

Parameters:
Name Type Description
rows Array.<string>
width number

number of spaces

Source:
Returns:
Type
Array.<string>

addReceipts(receiptSet)

Given a receipt set, make an object out of it and add it to allTheReceipts

Parameters:
Name Type Description
receiptSet

the receipt set imported from a file in ./receipt_sets

Source:

browserToPrinter(textContent) → {Array.<string>}

takes a string of browser-friendly receipt data and turns it into a printer-friendly array of receipt lines.
converts non-breaking spaces to regular spaces and break tags to \n. It also separates every line of textContent
to an element of the returned array.

Parameters:
Name Type Description
textContent

browser-friendly data

Source:
Returns:

printer-friendly data

Type
Array.<string>

centerPiece(long)

trunk of rope

Parameters:
Name Type Default Description
long boolean true

short or long trunk

Source:

constrictWidth(startIndex, endIndex) → {Sprite}

calls sliceSprite and updates current sprite

Parameters:
Name Type Description
startIndex
endIndex
Source:
See:
  • Sprite.sliceSprite
Returns:

this sprite, so we can chain commands

Type
Sprite

copy()

make a deep copy of this sprite (cast as a Sprite)

Source:

countCharacters()

helper function to count the number of characters in a string
assuming it has HTML and nonbreaking spaces in it.

Source:

flipHorizontal() → {Sprite}

flips this sprite horizontally, replacing all directed characters with their counterparts.
For example, '(' is replaced with ')' .

Source:
Returns:

this sprite, so we can chain commands

Type
Sprite

flipVertical() → {Sprite}

flip this sprite vertically.
This method does not turn individual characters (besides slashes) upside down; it only rearranges their positions.

Source:
Returns:

this sprite, so we can chain commands

Type
Sprite

generateHash()

Generates a hash.

Source:
Returns:

a 40 character sha1 hash

getReceiptContent()

the function we export

Source:

getTimestamp()

This function returns a random timestamp between now (aka before the HASTAC conference) and the rough date of its founding: 2003.
surrounded by \xa6 so that the timestamp can easily be located in a string.

Source:

imposeBlocks(block1, block2) → {string}

impose string block2 on top of string block1. assumes whitespace in the form of  's .

Parameters:
Name Type Description
block1 string

a string made up of rows that are separated by
tags

block2 string

a string made up of rows that are separated by
tags

Author:
  • Michael Crockett
Source:
Returns:

blocks imposed

Type
string

imposeStrings(str1, str2)

returns string 2 with any space replaced by corresponding character in string 1

Parameters:
Name Type Description
str1
str2
Source:

isNumeric()

https://stackoverflow.com/questions/175739/how-can-i-check-if-a-string-is-a-valid-number
taken from here ^

Source:

msToTime()

convert milliseconds to human-readable

Source:

numToSpace()

This helper function just converts a number to nonbreaking spaces.
That's all it does

Source:

offsetBy(amount) → {Sprite}

offset the sprite to the left or right. Positive number moves right, negative number moves left.
Moving can be destructive to the sprite if it moves past the start or end.

Parameters:
Name Type Description
amount

amount to offset by

Source:
Returns:

this sprite, so we can chain commands

Type
Sprite

oneCloudFlipped(startPosition, spaceChar)

I just... here it is flipped, i just couldn't -n

Parameters:
Name Type Description
startPosition *

the numeric start pos

spaceChar *
Source:

printBasketWeave()

print the basketweave

Source:

printBug()

prints the bug

Source:

printClouds(spaceChar, minLeft, maxLeft, flipped)

Parameters:
Name Type Default Description
spaceChar * &nbsp;
minLeft * 0
maxLeft * 21
flipped * 0

do we reverse to "flip" or no

Source:

printDiamond()

print diamond

Source:

printMarioCoinBox()

Source:
Returns:

prints the mario coin box - it is 22 chars wide.

printPeteca()

peteca sprite

Author:
  • Michael Crockett
Source:

printRibbonRow(ribbonStyles, rowNum)

returns a single row of the twinkle banner based on the current ribbon styles

Parameters:
Name Type Default Description
ribbonStyles

an array that specifies the order and style and length of each ribbon

rowNum 0

current row we are printing, starting from 1

Source:
Returns:

one row

printRope() → {string}

prints the rope as specified in the spec doc

Source:
Returns:

rope

Type
string

printSeedStitch()

print seed stitch pattern

Source:

printTimeLines(rowCount) → {string}

Print the timestamp + lines wavy pattern

Parameters:
Name Type Default Description
rowCount number 10
Source:
Returns:

a string for printing.

Type
string

printTriangle1()

print triangle 1

Source:

printTriangle2()

print triangle 2

Source:

printTriangleTop()

prints the common top part for triangles 1 and 2 (all the way down through first 2 rows with 0's)

Source:

printTwinkleBanner() → {string}

prints the twinkle banner as specified in the spec doc.

Source:
Returns:

twinkle banner

Type
string

setAlign(alignTo) → {Sprite}

set sprite alignment

Parameters:
Name Type Description
alignTo

"random", "left", "center", or "right

Source:
Returns:

this sprite, so we can chain commands

Type
Sprite

setMarginFill(left, right) → {Sprite}

set's the characters that will fill in the blank margins on either side of the sprite.

Parameters:
Name Type Description
left
right
Source:
Returns:
Type
Sprite

slicedSprite(startIndex, endIndex) → {Array.<string>}

This method calls slice on each row, does not update current sprite
Useful if the sprite you are using is too large for your receipt.

Parameters:
Name Type Description
startIndex

0th based index at which to begin, inclusive

endIndex

0th based index before which to end, not inclusive.

Source:
See:
  • String.slice
Returns:

sliced sprite rows

Type
Array.<string>