Created
November 10, 2017 09:31
-
-
Save di7spider/ec8c767fda95cba1ff498cb66db837ff to your computer and use it in GitHub Desktop.
Яндекс.Вебмастер :: Определение :: Много мелкого текста / Рекомендуем использовать шрифты размером не менее 12 px.
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
<script> | |
!function () { | |
/** | |
* @link https://webmaster.yandex.ru/site/tools/mobile-friendly/ | |
* @detect | |
* Много мелкого текста | |
* Рекомендуем использовать шрифты размером не менее 12 px. | |
*/ | |
var cb = function () { | |
console.log('>> Много мелкого текста:'); | |
var cnt = 0; | |
document.querySelectorAll('*').forEach(function (item) { | |
[null, ':before', ':after'].forEach(function (child) { | |
var size = window.getComputedStyle(item, child).getPropertyValue("font-size"); | |
if (size !== '') { | |
var sizeFrmt = parseFloat(size.replace(/[^\d]+/, "") || 0); | |
if (sizeFrmt < 12) { | |
console.log(size, sizeFrmt, child, item); | |
cnt++; | |
} | |
} | |
}); | |
}); | |
console.log('>> Найдено: ', cnt); | |
} | |
document.addEventListener("DOMContentLoaded", cb); | |
// cb(); | |
}(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JS скрипт ищет на странице dom элементы у которых font-size < 12
Инфа:
https://webmaster.yandex.ru/site/tools/mobile-friendly/
https://yandex.ru/blog/webmaster/razmer-shrifta-esche-odin-faktor-opredeleniya-mobiloprigodnosti-v-vebmastere
https://developer.mozilla.org/ru/docs/Web/API/Window/getComputedStyle