Clarify that UI for JSON-LD context is for a new context, some fixes.
authorDave Longley <dlongley@digitalbazaar.com>
Wed, 17 Jul 2013 21:11:32 -0400
changeset 1776 6a0b2f8e34ba
parent 1775 f17d5607ff52
child 1777 7ac97a649d94
child 1781 149fe3bf3ffd
Clarify that UI for JSON-LD context is for a new context, some fixes.

- Do not process query parameters if not present (allows placeholder
text to display).
playground/index.html
playground/playground.js
--- a/playground/index.html	Wed Jul 17 18:04:19 2013 -0700
+++ b/playground/index.html	Wed Jul 17 21:11:32 2013 -0400
@@ -130,9 +130,9 @@
               placeholder="Enter your JSON-LD markup here..." rows="10"></textarea>
             </div>
             <div id="context-div" class="span6">
-              <h3>JSON-LD Context</h3>
+              <h3>New JSON-LD Context</h3>
               <textarea id="context" class="compressed process span6"
-              placeholder="Enter your JSON-LD context here..." rows="10"></textarea>
+              placeholder="Enter the new JSON-LD context to compact to here..." rows="10"></textarea>
             </div>
             <div id="frame-div" class="span6">
               <h3>JSON-LD Frame</h3>
--- a/playground/playground.js	Wed Jul 17 18:04:19 2013 -0700
+++ b/playground/playground.js	Wed Jul 17 21:11:32 2013 -0400
@@ -61,9 +61,9 @@
   playground.processQueryParameters = function() {
     // data from the query
     var queryData = {
-       markup: null,
-       frame: null,
-       context: null
+      markup: null,
+      frame: null,
+      context: null
     };
 
     /**
@@ -82,7 +82,6 @@
 
       // check 'json-ld' parameter
       if(param !== null) {
-        hasQueryData = true;
         if(param.length === 0 || param[0] === '{' || param[0] === '[') {
           // param looks like JSON
           queryData[fieldName] = param;
@@ -123,8 +122,8 @@
 
     var startTab = getParameterByName('startTab');
     if(startTab) {
-        // strip 'tab-' to get the tab's panel's I D
-        $('#tabs').tabs('select', '#' + startTab.substr(4));
+      // strip 'tab-' to get the tab's panel's ID
+      $('#tabs').tabs('select', '#' + startTab.substr(4));
     }
 
     // wait for ajax if needed
@@ -147,7 +146,9 @@
   playground.init = function() {
     $('#tabs').tabs();
     $('#tabs').bind('tabsselect', playground.tabSelected);
-    playground.processQueryParameters();
+    if(window.location.search) {
+      playground.processQueryParameters();
+    }
   };
 
   /**