Browse Source

Allow path to be passed to page.

pull/56/head
Kalle Stenflo 10 years ago
parent
commit
7b88ffb7fa
  1. 69
      json-path-web-test/src/main/resources/webapp/index.html

69
json-path-web-test/src/main/resources/webapp/index.html

@ -22,7 +22,7 @@
<div class="form-group"> <div class="form-group">
<select id="selTemplates" name="template" class="form-control"> <select id="selTemplates" name="template" class="form-control">
<option value="blank"></option> <option value="blank"></option>
<option value="goessner.json">Goessner examle</option> <option value="goessner.json" selected>Goessner examle</option>
<option value="twitter.json">Twitter API</option> <option value="twitter.json">Twitter API</option>
<option value="webxml.json">Webapp</option> <option value="webxml.json">Webapp</option>
<option value="20k.json">20k</option> <option value="20k.json">20k</option>
@ -30,7 +30,50 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<textarea id="txtJson" name="json" rows="15" class="form-control" placeholder="Select a template above or enter JSON"></textarea> <textarea id="txtJson" name="json" rows="15" class="form-control" placeholder="Select a template above or enter JSON">
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"display-price": 8.95
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"display-price": 12.99
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"display-price": 8.99
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"display-price": 22.99
}
],
"bicycle": {
"foo": "baz",
"color": "red",
"display-price": 19.95,
"foo:bar": "fooBar",
"dot.notation": "new",
"dash-notation": "dashes"
}
},
"foo": "bar",
"@id": "ID"
}
</textarea>
</div> </div>
<div class="input-group"> <div class="input-group">
@ -155,6 +198,16 @@
</div> </div>
</body> </body>
<script> <script>
function getParameterByName( name ){
var regexS = "[\\?&]"+name+"=([^&#]*)",
regex = new RegExp( regexS ),
results = regex.exec( window.location.href );
if( results == null ){
return null;
} else{
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
}
$( document ).ready(function() { $( document ).ready(function() {
$('#path-status-tool').tooltip({ $('#path-status-tool').tooltip({
@ -212,12 +265,9 @@
} }
} }
}); });
} }
$('#submit').on('click', function() { $('#submit').on('click', function() {
$('.result').empty(); $('.result').empty();
var json = $('#txtJson').val(); var json = $('#txtJson').val();
@ -285,6 +335,12 @@
}); });
}); });
var path = getParameterByName('path');
if(path !== null){
$("#txtPath").val(path);
$("#submit").click();
}
}); });
var toJsonString = function(src){ var toJsonString = function(src){
@ -296,5 +352,8 @@
} }
return str; return str;
}; };
</script> </script>
</html> </html>
Loading…
Cancel
Save