Browse Source

librarian names as document label added with a class of their own

master
jules 4 years ago
parent
commit
15badcdb5b
  1. 17
      templates/layout.html

17
templates/layout.html

@ -152,6 +152,7 @@ function getCookie(name) {
var item = test[i]; var item = test[i];
if(item.debrisname.includes(thefile)){ if(item.debrisname.includes(thefile)){
ledocument = item.debrispath; ledocument = item.debrispath;
lelibrarian = item.librarian;
var extension = ledocument.replace(/^.*\./, ''); var extension = ledocument.replace(/^.*\./, '');
// var classname = ledocument.substring(ledocument.lastIndexOf('/')+1); // var classname = ledocument.substring(ledocument.lastIndexOf('/')+1);
// classname = classname.substr(0, classname.lastIndexOf('.')) || classname; // classname = classname.substr(0, classname.lastIndexOf('.')) || classname;
@ -170,19 +171,19 @@ function getCookie(name) {
if ((extension=="jpg") || (extension=="jpeg") || (extension=="png") || (extension=="gif") || (extension=="tiff")) { if ((extension=="jpg") || (extension=="jpeg") || (extension=="png") || (extension=="gif") || (extension=="tiff")) {
$(".name-elements").append("<li><img class='listed-images' src='/files/"+ledocument+"'><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>"); $(".name-elements").append("<li><img class='listed-images' src='/files/"+ledocument+"'><br><span class='librarians-label'>Librarian(s): "+lelibrarian+"</span><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>");
} }
else if (extension=="pdf") { else if (extension=="pdf") {
$(".name-elements").append("<li><object class='listed-pdf' data='files/"+ledocument+"'/><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>"); $(".name-elements").append("<li><object class='listed-pdf' data='files/"+ledocument+"'/><br><span class='librarians-label'>Librarian(s): "+lelibrarian+"</span><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>");
} }
else if (extension=="epub") { else if (extension=="epub") {
$(".name-elements").append("<li>"+ledocument+"</li>"); $(".name-elements").append("<li>"+ledocument+"</li>");
} }
else if ((extension=="mp3") || (extension=="wav") || (extension=="m4a")) { else if ((extension=="mp3") || (extension=="wav") || (extension=="m4a")) {
$(".name-elements").append("<li><audio class='listed-audio' controls><source src='files/"+ledocument+"'></audio><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>"); $(".name-elements").append("<li><audio class='listed-audio' controls><source src='files/"+ledocument+"'></audio><br><span class='librarians-label'>Librarian(s): "+lelibrarian+"</span><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>");
} }
else if ((extension=="mov") || (extension=="mp4")) { else if ((extension=="mov") || (extension=="mp4")) {
$(".name-elements").append("<li><video class='listed-videos' controls><source src='files/"+ledocument+"'></video><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>"); $(".name-elements").append("<li><video class='listed-videos' controls><source src='files/"+ledocument+"'></video><br><span class='librarians-label'>Librarian(s): "+lelibrarian+"</span><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>");
} }
else if ((extension=="odt") || (extension=="docx")) { else if ((extension=="odt") || (extension=="docx")) {
// something for odt and docx // something for odt and docx
@ -225,19 +226,19 @@ var flag = true;
if ((extension=="jpg") || (extension=="jpeg") || (extension=="png") || (extension=="gif") || (extension=="tiff")) { if ((extension=="jpg") || (extension=="jpeg") || (extension=="png") || (extension=="gif") || (extension=="tiff")) {
$(".name-elements").append("<li><img class='listed-images' src='/files/"+actualdocument+"'><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>"); $(".name-elements").append("<li><img class='listed-images' src='/files/"+actualdocument+"'><br><span class='librarians-label'>Librarian(s): "+lelibrarian+"</span><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>");
} }
else if (extension=="pdf") { else if (extension=="pdf") {
$(".name-elements").append("<li><object class='listed-pdf' data='files/"+actualdocument+"'/><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>"); $(".name-elements").append("<li><object class='listed-pdf' data='files/"+actualdocument+"'/><br><span class='librarians-label'>Librarian(s): "+lelibrarian+"</span><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>");
} }
else if (extension=="epub") { else if (extension=="epub") {
$(".name-elements").append("<li>"+actualdocument+"</li>"); $(".name-elements").append("<li>"+actualdocument+"</li>");
} }
else if ((extension=="mp3") || (extension=="wav") || (extension=="m4a")) { else if ((extension=="mp3") || (extension=="wav") || (extension=="m4a")) {
$(".name-elements").append("<li><audio class='listed-audio' controls><source src='files/"+actualdocument+"'></audio><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>"); $(".name-elements").append("<li><audio class='listed-audio' controls><source src='files/"+actualdocument+"'></audio><br><span class='librarians-label'>Librarian(s): "+lelibrarian+"</span><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>");
} }
else if ((extension=="mov") || (extension=="mp4")) { else if ((extension=="mov") || (extension=="mp4")) {
$(".name-elements").append("<li><video class='listed-videos' controls><source src='files/"+actualdocument+"'></video><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>"); $(".name-elements").append("<li><video class='listed-videos' controls><source src='files/"+actualdocument+"'></video><br><span class='librarians-label'>Librarian(s): "+lelibrarian+"</span><br><a href='/files/"+ledocument+"' download><button>Download file</button></a></li>");
} }
else if ((extension=="odt") || (extension=="docx")) { else if ((extension=="odt") || (extension=="docx")) {
// something for odt and docx // something for odt and docx

Loading…
Cancel
Save