diff options
author | Yorhel <git@yorhel.nl> | 2010-11-21 16:25:16 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-11-21 16:25:16 +0100 |
commit | db700ac32533b611242a36e2dac772d8632af4ed (patch) | |
tree | 321e6d19fe1695dde755f65085bc924c61441a24 | |
parent | a79312bb341bdfbdf14e7aeb3d1ffa6548604960 (diff) |
Use ~ as value separator in the filter string, rather than a comma
It seems a comma has to be escaped in query string values. A ~ doesn't
and thus makes the URIs significantly shorter.
-rw-r--r-- | data/script.js | 6 | ||||
-rw-r--r-- | lib/VNDB/Func.pm | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/data/script.js b/data/script.js index d54b8186..f4965ebb 100644 --- a/data/script.js +++ b/data/script.js @@ -1784,7 +1784,7 @@ if(byId('prodrelations')) * <fieldwritefunc> function reference, argument: <fieldcontents>, data from filter format; must update the contents with the passed data * * Filter string format: - * <field>-<value1>,<value2>.<field2>-<value>.<field3>-<value1>,<value2> + * <field>-<value1>~<value2>.<field2>-<value>.<field3>-<value1>~<value2> * Where: * <field> = [a-z0-9]+ * <value> = [a-zA-Z0-9_]+ and any UTF-8 characters not in the ASCII range @@ -1900,7 +1900,7 @@ function filSerialize() { } } if(r.length > 0 && r[0] != '') - l.push(fil_cats[0][f].fil_code+'-'+r.join(',')); + l.push(fil_cats[0][f].fil_code+'-'+r.join('~')); } byId('fil').value = l.join('.'); var cnt = byName(byId('filselect'), 'i')[1]; @@ -1922,7 +1922,7 @@ function filDeSerialize() { for(var fn in f) { var c = byId('fil_check_'+fn); c.checked = f[fn] == '' ? false : true; - var v = f[fn].split(','); + var v = f[fn].split('~'); for(var i=0; i<v.length; i++) v[i] = v[i].replace(/_([0-9]{2})/g, function (a, e) { return fil_escape[e] }); fil_cats[0][fn].fil_writefunc(fil_cats[0][fn].fil_contents, v); diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index a693e1de..810fe622 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -98,7 +98,7 @@ sub minage { sub fil_parse { return { map { my($f, $v) = split /-/, $_, 2; - my @v = split /,/, $v; + my @v = split /~/, $v; s/_([0-9]{2})/$1 > $#fil_escape ? '' : $fil_escape[$1]/eg for(@v); $f => @v > 1 ? \@v : @v } split /\./, scalar shift }; @@ -111,7 +111,7 @@ sub fil_serialize { return join '.', map { my @v = ref $fil->{$_} ? @{$fil->{$_}} : ($fil->{$_}); s/$e/_$fil_escape{$1}/g for(@v); - $_.'-'.join ',', @v + $_.'-'.join '~', @v } keys %$fil; } |