|
18 | 18 | <link rel="import" href="../iron-doc-viewer/iron-doc-viewer-default-theme.html"> |
19 | 19 | <link rel="import" href="../iron-doc-viewer/iron-doc-viewer.html"> |
20 | 20 | <link rel="import" href="../iron-icons/iron-icons.html"> |
21 | | -<link rel="import" href="../iron-location/iron-location.html"> |
22 | 21 | <link rel="import" href="../paper-icon-button/paper-icon-button.html"> |
23 | 22 | <link rel="import" href="../paper-styles/color.html"> |
24 | 23 | <link rel="import" href="../paper-styles/typography.html"> |
|
61 | 60 | } |
62 | 61 | </style> |
63 | 62 |
|
64 | | - <iron-location hash="{{_urlHash}}"></iron-location> |
65 | | - |
66 | 63 | <iron-ajax |
67 | 64 | auto |
68 | 65 | url="[[descriptorUrl]]" |
|
85 | 82 | <app-drawer id="drawer" slot="drawer" swipe-open> |
86 | 83 | <iron-doc-nav |
87 | 84 | descriptor="[[_descriptor]]" |
88 | | - path="{{_path}}" |
89 | | - on-select="_clearScroll"> |
| 85 | + path="[[_path]]" |
| 86 | + on-select="_onNavSelect"> |
90 | 87 | </iron-doc-nav> |
91 | 88 | </app-drawer> |
92 | 89 |
|
|
99 | 96 | </app-header> |
100 | 97 |
|
101 | 98 | <iron-doc-viewer |
102 | | - id="viewer" |
103 | 99 | descriptor="[[_descriptor]]" |
104 | 100 | title="{{_title}}" |
105 | | - path="[[_path]]" |
106 | | - fragment-prefix="[[_path]]#" |
107 | | - scroll-to="[[_scrollTo]]"> |
| 101 | + path="{{_path}}"> |
108 | 102 | </iron-doc-viewer> |
109 | 103 |
|
110 | 104 | </app-header-layout> |
|
131 | 125 | observer: '_descriptorChanged' |
132 | 126 | }, |
133 | 127 |
|
134 | | - _path: { |
135 | | - type: String, |
136 | | - observer: '_pathChanged' |
137 | | - }, |
| 128 | + _path: String, |
138 | 129 |
|
139 | 130 | _title: { |
140 | 131 | type: String, |
141 | 132 | observer: '_titleChanged' |
142 | | - }, |
143 | | - |
144 | | - _urlHash: { |
145 | | - type: String, |
146 | | - observer: '_urlHashChanged' |
147 | | - }, |
148 | | - |
149 | | - _scrollTo: String, |
150 | | - |
151 | | - _changing: { |
152 | | - type: Boolean, |
153 | | - value: false |
154 | 133 | } |
155 | 134 | }, |
156 | 135 |
|
157 | | - _clearScroll() { |
| 136 | + _onNavSelect() { |
158 | 137 | document.body.scrollTop = 0; |
159 | | - var pos = this._urlHash.indexOf('#'); |
160 | | - if (pos >= 0) { |
161 | | - this._urlHash = this._urlHash.substring(0, pos); |
| 138 | + if (this.$.layout.narrow) { |
| 139 | + this.$.drawer.close(); |
162 | 140 | } |
163 | 141 | }, |
164 | 142 |
|
|
175 | 153 | this._descriptor = _flatten(descriptor); |
176 | 154 | this._changing = false; |
177 | 155 |
|
178 | | - if (this._urlHash) { |
179 | | - return; |
180 | | - } |
| 156 | + return; |
181 | 157 |
|
182 | 158 | var behaviors = descriptor.metadata |
183 | 159 | && descriptor.metadata.polymer |
|
197 | 173 | } |
198 | 174 | }, |
199 | 175 |
|
200 | | - _pathChanged(path) { |
201 | | - if (this._changing) { |
202 | | - return; |
203 | | - } |
204 | | - this._changing = true; |
205 | | - this._urlHash = path; |
206 | | - this._changing = false; |
207 | | - if (this.$.layout.narrow) { |
208 | | - this.$.drawer.close(); |
209 | | - } |
210 | | - }, |
211 | | - |
212 | 176 | _titleChanged(title) { |
213 | 177 | window.document.title = title; |
214 | | - }, |
215 | | - |
216 | | - _urlHashChanged(urlHash) { |
217 | | - if (this._changing) { |
218 | | - return; |
219 | | - } |
220 | | - var parts = urlHash.split('#'); |
221 | | - this._changing = true; |
222 | | - this._path = parts[0]; |
223 | | - this._scrollTo = parts[1]; |
224 | | - this._changing = false; |
225 | 178 | } |
226 | 179 | }); |
227 | 180 |
|
|
0 commit comments