Last active
December 28, 2023 23:00
-
-
Save Protoff/d6643387f03d47b44b2d7c3cf7b3e0a0 to your computer and use it in GitHub Desktop.
Revisions
-
Protoff revised this gist
Jul 14, 2020 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,12 @@ document.addEventListener('DOMContentLoaded', function() { testWebP(document.body) }) function testWebP(elem) { const webP = new Image(); webP.src = 'data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA'; webP.onload = webP.onerror = function () { webP.height === 2 ? elem.classList.add('webp-true') : elem.classList.add('webp-false') } console.log(webP) } -
Protoff revised this gist
Jul 14, 2020 . 1 changed file with 8 additions and 17 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,9 @@ function testWebP() { const classes = document.body.classList const webP = new Image(); webP.src = 'data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA'; webP.onload = webP.onerror = function () { webP.height === 2 ? classes.add('webp-true') : classes.add('webp-false') } console.log(webP) } -
Protoff revised this gist
Jul 14, 2020 . No changes.There are no files selected for viewing
-
Protoff revised this gist
Jul 14, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ const backHeader = document.querySelector('body') function testWebP(callback) { var webP = new Image(); webP.src = 'data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA'; @@ -15,4 +15,4 @@ } } testWebP(notify) -
Protoff created this gist
Apr 27, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ const backHeader = document.querySelector('.header .bg') function testWebP(callback) { var webP = new Image(); webP.src = 'data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA'; webP.onload = webP.onerror = function () { callback(webP.height === 2); }; }; function notify(supported) { if(supported) { backHeader.classList.add('backwebp') } else { backHeader.classList.add('notbackwebp') } } testWebP(notify)