octopart search added. note: the API key is NOT included in the public repo, for obvious reasons.
This commit is contained in:
@@ -5,6 +5,7 @@ function init_edit(partID) {
|
||||
|
||||
$('table#details tr#partno td p').hide();
|
||||
$('table#details tr#partno td input').show();
|
||||
$('#magical_autofill').show();
|
||||
|
||||
$('table#details tr#description td p').hide();
|
||||
$('table#details tr#description td input').show();
|
||||
@@ -42,6 +43,8 @@ function end_edit() {
|
||||
$('table#details tr#partno td p').show();
|
||||
$('table#details tr#partno td input').hide();
|
||||
|
||||
$('#magical_autofill').hide();
|
||||
|
||||
$('table#details tr#description td p').text($('table#details tr#description td input').val());
|
||||
$('table#details tr#description td p').show();
|
||||
$('table#details tr#description td input').hide();
|
||||
@@ -216,6 +219,18 @@ function container_onchange() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function octopartFetch(){
|
||||
$.getJSON(rootURL + 'fetchOctopartSnippet/' + $('#partno-input').val()).done(function(json){
|
||||
if (json['result']=='ok'){
|
||||
$('#description-input').val(json['snippet']);
|
||||
}else{
|
||||
$('#description-input').val('');
|
||||
$('#description-input').attr('placeholder', json['result']);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$.ajaxSetup({ cache: false });
|
||||
$('.search-bar').on('keyup', function() {
|
||||
|
||||
Reference in New Issue
Block a user