11var _ipgeolocation = function ( ) {
22 var useSessionStorage = false ;
33 var asyncCall = true ;
4- var isHostname = false ;
5- var isLiveHostname = false ;
6- var isHostnameFallbackLive = false ;
7- var isSecurity = false ;
8- var isUserAgent = false ;
4+ var hostname = false ;
5+ var liveHostname = false ;
6+ var hostnameFallbackLive = false ;
7+ var security = false ;
8+ var userAgent = false ;
99 var ipAddress = "" ;
1010 var excludes = "" ;
1111 var fields = "" ;
@@ -58,34 +58,38 @@ var _ipgeolocation = function() {
5858 urlParameters = addUrlParameter ( urlParameters , "excludes" , excludes ) ;
5959 }
6060
61- if ( isHostname || isSecurity || isUserAgent ) {
62- var val = "" ;
63- var includeHost = false ;
64- if ( isHostname ) {
65- val = "hostname" ;
66- includeHost = true ;
67- } else if ( isHostnameFallbackLive ) {
68- val = "hostnameFallbackLive" ;
69- includeHost = true ;
70- } else if ( isLiveHostname ) {
71- val = "liveHostname" ;
72- includeHost = true ;
61+ if ( hostname || security || userAgent ) {
62+ var parameterValue = "" ;
63+ var hostnameSelected = false ;
64+
65+ if ( hostname ) {
66+ parameterValue = "hostname" ;
67+ hostnameSelected = true ;
68+ } else if ( hostnameFallbackLive ) {
69+ parameterValue = "hostnameFallbackLive" ;
70+ hostnameSelected = true ;
71+ } else if ( liveHostname ) {
72+ parameterValue = "liveHostname" ;
73+ hostnameSelected = true ;
7374 }
74- if ( isSecurity ) {
75- if ( includeHost ) {
76- val = val + ",security" ;
77- } else {
78- val = "security" ;
75+
76+ if ( security ) {
77+ if ( hostnameSelected ) {
78+ parameterValue = parameterValue + ",security" ;
79+ } else {
80+ parameterValue = "security" ;
7981 }
8082 }
81- if ( isUserAgent ) {
82- if ( includeHost || isSecurity ) {
83- val = val + ",useragent" ;
84- } else {
85- val = "useragent" ;
83+
84+ if ( userAgent ) {
85+ if ( hostnameSelected || security ) {
86+ parameterValue = parameterValue + ",useragent" ;
87+ } else {
88+ parameterValue = "useragent" ;
8689 }
8790 }
88- urlParameters = addUrlParameter ( urlParameters , "include" , val ) ;
91+
92+ urlParameters = addUrlParameter ( urlParameters , "include" , parameterValue ) ;
8993 }
9094
9195 if ( lang ) {
@@ -101,7 +105,7 @@ var _ipgeolocation = function() {
101105 urlParameters = addUrlParameter ( urlParameters , "long" , longitude ) ;
102106 }
103107
104- if ( location ) {
108+ if ( location ) {
105109 urlParameters = addUrlParameter ( urlParameters , "location" , location ) ;
106110 }
107111
@@ -154,19 +158,19 @@ var _ipgeolocation = function() {
154158 asyncCall = a ;
155159 } ,
156160 includeHostname : function ( h = false ) {
157- isHostname = h ;
161+ hostname = h ;
158162 } ,
159163 includeHostnameFallbackLive : function ( h = false ) {
160- isHostnameFallbackLive = h ;
164+ hostnameFallbackLive = h ;
161165 } ,
162166 includeLiveHostname : function ( h = false ) {
163- isLiveHostname = h ;
167+ liveHostname = h ;
164168 } ,
165169 includeSecurity : function ( s = false ) {
166- isSecurity = s ;
170+ security = s ;
167171 } ,
168172 includeUserAgent : function ( u = false ) {
169- isUserAgent = u ;
173+ userAgent = u ;
170174 } ,
171175 setFields : function ( f = "" ) {
172176 console . log ( "set" ) ;
0 commit comments