|
107 | 107 | {% endcomment %} |
108 | 108 |
|
109 | 109 |
|
110 | | -<scripttype="text/javascript"> |
| 110 | +<script> |
111 | 111 | (function(){ |
112 | 112 | constREPO='donydchen/donydchen.github.io'; |
113 | 113 | constAPI_URL=`https://api.github.com/repos/${REPO}`; |
|
160 | 160 |
|
161 | 161 | document.addEventListener('DOMContentLoaded',scheduleUpdate); |
162 | 162 |
|
163 | | -// Attach to the <hy-push-state> element directly |
164 | 163 | functionattachPushStateListeners(){ |
165 | 164 | consthyEl=document.querySelector('hy-push-state'); |
166 | | -if(!hyEl)return;// nothing yet, maybe not loaded |
| 165 | +if(!hyEl)return; |
167 | 166 | ['hy-push-state-after','hy-push-state-ready'].forEach(ev=> |
168 | 167 | hyEl.addEventListener(ev,()=>scheduleUpdate(400)) |
169 | 168 | ); |
170 | 169 | } |
171 | 170 |
|
172 | | -// Try immediately and again when DOM ready |
173 | 171 | attachPushStateListeners(); |
174 | 172 | document.addEventListener('DOMContentLoaded',attachPushStateListeners); |
175 | 173 | })(); |
|