Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / components / dom_distiller / core / javascript / extract_features.js
blob32be25cea1ff6a37232cf9f11f8a114f0f5ad0d1
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.
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;
14 return false;
17 var body = document.body;
18 if (!body) {
19 return false;
21 return JSON.stringify({
22 'opengraph': hasOGArticle(),
23 'url': document.location.href,
24 'numElements': body.querySelectorAll('*').length,
25 'numAnchors': body.querySelectorAll('a').length,
26 'numForms': body.querySelectorAll('form').length,
27 'innerText': body.innerText,
28 'textContent': body.textContent,
29 'innerHTML': body.innerHTML,
30 });
31 })()