Namespace

stat_link

stat_link

Event Injection Manager (Click on Links by default)

Methods

static activateAction(nodeTypeopt)

Activate Action click tags from configuration map.

Parameters:
Name Type Attributes Description
nodeType string <optional>

The tag name of nodes to be modified, by default 'A' or map specification.

static activateExternal(nodeTypeopt)

Activate Exit click tags from configuration map.

Parameters:
Name Type Attributes Description
nodeType string <optional>

The tag name of nodes to be modified, by default 'A' or map specification.

static activateInternal(nodeTypeopt)

Activate Navigation click tags from configuration map.

Parameters:
Name Type Attributes Description
nodeType string <optional>

The tag name of nodes to be modified, by default 'A' or map specification.

static addMapEvent(pm, fn, objopt, isExitopt, nodeTypeopt, markatopt, markeropt)

Add an event on every node specified in map

Parameters:
Name Type Attributes Description
pm Array.<Array.<string>>

The map (array of array of string containing: [path, selector, filter, statname])

fn function

The function to be fired by event

obj object <optional>

The object containing _aExt (array of filters), uses stat_link when omitted

isExit boolean <optional>

true if nodes URL are supposed to be external, no control if omitted

nodeType string <optional>

The tag name of nodes to be modified, 'A' when not specified

markat string <optional>

The marker attribute that must be used to avoid double marking, stat_link.markat when not specified

marker string <optional>

The marker value that must be used to avoid double marking, stat_link.marker when not specified

static getLinkName(href, type) → {string}

Provide the name of a raised click tag, starting from href.

Parameters:
Name Type Description
href string

URL of link

type string

Click tag type ('N', 'S', 'T', 'A')

string

static getLinkNameNc(href, type) → {string}

