var msOnPage = 0; var intervalID = 0; function startTimeOnPage() { intervalID = setInterval( function() { msOnPage += 500; if( 0 == msOnPage % 3000 ) { $cmhp_jq.ajax( '/eh-content/stat.ajax.php?user=4844&landingpage=&page=86074&nocache=1542064450&ajax=followup' ); } }, 500 ); } function pauseTimeOnPage() { clearInterval( intervalID ); } var vis = (function(){ var stateKey, eventKey, keys = { hidden: "visibilitychange", webkitHidden: "webkitvisibilitychange", mozHidden: "mozvisibilitychange", msHidden: "msvisibilitychange" }; for (stateKey in keys) { if (stateKey in document) { eventKey = keys[stateKey]; break; } } return function(c) { if (c) document.addEventListener(eventKey, c); return !document[stateKey]; } })(); $cmhp_jq( document ).ready( function() { if( vis() ) { $cmhp_jq.ajax( '/eh-content/stat.ajax.php?user=4844&landingpage=&page=86074&nocache=1542064450&ajax=initial' ); startTimeOnPage(); } vis( function() { if( vis() ) { startTimeOnPage(); } else { pauseTimeOnPage(); } }); if( /Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { var regex_positive = new RegExp( /[0-9][\s.\-\/\(\)]*[0-9][\s.\-\/\(\)]*[0-9][\s.\-\/\(\)]*[0-9]/ ); var regex_negative = new RegExp( /^[0-9]{5}[^0-9]+[a-zA-Z]/ ); $cmhp_jq( document ).find( '#titlecontainer .contact, #sidebar .menuitem.contactbox .sidebar_content, #sidebar_bottom .menuitem.contactbox .sidebar_content, #contentcontainer .cmod_contactbox .contactbox_text_container' ).find( '*' ).contents().filter( function() { return ( this.nodeType == 3 && regex_positive.test( $cmhp_jq( this ).text() ) && ! regex_negative.test( $cmhp_jq( this ).text() ) && 0 == $cmhp_jq( this ).parents( 'a' ).length ); }).each( function() { var number = $cmhp_jq( this ).text().replace( /[a-zA-Z]+/g, '|' ).replace( /[^0-9|]/g, '' ); while( '|' == number.substr( 0, 1 ) ) { number = number.substr( 1 ); } number = number.split('|')[0]; $cmhp_jq( this ).wrap( '' ); }); } $cmhp_jq( 'a[href^="tel:"]' ).on( 'click', function() { $cmhp_jq.ajax( '/eh-content/stat.ajax.php?user=4844&landingpage=&page=86074&nocache=1542064450&ajax=phonecall' ); }); });