library changes reverse clicking from file to name

This commit is contained in:
zeroth 2019-12-12 15:51:51 +00:00
parent eace763456
commit 2c39f2ddd3
2 changed files with 27 additions and 3 deletions

View File

@ -64,13 +64,13 @@ li a.nav-button {
z-index: 10000;
}
span.librarian-names, a.file-names {
span.librarian-names, span.file-names {
text-decoration: none;
padding: 0.3em;
color: black;
}
span.librarian-names:hover, a.file-names:hover {
span.librarian-names:hover, span.file-names:hover {
color: white;
cursor: pointer;
}

View File

@ -11,6 +11,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".librarian-names").click(function(event){
var thename = $(this).text();
$.getJSON('{{ url_for('static', filename='js/realjson.json') }}', function(test) {
@ -29,6 +30,29 @@
alert(alldocs);
});
});
$(".file-names").click(function(event){
var thefile = $(this).text();
$.getJSON('{{ url_for('static', filename='js/realjson.json') }}', function(test) {
alert(thefile);
// iterate in test[i].librarian to find where the name is present
//to get the test[i].debris that goes with it
var allpeeps = [];
var category = null;
for (var i = 0; i < test.length; ++i) {
var item = test[i];
if(item.debris.includes(thefile)){
ledocument = item.librarian;
// alert(ledocument);
allpeeps.push(ledocument);
};
category = item.method;
};
alert(allpeeps);
alert(category);
});
});
});
</script>
@ -54,7 +78,7 @@
<div class="file-names-container">
{% for file in filetoname_dict %}
<a href="" class="file-names">{{file["debris"]}}</a><br>
<span class="file-names">{{file["debris"]}}</span><br>
{% endfor %}
</div>
</div>