Only use alternative context for Schema.org if user explicitly agrees
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Fri, 16 Aug 2013 16:39:52 +0200
changeset 1892 b4473de683b6
parent 1891 6166130ce593
child 1893 8ff237dff16b
Only use alternative context for Schema.org if user explicitly agrees

I made the explanation very schema.org specific since that's currently the only entry in the map. As soon as we add other alternative contexts we should update it.

/cc @davidlehn @danbri
playground/index.html
playground/playground.js
--- a/playground/index.html	Fri Aug 16 12:12:13 2013 +0200
+++ b/playground/index.html	Fri Aug 16 16:39:52 2013 +0200
@@ -140,13 +140,32 @@
           </div>
         </div>
       </div>
-      <br/>
-      <div id="permalink"></div>
-      <br/>
-      <div id="markup-errors" class="text-error"></div>
-      <br/>
+      <p id="permalink"></p>
+      <p id="markup-errors" class="text-error"></p>
       <div id="param-errors" class="text-error"></div>
-      <div id="processing-errors" class="text-error"></div>
+      <div id="using-context-map" class="hide alert alert-note">
+        <p>NOTE: Schema.org's remote context was detected in your input but, unfortunately,
+          it doesn't resolve to a proper context document yet. The Schema.org team is
+          already working on this issue and it is expected to be resolved in a couple
+          of weeks.</p>
+        <p>In the meantime, if you wish, you can use an alternative context created by
+          the JSON-LD community to process your document.</p>
+        <label class="checkbox">
+          <input type="checkbox" id="use-context-map" value="1"> Use alternative context
+        </label>
+        <table class="table table-condensed">
+          <thead>
+            <tr>
+              <td>Original</td>
+              <td>Alternative</td>
+            </tr>
+          </thead>
+          <tbody>
+            <!-- dynamic rows -->
+          </tbody>
+        </table>
+      </div>
+      <p id="processing-errors" class="text-error"></p>
       <div id="tabs">
         <div class="tabbable">
           <ul class="nav nav-tabs">
@@ -179,23 +198,6 @@
           </div><!-- /.tab-content -->
         </div><!-- /.tabbable -->
       </div>
-      <div id="using-context-map" class="hide alert alert-note">
-        <p>
-        NOTE: Context map below is in use. One or more of the context URLs
-        was loaded from a modified value.
-        </p>
-        <table class="table table-condensed">
-          <thead>
-            <tr>
-              <td>Original</td>
-              <td>Modified</td>
-            </tr>
-          </thead>
-          <tbody>
-            <!-- dynamic rows -->
-          </tbody>
-        </table>
-      </div>
       <hr>
       <div id="footer">
         <p id="copyright">
--- a/playground/playground.js	Fri Aug 16 12:12:13 2013 +0200
+++ b/playground/playground.js	Fri Aug 16 16:39:52 2013 +0200
@@ -491,7 +491,10 @@
           $('#using-context-map table tbody').append(row);
           playground.activeContextMap[url] = modified;
         }
-        url = modified;
+
+        if($('#use-context-map').prop('checked')) {
+          url = modified;
+        }
       }
       jqueryDocumentLoader(url, callback);
     };
@@ -510,6 +513,10 @@
       clearTimeout(processTimer);
       processTimer = setTimeout(playground.process, 500);
     });
+
+    $('#use-context-map').change(function() {
+      playground.process();
+    });
   });
 
 })(jQuery);