Skip to content

Instantly share code, notes, and snippets.

@di7spider
Created November 10, 2017 09:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save di7spider/ec8c767fda95cba1ff498cb66db837ff to your computer and use it in GitHub Desktop.
Save di7spider/ec8c767fda95cba1ff498cb66db837ff to your computer and use it in GitHub Desktop.
Яндекс.Вебмастер :: Определение :: Много мелкого текста / Рекомендуем использовать шрифты размером не менее 12 px.
<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>
@di7spider
Copy link
Author

di7spider commented Nov 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment