OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 (function() { |
| 6 function hasOGArticle() { |
| 7 var elems = document.head.querySelectorAll( |
| 8 'meta[property="og:type"],meta[name="og:type"]'); |
| 9 for (var i in elems) { |
| 10 if (elems[i].content && elems[i].content.toUpperCase() == 'ARTICLE') { |
| 11 return true; |
| 12 } |
| 13 } |
| 14 return false; |
| 15 } |
| 16 |
| 17 var body = document.body; |
| 18 return JSON.stringify({ |
| 19 'opengraph': hasOGArticle(), |
| 20 'url': document.location.href, |
| 21 'numElements': body.querySelectorAll('*').length, |
| 22 'numAnchors': body.querySelectorAll('a').length, |
| 23 'numForms': body.querySelectorAll('form').length, |
| 24 'innerText': body.innerText, |
| 25 'textContent': body.textContent, |
| 26 'innerHTML': body.innerHTML, |
| 27 }); |
| 28 })() |
OLD | NEW |