|
@ -11,45 +11,62 @@ |
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script> |
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script> |
|
|
<script type="text/javascript"> |
|
|
<script type="text/javascript"> |
|
|
$(document).ready(function() { |
|
|
$(document).ready(function() { |
|
|
|
|
|
|
|
|
$(".librarian-names").click(function(event){ |
|
|
$(".librarian-names").click(function(event){ |
|
|
var thename = $(this).text(); |
|
|
var thename = $(this).text(); |
|
|
$.getJSON('{{ url_for('static', filename='js/realjson.json') }}', function(test) { |
|
|
$(".name-elements").empty(); |
|
|
alert(thename); |
|
|
|
|
|
// iterate in test[i].librarian to find where the name is present |
|
|
$.getJSON('{{ url_for('static', filename='js/mergedjson.json') }}', function(test) { |
|
|
//to get the test[i].debris that goes with it |
|
|
// iterate in test[i].librarian to find where the name is present to get the test[i].debris that goes with it |
|
|
var alldocs = []; |
|
|
var alldocs = []; |
|
|
for (var i = 0; i < test.length; ++i) { |
|
|
for (var i = 0; i < test.length; ++i) { |
|
|
var item = test[i]; |
|
|
var item = test[i]; |
|
|
if(item.librarian.includes(thename)){ |
|
|
if(item.librarian.includes(thename)){ |
|
|
ledocument = item.debris; |
|
|
ledocument = item.debrispath; |
|
|
// alert(ledocument); |
|
|
//put ledocument into li and nest inside ul |
|
|
alldocs.push(ledocument); |
|
|
var extension = ledocument.replace(/^.*\./, ''); |
|
|
|
|
|
console.log(ledocument); |
|
|
|
|
|
if ((extension=="jpg") || (extension=="jpeg") || (extension=="png") || (extension=="gif") || (extension=="tiff")) { |
|
|
|
|
|
$(".name-elements").append("<li><img class='listed-images' src='/files/"+ledocument+"'></li>"); |
|
|
|
|
|
} |
|
|
|
|
|
else if (extension=="pdf") { |
|
|
|
|
|
$(".name-elements").append("<li><iframe src='"+ledocument+"'></iframe></li>"); |
|
|
|
|
|
} |
|
|
|
|
|
else if (extension=="epub") { |
|
|
|
|
|
$(".name-elements").append("<li>"+ledocument+"</li>"); |
|
|
|
|
|
} |
|
|
|
|
|
else if ((extension=="mp3") || (extension=="wav") || (extension=="m4a")) { |
|
|
|
|
|
$(".name-elements").append("<li><audio controls><source src='"+ledocument+"'></audio></li>"); |
|
|
|
|
|
} |
|
|
|
|
|
else if ((extension=="mov") || (extension=="mp4")) { |
|
|
|
|
|
$(".name-elements").append("<li><video controls><source='"+ledocument+"'></video></li>"); |
|
|
|
|
|
} |
|
|
|
|
|
else if ((extension=="odt") || (extension=="docx")) { |
|
|
|
|
|
// something for odt and docx |
|
|
|
|
|
$(".name-elements").append("<li>"+ledocument+"</li>"); |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
alert(alldocs); |
|
|
}; |
|
|
}); |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
$(".file-names").click(function(event){ |
|
|
$(".file-names").click(function(event){ |
|
|
var thefile = $(this).text(); |
|
|
var thefile = $(this).text(); |
|
|
$.getJSON('{{ url_for('static', filename='js/realjson.json') }}', function(test) { |
|
|
$.getJSON('{{ url_for('static', filename='js/mergedjson.json') }}', function(test) { |
|
|
alert(thefile); |
|
|
$(".name-elements").empty(); |
|
|
// iterate in test[i].librarian to find where the name is present |
|
|
// iterate in test[i].librarian to find where the name is present |
|
|
//to get the test[i].debris that goes with it |
|
|
//to get the test[i].debris that goes with it |
|
|
var allpeeps = []; |
|
|
var allpeeps = []; |
|
|
var category = null; |
|
|
var category = null; |
|
|
for (var i = 0; i < test.length; ++i) { |
|
|
for (var i = 0; i < test.length; ++i) { |
|
|
var item = test[i]; |
|
|
var item = test[i]; |
|
|
if(item.debris.includes(thefile)){ |
|
|
if(item.debrisname.includes(thefile)){ |
|
|
ledocument = item.librarian; |
|
|
ledocument = item.debrispath; |
|
|
// alert(ledocument); |
|
|
$(".name-elements").append("<li>"+ledocument+"</li>"); |
|
|
allpeeps.push(ledocument); |
|
|
allpeeps.push(ledocument); |
|
|
}; |
|
|
}; |
|
|
category = item.method; |
|
|
category = item.method; |
|
|
}; |
|
|
}; |
|
|
alert(allpeeps); |
|
|
|
|
|
alert(category); |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -77,15 +94,17 @@ |
|
|
<br> |
|
|
<br> |
|
|
|
|
|
|
|
|
<div class="file-names-container"> |
|
|
<div class="file-names-container"> |
|
|
{% for file in filetoname_dict %} |
|
|
{% for file in files_without_folders %} |
|
|
<span class="file-names">{{file["debris"]}}</span><br> |
|
|
<span class="file-names">{{file}}</span><br> |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="main-column-right"> |
|
|
<div class="main-column-right"> |
|
|
<a href="{{ url_for('static', filename='realjson.json') }}">test link</a> |
|
|
<a href="{{ url_for('static', filename='realjson.json') }}">test link</a> |
|
|
|
|
|
<ul class="name-elements"> |
|
|
|
|
|
<p>hello world</p> |
|
|
|
|
|
</ul> |
|
|
|
|
|
|
|
|
{% block content %} |
|
|
{% block content %} |
|
|
{% endblock content %} |
|
|
{% endblock content %} |
|
|