Class

Func

Func()

Helper functions

Constructor

# new Func()

View Source tools/Func.js, line 15

Classes

Func

Methods

# static atou(b64) → {string}

Parameters:
Name Type Description
b64 *

View Source tools/Func.js, line 770

string

# static clone(obj) → {Object}

Clone/Deep copy this object

Parameters:
Name Type Description
obj Object

View Source tools/Func.js, line 71

Object

# static compare(obj1, obj2, recursivelyopt) → {boolean}

Compares content of two objects (yet not recursively for objects!)

Parameters:
Name Type Attributes Default Description
obj1 Object
obj2 Object
recursively boolean <optional>
false

not implemented yet

View Source tools/Func.js, line 153

boolean

# static compileFilterString(projectlist, cataloguelist, constraints, property_typeids, ptr_property)

Compile filter string from id, type, name pattern and properties

Parameters:
Name Type Description
projectlist *

can be empty

cataloguelist *

can be empty

constraints *

= { 'pattern_object_id' : ' ... ' // AND 'pattern_object_name' : ' ... ' // AND 'pattern_object_type' : ' ... ' // AND }

property_typeids *

Search in these property types

ptr_property *

Search in each property type for this pattern

View Source tools/Func.js, line 551

Filterstring according to web service

# static componentToHex(c) → {string}

Convert component (R,G or B) to hex value. 0 => 0 255 => FF

Parameters:
Name Type Description
c number

View Source tools/Func.js, line 1024

string

# static count(obj) → {number}

Count objects/keys in a dictionary.

Parameters:
Name Type Description
obj Object

View Source tools/Func.js, line 112

Number of 'own' properties

number

# static createId() → {string}

Create a new ID

View Source tools/Func.js, line 40

New ID

string

# static createTimestamp() → {string}

View Source tools/Func.js, line 1095

string

# static dbToHtml(str) → {string}

Convert a string which is stored in a db to a string that can be rendered in html.

Parameters:
Name Type Description
str *

View Source tools/Func.js, line 383

string

# static dbToTxt(str) → {string}

Parameters:
Name Type Description
str string

Text to be decoded from DB format to JSON.

View Source tools/Func.js, line 367

string

# static elideText(str, max_length) → {string|null}

Elide text

Parameters:
Name Type Description
str string

Text

max_length number

Maximum length of text

View Source tools/Func.js, line 293

Center elided text or null if str = null

string | null

# static getSizeAsString(size) → {string}

Get number of bytes as formatted text in suitable units ['Bytes', 'kB', 'MB', 'GB']

Parameters:
Name Type Description
size number

View Source tools/Func.js, line 50

string

# static getTokenList(str, start, end) → {Array.<string>}

Get tokens specified by start-end string in str Examples start = '[[' , end = ']]'

Parameters:
Name Type Description
str string
start string
end string

View Source tools/Func.js, line 208

Array with extracted tokens, empty array if no tokens could be extractred

Array.<string>

# static htmlToText(html, all) → {string}

Convert hmtl to plain text.

Parameters:
Name Type Description
html string
all boolean

if true, get full text content (faster), else if slow get inner text (considering styles like display: none, slightly slower)

View Source tools/Func.js, line 522

Plain text, empty string if html is invalid

string

# static increaseIndex(str_number) → {string}

Increase Index given as A0, A1, ... , B0, B1, ...

Parameters:
Name Type Description
str_number *

View Source tools/Func.js, line 1062

string

# static isEqual(val1, val2, propertytype, options) → {boolean}

Parameters:
Name Type Default Description
val1 *
val2 *
propertytype Object
options Object null

{ precision: 0.0001, case_sensitive: true }

View Source tools/Func.js, line 808

boolean

# static isValue(v) → {boolean}

Parameters:
Name Type Description
v *

View Source tools/Func.js, line 788

boolean

# static matchValue(value, xsdatatype, matchvalue, propertymap) → {boolean}

Check if a property value matches the given values.

Parameters:
Name Type Description
value any

Value of property. If null or undefined, false will be returned.

xsdatatype string

Explicit data type of value ('xs:...')

matchvalue *

Values : '*', ["A","B", "C"], [1,2,3], /^abc/g, == 'Text', > 1.234

propertymap Object

Evaluated values for property references [[name##type]] { 'Text##xs:string' : "ABC", 'Number##xs:double' : 1.234 }

View Source tools/Func.js, line 842

true if match was successful, else false

boolean

# static md5(inputString) → {string}

Create a md5 key from a given string

Parameters:
Name Type Description
inputString string

View Source tools/Func.js, line 242

MD5 key

string

# static replaceSpecialCharsWithASCII(id) → {String}

replaces each character of !"#$%&'()*+,./:;<=>?@[]^`{|}~ with . So jQuery can work with it. see jquery docs: https://api.jquery.com/category/selectors/ Escaping with \ as recommended there didn't work.

Parameters:
Name Type Description
id String

any String used as id with jquery

View Source tools/Func.js, line 1119

id but each character of !"#$%&'()*+,./:;<=>?@[]^`{|}~ replaced by

String

# static replaceStr(str, olds, news) → {string}

Parameters:
Name Type Description
str *
olds *
news *

View Source tools/Func.js, line 127

string

# static rgbToHex(r, g, b) → {string}

Convert (RGB) color to hex value

(0,0,0) => #000000 (255,255,255) => #FFFFFF

Parameters:
Name Type Description
r *
g *
b *

View Source tools/Func.js, line 1041

string

# static sanitize(id) → {string}

Sanitize ID

Remove :, =, ' '

Parameters:
Name Type Description
id string

View Source tools/Func.js, line 29

string

# static sanitizeText(str) → {string}

Remove 'invalid'/invisible characters from string which can occur when copy-pasting from html pages Todo: better Black- or Whitelist? Ranges?

Parameters:
Name Type Description
str string

View Source tools/Func.js, line 501

Sanitized string

string

# static sanitizeTooltip(a) → {string}

Sanitize string 'a' so it can be used in a html tooltip (title).

Parameters:
Name Type Description
a string

View Source tools/Func.js, line 397

string

# static txtToDb(str) → {string}

Encode text from text to JSON acceptable text. So this text can be transferred and stored in a DB.

\n ->
' -> ```

Parameters:
Name Type Description
str string

Text to be encoded from JSON

View Source tools/Func.js, line 333

string

# static txtToHtml(str) → {string}

Encode text from text to HTML acceptable text

\n ->

Parameters:
Name Type Description
str string

View Source tools/Func.js, line 354

string

# static utoa(data) → {string}

Parameters:
Name Type Description
data *

View Source tools/Func.js, line 779

string

# static validateArray(pattern) → {boolean}

Check if pattern is a string representation (JSON) of an array.

Parameters:
Name Type Description
pattern string

View Source tools/Func.js, line 480

boolean

# static validateEmail(str) → {boolean}

Validates whether a text is a syntactically correct email address. Note: The only way to reliably verify that a supplied email is a working valid email is to send a mail with a verification link

Parameters:
Name Type Description
str string

String holding the Email address

View Source tools/Func.js, line 412

True, if validation is successful, else false

boolean

# static validateRegex(pattern) → {boolean}

Check if pattern is a valid regex expression.

Parameters:
Name Type Description
pattern string

View Source tools/Func.js, line 426

boolean

# static wildcardToRegex(wildcard) → {RegExp}

Parameters:
Name Type Description
wildcard string

View Source tools/Func.js, line 461

RegExp

# static xor(a, b) → {boolean}

Parameters:
Name Type Description
a *
b *

View Source tools/Func.js, line 1051

boolean