Rev 110 | Rev 118 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
function tableFilterButtons(){$(".filterButton,.filterButtonSmall").click(function(){$.post("filterTable.php",{submit:$(this).attr("value"),sessionTab:document.getElementById("sessionTab").value},function(e,t){"success"==t&&(document.getElementById("productTable").innerHTML=e,tableFilterButtons(),detailTableFilterButtons())})})}function detailTableFilterButtons(){$("#detailFilterForm").on("submit",function(e){return e.preventDefault(),!1}),$("#detailTab").click(function(){return x=document.getElementById("detailFilter"),"block"==x.style.display?(document.getElementById("detailTabArrow").innerHTML='<i class="fas fa-caret-down"></i>',x.style.display="none"):(document.getElementById("detailTabArrow").innerHTML='<i class="fas fa-caret-up"></i>',x.style.display="block"),!1}),$(".detailFilterButton").click(function(){var e=$("#detailFilterForm").serializeArray();return e.push({name:this.name,value:this.value}),$.post("filterTable.php",e,function(e,t){"success"==t&&(document.getElementById("productTable").innerHTML
=e,detailTableFilterButtons(),tableFilterButtons())}),!1})}function barcodeFormButtons(){$("#barcodeForm").on("submit",function(e){return e.preventDefault(),!1}),$(".barcodeButton").click(function(){var e=$("#barcodeForm").serializeArray();return e.push({name:this.name,value:this.value}),$.post("barcode.php",e,function(e,t){"success"==t&&(document.getElementById("barcodeResult").innerHTML=e)}),!1})}function alertAutoClose(){window.setTimeout(function(){$(".alert").fadeTo(1e3,0).slideUp(1e3,function(){$(this).remove()})},3e3)}function initProgressBarModal(e){var t=document.getElementById("progressBar");t.style.width="0%",t.innerHTML="0%",t=document.getElementById("progressBarHeader"),t.innerHTML=e,t=document.getElementById("progressBarMessage"),t.innerHTML="",$("#progressBarDiv").modal({backdrop:"static"})}function updateProgressBar(e,t){var n=document.getElementById("progressBar");n&&e&&(n.style.width=e+"%",n.innerHTML=e.toFixed(0)+"%")}function endProgressBarModal(){$("#progressBarDiv").modal("hide")}functi
on refreshProgress(){$.ajax({url:"pbChecker.php?file="+document.getElementById("sessionId").value+"_"+document.getElementById("sessionTab").value,success:function(e){updateProgressBar(e.percent,e.message),e.percent>=100&&(window.clearInterval(timer),timer=window.setInterval(completeProgress,1e3))}})}function completeProgress(){updateProgressBar(100,"Completed"),window.clearInterval(timer),endProgressBarModal()}function progressBar(e){initProgressBarModal(e),timer=window.setInterval(refreshProgress,1e3)}function saveTransfer(e){var t=new XMLHttpRequest;t.open("POST","savetransfer.php",!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.send("target="+btoa(e)+"&sessionTab="+document.getElementById("sessionTab").value)}function addWishlist(e,t,n,o){$(t).tooltip("hide"),$(t).remove();var a=new XMLHttpRequest;a.onreadystatechange=function(){if(4==this.readyState){switch(json=JSON.parse(this.responseText),json.retval){case 0:msg="Added to wishlist.",alertTxt="alert-success";break;case 1:ms
g="Already on the wishlist.",alertTxt="alert-warning";break;default:msg="ERROR! Could not add to the wishlist.",alertTxt="alert-danger"}document.getElementById("wishlistAdd"+n).innerHTML='<div class="alert '+alertTxt+' alert-dismissible mt-2 mb-0"><button type="button" class="close" data-dismiss="alert">×</button>'+msg+"</div>",alertAutoClose()}},a.open("POST","wishlistDB.php",!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send("id="+e+"&function=add&wl="+o+"&sessionTab="+document.getElementById("sessionTab").value)}function deleteWishlist(e,t,n,o){if($(t).tooltip("hide"),confirm("Remove "+n+" by "+o+" from wishlist?")){var a=t.parentNode.parentNode.parentNode,l=new XMLHttpRequest;l.open("POST","wishlistDB.php",!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.send("function=delete&id="+e+"&sessionTab="+document.getElementById("sessionTab").value),a.parentNode.removeChild(a)}}function editWishlist(e,t){if(null!==t){$(t).tooltip("hide");var n=t.pa
rentNode.parentNode.parentNode,o=mysqliHtmlDecode(n.getElementsByTagName("td")[1].innerHTML),a=mysqliHtmlDecode(n.getElementsByTagName("td")[2].innerHTML),l=n.getElementsByTagName("td")[3].innerHTML.replace(/-/g,""),i=n.getElementsByTagName("td")[5].innerHTML,s=n.getElementsByTagName("td")[6].innerHTML,r=n.getElementsByTagName("td")[7].innerHTML;document.getElementById("wlMsg").innerHTML="",document.getElementById("wlId").value=e,document.getElementById("wlArtist").value=o,document.getElementById("wlTitle").value=a,document.getElementById("wlBarcode").value=l,document.getElementById("wlCond").value=i,document.getElementById("wlFormat").value=s,document.getElementById("wlPrice").value=r}$("#editWishlistModal").modal({backdrop:"static",keyboard:!1})}function saveEditedWishlist(){var e=document.getElementById("wlId").value,t=document.getElementById("wlIdRow"+e),n=t.parentNode,o=document.getElementById("wlArtist").value,a=document.getElementById("wlTitle").value,l=document.getElementById("wlBarcode").value,i=doc
ument.getElementById("wlCond").value,s=document.getElementById("wlFormat").value,r=document.getElementById("wlPrice").value,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==this.readyState)switch(json=JSON.parse(this.responseText),json.retval){case 0:n.getElementsByTagName("td")[1].innerHTML=o,n.getElementsByTagName("td")[2].innerHTML=a,n.getElementsByTagName("td")[3].innerHTML=l,n.getElementsByTagName("td")[4].innerHTML=l,n.getElementsByTagName("td")[5].innerHTML=i,n.getElementsByTagName("td")[6].innerHTML=s,n.getElementsByTagName("td")[7].innerHTML=r,n.getElementsByTagName("td")[8].innerHTML="$"+Number(r).toFixed(2),$("#editWishlistModal").modal("hide");break;case 1:document.getElementById("wlMsg").innerHTML='<div class="alert alert-danger alert-dismissible mt-0 mb-0"><button type="button" class="close" data-dismiss="alert">×</button>'+json.msg+"</div>",editWishlist(e,null);break;default:document.getElementById("wlMsg").innerHTML='<div class="alert alert-danger alert-dismissible mt-0 mb-0">
<button type="button" class="close" data-dismiss="alert">×</button>Unknown Error. Please reload page.</div>'}},d.open("POST","wishlistDB.php",!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.send("function=update&id="+e+"&artist="+encodeURIComponent(o)+"&title="+encodeURIComponent(a)+"&barcode="+encodeURIComponent(l)+"&cond="+encodeURIComponent(i)+"&format="+encodeURIComponent(s)+"&price="+encodeURIComponent(r)+"&sessionTab="+document.getElementById("sessionTab").value)}function paginationSetup(){null!==document.getElementById("discogsDeck")&&($("[id^=masterModal]").modal("hide"),$("#discogsDeck").paginate({paginateElement:".card",elementsPerPage:paginationPerPage(),effect:"default",firstButtonText:'<i class="fas fa-angle-double-left"></i>',lastButtonText:'<i class="fas fa-angle-double-right"></i>',prevButtonText:'<i class="fas fa-angle-left"></i>',nextButtonText:'<i class="fas fa-angle-right"></i>',extraButtonClasses:"btn bg-primary px-2 shadow-sm"}),$('[data-toggle="toolti
p"]').tooltip({trigger:"hover"}),$('[data-toggle2="tooltip"]').tooltip({trigger:"hover"}))}function filterWishlist(){var e,t,n,o,a,l,i,s,r;for(e=document.getElementById("tableFilter"),t=e.value.toUpperCase(),n=document.getElementById("wishlistTable"),o=n.getElementsByTagName("tr"),document.getElementById("tableFilterButton").style.display=t.length>0?"":"none",l=1;l<o.length;l++){for(a=o[l].getElementsByTagName("td"),r="none",i=0;i<a.length;i++)if(a[i]&&(s=a[i].textContent||a[i].innerText,s.toUpperCase().indexOf(t)>-1)){r="";break}o[l].style.display=r}}function mysqliHtmlDecode(e){return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">")}function paginationPerPage(){var e=$(window).width(),t=Math.floor(e/210);return t>9?t=9:576>e&&(t=1),t}function sortTable(e,t,n){var o,a,l,i,s,r,d,m=0;for(e=document.getElementById(e),a=!0,d="asc";a;){for(a=!1,o=e.rows,l=1;l<o.length-1;l++)if(r=!1,i=o[l].getElementsByTagName("TD")[t],s=o[l+1].getElementsByTagName("TD")[t],"asc"==d){if("numeric"==n){if
(Number(i.innerHTML)>Number(s.innerHTML.toLowerCase)){r=!0;break}}else if(i.innerHTML.toLowerCase()>s.innerHTML.toLowerCase()){r=!0;break}}else if("desc"==d)if("numeric"==n){if(Number(i.innerHTML)<Number(s.innerHTML)){r=!0;break}}else if(i.innerHTML.toLowerCase()<s.innerHTML.toLowerCase()){r=!0;break}r?(o[l].parentNode.insertBefore(o[l+1],o[l]),a=!0,m++):0===m&&"asc"==d&&(d="desc",a=!0)}}function scrollFunction(){var e=document.getElementById("topBtn");document.body.scrollTop>50||document.documentElement.scrollTop>50?e.style.display="block":e.style.display="none"}function topFunction(){document.body.scrollTop=document.documentElement.scrollTop=0}$(document).ready(function(){function e(){dataLayer.push(arguments)}var t;window.dataLayer=window.dataLayer||[],e("js",new Date),e("config","UA-138428761-2"),$('[data-toggle="tooltip"]').tooltip({trigger:"hover"}),$('[data-toggle2="tooltip"]').tooltip({trigger:"hover"}),$('[rel="tooltip"]').on("click",function(){$(this).tooltip("hide")}),$.fn.flexdatalist&&($(".flexd
atalist").flexdatalist(),$(function(){$("input[id='searchTerm-flexdatalist']").clearer()}),$(".flexdatalist").flexdatalist({minLength:0,searchContain:!0,noResultsText:""})),$(window).on("beforeunload",function(){$(":submit").attr("disabled","disabled"),document.body.style.cursor="progress"}),$(window).bind("resize orientationchange",paginationSetup),paginationSetup(),(t=document.getElementById("detailFilterForm"))&&(tableFilterButtons(),detailTableFilterButtons()),(t=document.getElementById("barcodeForm"))&&barcodeFormButtons(),window.onscroll=function(){scrollFunction()}});