This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <img data-src="unicorn.jpg" loading="lazy" alt=".." class="lazyload"/> | |
| <script> | |
| // Select all images with the class "lazyload" | |
| const images = document.querySelectorAll("img.lazyload"); | |
| // Check if the browser supports the "loading" attribute | |
| if ('loading' in HTMLImageElement.prototype) { | |
| // If so, we'll update all <img src> to point to the data-src instead | |
| images.forEach(img => { | |
| img.src = img.dataset.src; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://webreflection.medium.com/using-the-input-datetime-local-9503e7efdce | |
| Date.prototype.toDatetimeLocal = | |
| function toDatetimeLocal() { | |
| var | |
| date = this, | |
| ten = function (i) { | |
| return (i < 10 ? '0' : '') + i; | |
| }, | |
| YYYY = date.getFullYear(), | |
| MM = ten(date.getMonth() + 1), |