Permalink
Browse files

Allow json param in URL

  • Loading branch information...
1 parent 4eb83a1 commit b5dc6573a11e9fd88ea5810e2a51542bcae445f7 @umbrae committed Jun 10, 2011
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,18 @@
+{
+ "name": "JSON Lint",
+ "description": "Always use double quotes.",
+ "version": "1",
+ "app": {
+ "urls": [
+ "http://www.jsonlint.com/",
+ "http://jsonlint.com/"
+ ],
+ "launch": {
+ "web_url": "http://jsonlint.com/"
+ }
+ },
+ "icons": {
+ "128": "jsonlint-logo.png"
+ },
+ "permissions": []
+}
View
@@ -86,12 +86,14 @@ jsl.interactions = (function () {
* @return string the url parameter's value, if any
**/
function getURLParameter(name) {
- return decodeURI(
- (new RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || ['', null])[1]
- );
+ param = (new RegExp(name + '=' + '(.+?)(&|$)').exec(location.search) || ['', null])[1];
+ if (param) {
+ return decodeURI(param);
+ } else {
+ return null;
+ }
}
-
/******* INTERACTION METHODS *******/
/**
@@ -163,8 +165,9 @@ jsl.interactions = (function () {
function init() {
reformatParam = getURLParameter('reformat');
reformat = reformatParam !== '0' && reformatParam !== 'no';
- compress = reformatParam === 'compress';
-
+ compress = reformatParam === 'compress',
+ jsonParam = getURLParameter('json');
+
if (compress) {
$('#headerText').html('JSONLint<span class="light">Compressor</span>');
}
@@ -203,6 +206,11 @@ jsl.interactions = (function () {
$('#faqButton').click(function () {
$('#faq').slideToggle();
});
+
+ if (jsonParam) {
+ $('#json_input').val(jsonParam);
+ $('#validate').click();
+ }
}
return {
View
@@ -1,7 +1,7 @@
CACHE MANIFEST
CACHE:
-# version: 3
+# version: 4
c/css/blueprint/compressed/screen.css
c/css/blueprint/plugins/css-classes/css-classes.css
c/css/screen.css

0 comments on commit b5dc657

Please sign in to comment.