octopart-fetch button is mash-like-an-idiot proof

master
Marek Baczynski 6 years ago
parent dc880978ab
commit f4235556f7

@ -248,7 +248,9 @@ function container_onchange() {
} }
function octopartFetch(){ function octopartFetch(){
$('#magic-autofill-button').attr('disabled', 'disabled');
$.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){ $.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){
$('#magic-autofill-button').removeAttr('disabled');
if (json['result']=='ok'){ if (json['result']=='ok'){
$('#description-input').val(json['snippet']); $('#description-input').val(json['snippet']);
}else{ }else{

@ -59,7 +59,7 @@
<tr id="partno" class="details-content"><td><p></p><input type="text" name="partno-input" placeholder="Part Number" class="pinfo-input" id="partno-input"/></td></tr> <tr id="partno" class="details-content"><td><p></p><input type="text" name="partno-input" placeholder="Part Number" class="pinfo-input" id="partno-input"/></td></tr>
<tr id="description-head" class="details-header"><td>DESCRIPTION</td></tr> <tr id="description-head" class="details-header"><td>DESCRIPTION</td></tr>
<tr id="description" class="details-content"><td><p></p><input type="text" name="description-input" placeholder="Description" class="pinfo-input" id="description-input"/></td></tr> <tr id="description" class="details-content"><td><p></p><input type="text" name="description-input" placeholder="Description" class="pinfo-input" id="description-input"/></td></tr>
<tr id="magical_autofill" style="display:none"><td><input type="button" id="magic-autofill-button" onclick="octopartFetch()" value="magical auto-fill powered by OctoPart™" style="margin-bottom:6pt"/></td></tr> <tr id="magical_autofill" style="display:none"><td><input type="button" id="magic-autofill-button" onclick="octopartFetch()" value="magical auto-fill" style="margin-bottom:6pt"/> powered by <a href="http://octopart.com" class="small_link">OctoPart™</a></td></tr>
<tr id="datasheet-head" class="details-header"><td>DATASHEET: </td></tr> <tr id="datasheet-head" class="details-header"><td>DATASHEET: </td></tr>
<tr id="datasheet" style="display: none"><td><input type="file" accept=".pdf" class="pinfo-input" id="datasheet-finput"></td></tr> <tr id="datasheet" style="display: none"><td><input type="file" accept=".pdf" class="pinfo-input" id="datasheet-finput"></td></tr>
<tr id="datasheet" style="display: none"><td>OR: <input type="text" class="pinfo-input" name="datasheet-url-input" style="width:80%; margin-bottom: 6pt;" placeholder="Datasheet URL"></td></tr> <tr id="datasheet" style="display: none"><td>OR: <input type="text" class="pinfo-input" name="datasheet-url-input" style="width:80%; margin-bottom: 6pt;" placeholder="Datasheet URL"></td></tr>

Loading…
Cancel
Save