Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: components/dom_distiller/core/javascript/extract_features.js

Issue 1047223003: Add integration of the new heuristics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dd-adaboost-model
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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"]');
nyquist 2015/04/01 18:12:20 Nit: Would we need to do anything special if devel
cjhopman 2015/04/01 20:59:29 Yeah, we're not really doing this right, but it's
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 {
nyquist 2015/04/01 18:12:20 return as stringified to help out our iOS friends?
cjhopman 2015/04/01 20:59:29 Done.
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,
nyquist 2015/04/01 18:12:20 It would be amazing if we at some point would get
cjhopman 2015/04/01 20:59:29 Yeah, it would be nice.
26 'innerHTML': body.innerHTML,
27 }
28 })()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698