OLD | NEW |
1 return (function() { | 1 return (function() { |
2 function hasOGArticle() { | 2 function hasOGArticle() { |
3 var elems = document.head.querySelectorAll( | 3 var elems = document.head.querySelectorAll( |
4 'meta[property="og:type"],meta[name="og:type"]'); | 4 'meta[property="og:type"],meta[name="og:type"]'); |
5 for (var i in elems) { | 5 for (var i in elems) { |
6 if (elems[i].content && elems[i].content.toUpperCase() == 'ARTICLE') { | 6 if (elems[i].content && elems[i].content.toUpperCase() == 'ARTICLE') { |
7 return true; | 7 return true; |
8 } | 8 } |
9 } | 9 } |
10 return false; | 10 return false; |
11 } | 11 } |
12 | 12 |
13 function isVisible(e) { | 13 function isVisible(e) { |
14 var bounds = e.getBoundingClientRect() | 14 var bounds = e.getBoundingClientRect() |
15 var style = window.getComputedStyle(e); | 15 var style = window.getComputedStyle(e); |
16 return !( | 16 return !( |
17 bounds.height == 0 || bounds.width == 0 || | 17 (bounds.height == 0 && bounds.width == 0) || |
18 style.display == "none" || | 18 style.display == "none" || |
19 style.visibility == "hidden" || | 19 style.visibility == "hidden" || |
20 style.opacity == 0 | 20 style.opacity == 0 |
21 ) | 21 ) |
22 } | 22 } |
23 | 23 |
24 function countVisible(nodes) { | 24 function countVisible(nodes) { |
25 var count = 0; | 25 var count = 0; |
26 for (var i = 0; i < nodes.length; i++) { | 26 for (var i = 0; i < nodes.length; i++) { |
27 var node = nodes[i]; | 27 var node = nodes[i]; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 'mozScore': _mozScore(true, 0.5, 140, true, 1e100), | 89 'mozScore': _mozScore(true, 0.5, 140, true, 1e100), |
90 'mozScoreAllSqrt': _mozScore(true, 0.5, 0, true, 1e100), | 90 'mozScoreAllSqrt': _mozScore(true, 0.5, 0, true, 1e100), |
91 'mozScoreAllLinear': _mozScore(true, 1, 0, true, 1e100), | 91 'mozScoreAllLinear': _mozScore(true, 1, 0, true, 1e100), |
92 'mozScoreFast': _mozScore(false, 0.5, 140, true, 1000), | 92 'mozScoreFast': _mozScore(false, 0.5, 140, true, 1000), |
93 'mozScoreFastAllSqrt': _mozScore(false, 0.5, 0, true, 1000), | 93 'mozScoreFastAllSqrt': _mozScore(false, 0.5, 0, true, 1000), |
94 'mozScoreFastAllLinear': _mozScore(false, 1, 0, true, 1000), | 94 'mozScoreFastAllLinear': _mozScore(false, 1, 0, true, 1000), |
95 'visibleElements': countVisible(body.querySelectorAll('*')), | 95 'visibleElements': countVisible(body.querySelectorAll('*')), |
96 'visiblePPRE': countVisible(body.querySelectorAll('p,pre')), | 96 'visiblePPRE': countVisible(body.querySelectorAll('p,pre')), |
97 } | 97 } |
98 })() | 98 })() |
OLD | NEW |