|
|
@ -6,9 +6,6 @@ |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
|
|
<title>Library</title> |
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}"> |
|
|
|
|
|
|
|
|
|
|
|
<!--TEST--> |
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script> |
|
|
|
<script src="{{ url_for('static', filename='js/highlight.js') }}"></script> |
|
|
|
|
|
|
@ -74,7 +71,9 @@ |
|
|
|
location.href = address; |
|
|
|
}; |
|
|
|
}); |
|
|
|
/////DISPLAY FILES///////////// |
|
|
|
|
|
|
|
/////DISPLAY FILENAMES///////////// |
|
|
|
|
|
|
|
$(".file-names").click(function(event){ |
|
|
|
|
|
|
|
// alert(listofselecteddocs); |
|
|
@ -86,14 +85,11 @@ |
|
|
|
// 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.debrisname.includes(thefile)){ |
|
|
|
ledocument = item.debrispath; |
|
|
|
// allpeeps.push(ledocument); |
|
|
|
var extension = ledocument.replace(/^.*\./, ''); |
|
|
|
// var classname = ledocument.substring(ledocument.lastIndexOf('/')+1); |
|
|
|
// classname = classname.substr(0, classname.lastIndexOf('.')) || classname; |
|
|
@ -101,6 +97,7 @@ |
|
|
|
console.log(ledocument); |
|
|
|
|
|
|
|
// check or unchecked checkbox if classname in array |
|
|
|
|
|
|
|
var checkboite; |
|
|
|
if(jQuery.inArray(classname, listofselecteddocs) != -1) { |
|
|
|
console.log("is in array"); |
|
|
@ -136,6 +133,69 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
////DISPLAY FILES///////////// |
|
|
|
|
|
|
|
var flag = true; |
|
|
|
|
|
|
|
$("#showall").click(function(event){ |
|
|
|
if (flag === true) { |
|
|
|
$('.file-names-container span').each(function () { |
|
|
|
var current = $(this).attr('id'); |
|
|
|
$.getJSON('{{ url_for('static', filename='js/mergedjson.json') }}', function(test) { |
|
|
|
var category = null; |
|
|
|
for (var i = 0; i < test.length; ++i) { |
|
|
|
var item = test[i]; |
|
|
|
if(item.debrisname.includes(current)){ |
|
|
|
actualdocument = item.debrispath; |
|
|
|
var extension = actualdocument.replace(/^.*\./, ''); |
|
|
|
var classname = actualdocument; |
|
|
|
|
|
|
|
// check or unchecked checkbox if classname in array |
|
|
|
|
|
|
|
var checkboite; |
|
|
|
if(jQuery.inArray(classname, listofselecteddocs) != -1) { |
|
|
|
console.log("is in array"); |
|
|
|
checkboite = "<br /><input type='checkbox' class='addtoprint' id='"+classname+"' name='"+classname+"' value='print' checked><label for='"+classname+"'> Add to print</label>"; |
|
|
|
} else { |
|
|
|
checkboite = "<br /><input type='checkbox' class='addtoprint' id='"+classname+"' name='"+classname+"' value='print'><label for='"+classname+"'> Add to print</label>"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((extension=="jpg") || (extension=="jpeg") || (extension=="png") || (extension=="gif") || (extension=="tiff")) { |
|
|
|
$(".name-elements").append("<li><img class='listed-images' src='/files/"+actualdocument+"'>"+checkboite+"</li>"); |
|
|
|
} |
|
|
|
else if (extension=="pdf") { |
|
|
|
$(".name-elements").append("<li><object class='listed-pdf' data='files/"+actualdocument+"'/>"+checkboite+"</li>"); |
|
|
|
} |
|
|
|
else if (extension=="epub") { |
|
|
|
$(".name-elements").append("<li>"+actualdocument+"</li>"); |
|
|
|
} |
|
|
|
else if ((extension=="mp3") || (extension=="wav") || (extension=="m4a")) { |
|
|
|
$(".name-elements").append("<li><audio class='listed-audio' controls><source src='files/"+actualdocument+"'></audio>"+checkboite+"</li>"); |
|
|
|
} |
|
|
|
else if ((extension=="mov") || (extension=="mp4")) { |
|
|
|
$(".name-elements").append("<li><video class='listed-videos' controls><source src='files/"+actualdocument+"'></video>"+checkboite+"</li>"); |
|
|
|
} |
|
|
|
else if ((extension=="odt") || (extension=="docx")) { |
|
|
|
// something for odt and docx |
|
|
|
$(".name-elements").append("<li>"+actualdocument+"</li>"); |
|
|
|
}; |
|
|
|
}; |
|
|
|
category = item.method; |
|
|
|
}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
flag = false; |
|
|
|
} else { |
|
|
|
$(".name-elements").empty(); |
|
|
|
flag = true; |
|
|
|
}; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
///////////CHECKBOXES//////////////// |
|
|
|
|
|
|
|
var listofselecteddocs = []; |
|
|
@ -239,7 +299,6 @@ $.ajax({ |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="main-column-right"> |
|
|
|
<!--<a href="{{ url_for('static', filename='realjson.json') }}">test link</a>--> |
|
|
|
<ul class="name-elements"> |
|
|
|
</ul> |
|
|
|
|
|
|
|