Last active
June 21, 2018 05:56
-
-
Save plugnburn/6955c6794abfad821ca7a0432e70b990 to your computer and use it in GitHub Desktop.
Paschenometer - visual image to text ratio meter for helpix.ru reviews
This file contains 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
//copy the following into browser console and run | |
(()=>{ | |
let root=document.querySelector('div[itemprop="reviewBody"]'), | |
selCalc = sel => [].slice.call(root.querySelectorAll(sel)).reduce((v,el)=> v + (parseFloat(getComputedStyle(el).height) || 0), 0), | |
totalImageHeight = selCalc('div[align="center"] img'), totalTextHeight = selCalc('p'), | |
totalHeight = totalImageHeight + totalTextHeight; | |
console.log('Percentage: images - ' + (100*totalImageHeight/totalHeight).toFixed(2) + '%, text - ' + (100*totalTextHeight/totalHeight).toFixed(2) + '%') | |
console.log('Paschenism ratio:', (totalImageHeight/totalTextHeight).toFixed(2)) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment