* @param {!Event} e
(e)
| 82 | * @param {!Event} e |
| 83 | */ |
| 84 | handleNavigate_(e) { |
| 85 | if (e.defaultPrevented) { |
| 86 | return false; |
| 87 | } |
| 88 | if (e.button) { |
| 89 | return false; |
| 90 | } |
| 91 | let a = e.target; |
| 92 | while (a) { |
| 93 | if (a.tagName == 'A' && a.href) { |
| 94 | break; |
| 95 | } |
| 96 | a = a.parentElement; |
| 97 | } |
| 98 | if (a) { |
| 99 | const url = new URL(a.href); |
| 100 | const {location} = this.win; |
| 101 | if ( |
| 102 | url.origin == location.origin && |
| 103 | startsWith(url.pathname, '/pwa/') && |
| 104 | url.pathname.indexOf('amp.html') != -1 |
| 105 | ) { |
| 106 | e.preventDefault(); |
| 107 | const newPage = url.pathname + location.search; |
| 108 | log('Internal link to: ', newPage); |
| 109 | if (newPage != this.currentPage_) { |
| 110 | this.closeSidebar().then(() => this.navigateTo(newPage)); |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | handlePopState_() { |
| 117 | const newPage = this.win.location.pathname; |
nothing calls this directly
no test coverage detected