src/Server/js/caliban.js
/*
             * Add click handlers to anchor and AREA elements, except those to be ignored
             */
Add click handlers to anchor and AREA elements, except those to be ignored
Add click handlers to anchor and AREA elements except those to be ignored
function addClickListeners(enable, trackerInstance) {
                linkTrackingInstalled = true;
                var i,
                    ignorePattern = getClassesRegExp(configIgnoreClasses, 'ignore'),
                    linkElements = documentAlias.links,
                    linkElement = null,
                    trackerType = null;
                if (linkElements) {
                    for (i = 0; i < linkElements.length; i++) {
                        linkElement = linkElements[i];
                        if (!ignorePattern.test(linkElement.className)) {
                            trackerType = typeof linkElement.calibanTrackers;
                            if ('undefined' === trackerType) {
                                linkElement.calibanTrackers = [];
                            }
                            if (-1 === indexOfArray(linkElement.calibanTrackers, trackerInstance)) {
                                linkElement.calibanTrackers.push(trackerInstance);
                                addClickListener(linkElement, enable);
                            }
                        }
                    }
                }
            }
function addClickListeners ( enable , trackerInstance ) { linkTrackingInstalled = true ; var i , ignorePattern = getClassesRegExp ( configIgnoreClasses , 'ignore' ) , linkElements = documentAlias . links , linkElement = null , trackerType = null ; if ( linkElements ) { for ( i = 0 ; i < linkElements . length ; i ++ ) { linkElement = linkElements [ i ] ; if ( ! ignorePattern . test ( linkElement . className ) ) { trackerType = typeof linkElement . calibanTrackers ; if ( 'undefined' === trackerType ) { linkElement . calibanTrackers = [ ] ; } if ( - 1 === indexOfArray ( linkElement . calibanTrackers , trackerInstance ) ) { linkElement . calibanTrackers . push ( trackerInstance ) ; addClickListener ( linkElement , enable ) ; } } } } }
Add click handlers to anchor and AREA elements, except those to be ignored
Add click handlers to anchor and AREA elements except those to be ignored
// iterate through anchor elements with href and AREA elements // we make sure to setup link only once for each tracker