Class: Helper

Helper()

new Helper()

static Helper methods
Source:

Methods

(static) baseUri() → {string}

get the current location (without search or hash part of the URL), eg. https://example.com/path/?aaaa#bbbb --> https://example.com/path/
Source:
Returns:
Type
string

(static) getCookie(cname) → {string}

get value of cookie, if it was set, empty string otherwise
Parameters:
Name Type Description
cname string may not be empty
Source:
See:
Returns:
Type
string

(static) isBadBot() → {bool}

checks whether this is a bot we dislike
Source:
Returns:
Type
bool

(static) reset()

resets state, used for unit testing
Source:

(static) secondsToHuman(seconds) → {Array}

converts a duration (in seconds) into human friendly approximation
Parameters:
Name Type Description
seconds number
Source:
Returns:
Type
Array

(static) selectText(element)

text range selection
Parameters:
Name Type Description
element HTMLElement
Source:
See:

(static) sprintf(format, …args) → {string}

minimal sprintf emulation for %s and %d formats Note that this function needs the parameters in the same order as the format strings appear in the string, contrary to the original.
Parameters:
Name Type Attributes Description
format string
args * <repeatable>
one or multiple parameters injected into format string
Source:
See:
Returns:
Type
string
convert URLs to clickable links. URLs to handle:
    magnet:?xt.1=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C&xt.2=urn:sha1:TXGCZQTH26NL6OUQAJJPFALHG2LTGBC7
    https://example.com:8800/zero/?6f09182b8ea51997#WtLEUO5Epj9UHAV9JFs+6pUQZp13TuspAUjnF+iM+dM=
    http://user:example.com@localhost:8800/zero/?6f09182b8ea51997#WtLEUO5Epj9UHAV9JFs+6pUQZp13TuspAUjnF+iM+dM=
Parameters:
Name Type Description
html string
Source:
Returns:
Type
string