Fishies 0.8.11
This commit is contained in:
parent
11661ffb05
commit
f31db9cb37
1 changed files with 4 additions and 1 deletions
|
|
@ -17,5 +17,8 @@ export function reveal(img: HTMLImageElement, instant?: boolean): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FX_IMAGE_SCRIPT = `(function(){var r=${reveal.toString()};` +
|
export const FX_IMAGE_SCRIPT = `(function(){var r=${reveal.toString()};` +
|
||||||
`function h(e){var t=e.target;if(t&&t.tagName==='IMG'&&t.hasAttribute('data-fx'))r(t)}` +
|
`var p=/(\\/game\\/[^?#\\s]+)\\.png(?=[?#\\s]|$)/g;` +
|
||||||
|
`function w(t){if(t.getAttribute('data-webp-tried'))return false;var s=t.getAttribute('src')||'';if(!/\\/game\\/[^?#]+\\.png/.test(s))return false;` +
|
||||||
|
`t.setAttribute('data-webp-tried','1');var ss=t.getAttribute('srcset');if(ss)t.setAttribute('srcset',ss.replace(p,'$1.webp'));t.setAttribute('src',s.replace(p,'$1.webp'));return true}` +
|
||||||
|
`function h(e){var t=e.target;if(!t||t.tagName!=='IMG')return;if(e.type==='error'&&w(t))return;if(t.hasAttribute('data-fx'))r(t)}` +
|
||||||
`document.addEventListener('load',h,true);document.addEventListener('error',h,true)})()`
|
`document.addEventListener('load',h,true);document.addEventListener('error',h,true)})()`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue