|
|
|
@ -1,3 +1,19 @@
|
|
|
|
|
function overlay_in() {
|
|
|
|
|
$('.shadow').css({'display' : 'block'});
|
|
|
|
|
$('.overlay').css({'display' : 'block'});
|
|
|
|
|
$('.shadow').animate({'opacity' : 0.7});
|
|
|
|
|
$('.overlay').animate({'top' : '10%'});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function overlay_out() {
|
|
|
|
|
$('.shadow').animate({'opacity' : 0.0}, function () {
|
|
|
|
|
$('.overlay').css({'display' : 'none'});
|
|
|
|
|
});
|
|
|
|
|
$('.overlay').animate({'top' : '-70%'}, function () {
|
|
|
|
|
$('.shadow').css({'display' : 'none'});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
$('.search-bar').on('keyup', function() {
|
|
|
|
|
var query = $('.search-bar').val();
|
|
|
|
@ -13,7 +29,8 @@ $(document).ready(function() {
|
|
|
|
|
$.getJSON('http://127.0.0.1:5000/query/' + filter + '/' + query, function(data) {
|
|
|
|
|
var newResults = '<div class="results">';
|
|
|
|
|
for(var i = 0; i < data.length; i++) { // Create new view for results
|
|
|
|
|
newResults += '<div class="results-row">';
|
|
|
|
|
newResults += '<div class="results-row" part-id="' + data[i].id + '">';
|
|
|
|
|
newResults += '<a href=#>'
|
|
|
|
|
|
|
|
|
|
newResults += '<div class="results-block">';
|
|
|
|
|
if (data[i].block != null)
|
|
|
|
@ -45,12 +62,22 @@ $(document).ready(function() {
|
|
|
|
|
if (data[i].datasheet != null)
|
|
|
|
|
newResults += '<a href="http://127.0.0.1:5000/getfile/' + data[i].datasheet + '"><i class="fa fa-file-text" aria-hidden="true"></i></a>';
|
|
|
|
|
newResults += '</div>';
|
|
|
|
|
newResults += '</a>'
|
|
|
|
|
newResults += '</div>';
|
|
|
|
|
}
|
|
|
|
|
newResults += '</div>';
|
|
|
|
|
$('.results').replaceWith(newResults);
|
|
|
|
|
}).fail(function() {
|
|
|
|
|
console.log( "failed" );
|
|
|
|
|
console.log( "Query failed" );
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.results-row').on('click', function() {
|
|
|
|
|
var partID = $(this).attr('part-id');
|
|
|
|
|
$.getJSON('http://127.0.0.1:5000/getpartinfo/' + partID, function(data) {
|
|
|
|
|
// TODO: Fill stuff with the fetched info
|
|
|
|
|
}).fail(function() {
|
|
|
|
|
console.log( "Fetching part info failed" );
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|