| 15 |
- |
1 |
$(document).ready(function() {
|
| 17 |
- |
2 |
$('[data-toggle="tooltip"]').tooltip({trigger : 'hover'});
|
|
|
3 |
$('[data-toggle2="tooltip"]').tooltip({trigger : 'hover'});
|
| 28 |
- |
4 |
$('[rel="tooltip"]').on('click', function() {$(this).tooltip('hide');});
|
| 23 |
- |
5 |
|
| 20 |
- |
6 |
$('.flexdatalist').flexdatalist();
|
|
|
7 |
$(function() {
|
|
|
8 |
$("input[id='searchTerm-flexdatalist']").clearer();
|
|
|
9 |
});
|
|
|
10 |
$('.flexdatalist').flexdatalist({minLength: 0, searchContain : true, noResultsText: ""}); /* reset after running clearer */
|
| 6 |
- |
11 |
|
| 15 |
- |
12 |
$(window).on('beforeunload', function() {
|
|
|
13 |
$(":submit").attr('disabled', 'disabled');
|
| 47 |
- |
14 |
document.body.style.cursor = "progress";
|
| 15 |
- |
15 |
});
|
|
|
16 |
|
| 43 |
- |
17 |
$(window).bind('resize orientationchange', paginationSetup);
|
|
|
18 |
|
| 15 |
- |
19 |
tableFilterButtons();
|
| 43 |
- |
20 |
paginationSetup();
|
| 6 |
- |
21 |
});
|
| 11 |
- |
22 |
|
| 15 |
- |
23 |
function tableFilterButtons() {
|
|
|
24 |
$(".filterButton").click(function() {
|
|
|
25 |
$.post("filterTable.php", {
|
|
|
26 |
submit: $(this).attr("value"),
|
|
|
27 |
sessionTab: document.getElementById("sessionTab").value
|
|
|
28 |
}, function(data, status) {
|
|
|
29 |
if (status == "success") {
|
|
|
30 |
document.getElementById("productTable").innerHTML = data;
|
|
|
31 |
tableFilterButtons();
|
|
|
32 |
}
|
|
|
33 |
});
|
|
|
34 |
});
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
function initProgressBarModal(title) {
|
|
|
38 |
var elem = document.getElementById("progressBar");
|
|
|
39 |
elem.style.width = '0%';
|
|
|
40 |
elem.innerHTML = '0%';
|
|
|
41 |
|
|
|
42 |
elem = document.getElementById("progressBarHeader");
|
|
|
43 |
elem.innerHTML = title;
|
|
|
44 |
|
| 23 |
- |
45 |
$("#progressBarDiv").modal({backdrop: "static"});
|
| 15 |
- |
46 |
}
|
|
|
47 |
|
|
|
48 |
function updateProgressBar(width, message) {
|
|
|
49 |
var elem = document.getElementById("progressBar");
|
|
|
50 |
elem.style.width = width + '%';
|
|
|
51 |
elem.innerHTML = width.toFixed(0) + '%';
|
|
|
52 |
// bugbug document.getElementById("progressBarMessage").innerHTML = message;
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
function endProgressBarModal() {
|
|
|
56 |
$("#progressBarDiv").modal("hide");
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
// Refresh the progress bar.
|
|
|
60 |
function refreshProgress() {
|
|
|
61 |
$.ajax({
|
|
|
62 |
url: "pbChecker.php?file=" + document.getElementById("sessionId").value + "_" + document.getElementById("sessionTab").value,
|
|
|
63 |
success: function(data) {
|
|
|
64 |
updateProgressBar(data.percent, data.message);
|
|
|
65 |
if (data.percent == 100) {
|
|
|
66 |
window.clearInterval(timer);
|
|
|
67 |
timer = window.setInterval(completeProgress, 1000);
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
});
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
// End the progress bar.
|
|
|
74 |
function completeProgress() {
|
|
|
75 |
updateProgressBar(100, "Completed");
|
|
|
76 |
window.clearInterval(timer);
|
| 39 |
- |
77 |
endProgressBarModal();
|
| 15 |
- |
78 |
}
|
|
|
79 |
|
|
|
80 |
// Start the progress bar.
|
|
|
81 |
function progressBar(title) {
|
|
|
82 |
initProgressBarModal(title);
|
|
|
83 |
timer = window.setInterval(refreshProgress, 1000);
|
| 28 |
- |
84 |
}
|
|
|
85 |
|
|
|
86 |
function saveTransfer($url) {
|
|
|
87 |
var xhttp = new XMLHttpRequest();
|
|
|
88 |
xhttp.open("POST", "savetransfer.php", true);
|
|
|
89 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
|
90 |
xhttp.send("target=" + btoa($url) + "&sessionTab=" + document.getElementById("sessionTab").value);
|
| 43 |
- |
91 |
}
|
|
|
92 |
|
|
|
93 |
// Pagination
|
|
|
94 |
function paginationSetup(){
|
|
|
95 |
$('#discogsDeck').paginate({
|
|
|
96 |
paginateElement: '.card',
|
|
|
97 |
elementsPerPage: paginationPerPage(),
|
|
|
98 |
effect: 'default',
|
|
|
99 |
firstButtonText: '<i class="fas fa-angle-double-left"></i>',
|
|
|
100 |
lastButtonText: '<i class="fas fa-angle-double-right"></i>',
|
|
|
101 |
prevButtonText: '<i class="fas fa-angle-left"></i>',
|
|
|
102 |
nextButtonText: '<i class="fas fa-angle-right"></i>',
|
|
|
103 |
extraButtonClasses: 'btn btn-primary px-2 shadow-sm'
|
|
|
104 |
});
|
|
|
105 |
$('[data-toggle="tooltip"]').tooltip({trigger : 'hover'});
|
|
|
106 |
$('[data-toggle2="tooltip"]').tooltip({trigger : 'hover'});
|
|
|
107 |
}
|
|
|
108 |
|
| 46 |
- |
109 |
// number of discogs entries per page according to screen size
|
| 43 |
- |
110 |
function paginationPerPage() {
|
|
|
111 |
width = $( document ).width();
|
|
|
112 |
if (width < 576){
|
|
|
113 |
return 1;
|
|
|
114 |
} else if (width < 768){
|
|
|
115 |
return 2;
|
|
|
116 |
} else if (width < 992){
|
|
|
117 |
return 3;
|
|
|
118 |
} else if (width < 1200){
|
|
|
119 |
return 4;
|
|
|
120 |
} else {
|
|
|
121 |
return 6;
|
|
|
122 |
}
|
|
|
123 |
}
|
| 46 |
- |
124 |
|
|
|
125 |
// sort table by column
|
|
|
126 |
function sortTable(table, col, colType) {
|
|
|
127 |
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
|
|
|
128 |
table = document.getElementById(table);
|
|
|
129 |
switching = true;
|
|
|
130 |
// Set the sorting direction to ascending:
|
|
|
131 |
dir = "asc";
|
|
|
132 |
/* Make a loop that will continue until no switching has been done: */
|
|
|
133 |
while (switching) {
|
|
|
134 |
// Start by saying: no switching is done:
|
|
|
135 |
switching = false;
|
|
|
136 |
rows = table.rows;
|
|
|
137 |
/* Loop through all table rows (except the first, which contains table headers): */
|
|
|
138 |
for (i = 1; i < (rows.length - 1); i++) {
|
|
|
139 |
// Start by saying there should be no switching:
|
|
|
140 |
shouldSwitch = false;
|
|
|
141 |
/* Get the two elements you want to compare, one from current row and one from the next: */
|
|
|
142 |
x = rows[i].getElementsByTagName("TD")[col];
|
|
|
143 |
y = rows[i + 1].getElementsByTagName("TD")[col];
|
|
|
144 |
/* Check if the two rows should switch place, based on the direction, asc or desc: */
|
|
|
145 |
if (dir == "asc") {
|
|
|
146 |
if (colType == 'numeric') {
|
|
|
147 |
if (Number(x.innerHTML) > Number(y.innerHTML.toLowerCase)) {
|
|
|
148 |
// If so, mark as a switch and break the loop:
|
|
|
149 |
shouldSwitch = true;
|
|
|
150 |
break;
|
|
|
151 |
}
|
|
|
152 |
} else /* if (colType == 'text') */ {
|
|
|
153 |
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
|
|
|
154 |
// If so, mark as a switch and break the loop:
|
|
|
155 |
shouldSwitch = true;
|
|
|
156 |
break;
|
|
|
157 |
}
|
|
|
158 |
}
|
|
|
159 |
} else if (dir == "desc") {
|
|
|
160 |
if (colType == 'numeric') {
|
|
|
161 |
if (Number(x.innerHTML) < Number(y.innerHTML)) {
|
|
|
162 |
// If so, mark as a switch and break the loop:
|
|
|
163 |
shouldSwitch = true;
|
|
|
164 |
break;
|
|
|
165 |
}
|
|
|
166 |
} else /* if (colType == 'text') */ {
|
|
|
167 |
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
|
|
|
168 |
// If so, mark as a switch and break the loop:
|
|
|
169 |
shouldSwitch = true;
|
|
|
170 |
break;
|
|
|
171 |
}
|
|
|
172 |
}
|
|
|
173 |
}
|
|
|
174 |
}
|
|
|
175 |
if (shouldSwitch) {
|
|
|
176 |
/* If a switch has been marked, make the switch and mark that a switch has been done: */
|
|
|
177 |
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
|
|
|
178 |
switching = true;
|
|
|
179 |
// Each time a switch is done, increase this count by 1:
|
|
|
180 |
switchcount++;
|
|
|
181 |
} else {
|
|
|
182 |
/* If no switching has been done AND the direction is "asc", set the direction to "desc" and run the while loop again. */
|
|
|
183 |
if (switchcount == 0 && dir == "asc") {
|
|
|
184 |
dir = "desc";
|
|
|
185 |
switching = true;
|
|
|
186 |
}
|
|
|
187 |
}
|
|
|
188 |
}
|
|
|
189 |
}
|
|
|
190 |
|