Skip to content

Instantly share code, notes, and snippets.

@plugnburn
Last active June 21, 2018 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugnburn/6955c6794abfad821ca7a0432e70b990 to your computer and use it in GitHub Desktop.
Save plugnburn/6955c6794abfad821ca7a0432e70b990 to your computer and use it in GitHub Desktop.
Paschenometer - visual image to text ratio meter for helpix.ru reviews
//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