@@ -207,7 +207,8 @@ function isGoogleAnalyticsReady(){
207207//Detect Battery Level
208208function nebulaBattery ( ) {
209209 nebula . user . client . device . battery = false ;
210- if ( typeof Modernizr != 'undefined' && has ( Modernizr , 'batteryapi' ) ) {
210+
211+ if ( has ( navigator , 'getBattery' ) ) {
211212 navigator . getBattery ( ) . then ( function ( battery ) {
212213 nebulaBatteryData ( battery ) ;
213214 jQuery ( battery ) . on ( 'chargingchange levelchange' , function ( ) {
@@ -414,15 +415,6 @@ function eventTracking(){
414415 ga ( 'send' , 'event' , 'Button Click' , btnText , jQuery ( this ) . attr ( 'href' ) ) ;
415416 } ) ;
416417
417- //Outbound Links
418- nebula . dom . document . on ( 'mousedown touch tap' , "a[rel*='external']" , function ( e ) {
419- eventIntent = ( e . which >= 2 ) ? 'Intent' : 'Explicit' ;
420- ga ( 'set' , gaCustomDimensions [ 'eventIntent' ] , eventIntent ) ;
421- ga ( 'set' , gaCustomDimensions [ 'timestamp' ] , localTimestamp ( ) ) ;
422- ga ( 'send' , 'event' , 'Outbound Link' , 'Click' , jQuery ( this ) . attr ( 'href' ) ) ;
423- nv ( 'append' , { 'outbound_links' : jQuery ( this ) . attr ( 'href' ) } ) ;
424- } ) ;
425-
426418 //PDF View/Download
427419 nebula . dom . document . on ( 'mousedown touch tap' , "a[href$='.pdf']" , function ( e ) {
428420 eventIntent = ( e . which >= 2 ) ? 'Intent' : 'Explicit' ;
@@ -1595,9 +1587,9 @@ function cf7Functions(){
15951587 }
15961588
15971589 //Track CF7 forms when they scroll into view (Autotrack). Currently not possible to change category/action/label for just these impressions.
1598- jQuery ( 'form.wpcf7-form ' ) . each ( function ( ) {
1590+ jQuery ( 'form' ) . each ( function ( ) {
15991591 ga ( 'impressionTracker:observeElements' , [ {
1600- 'id' : jQuery ( this ) . closest ( '.wpcf7' ) . attr ( 'id' ) ,
1592+ 'id' : jQuery ( this ) . closest ( '.wpcf7' ) . attr ( 'id' ) || jQuery ( this ) . attr ( 'id' ) ,
16011593 'threshold' : 0.25
16021594 } ] ) ;
16031595 } ) ;
@@ -1606,7 +1598,7 @@ function cf7Functions(){
16061598 jQuery ( '.wpcf7-form input, .wpcf7-form textarea' ) . on ( 'focus' , function ( ) {
16071599 formID = jQuery ( this ) . parents ( 'div.wpcf7' ) . attr ( 'id' ) ;
16081600
1609- if ( ! jQuery ( 'form' ) . hasClass ( '.ignore-form' ) && ! jQuery ( 'form' ) . find ( '.ignore-form' ) . length && ( typeof formStarted [ formID ] === 'undefined' || ! formStarted [ formID ] ) ) {
1601+ if ( ! jQuery ( 'form' ) . hasClass ( '.ignore-form' ) && ! jQuery ( 'form' ) . find ( '.ignore-form' ) . length && ! jQuery ( '#' + e . target . id ) . parents ( '.ignore-form' ) . length && ( typeof formStarted [ formID ] === 'undefined' || ! formStarted [ formID ] ) ) {
16101602 ga ( 'set' , gaCustomDimensions [ 'timestamp' ] , localTimestamp ( ) ) ;
16111603 ga ( 'set' , gaCustomMetrics [ 'formStarts' ] , 1 ) ;
16121604 ga ( 'send' , 'event' , 'CF7 Form' , 'Started Form (Focus)' , 'Began filling out form ID: ' + formID + ' (' + jQuery ( this ) . attr ( 'id' ) + ')' ) ;
@@ -1675,7 +1667,7 @@ function cf7Functions(){
16751667 //CF7 Mail Sent Success (CF7 AJAX response after submit success)
16761668 nebula . dom . document . on ( 'wpcf7mailsent' , function ( e ) {
16771669 var formTime = nebulaTimer ( e . target . id , 'end' ) ;
1678- if ( ! jQuery ( '#' + e . target . id ) . hasClass ( '.ignore-form' ) && ! jQuery ( '#' + e . target . id ) . find ( '.ignore-form' ) . length ) {
1670+ if ( ! jQuery ( '#' + e . target . id ) . hasClass ( '.ignore-form' ) && ! jQuery ( '#' + e . target . id ) . find ( '.ignore-form' ) . length && ! jQuery ( '#' + e . target . id ) . parents ( '.ignore-form' ) . length ) {
16791671 ga ( 'set' , gaCustomMetrics [ 'formSubmissions' ] , 1 ) ;
16801672 }
16811673 ga ( 'set' , gaCustomDimensions [ 'contactMethod' ] , 'CF7 Form (Success)' ) ;
@@ -1745,10 +1737,6 @@ function cf7LocalStorage(){
17451737
17461738//Form live (soft) validator
17471739function nebulaLiveValidator ( ) {
1748- if ( ! jQuery ( '.nebula-validate' ) . length ) { //@TODO "Nebula" 0: This isn't necessarily required... Maybe remove this restriction?
1749- return false ;
1750- }
1751-
17521740 //Standard text inputs and select menus
17531741 jQuery ( '.nebula-validate-text, .nebula-validate-select' ) . on ( 'keyup change blur' , function ( e ) {
17541742 if ( jQuery ( this ) . val ( ) === '' ) {
@@ -2896,7 +2884,7 @@ function has(obj, prop){
28962884
28972885//Functionality for selecting and copying text using Nebula Pre tags.
28982886function nebulaPre ( ) {
2899- try { // @TODO "Nebula" 0: Use Modernizr check here instead.
2887+ try {
29002888 if ( document . queryCommandEnabled ( "SelectAll" ) ) { //@TODO "Nebula" 0: If using document.queryCommandSupported("copy") it always returns false (even though it does actually work when execCommand('copy') is called.
29012889 var selectCopyText = 'Copy to clipboard' ;
29022890 } else if ( document . body . createTextRange || window . getSelection ) {
@@ -3081,7 +3069,7 @@ function nebulaVideoTracking(){
30813069
30823070//Native HTML5 Video Tracking
30833071function nebulaHTML5VideoTracking ( ) {
3084- if ( jQuery ( 'video' ) . is ( ':visible' ) . length ) { // @TODO "Nebula" 0: Better detection for Modernizr's video polyfill?
3072+ if ( jQuery ( 'video' ) . is ( ':visible' ) . length ) {
30853073 jQuery ( 'video' ) . each ( function ( ) {
30863074 var oThis = jQuery ( this ) ;
30873075 var id = oThis . attr ( 'id' ) ;
0 commit comments