Index: chrome/android/java/res/raw/parse.js |
diff --git a/chrome/android/java/res/raw/parse.js b/chrome/android/java/res/raw/parse.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..91a15b2aeb7240b0efac379aa00568e51f9ba300 |
--- /dev/null |
+++ b/chrome/android/java/res/raw/parse.js |
@@ -0,0 +1,9 @@ |
+/* Copyright 2017 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. |
+ * |
+ * TODO(dproctor): This works only for JSON-LD data. If we want to support other |
+ * data formats, such as Microdata, RDF, etc. we'll need to include a parsing |
+ * library. |
+ */ |
+var a=document.querySelectorAll("script[type=\"application/ld+json\"]");if(a){ var b=[];a.forEach(function(s) {b.push(JSON.parse(s.innerHTML)) });b; } |
wychen
2017/02/13 22:08:06
A few corner cases we might want to handle:
{
"
dproctor
2017/02/13 23:11:57
Hey, thanks for raising the issue. I didn't see an
wychen
2017/02/13 23:44:31
I think flattening sounds nice, but then it would
|