|
22 | 22 | <!-- End META-TAG Section --> |
23 | 23 |
|
24 | 24 | <!-- Begin LINK Section --> |
| 25 | + <link id="LcpLink" rel="preload" href="photos/quincy.acklen.webp" as="image" fetchpriority="high"/> |
25 | 26 | <link href="images/orgchart_192x192.png" rel="apple-touch-icon" type="image/png"/> |
26 | 27 | <link rel="icon" type="image/x-icon" href="favicon.ico"/> |
27 | 28 | <link rel="manifest" id="orgchart_manifest" crossorigin="use-credentials" href="manifest.json"/> |
|
2069 | 2070 | </style> |
2070 | 2071 | <!-- End STYLESHEET Section --> |
2071 | 2072 |
|
2072 | | - <link id="LcpLink" rel="prefetch" href="" as="image" /> |
| 2073 | + |
2073 | 2074 | <!-- Begin JAVASCRIPT Section --> |
2074 | 2075 | <script> |
2075 | | - const sDefaultPersonId = 'quincy.acklen'; |
2076 | | - function prefetchLargeImage() |
| 2076 | + let sDefaultPersonId = 'quincy.acklen'; |
| 2077 | + function preloadLargeImage() |
2077 | 2078 | { |
2078 | | - let oStartingPerson = null; |
2079 | | - let sUrl = document.location.hash; |
2080 | | - let sPersonId = sUrl.match( /person=([^&]*)/gi ); |
2081 | 2079 | const link = document.getElementById("LcpLink"); |
2082 | | - if( sPersonId && sPersonId [ 0 ] ) |
2083 | | - { |
2084 | | - sPersonId = sPersonId[ 0 ].replace( 'person=', '' ); |
| 2080 | + const regex = /\/([^\/]+)\.[^\.]+$/; |
| 2081 | + const match = link.href.match(regex); |
| 2082 | + console.log(match[1]) |
| 2083 | + if (match[1]) { |
| 2084 | + sDefaultPersonId = match[1]; |
2085 | 2085 | } |
2086 | | - else{ |
2087 | | - sPersonId = sDefaultPersonId; |
2088 | | - } |
2089 | | - link.href = `photos/${ sPersonId }.webp` |
2090 | | - link.rel = "preload"; |
2091 | 2086 | } |
| 2087 | + preloadLargeImage(); |
2092 | 2088 | </script> |
2093 | 2089 |
|
2094 | 2090 | <script id="serviceworker_for_PWA"> |
|
0 commit comments