Mercurial > urweb
comparison lib/js/urweb.js @ 925:552c989c1601
Change string URLification to avoid using the empty string, which confuses Apache no2slash()
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 12 Sep 2009 09:31:50 -0400 |
parents | 771449d8b411 |
children | d136bc34e4ca |
comparison
equal
deleted
inserted
replaced
924:803342eb2dc0 | 925:552c989c1601 |
---|---|
462 else | 462 else |
463 return null; | 463 return null; |
464 } | 464 } |
465 | 465 |
466 function uf(s) { | 466 function uf(s) { |
467 return escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B"); | 467 if (s.length == 0) |
468 return "_"; | |
469 return (s[0] == '_' ? "_" : "") | |
470 + escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B"); | |
468 } | 471 } |
469 | 472 |
470 function uu(s) { | 473 function uu(s) { |
474 if (s.length > 0 && s[0] == '_') | |
475 s = s.substring(1); | |
471 return unescape(s.replace(new RegExp ("\\+", "g"), " ")); | 476 return unescape(s.replace(new RegExp ("\\+", "g"), " ")); |
472 } | 477 } |
473 | 478 |
474 function ub(b) { | 479 function ub(b) { |
475 return b ? "1" : "0"; | 480 return b ? "1" : "0"; |