Showing the changes to assets/javascripts (2 of 2 files). Show all
Unified · Split
| @@ -112,18 +112,15 @@ class app.Router · 111 unmodified lines | ||
| 112 | 112 | @triggerRoute 'notFound' |
| 113 | 113 | return |
| 114 | 114 | |
| 115 | − isRoot: -> | |
| 116 | − location.pathname is '/' | |
| 117 | − | |
| 118 | − isDocIndex: -> | |
| 119 | − @context and @context.doc and @context.entry is @context.doc.toEntry() | |
| 115 | + isIndex: -> | |
| 116 | + @context.path is '/' or (app.isSingleDoc() and @context?.entry?.isIndex()) | |
| 120 | 117 | |
| 121 | 118 | setInitialPath: -> |
| 122 | 119 | # Remove superfluous forward slashes at the beginning of the path |
| 123 | 120 | if (path = location.pathname.replace /^\/{2,}/g, '/') isnt location.pathname |
| 124 | 121 | page.replace path + location.search + location.hash, null, true |
| 125 | 122 | |
| 126 | − if @isRoot() | |
| 123 | + if location.pathname is '/' | |
| 127 | 124 | if path = @getInitialPathFromHash() |
| 128 | 125 | page.replace path + location.search, null, true |
| 129 | 126 | else if path = @getInitialPathFromCookie() |
| @@ -19,7 +19,6 @@ class app.views.Search extends app.View · 18 unmodified lines | ||
| 19 | 19 | altS: 'stackoverflow' |
| 20 | 20 | |
| 21 | 21 | @routes: |
| 22 | − root: 'onRoot' | |
| 23 | 22 | after: 'afterRoute' |
| 24 | 23 | |
| 25 | 24 | init: -> |
| @@ -77,9 +76,9 @@ class app.views.Search extends app.View · 51 unmodified lines | ||
| 77 | 76 | return |
| 78 | 77 | |
| 79 | 78 | searchUrl: => |
| 80 | − if app.router.isRoot() | |
| 79 | + if location.pathname is '/' | |
| 81 | 80 | @scope.searchUrl() |
| 82 | − else if not app.router.isDocIndex() | |
| 81 | + else if not app.router.isIndex() | |
| 83 | 82 | return |
| 84 | 83 | |
| 85 | 84 | return unless value = @extractHashValue() |
| @@ -129,11 +128,8 @@ class app.views.Search extends app.View · 43 unmodified lines | ||
| 129 | 128 | $.stopEvent(event) |
| 130 | 129 | return |
| 131 | 130 | |
| 132 | − onRoot: (context) => | |
| 133 | − @reset() unless context.init | |
| 134 | − return | |
| 135 | − | |
| 136 | 131 | afterRoute: (name, context) => |
| 132 | + @reset() if not context.init and app.router.isIndex() | |
| 137 | 133 | @delay @searchUrl if context.hash |
| 138 | 134 | @delay @autoFocus |
| 139 | 135 | return |