2
2
3
3
// Page Parameters ------------------------------------------------------------
4
4
5
- var page_query_string =
6
- ( location . href . search ( / \? ( [ ^ # ] + ) (?: # | $ ) / ) >= 0 ) && RegExp . $1 ;
5
+ var page_query_string = location . search . substring ( 1 ) ;
7
6
8
7
var page_args =
9
8
( ( function ( ) {
@@ -32,13 +31,16 @@ function MergePageArgsIntoLink(a) {
32
31
}
33
32
34
33
function MergePageArgsIntoUrl ( href ) {
35
- href . search ( / ^ ( [ ^ ? # ] * ) (?: \? ( [ ^ # ] * ) ) ? ( # .* ) ? $ / ) ;
36
- if ( RegExp . $2 . length == 0 ) {
37
- return RegExp . $1 + "?" + page_query_string + RegExp . $3 ;
38
- } else {
34
+ var mtch = href . match ( / ^ ( [ ^ ? # ] * ) (?: \? ( [ ^ # ] * ) ) ? ( # .* ) ? $ / ) ;
35
+ if ( mtch == undefined ) { // I think this never happens
36
+ return "?" + page_query_string ;
37
+ }
38
+ if ( ! mtch [ 2 ] ) {
39
+ return mtch [ 1 ] + "?" + page_query_string + ( mtch [ 3 ] || "" ) ;
40
+ }
39
41
// need to merge here, precedence to arguments that exist in `a'
40
42
var i , j ;
41
- var prefix = RegExp . $1 , str = RegExp . $2 , suffix = RegExp . $3 ;
43
+ var prefix = mtch [ 1 ] , str = mtch [ 2 ] || "" , suffix = mtch [ 3 ] || "" ;
42
44
var args = str . split ( / [ & ; ] / ) ;
43
45
for ( i = 0 ; i < args . length ; i ++ ) {
44
46
j = args [ i ] . indexOf ( '=' ) ;
@@ -52,7 +54,6 @@ function MergePageArgsIntoUrl(href) {
52
54
if ( ! exists ) str += "&" + page_args [ i ] [ 0 ] + "=" + page_args [ i ] [ 1 ] ;
53
55
}
54
56
return prefix + "?" + str + suffix ;
55
- }
56
57
}
57
58
58
59
// Cookies --------------------------------------------------------------------
0 commit comments