@@ -68,7 +68,7 @@ wax.util = {
68
68
parseInt ( htmlComputed . marginTop , 10 ) &&
69
69
! isNaN ( parseInt ( htmlComputed . marginTop , 10 ) ) ) {
70
70
top += parseInt ( htmlComputed . marginTop , 10 ) ;
71
- left += parseInt ( htmlComputed . marginLeft , 10 ) ;
71
+ left += parseInt ( htmlComputed . marginLeft , 10 ) ;
72
72
}
73
73
74
74
return {
@@ -89,14 +89,14 @@ wax.util = {
89
89
// Returns a version of a function that always has the second parameter,
90
90
// `obj`, as `this`.
91
91
bind : function ( func , obj ) {
92
- var args = Array . prototype . slice . call ( arguments , 2 ) ;
93
- return function ( ) {
94
- return func . apply ( obj , args . concat ( Array . prototype . slice . call ( arguments ) ) ) ;
95
- } ;
92
+ var args = Array . prototype . slice . call ( arguments , 2 ) ;
93
+ return function ( ) {
94
+ return func . apply ( obj , args . concat ( Array . prototype . slice . call ( arguments ) ) ) ;
95
+ } ;
96
96
} ,
97
97
// From underscore
98
98
isString : function ( obj ) {
99
- return ! ! ( obj === '' || ( obj && obj . charCodeAt && obj . substr ) ) ;
99
+ return ! ! ( obj === '' || ( obj && obj . charCodeAt && obj . substr ) ) ;
100
100
} ,
101
101
// IE doesn't have indexOf
102
102
indexOf : function ( array , item ) {
@@ -113,10 +113,10 @@ wax.util = {
113
113
} ,
114
114
// From underscore: reimplement the ECMA5 `Object.keys()` method
115
115
keys : Object . keys || function ( obj ) {
116
- var hasOwnProperty = Object . prototype . hasOwnProperty ;
116
+ var ho = Object . prototype . hasOwnProperty ;
117
117
if ( obj !== Object ( obj ) ) throw new TypeError ( 'Invalid object' ) ;
118
118
var keys = [ ] ;
119
- for ( var key in obj ) if ( hasOwnProperty . call ( obj , key ) ) keys [ keys . length ] = key ;
119
+ for ( var key in obj ) if ( ho . call ( obj , key ) ) keys [ keys . length ] = key ;
120
120
return keys ;
121
121
} ,
122
122
// From quirksmode: normalize the offset of an event from the top-left
@@ -139,9 +139,9 @@ wax.util = {
139
139
var leftMargin = parseInt ( htmlComputed . marginLeft , 10 ) || 0 ;
140
140
return {
141
141
x : e . clientX + ( doc && doc . scrollLeft || body && body . scrollLeft || 0 ) -
142
- ( doc && doc . clientLeft || body && body . clientLeft || 0 ) + leftMargin ,
142
+ ( doc && doc . clientLeft || body && body . clientLeft || 0 ) + leftMargin ,
143
143
y : e . clientY + ( doc && doc . scrollTop || body && body . scrollTop || 0 ) -
144
- ( doc && doc . clientTop || body && body . clientTop || 0 ) + topMargin
144
+ ( doc && doc . clientTop || body && body . clientTop || 0 ) + topMargin
145
145
} ;
146
146
} else if ( e . touches && e . touches . length === 1 ) {
147
147
// Touch browsers
@@ -150,5 +150,37 @@ wax.util = {
150
150
y : e . touches [ 0 ] . pageY
151
151
} ;
152
152
}
153
+ } ,
154
+ // parseUri 1.2.2
155
+ // Steven Levithan <stevenlevithan.com>
156
+ parseUri : function ( str ) {
157
+ var o = {
158
+ strictMode : false ,
159
+ key : [ "source" , "protocol" , "authority" , "userInfo" , "user" , "password" , "host" , "port" , "relative" , "path" , "directory" , "file" , "query" , "anchor" ] ,
160
+ q : {
161
+ name : "queryKey" ,
162
+ parser : / (?: ^ | & ) ( [ ^ & = ] * ) = ? ( [ ^ & ] * ) / g
163
+ } ,
164
+ parser : {
165
+ strict : / ^ (?: ( [ ^ : \/ ? # ] + ) : ) ? (?: \/ \/ ( (?: ( ( [ ^ : @ ] * ) (?: : ( [ ^ : @ ] * ) ) ? ) ? @ ) ? ( [ ^ : \/ ? # ] * ) (?: : ( \d * ) ) ? ) ) ? ( ( ( (?: [ ^ ? # \/ ] * \/ ) * ) ( [ ^ ? # ] * ) ) (?: \? ( [ ^ # ] * ) ) ? (?: # ( .* ) ) ? ) / ,
166
+ loose : / ^ (?: (? ! [ ^ : @ ] + : [ ^ : @ \/ ] * @ ) ( [ ^ : \/ ? # . ] + ) : ) ? (?: \/ \/ ) ? ( (?: ( ( [ ^ : @ ] * ) (?: : ( [ ^ : @ ] * ) ) ? ) ? @ ) ? ( [ ^ : \/ ? # ] * ) (?: : ( \d * ) ) ? ) ( ( ( \/ (?: [ ^ ? # ] (? ! [ ^ ? # \/ ] * \. [ ^ ? # \/ . ] + (?: [ ? # ] | $ ) ) ) * \/ ? ) ? ( [ ^ ? # \/ ] * ) ) (?: \? ( [ ^ # ] * ) ) ? (?: # ( .* ) ) ? ) /
167
+ }
168
+ } ,
169
+ m = o . parser [ o . strictMode ? "strict" : "loose" ] . exec ( str ) ,
170
+ uri = { } ,
171
+ i = 14 ;
172
+
173
+ while ( i -- ) uri [ o . key [ i ] ] = m [ i ] || "" ;
174
+
175
+ uri [ o . q . name ] = { } ;
176
+ uri [ o . key [ 12 ] ] . replace ( o . q . parser , function ( $0 , $1 , $2 ) {
177
+ if ( $1 ) uri [ o . q . name ] [ $1 ] = $2 ;
178
+ } ) ;
179
+ return uri ;
180
+ } ,
181
+ // appends callback onto urls regardless of existing query params
182
+ addUrlData : function ( url , data ) {
183
+ url += ( this . parseUri ( url ) . query ) ? '&' : '?' ;
184
+ return url += data ;
153
185
}
154
186
} ;
0 commit comments