diff options
Diffstat (limited to 'public/js/vendor')
| -rw-r--r-- | public/js/vendor/util.js | 1 | ||||
| -rw-r--r-- | public/js/vendor/view/router.js | 12 |
2 files changed, 7 insertions, 6 deletions
diff --git a/public/js/vendor/util.js b/public/js/vendor/util.js index 73a25ad..3637f49 100644 --- a/public/js/vendor/util.js +++ b/public/js/vendor/util.js @@ -14,6 +14,7 @@ function trim (s){ return s.replace(/^\s+/,"").replace(/\s+$/,"") } function sanitize (s){ return (s || "").replace(new RegExp("[<>&]", 'g'), "") } function sanitizeName (s){ return (s || "").replace(new RegExp("[^-_a-zA-Z0-9]", 'g'), "") } function stripHTML (s){ return (s || "").replace(/<[^>]+>/g, "") } +function sanitizeHTML (s){ return (s || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">") } function capitalize (s){ return s.split(" ").map(capitalizeWord).join(" ") } function capitalizeWord (s){ return s.charAt(0).toUpperCase() + s.slice(1) } function slugify (s){ return (s || "").toLowerCase().replace(/\s/g,"-").replace(/[^-_a-zA-Z0-9]/g, '-').replace(/-+/g,"-") } diff --git a/public/js/vendor/view/router.js b/public/js/vendor/view/router.js index 28905b2..ac2b5d4 100644 --- a/public/js/vendor/view/router.js +++ b/public/js/vendor/view/router.js @@ -15,7 +15,7 @@ var Router = View.extend({ } if (pathname in routes) { - this[this.routes[pathname]](null) + this[this.routes[pathname]]() return } @@ -27,27 +27,27 @@ var Router = View.extend({ var routePath = route.split("/") if (routePath[1] == path[1]) { if (routePath[2] && routePath[2].indexOf(":") !== -1 && path[2] && (path[3] === routePath[3]) ) { - this[this.routes[route]](null, path[2]) + this[this.routes[route]](path[2]) return } else if (routePath[2] == path[2]) { if (routePath[3] && path[3]) { if (routePath[3].indexOf(":") !== -1) { - this[this.routes[route]](null, path[3]) + this[this.routes[route]](path[3]) return } else if (routePath[3] == path[3]) { - this[this.routes[route]](null) + this[this.routes[route]]() return } } else if (! routePath[3] && ! path[3]) { - this[this.routes[route]](null) + this[this.routes[route]]() return } } else if (! routePath[2] && (! path[2].length || ! path[2])) { - this[this.routes[route]](null) + this[this.routes[route]]() return } } |
