Methods

AddEvent(html_element, event_name, event_function)

Adds event to the element

Parameters:
NameTypeDescription
html_elementNode

Target element

event_namestring

Target Event

event_functionfunction

Callback Function

Beautify(what, floats) → {string}

Beautifies the number, turns 9999999 into 9,999,999

Parameters:
NameTypeDefaultDescription
whatnumber

Target number

floatsnumber0

Chars after comma

Returns:
Type: 
string

CatClick()

Function called when the kitten is clicked.

CheckCollision(div1, div2) → {boolean}

Checks collision of two elements

Parameters:
NameTypeDescription
div1HTMLElement

First element

div2HTMLElement

Second element

Returns:
Type: 
boolean

CompressBin(arr) → {number}

Compress a sequence like [0,1,1,0,1,0]... into a number like 54.

Parameters:
NameTypeDescription
arrArray.<any>

Source data

Returns:
Type: 
number

CompressLargeBin(arr) → {Array.<any>}

Compresses array. We have to compress in smaller chunks to avoid getting into scientific notation

Parameters:
NameTypeDescription
arrArray.<any>

Source data

Returns:
Type: 
Array.<any>

CupcakePrompt(title1, text1, showCancelButton1, closeOnConfirm1, inputPlaceholder1, inputError, onEnd, inputValue1) → {void}

Function to display a popup window with a text input prompt.

Parameters:
NameTypeDescription
title1string

The title of the window.

text1string

The text displayed in the window.

showCancelButton1boolean

Specifies whether the cancel button should be displayed.

closeOnConfirm1boolean

Specifies whether the window should close after the confirm button is clicked.

inputPlaceholder1string

The placeholder text displayed in the input field.

inputErrorstring

The error message displayed when trying to submit an empty value.

onEndfunction

The function called after the user enters a value.

inputValue1string

The initial value displayed in the input field.

Returns:
Type: 
void

KittenStart()

Function that starts the kitten game.

PlaySound(sound)

Plays sound from certian file

Parameters:
NameTypeDescription
soundstring

Path to the sound file

UncompressBin(num) → {Array.<any>}

uncompress a number like 54 to a sequence like [0,1,1,0,1,0].

Parameters:
NameTypeDescription
numnumber

Source data

Returns:
Type: 
Array.<any>

UncompressLargeBin(arr) → {Array.<any>}

Uncomresses array

Parameters:
NameTypeDescription
arrArray.<any>

Source data

Returns:
Type: 
Array.<any>

b64_to_utf8(str) → {string}

Translates Base64 string to UTF8

Parameters:
NameTypeDescription
strstring

Target string

Returns:
Type: 
string

caesarCipher(str, shift) → {string}

Encodes string with Caesar Cipher

Parameters:
NameTypeDescription
strstring

Target string

shiftnumber

Cipher shift

Returns:
Type: 
string

caesarDecipher(str, shift) → {string}

Decodes string with Caesar Cipher

Parameters:
NameTypeDescription
strstring

Source string

shiftnumber

Cipher shift

Returns:
Type: 
string

choose(arr) → {any}

Choosing random element from array

Parameters:
NameTypeDescription
arrArray.<any>

Target array

Returns:
Type: 
any

getRandomInt(min, max) → {number}

Gets random int in defined range

Parameters:
NameTypeDescription
minnumber

Low bound

maxnumber

High bound

Returns:
Type: 
number

l(what) → {HTMLElement}

Gets element by ID (analog for $ from jQuery)

Parameters:
NameTypeDescription
whatstring

Element ID

Returns:
Type: 
HTMLElement

moveDiv()

Function to move the kitten to a random position on the screen.

readLocalFile(e) → {void}

Mod file opening event listner

Parameters:
NameTypeDescription
eEvent

Event element

Returns:
Type: 
void

scopeEval(scope, script) → {any}

Evals the custom JS code with custom scope

Parameters:
NameTypeDescription
scopeObject

Object contains the scope

scriptstring

String with js code

Returns:
Type: 
any

shuffle(array) → {Array.<any>}

Shuffles the array

Parameters:
NameTypeDescription
arrayArray.<any>

Target array

Returns:
Type: 
Array.<any>

utf8_to_b64(str) → {string}

Translates UTF8 string to Base64

Parameters:
NameTypeDescription
strstring

Target string

Returns:
Type: 
string