Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: web/apps/logdog-app/elements/routing.html

Issue 2570963003: Revert of Rewrite LogDog log viewer app. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « web/apps/logdog-app/elements/logdog-app/logdog-scripts-main.html ('k') | web/apps/logdog-app/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: web/apps/logdog-app/elements/routing.html
diff --git a/web/apps/logdog-app/elements/routing.html b/web/apps/logdog-app/elements/routing.html
index 9eec0c1d540631d89f420bf61aff38bea5702495..1d99b473a8266cb903e8731dd0bce42371e8a76a 100644
--- a/web/apps/logdog-app/elements/routing.html
+++ b/web/apps/logdog-app/elements/routing.html
@@ -14,8 +14,7 @@
// client-side router inspired by the Express router
// More info: https://visionmedia.github.io/page.js/
// Removes end / from app.baseUrl which page.base requires for production
- var baseUrl = app.baseUrl;
- page.base(baseUrl);
+ page.base(app.baseUrl);
// Middleware
function scrollToTop(ctx, next) {
@@ -27,36 +26,19 @@
next();
}
- // Hack to make this work on root-URL apps (e.g., localhost testing).
- if ( baseUrl === "/" ) {
- var oldReplace = page.replace;
- page.replace = function(path, state, init, dispatch) {
- if ( path.substring(0, 1) !== "/" ) {
- path = "/" + path;
- }
- if ( path.substring(0, 3) !== "/#!" ) {
- path = "/#!" + path;
- }
- return oldReplace(path, state, init, dispatch);
- };
- }
-
// Routes
- page("*", scrollToTop, closeDrawer, function(ctx, next) {
+ page('*', scrollToTop, closeDrawer, function(ctx, next) {
next();
});
-
- page("/", function() {
- app.route = "root";
+ page('/', function() {
+ app.route = 'root';
});
-
- page("/list/*", function(data) {
- app.route = "list";
+ page('/list/*', function(data) {
+ app.route = 'list';
app.$.list.base = logdog.correctStreamPath(data.params[0]);
});
-
- page("/stream/*", function(data) {
- app.route = "stream";
+ page('/stream/*', function(data) {
+ app.route = 'stream';
app.$.stream.streams = logdog.getQueryValues(data.querystring, "s").
map(logdog.correctStreamPath);
});
@@ -68,7 +50,7 @@
app.$.toast.show();
page.redirect(app.baseUrl);
});
-
+ // add #! before urls
page({
hashbang: true,
});
« no previous file with comments | « web/apps/logdog-app/elements/logdog-app/logdog-scripts-main.html ('k') | web/apps/logdog-app/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698