Skip to content

Commit

Permalink
Merge pull request #5 from aayushdutt/master
Browse files Browse the repository at this point in the history
Fix #1 : Fixed make it readable button
  • Loading branch information
amitguptagwl authored May 6, 2018
2 parents 367fd06 + 3e480f7 commit eac9063
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
<br>
<br>
<textarea id="txtNimnSchema" name="nimn" rows="20" class="form-control" placeholder="Paste NIMN schema here"></textarea>
</div>
</div>
<div class="col-md-4">
<button id="makeitreadable" style="width: 100%;opacity: 0.6; cursor: not-allowed;" class="btn btn-primary" type="button">Make it Readable</button>
<button id="makeitreadable" style="width: 100%;" class="btn btn-primary disabled" type="button">Make it Readable</button>
<textarea id="txtNimn" name="nimn" rows="30" class="form-control" placeholder="Paste NIMN data here"></textarea>
</div>
</div>
Expand Down Expand Up @@ -83,8 +83,10 @@
}
var result = nimnEncoder.encode(jObj);
$('#txtNimn').val(result);
$("#makeitreadable").removeClass("disabled");
}catch(e){
$('#txtNimn').val(e);
$("#makeitreadable").addClass("disabled");
}
});

Expand Down Expand Up @@ -124,6 +126,14 @@
$('#txtJson').val(e);
}
});

$("#txtNimn").on('input', function()
{
if( !this.value ) {
$("#makeitreadable").addClass("disabled");
}
else $("#makeitreadable").removeClass("disabled");
});


$("#makeitreadable").click(function(){
Expand All @@ -149,20 +159,6 @@

});

$("#txtJson").on('input', function() {
var inputLength = $("#txtJson").val().length;
if(inputLength == 1){
$("#makeitreadable").css(
{"opacity": "1",
"cursor": "auto"});
}
else if (inputLength == 0) {
$("#makeitreadable").css(
{"opacity": "0.6",
"cursor": "not-allowed"});
}
});

});


Expand Down

0 comments on commit eac9063

Please sign in to comment.