Chromium Code Reviews| Index: components/dom_distiller/core/javascript/is_distillable_trigger.js |
| diff --git a/components/dom_distiller/core/javascript/is_distillable_trigger.js b/components/dom_distiller/core/javascript/is_distillable_trigger.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6bdef02e94922c32ff287f0cec6aca3c4eea0568 |
| --- /dev/null |
| +++ b/components/dom_distiller/core/javascript/is_distillable_trigger.js |
| @@ -0,0 +1,21 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +function() { |
|
Yaron
2014/08/12 20:48:59
Why did you remove the closure wrap? It's no longe
smaslo
2014/08/12 20:58:15
Done.
|
| + var elems = document.querySelectorAll( |
| + 'meta[property="og:type"],meta[name=\\"og:type\\"]'); |
| + for (var i in elems) { |
| + if (elems[i].content && elems[i].content.toUpperCase() == 'ARTICLE') { |
| + return true; |
| + } |
| + } |
| + var elems = document.querySelectorAll( |
| + '*[itemtype="http://schema.org/Article"]'); |
| + for (var i in elems) { |
| + if (elems[i].itemscope) { |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |