11/*
22 * breinify-api
3- * v1.0.3
3+ * v1.0.4
44 **/
55/*
66 * We inject a dependencyScope variable, which will be used
@@ -12181,7 +12181,7 @@ dependencyScope.jQuery = $;;
1218112181 } ,
1218212182
1218312183 select : function ( cssSelector , childSelector , directChild ) {
12184- var $el = cssSelector instanceof jQuery ? cssSelector : $ ( cssSelector ) ;
12184+ var $el = cssSelector instanceof $ ? cssSelector : $ ( cssSelector ) ;
1218512185 directChild = typeof directChild === 'boolean' ? directChild : false ;
1218612186
1218712187 if ( directChild ) {
@@ -12192,7 +12192,7 @@ dependencyScope.jQuery = $;;
1219212192 } ,
1219312193
1219412194 texts : function ( cssSelector , excludeChildren ) {
12195- var $el = cssSelector instanceof jQuery ? cssSelector : $ ( cssSelector ) ;
12195+ var $el = cssSelector instanceof $ ? cssSelector : $ ( cssSelector ) ;
1219612196 excludeChildren = typeof excludeChildren === 'boolean' ? excludeChildren : true ;
1219712197
1219812198 var result = [ ] ;
@@ -12239,7 +12239,7 @@ dependencyScope.jQuery = $;;
1223912239 } ,
1224012240
1224112241 setText : function ( cssSelector , text ) {
12242- var $el = cssSelector instanceof jQuery ? cssSelector : $ ( cssSelector ) ;
12242+ var $el = cssSelector instanceof $ ? cssSelector : $ ( cssSelector ) ;
1224312243
1224412244 if ( $el . is ( 'input' ) ) {
1224512245 $el . val ( text ) ;
@@ -12373,7 +12373,7 @@ dependencyScope.jQuery = $;;
1237312373 } ) ;
1237412374
1237512375 var BreinifyConfig = function ( config ) {
12376- this . version = '1.0.3 ' ;
12376+ this . version = '1.0.4 ' ;
1237712377
1237812378 /*
1237912379 * Validate the passed config-parameters.
@@ -12487,6 +12487,11 @@ dependencyScope.jQuery = $;;
1248712487 group : 4 ,
1248812488 optional : false
1248912489 } ) ;
12490+ attributes . add ( 'SESSIONID' , {
12491+ name : 'sessionId' ,
12492+ group : 5 ,
12493+ optional : false
12494+ } ) ;
1249012495 attributes . add ( 'additional' , {
1249112496 validate : function ( value ) {
1249212497 return typeof value === 'undefined' || $ . isPlainObject ( value ) ;
@@ -12534,19 +12539,36 @@ dependencyScope.jQuery = $;;
1253412539
1253512540 var BreinifyUser = function ( user , onReady ) {
1253612541 var instance = this ;
12537- instance . version = '1.0.3 ' ;
12542+ instance . version = '1.0.4 ' ;
1253812543
1253912544 // set the values provided
1254012545 instance . setAll ( user ) ;
1254112546
1254212547 // set the user-agent to a default value if there isn't one yet
1254312548 if ( instance . read ( 'userAgent' ) === null ) {
12544- instance . add ( 'userAgent' , navigator . userAgent ) ;
12549+ var userAgent = navigator . userAgent ;
12550+
12551+ if ( ! BreinifyUtil . isEmpty ( userAgent ) ) {
12552+ instance . add ( 'userAgent' , userAgent ) ;
12553+ }
1254512554 }
1254612555
1254712556 // set the referrer to a default value if there isn't one yet
1254812557 if ( instance . read ( 'referrer' ) === null ) {
12549- instance . add ( 'referrer' , document . referrer ) ;
12558+ var referrer = document . referrer ;
12559+
12560+ if ( ! BreinifyUtil . isEmpty ( referrer ) ) {
12561+ instance . add ( 'referrer' , referrer ) ;
12562+ }
12563+ }
12564+
12565+ // also add the current URL if not provided
12566+ if ( instance . read ( 'url' ) === null ) {
12567+ var url = window . location . href ;
12568+
12569+ if ( ! BreinifyUtil . isEmpty ( url ) ) {
12570+ instance . add ( 'url' , url ) ;
12571+ }
1255012572 }
1255112573
1255212574 // try to set the location if there isn't one yet
@@ -12573,7 +12595,9 @@ dependencyScope.jQuery = $;;
1257312595 var instance = this ;
1257412596
1257512597 _privates . resolveGeoLocation ( function ( location ) {
12576- instance . add ( 'location' , location ) ;
12598+ if ( ! BreinifyUtil . isEmpty ( location ) ) {
12599+ instance . add ( 'location' , location ) ;
12600+ }
1257712601
1257812602 if ( $ . isFunction ( onReady ) ) {
1257912603 onReady ( instance ) ;
@@ -12629,10 +12653,12 @@ dependencyScope.jQuery = $;;
1262912653 if ( ! attributes . is ( attribute ) ) {
1263012654 throw new Error ( 'The attribute "' + attribute + '" is not supported by a user.' ) ;
1263112655 } else if ( attribute === BreinifyUser . ATTRIBUTES . EMAIL ) {
12632- this . reset ( attribute ) ;
12656+ this . reset ( BreinifyUser . ATTRIBUTES . MD5EMAIL ) ;
1263312657
12634- //noinspection JSUnresolvedFunction
12635- this . set ( BreinifyUser . ATTRIBUTES . MD5EMAIL , BreinifyUtil . md5 ( value ) ) ;
12658+ if ( ! BreinifyUtil . isEmpty ( value ) ) {
12659+ //noinspection JSUnresolvedFunction
12660+ this . set ( BreinifyUser . ATTRIBUTES . MD5EMAIL , BreinifyUtil . md5 ( value ) ) ;
12661+ }
1263612662 } else if ( attribute === BreinifyUser . ATTRIBUTES . MD5EMAIL ) {
1263712663 var email = this . get ( BreinifyUser . ATTRIBUTES . EMAIL ) ;
1263812664
@@ -12647,7 +12673,12 @@ dependencyScope.jQuery = $;;
1264712673 this . _user = { } ;
1264812674 }
1264912675
12650- this . _user [ attribute ] = value ;
12676+ // if the attribute is an empty value, we reset it
12677+ if ( BreinifyUtil . isEmpty ( value ) ) {
12678+ this . reset ( attribute ) ;
12679+ } else {
12680+ this . _user [ attribute ] = value ;
12681+ }
1265112682 } ,
1265212683
1265312684 reset : function ( attribute ) {
@@ -12766,7 +12797,7 @@ dependencyScope.jQuery = $;;
1276612797 * The one and only instance of the library.
1276712798 */
1276812799 var Breinify = {
12769- version : '1.0.3 ' ,
12800+ version : '1.0.4 ' ,
1277012801 jQueryVersion : $ . fn . jquery
1277112802 } ;
1277212803
0 commit comments