Browse Source

sounds on click

master
zeroth 4 years ago
parent
commit
6166ff3f57
  1. 52
      templates/layout.html

52
templates/layout.html

@ -25,6 +25,19 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
var audio=document.createElement('audio');
// var first=true;
// window.addEventListener('mousedown',onmousedown);
var listsounds = ["https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.anna&auryn/debris.gift.choreographies_for_phantom_limbs.anna&auryn.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.anne/debris.gift.choreographies_for_phantom_limbs.anne.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.ashley/debris.gift.choreographies_for_phantom_limbs.ashley.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.cian/debris.gift.choreographies_for_phantom_limbs.cian.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.denise/debris.gift.choreographies_for_phantom_limbs.denise.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.eva/debris.gift.choreographies_for_phantom_limbs.eva.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.group1_with_loop.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.group2_with_loop.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.group3_with_loop.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.group4_with_loop.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.group_work1.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.group_work2.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.group_work3.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.student_work_all_together.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.jonnah/debris.gift.choreographies_for_phantom_limbs.jonnah.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.julia&maud&jinnie/debris.gift.choreographies_for_phantom_limbs.julia_maud_jinnie.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.kitty/debris.gift.choreographies_for_phantom_limbs.kitty.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.masha/debris.gift.choreographies_for_phantom_limbs.masha.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.mia/debris.gift.choreographies_for_phantom_limbs.mia.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.rubin/debris.gift.choreographies_for_phantom_limbs.rubin.wav", "https://who-is-the-author.me/files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.senka/debris.gift.choreographies_for_phantom_limbs.senka.wav"
]
function play(){
// if(!first) return;
// first=false;
audio.src = listsounds[Math.floor(Math.random()*listsounds.length)];
audio.play();
}
$(document).ready(function() { $(document).ready(function() {
@ -192,16 +205,16 @@ 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><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download'>Download file</button></a></li>"); $(".name-elements").append("<li><img class='listed-images' src='/files/"+ledocument+"'><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download' onclick='play()'>Download file</button></a></li>");
} }
else if (extension=="pdf") { else if (extension=="pdf") {
$(".name-elements").append("<li><span class='mobile-pdf'>The PDF cannot be displayed on mobile. Please download the file to see it.</span><object class='listed-pdf' data='files/"+ledocument+"'/><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download'>Download file</button></a></li>"); $(".name-elements").append("<li><span class='mobile-pdf'>The PDF cannot be displayed on mobile. Please download the file to see it.</span><object class='listed-pdf' data='files/"+ledocument+"'/><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download' onclick='play()'>Download file</button></a></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><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download'>Download file</button></a></li>"); $(".name-elements").append("<li><audio class='listed-audio' controls><source src='files/"+ledocument+"'></audio><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download' onclick='play()'>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><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download'>Download file</button></a></li>"); $(".name-elements").append("<li><video class='listed-videos' controls><source src='files/"+ledocument+"'></video><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download' onclick='play()'>Download file</button></a></li>");
}; };
}; };
category = item.method; category = item.method;
@ -247,16 +260,16 @@ 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/"+ledocument+"'><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download'>Download file</button></a></li>"); $(".name-elements").append("<li><img class='listed-images' src='/files/"+ledocument+"'><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download' onclick='play()'>Download file</button></a></li>");
} }
else if (extension=="pdf") { else if (extension=="pdf") {
$(".name-elements").append("<li><span class='mobile-pdf'>The PDF cannot be displayed on mobile. Please download the file to see it.</span><object class='listed-pdf' data='files/"+ledocument+"'/><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download'>Download file</button></a></li>"); $(".name-elements").append("<li><span class='mobile-pdf'>The PDF cannot be displayed on mobile. Please download the file to see it.</span><object class='listed-pdf' data='files/"+ledocument+"'/><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download' onclick='play()'>Download file</button></a></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><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download'>Download file</button></a></li>"); $(".name-elements").append("<li><audio class='listed-audio' controls><source src='files/"+ledocument+"'></audio><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download' onclick='play()'>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><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download'>Download file</button></a></li>"); $(".name-elements").append("<li><video class='listed-videos' controls><source src='files/"+ledocument+"'></video><br><br><span class='librarians-label'><b>Librarian(s):</b> "+librarianstring+"</span><br><span class='method-label'><b>Method:</b> "+methodstring+"</span><br><br><a href='/files/"+ledocument+"' download><button class='download' onclick='play()'>Download file</button></a></li>");
}; };
}; };
category = item.method; category = item.method;
@ -385,6 +398,9 @@ var flag = true;
</head> </head>
<body> <body>
<div class="nav-top"> <div class="nav-top">
<ul> <ul>
<li><span class="nav-button" style="text-align: left;" id="bought">BOUGHT</span></li> <li><span class="nav-button" style="text-align: left;" id="bought">BOUGHT</span></li>
@ -443,10 +459,10 @@ var flag = true;
<!-- submit data and buttons--> <!-- submit data and buttons-->
<button id="about">About</button> <button id="about" onclick='play()'>About</button>
<!-- <a href="/test/" target="_blank"><button id="listoffiles">Download</button></a> --> <!-- <a href="/test/" target="_blank"><button id="listoffiles">Download</button></a> -->
<a href="/"><button id="reset">Reset</button></a> <a href="/"><button id="reset" onclick='play()'>Reset</button></a>
<button id="showall">Show All</button> <button id="showall" onclick='play()'>Show All</button>
<!-- INSERT --> <!-- INSERT -->
@ -751,21 +767,7 @@ var flag = true;
</div> </div>
<!-- audio stuff -->
<script type="text/javascript">
var audio=document.createElement('audio');
var first=true;
$(".download").addEventListener('mousedown',onmousedown);
function onmousedown(){
if(!first) return;
first=false;
audio.src="files/GIFT/debris.gift.choreographies_for_phantom_limbs/debris.gift.choreographies_for_phantom_limbs.group/debris.gift.choreographies_for_phantom_limbs.group_work2.wav";
audio.type="audio/wav";
audio.play();
}
</script>
</div> </div>
</div> </div>

Loading…
Cancel
Save