| 15 |
- |
1 |
$(document).ready(function() {
|
| 107 |
- |
2 |
var x;
|
| 23 |
- |
3 |
|
| 107 |
- |
4 |
window.dataLayer = window.dataLayer || [];
|
| 66 |
- |
5 |
|
| 107 |
- |
6 |
function gtag() {
|
|
|
7 |
dataLayer.push(arguments);
|
|
|
8 |
}
|
|
|
9 |
gtag('js', new Date());
|
|
|
10 |
gtag('config', 'UA-138428761-2');
|
| 66 |
- |
11 |
|
| 107 |
- |
12 |
$(window).on('beforeunload', function() {
|
|
|
13 |
$(":submit").attr('disabled', 'disabled');
|
|
|
14 |
document.body.style.cursor = "progress";
|
|
|
15 |
});
|
| 52 |
- |
16 |
|
| 107 |
- |
17 |
$(window).bind('resize orientationchange', paginationSetup);
|
| 116 |
- |
18 |
paginationSetup();
|
| 81 |
- |
19 |
|
| 107 |
- |
20 |
if ((x = document.getElementById("detailFilterForm"))) {
|
|
|
21 |
tableFilterButtons();
|
|
|
22 |
detailTableFilterButtons();
|
|
|
23 |
}
|
|
|
24 |
|
| 113 |
- |
25 |
if ((x = document.getElementById("barcodeForm"))) {
|
|
|
26 |
barcodeFormButtons();
|
|
|
27 |
}
|
|
|
28 |
|
| 107 |
- |
29 |
// Floating Top Navigation Button:
|
|
|
30 |
window.onscroll = function() {
|
|
|
31 |
scrollFunction();
|
|
|
32 |
};
|
| 116 |
- |
33 |
|
|
|
34 |
flexdatalistSetup();
|
|
|
35 |
|
|
|
36 |
tooltipSetup();
|
| 6 |
- |
37 |
});
|
| 11 |
- |
38 |
|
| 107 |
- |
39 |
|
| 15 |
- |
40 |
function tableFilterButtons() {
|
| 107 |
- |
41 |
$(".filterButton,.filterButtonSmall").click(function() {
|
|
|
42 |
$.post("filterTable.php", {
|
|
|
43 |
submit: $(this).attr("value"),
|
|
|
44 |
sessionTab: document.getElementById("sessionTab").value
|
|
|
45 |
},
|
|
|
46 |
function(data, status) {
|
|
|
47 |
if (status == "success") {
|
|
|
48 |
document.getElementById("productTable").innerHTML = data;
|
|
|
49 |
tableFilterButtons();
|
|
|
50 |
detailTableFilterButtons();
|
|
|
51 |
}
|
|
|
52 |
}
|
|
|
53 |
);
|
|
|
54 |
});
|
| 15 |
- |
55 |
}
|
|
|
56 |
|
| 66 |
- |
57 |
function detailTableFilterButtons() {
|
| 107 |
- |
58 |
$("#detailFilterForm").on('submit', function(e) {
|
|
|
59 |
e.preventDefault();
|
|
|
60 |
return false;
|
|
|
61 |
});
|
|
|
62 |
|
|
|
63 |
$("#detailTab").click(function() {
|
| 116 |
- |
64 |
x = document.getElementById("detailFilter");
|
|
|
65 |
if (x.style.display == "block") {
|
|
|
66 |
document.getElementById("detailTabArrow").innerHTML = '<i class="material-icons material-text">expand_more</i>';
|
|
|
67 |
x.style.display = "none";
|
|
|
68 |
} else {
|
|
|
69 |
document.getElementById("detailTabArrow").innerHTML = '<i class="material-icons material-text">expand_less</i>';
|
|
|
70 |
x.style.display = "block";
|
|
|
71 |
}
|
|
|
72 |
return false;
|
| 107 |
- |
73 |
});
|
| 116 |
- |
74 |
|
| 107 |
- |
75 |
$(".detailFilterButton").click(function() {
|
|
|
76 |
var formData = $("#detailFilterForm").serializeArray();
|
|
|
77 |
formData.push({
|
|
|
78 |
name: this.name,
|
|
|
79 |
value: this.value
|
|
|
80 |
});
|
|
|
81 |
$.post("filterTable.php",
|
|
|
82 |
formData,
|
|
|
83 |
function(data, status) {
|
|
|
84 |
if (status == "success") {
|
|
|
85 |
document.getElementById("productTable").innerHTML = data;
|
|
|
86 |
detailTableFilterButtons();
|
|
|
87 |
tableFilterButtons();
|
|
|
88 |
}
|
|
|
89 |
}
|
|
|
90 |
);
|
|
|
91 |
return false;
|
|
|
92 |
});
|
| 66 |
- |
93 |
}
|
|
|
94 |
|
| 113 |
- |
95 |
function barcodeFormButtons() {
|
|
|
96 |
$("#barcodeForm").on('submit', function(e) {
|
| 107 |
- |
97 |
e.preventDefault();
|
| 113 |
- |
98 |
return false;
|
| 107 |
- |
99 |
});
|
|
|
100 |
|
| 113 |
- |
101 |
$(".barcodeButton").click(function() {
|
|
|
102 |
var formData = $("#barcodeForm").serializeArray();
|
|
|
103 |
formData.push({
|
|
|
104 |
name: this.name,
|
|
|
105 |
value: this.value
|
|
|
106 |
});
|
|
|
107 |
$.post("barcode.php",
|
|
|
108 |
formData,
|
|
|
109 |
function(data, status) {
|
|
|
110 |
if (status == "success") {
|
|
|
111 |
document.getElementById("barcodeResult").innerHTML = data;
|
|
|
112 |
}
|
|
|
113 |
}
|
|
|
114 |
);
|
|
|
115 |
return false;
|
|
|
116 |
});
|
| 66 |
- |
117 |
}
|
| 116 |
- |
118 |
|
| 64 |
- |
119 |
function alertAutoClose() {
|
| 107 |
- |
120 |
window.setTimeout(function() {
|
|
|
121 |
$(".alert").fadeTo(1000, 0).slideUp(1000, function() {
|
|
|
122 |
$(this).remove();
|
|
|
123 |
});
|
|
|
124 |
}, 3000);
|
| 64 |
- |
125 |
}
|
|
|
126 |
|
| 15 |
- |
127 |
function initProgressBarModal(title) {
|
| 107 |
- |
128 |
var elem = document.getElementById("progressBar");
|
|
|
129 |
elem.style.width = '0%';
|
|
|
130 |
elem.innerHTML = '0%';
|
| 15 |
- |
131 |
|
| 107 |
- |
132 |
elem = document.getElementById("progressBarHeader");
|
|
|
133 |
elem.innerHTML = title;
|
| 15 |
- |
134 |
|
| 107 |
- |
135 |
elem = document.getElementById("progressBarMessage");
|
|
|
136 |
elem.innerHTML = "";
|
| 84 |
- |
137 |
|
| 107 |
- |
138 |
$("#progressBarDiv").modal({
|
|
|
139 |
backdrop: "static"
|
|
|
140 |
});
|
| 15 |
- |
141 |
}
|
|
|
142 |
|
|
|
143 |
function updateProgressBar(width, message) {
|
| 107 |
- |
144 |
var elem = document.getElementById("progressBar");
|
|
|
145 |
if (elem && width) {
|
|
|
146 |
elem.style.width = width + '%';
|
|
|
147 |
elem.innerHTML = width.toFixed(0) + '%';
|
|
|
148 |
// bugbug document.getElementById("progressBarMessage").innerHTML = message;
|
|
|
149 |
}
|
| 15 |
- |
150 |
}
|
|
|
151 |
|
|
|
152 |
function endProgressBarModal() {
|
| 107 |
- |
153 |
$("#progressBarDiv").modal("hide");
|
| 15 |
- |
154 |
}
|
|
|
155 |
|
|
|
156 |
// Refresh the progress bar.
|
|
|
157 |
function refreshProgress() {
|
| 107 |
- |
158 |
$.ajax({
|
|
|
159 |
url: "pbChecker.php?file=" + document.getElementById("sessionId").value + "_" + document.getElementById("sessionTab").value,
|
|
|
160 |
success: function(data) {
|
|
|
161 |
updateProgressBar(data.percent, data.message);
|
|
|
162 |
if (data.percent >= 100) {
|
|
|
163 |
window.clearInterval(timer);
|
|
|
164 |
timer = window.setInterval(completeProgress, 1000);
|
|
|
165 |
}
|
|
|
166 |
}
|
|
|
167 |
});
|
| 15 |
- |
168 |
}
|
|
|
169 |
|
|
|
170 |
// End the progress bar.
|
|
|
171 |
function completeProgress() {
|
| 107 |
- |
172 |
updateProgressBar(100, "Completed");
|
|
|
173 |
window.clearInterval(timer);
|
|
|
174 |
endProgressBarModal();
|
| 15 |
- |
175 |
}
|
|
|
176 |
|
|
|
177 |
// Start the progress bar.
|
|
|
178 |
function progressBar(title) {
|
| 107 |
- |
179 |
initProgressBarModal(title);
|
|
|
180 |
timer = window.setInterval(refreshProgress, 1000);
|
| 28 |
- |
181 |
}
|
|
|
182 |
|
| 52 |
- |
183 |
function saveTransfer(url) {
|
| 107 |
- |
184 |
var xhttp = new XMLHttpRequest();
|
|
|
185 |
xhttp.open("POST", "savetransfer.php", true);
|
|
|
186 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
|
187 |
xhttp.send("target=" + btoa(url) + "&sessionTab=" + document.getElementById("sessionTab").value);
|
| 43 |
- |
188 |
}
|
|
|
189 |
|
| 52 |
- |
190 |
function addWishlist(id, field, cnt, wl) {
|
| 107 |
- |
191 |
$(field).tooltip('hide');
|
|
|
192 |
$(field).remove();
|
|
|
193 |
var xhttp = new XMLHttpRequest();
|
|
|
194 |
xhttp.onreadystatechange = function() {
|
|
|
195 |
if (this.readyState == 4) {
|
|
|
196 |
json = JSON.parse(this.responseText);
|
|
|
197 |
switch (json.retval) {
|
|
|
198 |
case 0:
|
|
|
199 |
msg = "Added to wishlist.";
|
|
|
200 |
alertTxt = "alert-success";
|
|
|
201 |
break;
|
|
|
202 |
case 1:
|
|
|
203 |
msg = "Already on the wishlist.";
|
|
|
204 |
alertTxt = "alert-warning";
|
|
|
205 |
break;
|
|
|
206 |
default:
|
|
|
207 |
msg = "ERROR! Could not add to the wishlist.";
|
|
|
208 |
alertTxt = "alert-danger";
|
|
|
209 |
break;
|
|
|
210 |
}
|
|
|
211 |
document.getElementById("wishlistAdd" + cnt).innerHTML = "<div class=\"alert " + alertTxt + " alert-dismissible mt-2 mb-0\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>" + msg + "</div>";
|
|
|
212 |
alertAutoClose();
|
|
|
213 |
}
|
|
|
214 |
};
|
|
|
215 |
xhttp.open("POST", "wishlistDB.php", true);
|
|
|
216 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
|
217 |
xhttp.send("id=" + id + "&function=add&wl=" + wl + "&sessionTab=" + document.getElementById("sessionTab").value);
|
| 52 |
- |
218 |
}
|
|
|
219 |
|
|
|
220 |
function deleteWishlist(id, field, title, artist) {
|
| 107 |
- |
221 |
$(field).tooltip('hide');
|
|
|
222 |
if (confirm('Remove ' + title + ' by ' + artist + ' from wishlist?')) {
|
|
|
223 |
var parent = field.parentNode.parentNode.parentNode;
|
|
|
224 |
var xhttp = new XMLHttpRequest();
|
|
|
225 |
xhttp.open("POST", "wishlistDB.php", true);
|
|
|
226 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
|
227 |
xhttp.send("function=delete&id=" + id + "&sessionTab=" + document.getElementById("sessionTab").value);
|
|
|
228 |
parent.parentNode.removeChild(parent);
|
|
|
229 |
}
|
| 52 |
- |
230 |
}
|
|
|
231 |
|
|
|
232 |
function editWishlist(id, field) {
|
| 107 |
- |
233 |
if (field !== null) {
|
|
|
234 |
$(field).tooltip('hide');
|
|
|
235 |
var parent = field.parentNode.parentNode.parentNode;
|
| 52 |
- |
236 |
|
| 107 |
- |
237 |
var artist = mysqliHtmlDecode(parent.getElementsByTagName("td")[1].innerHTML);
|
|
|
238 |
var title = mysqliHtmlDecode(parent.getElementsByTagName("td")[2].innerHTML);
|
|
|
239 |
var barcode = parent.getElementsByTagName("td")[3].innerHTML.replace(/-/g, '');
|
|
|
240 |
var cond = parent.getElementsByTagName("td")[5].innerHTML;
|
|
|
241 |
var format = parent.getElementsByTagName("td")[6].innerHTML;
|
|
|
242 |
var price = parent.getElementsByTagName("td")[7].innerHTML;
|
| 52 |
- |
243 |
|
| 107 |
- |
244 |
document.getElementById("wlMsg").innerHTML = "";
|
|
|
245 |
document.getElementById("wlId").value = id;
|
|
|
246 |
document.getElementById("wlArtist").value = artist;
|
|
|
247 |
document.getElementById("wlTitle").value = title;
|
|
|
248 |
document.getElementById("wlBarcode").value = barcode;
|
|
|
249 |
document.getElementById("wlCond").value = cond;
|
|
|
250 |
document.getElementById("wlFormat").value = format;
|
|
|
251 |
document.getElementById("wlPrice").value = price;
|
|
|
252 |
}
|
| 52 |
- |
253 |
|
| 116 |
- |
254 |
$("#editWishlistModal").modal({
|
|
|
255 |
backdrop: 'static',
|
|
|
256 |
keyboard: false
|
|
|
257 |
});
|
| 52 |
- |
258 |
}
|
|
|
259 |
|
|
|
260 |
function saveEditedWishlist() {
|
| 107 |
- |
261 |
var id = document.getElementById("wlId").value;
|
|
|
262 |
var field = document.getElementById("wlIdRow" + id);
|
|
|
263 |
var parent = field.parentNode;
|
|
|
264 |
var artist = document.getElementById("wlArtist").value;
|
|
|
265 |
var title = document.getElementById("wlTitle").value;
|
|
|
266 |
var barcode = document.getElementById("wlBarcode").value;
|
|
|
267 |
var cond = document.getElementById("wlCond").value;
|
|
|
268 |
var format = document.getElementById("wlFormat").value;
|
|
|
269 |
var price = document.getElementById("wlPrice").value;
|
| 52 |
- |
270 |
|
| 107 |
- |
271 |
var xhttp = new XMLHttpRequest();
|
|
|
272 |
xhttp.onreadystatechange = function() {
|
|
|
273 |
if (this.readyState == 4) {
|
|
|
274 |
json = JSON.parse(this.responseText);
|
|
|
275 |
switch (json.retval) {
|
|
|
276 |
case 0:
|
|
|
277 |
parent.getElementsByTagName("td")[1].innerHTML = artist;
|
|
|
278 |
parent.getElementsByTagName("td")[2].innerHTML = title;
|
|
|
279 |
parent.getElementsByTagName("td")[3].innerHTML = barcode;
|
|
|
280 |
parent.getElementsByTagName("td")[4].innerHTML = barcode; // bugbug Format
|
|
|
281 |
parent.getElementsByTagName("td")[5].innerHTML = cond;
|
|
|
282 |
parent.getElementsByTagName("td")[6].innerHTML = format;
|
|
|
283 |
parent.getElementsByTagName("td")[7].innerHTML = price;
|
|
|
284 |
parent.getElementsByTagName("td")[8].innerHTML = '$' + Number(price).toFixed(2); // bugbug Format
|
|
|
285 |
$("#editWishlistModal").modal('hide');
|
|
|
286 |
break;
|
|
|
287 |
case 1:
|
|
|
288 |
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>";
|
|
|
289 |
editWishlist(id, null);
|
|
|
290 |
break;
|
|
|
291 |
default:
|
|
|
292 |
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>";
|
|
|
293 |
break;
|
|
|
294 |
}
|
|
|
295 |
}
|
|
|
296 |
};
|
|
|
297 |
xhttp.open("POST", "wishlistDB.php", true);
|
|
|
298 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
|
299 |
xhttp.send("function=update&id=" + id + "&artist=" + encodeURIComponent(artist) + "&title=" + encodeURIComponent(title) + "&barcode=" + encodeURIComponent(barcode) + "&cond=" + encodeURIComponent(cond) + "&format=" + encodeURIComponent(format) + "&price=" + encodeURIComponent(price) + "&sessionTab=" + document.getElementById("sessionTab").value);
|
| 52 |
- |
300 |
}
|
|
|
301 |
|
| 116 |
- |
302 |
// Flex Data List
|
|
|
303 |
function flexdatalistSetup() {
|
| 118 |
- |
304 |
if ($.fn.flexdatalist && $.fn.clearer) {
|
| 116 |
- |
305 |
$('.flexdatalist').flexdatalist();
|
|
|
306 |
$(function() {
|
|
|
307 |
$("input[id='searchTerm-flexdatalist']").clearer();
|
|
|
308 |
});
|
|
|
309 |
$('.flexdatalist').flexdatalist({
|
|
|
310 |
minLength: 0,
|
|
|
311 |
searchContain: true,
|
|
|
312 |
noResultsText: ""
|
|
|
313 |
}); /* reset after running clearer */
|
|
|
314 |
} else {
|
|
|
315 |
setTimeout(flexdatalistSetup, 100);
|
|
|
316 |
}
|
|
|
317 |
}
|
|
|
318 |
|
| 43 |
- |
319 |
// Pagination
|
| 65 |
- |
320 |
function paginationSetup() {
|
| 116 |
- |
321 |
if ($.fn.paginate && $.fn.modal && $.fn.tooltip && typeof Popper != 'undefined') {
|
|
|
322 |
if (document.getElementById("discogsDeck") !== null) {
|
|
|
323 |
$("[id^=masterModal]").modal("hide");
|
|
|
324 |
$('#discogsDeck').paginate({
|
|
|
325 |
paginateElement: '.card',
|
|
|
326 |
elementsPerPage: paginationPerPage(),
|
|
|
327 |
effect: 'default',
|
|
|
328 |
firstButtonText: '<i class="material-icons material-text">first_page</i>',
|
|
|
329 |
lastButtonText: '<i class="material-icons material-text">last_page</i>',
|
|
|
330 |
prevButtonText: '<i class="material-icons material-text">navigate_before</i>',
|
|
|
331 |
nextButtonText: '<i class="material-icons material-text">navigate_next</i>',
|
|
|
332 |
extraButtonClasses: 'btn bg-primary px-2 shadow-sm'
|
|
|
333 |
});
|
|
|
334 |
tooltipSetup();
|
|
|
335 |
}
|
|
|
336 |
} else {
|
|
|
337 |
setTimeout(paginationSetup, 100);
|
|
|
338 |
}
|
|
|
339 |
}
|
|
|
340 |
|
|
|
341 |
// Tooltip Setup
|
|
|
342 |
function tooltipSetup() {
|
|
|
343 |
if ($.fn.tooltip && typeof Popper != 'undefined') {
|
| 107 |
- |
344 |
$('[data-toggle="tooltip"]').tooltip({
|
|
|
345 |
trigger: 'hover'
|
|
|
346 |
});
|
| 116 |
- |
347 |
|
| 107 |
- |
348 |
$('[data-toggle2="tooltip"]').tooltip({
|
|
|
349 |
trigger: 'hover'
|
|
|
350 |
});
|
| 116 |
- |
351 |
|
|
|
352 |
$('[rel="tooltip"]').on('click', function() {
|
|
|
353 |
$(this).tooltip('hide');
|
|
|
354 |
});
|
|
|
355 |
} else {
|
|
|
356 |
setTimeout(tooltipSetup, 100);
|
| 107 |
- |
357 |
}
|
| 43 |
- |
358 |
}
|
|
|
359 |
|
| 52 |
- |
360 |
function filterWishlist() {
|
| 107 |
- |
361 |
var input, filter, table, tr, td, i, j, txtValue, flag;
|
|
|
362 |
input = document.getElementById("tableFilter");
|
|
|
363 |
filter = input.value.toUpperCase();
|
|
|
364 |
table = document.getElementById("wishlistTable");
|
|
|
365 |
tr = table.getElementsByTagName("tr");
|
|
|
366 |
document.getElementById("tableFilterButton").style.display = (filter.length > 0 ? "" : "none");
|
| 52 |
- |
367 |
|
| 107 |
- |
368 |
// Loop through all table rows, excluding the header, and hide those who don't match the search query
|
|
|
369 |
for (i = 1; i < tr.length; i++) {
|
|
|
370 |
td = tr[i].getElementsByTagName("td");
|
|
|
371 |
flag = "none";
|
| 52 |
- |
372 |
|
| 107 |
- |
373 |
for (j = 0; j < td.length; j++) {
|
|
|
374 |
if (td[j]) {
|
|
|
375 |
txtValue = td[j].textContent || td[j].innerText;
|
|
|
376 |
if (txtValue.toUpperCase().indexOf(filter) > -1) {
|
|
|
377 |
flag = "";
|
|
|
378 |
break;
|
|
|
379 |
}
|
|
|
380 |
}
|
|
|
381 |
}
|
| 52 |
- |
382 |
|
| 107 |
- |
383 |
tr[i].style.display = flag;
|
|
|
384 |
}
|
| 52 |
- |
385 |
}
|
|
|
386 |
|
|
|
387 |
function mysqliHtmlDecode(str) {
|
| 107 |
- |
388 |
str = str.replace(/&/g, '&');
|
|
|
389 |
str = str.replace(/</g, '<');
|
|
|
390 |
str = str.replace(/>/g, '>');
|
|
|
391 |
return str;
|
| 52 |
- |
392 |
}
|
|
|
393 |
|
| 46 |
- |
394 |
// number of discogs entries per page according to screen size
|
| 43 |
- |
395 |
function paginationPerPage() {
|
| 107 |
- |
396 |
var width = $(window).width();
|
|
|
397 |
var num = Math.floor(width / 210);
|
|
|
398 |
if (num > 9) {
|
|
|
399 |
num = 9;
|
|
|
400 |
} else if (width < 576) {
|
|
|
401 |
num = 1;
|
|
|
402 |
}
|
|
|
403 |
return num;
|
| 43 |
- |
404 |
}
|
| 46 |
- |
405 |
|
|
|
406 |
// sort table by column
|
|
|
407 |
function sortTable(table, col, colType) {
|
| 107 |
- |
408 |
var rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
|
|
|
409 |
table = document.getElementById(table);
|
|
|
410 |
switching = true;
|
|
|
411 |
// Set the sorting direction to ascending:
|
|
|
412 |
dir = "asc";
|
|
|
413 |
/* Make a loop that will continue until no switching has been done: */
|
|
|
414 |
while (switching) {
|
|
|
415 |
// Start by saying: no switching is done:
|
|
|
416 |
switching = false;
|
|
|
417 |
rows = table.rows;
|
|
|
418 |
/* Loop through all table rows (except the first, which contains table headers): */
|
|
|
419 |
for (i = 1; i < (rows.length - 1); i++) {
|
|
|
420 |
// Start by saying there should be no switching:
|
|
|
421 |
shouldSwitch = false;
|
|
|
422 |
/* Get the two elements you want to compare, one from current row and one from the next: */
|
|
|
423 |
x = rows[i].getElementsByTagName("TD")[col];
|
|
|
424 |
y = rows[i + 1].getElementsByTagName("TD")[col];
|
|
|
425 |
/* Check if the two rows should switch place, based on the direction, asc or desc: */
|
|
|
426 |
if (dir == "asc") {
|
|
|
427 |
if (colType == 'numeric') {
|
|
|
428 |
if (Number(x.innerHTML) > Number(y.innerHTML.toLowerCase)) {
|
|
|
429 |
// If so, mark as a switch and break the loop:
|
|
|
430 |
shouldSwitch = true;
|
|
|
431 |
break;
|
|
|
432 |
}
|
|
|
433 |
} else /* if (colType == 'text') */ {
|
|
|
434 |
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
|
|
|
435 |
// If so, mark as a switch and break the loop:
|
|
|
436 |
shouldSwitch = true;
|
|
|
437 |
break;
|
|
|
438 |
}
|
|
|
439 |
}
|
|
|
440 |
} else if (dir == "desc") {
|
|
|
441 |
if (colType == 'numeric') {
|
|
|
442 |
if (Number(x.innerHTML) < Number(y.innerHTML)) {
|
|
|
443 |
// If so, mark as a switch and break the loop:
|
|
|
444 |
shouldSwitch = true;
|
|
|
445 |
break;
|
|
|
446 |
}
|
|
|
447 |
} else /* if (colType == 'text') */ {
|
|
|
448 |
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
|
|
|
449 |
// If so, mark as a switch and break the loop:
|
|
|
450 |
shouldSwitch = true;
|
|
|
451 |
break;
|
|
|
452 |
}
|
|
|
453 |
}
|
|
|
454 |
}
|
|
|
455 |
}
|
|
|
456 |
if (shouldSwitch) {
|
|
|
457 |
/* If a switch has been marked, make the switch and mark that a switch has been done: */
|
|
|
458 |
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
|
|
|
459 |
switching = true;
|
|
|
460 |
// Each time a switch is done, increase this count by 1:
|
|
|
461 |
switchcount++;
|
|
|
462 |
} else {
|
|
|
463 |
/* If no switching has been done AND the direction is "asc", set the direction to "desc" and run the while loop again. */
|
|
|
464 |
if (switchcount === 0 && dir == "asc") {
|
|
|
465 |
dir = "desc";
|
|
|
466 |
switching = true;
|
|
|
467 |
}
|
|
|
468 |
}
|
|
|
469 |
}
|
| 66 |
- |
470 |
}
|
| 81 |
- |
471 |
|
|
|
472 |
function scrollFunction() {
|
| 107 |
- |
473 |
var topButton = document.getElementById("topBtn");
|
| 81 |
- |
474 |
|
| 107 |
- |
475 |
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
|
|
|
476 |
topButton.style.display = "block";
|
|
|
477 |
} else {
|
|
|
478 |
topButton.style.display = "none";
|
|
|
479 |
}
|
| 81 |
- |
480 |
}
|
|
|
481 |
|
|
|
482 |
function topFunction() {
|
| 107 |
- |
483 |
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
|
|
484 |
}
|