Provide the link name for click tag, starting from href, without customization call.

  • Exit (type='S'): provided href minus protocol & parameters
  • All other types: Only the file name (or last folder)

    Parameters:
    Name Type Description
    href string

    URL of link

    type string

    Click tag type ('N', 'S', 'T', 'A')

    Click Name

    string
  • static getLinkNodeName(node, type, eopt) → {string}

    Provide name of raised click tag, starting from node

    Parameters:
    Name Type Attributes Description
    node object

    Clicked node.

    type string

    Click tag type ('N', 'S', 'T', 'A').

    e object <optional>

    Current event.

    Click or Event name

    string

    static getLinkNodeNameNc(node, type, eopt) → {string}

    Provide name of raised click or event tag, starting from node, without customization call.
    It retrieves the configured name pattern, then return stat_link.getName.

    Parameters:
    Name Type Attributes Description
    node object

    Clicked node.

    type string

    Click tag type ('N', 'S', 'T', 'A').

    e object <optional>

    Current event.

    Click or Event name

    string

    static getName(statName, node, type, evtopt) → {string}

    Process full name pattern evaluation.
    If the pattern is empty: return stat_link.getLinkName if it's a link with a target, or getCustomNodeLabel in all other cases.

    Parameters:
    Name Type Attributes Description
    statName string

    Name pattern to evaluate.

    node object

    Considered node.

    type string

    Click tag type ('N', 'S', 'T', 'A').

    evt object <optional>

    Current event.

    Processed name

    string

    static getNameChapter(cname, node, defval, evtopt) → {string}

    Process chapter name pattern evaluation.
    Called by stat_link.getName for each chapter.

    Parameters:
    Name Type Attributes Description
    cname string

    chapter name pattern.

    node object

    Considered node.

    defval string

    Default value, if missing.

    evt object <optional>

    Current event.

    Processed chapter name

    string

    static getNodeAttr(node, attr, defVal) → {string}

    Get a node attribute value, or, if missing, a paremeter value in the URL on its href

    Parameters:
    Name Type Description
    node object

    Considered node

    attr string

    Attribute name, or possibly, node.href URL parameter

    defVal string

    Value returned if no attribute nor href parameter value

    Attribute value or targeted href URL parameter value

    string

    static getNodeNamePattern(node) → {string}

    Get the configured name of a node, without processing

    Parameters:
    Name Type Description
    node object

    Considered node

    Configured name, if any

    string

    static getParentNodes(selector) → {Array.<object>}

    Provide an array of node corresponding to given selector
    Same as stat_dom.getSelectorNodes, but return document if no selector.

    Parameters:
    Name Type Description
    selector string

    Nodes selector

    List of selected nodes

    Array.<object>

    Test if an URL must be considered as an exit link. Call isCustomExitLink.
    If isCustomExitLink is not defined:

  • all URL with a different hostname than current one is an Exit
  • Anchor is considered as Navigation
  • mailto: and tel: are undefined

    Parameters:
    Name Type Attributes Description
    u string

    URL to test

    def boolean <optional>

    true if default test must be forced, false or nothing to allow customization, undefined if none of them

    true if this URL is an exit link, false if it is not, undefined if it cannot be asserted.

    boolean
  • static modifySelection(nodes, extLit, modifyFn, listenerFn, isExit, nodeType, statName, markatopt, evtNameopt, markeropt) → {number}

    Modify an array of selected nodes with given function and listener.

    Parameters:
    Name Type Attributes Description
    nodes Array.<object>

    Objects array containing nodes to be modified

    extLit Array.<string>

    Strings array containing expected extensions (filters)

    modifyFn function

    Function used to modify the nodes

    listenerFn function

    Listener function to be added to the nodes

    isExit boolean

    true if href must contain an external URL, false if it must be an internal one, undefined if no check required

    nodeType string

    The tag name of nodes to be modified, 'A' when not specified

    statName string

    The name that must be registered as statName attribute

    markat string <optional>

    The marker that must be used to avoid double marking, stat_link.markat when not specified

    evtName string <optional>

    Name of event to be catch ('click' by default).

    marker string <optional>

    mark attribute value (stat_link.marker by default).

    Count of modified nodes

    number

    static namePreprocessor(sn, urlopt, typeopt, evtopt) → {string}

    Preprocess a name with basic syntax.

    Parameters:
    Name Type Attributes Description
    sn string

    statName to preprocess.

    url object <optional>

    Concerned url.

    type string <optional>

    Click tag type ('N', 'S', 'T', 'A').

    evt object <optional>

    Current event.

    Preprocessed name

    string

    static preComputeName(node) → {string}

    Precompute click or event name

    Parameters:
    Name Type Description
    node object

    Node to compute

    Precomputed name

    string

    static raiseClickTag(lname, type, node, eopt) → {boolean}

    Raise the click tag

    Parameters:
    Name Type Attributes Description
    lname string

    Click tag name.

    type string

    Click tag type ('N', 'S', 'T', 'A').

    node object

    Clicked node.

    e object <optional>

    Current event.

    true if event must be continued, false to stop

    boolean

    static raisePageTag(lname, node, eopt) → {boolean}

    Raise the click tag

    Parameters:
    Name Type Attributes Description
    lname string

    Click tag name

    node object

    Clicked node

    e object <optional>

    Current event.

    true if event must be continued, false to stop

    boolean

    static reactivateAction(delay)

    Scan again the page to apply Action events configuration on new nodes

    Parameters:
    Name Type Description
    delay number

    Delay before execution

    static reactivateExternal(delay)

    Scan again the page to apply Exit clicks configuration on new nodes

    Parameters:
    Name Type Description
    delay number

    Delay before execution

    static reactivateInternal(delay)

    Scan again the page to apply Navigation clicks configuration on new nodes

    Parameters:
    Name Type Description
    delay number

    Delay before execution

    static reInit()

    Clean all status

    static relayActionClickTag(node, eopt) → {boolean}

    Intermediary function called to raise Action click tag (build contextual parameters)

    Parameters:
    Name Type Attributes Description
    node object

    Clicked node.

    e object <optional>

    Current event.

    true if event must be continued, false to stop

    boolean

    static relayClickTag(node, type, eopt, fnopt) → {boolean}

    Intermediary function called to raise any click tag (build contextual parameters).

    Parameters:
    Name Type Attributes Description
    node object

    Clicked node.

    type string

    Click tag type ('N', 'S', 'T', 'A').

    e object <optional>

    Current event.

    fn function <optional>

    Function returning click name, stat_link.getLinkNodeName by default.

    true if event must be continued, false to stop

    boolean

    static relayExternalClickTag(node, eopt) → {boolean}

    Intermediary function called to raise Exit click tag (build contextual parameters)

    Parameters:
    Name Type Attributes Description
    node object

    Clicked node.

    e object <optional>

    Current event.

    true if event must be continued, false to stop

    boolean

    static relayInternalClickTag(node, eopt) → {boolean}

    Intermediary function called to raise Navigation click tag (build contextual parameters)

    Parameters:
    Name Type Attributes Description
    node object

    Clicked node.

    e object <optional>

    Current event.

    true if event must be continued, false to stop

    boolean

    static waitRefresh(cssSelector, scopeopt, intervalopt, maxopt)

    Wait for nodes refreshing (ajax or spa)

    Parameters:
    Name Type Attributes Default Description
    cssSelector string

    The selector te be used for refreshing scope, for example "a,button"

    scope string <optional>
    "DNEA"

    The scope of refresh, one letter per type: Downloads,Navigations,Exits,Actions,Videos. T is like D and S like E.

    interval number <optional>
    100

    The interval between two checks, in ms

    max number <optional>
    75

    Maximum number of checkings

    Example

    In a NAME column of Configuration:

    openPopup::<js:stat_link.waitRefresh('AV')>