120 |
- |
1 |
var myTimer;
|
|
|
2 |
|
15 |
- |
3 |
$(document).ready(function() {
|
107 |
- |
4 |
$(window).on('beforeunload', function() {
|
|
|
5 |
$(":submit").attr('disabled', 'disabled');
|
|
|
6 |
document.body.style.cursor = "progress";
|
|
|
7 |
});
|
52 |
- |
8 |
|
120 |
- |
9 |
$(window).bind('resize orientationchange', function() { paginationSetup(); });
|
116 |
- |
10 |
paginationSetup();
|
81 |
- |
11 |
|
120 |
- |
12 |
if (document.getElementById("detailFilterForm")) {
|
107 |
- |
13 |
tableFilterButtons();
|
|
|
14 |
detailTableFilterButtons();
|
|
|
15 |
}
|
|
|
16 |
|
120 |
- |
17 |
if (document.getElementById("barcodeForm")) {
|
113 |
- |
18 |
barcodeFormButtons();
|
|
|
19 |
}
|
|
|
20 |
|
116 |
- |
21 |
flexdatalistSetup();
|
|
|
22 |
|
143 |
- |
23 |
dataTableSetup();
|
|
|
24 |
|
116 |
- |
25 |
tooltipSetup();
|
141 |
- |
26 |
|
143 |
- |
27 |
inputClearerSetup();
|
6 |
- |
28 |
});
|
11 |
- |
29 |
|
107 |
- |
30 |
|
15 |
- |
31 |
function tableFilterButtons() {
|
124 |
- |
32 |
$(".filterButton").click(function() {
|
107 |
- |
33 |
$.post("filterTable.php", {
|
136 |
- |
34 |
submitBtn: $(this).attr("value"),
|
120 |
- |
35 |
sessionTab: document.getElementById("sessionTab").value,
|
|
|
36 |
nonce: document.getElementById("nonce").value
|
107 |
- |
37 |
},
|
|
|
38 |
function(data, status) {
|
|
|
39 |
if (status == "success") {
|
|
|
40 |
document.getElementById("productTable").innerHTML = data;
|
|
|
41 |
tableFilterButtons();
|
|
|
42 |
detailTableFilterButtons();
|
143 |
- |
43 |
dataTableSetup();
|
107 |
- |
44 |
}
|
|
|
45 |
}
|
|
|
46 |
);
|
|
|
47 |
});
|
15 |
- |
48 |
}
|
|
|
49 |
|
66 |
- |
50 |
function detailTableFilterButtons() {
|
107 |
- |
51 |
$("#detailFilterForm").on('submit', function(e) {
|
|
|
52 |
e.preventDefault();
|
|
|
53 |
return false;
|
|
|
54 |
});
|
|
|
55 |
|
149 |
- |
56 |
$("#detailTab").click(function(e) {
|
|
|
57 |
e.preventDefault();
|
116 |
- |
58 |
x = document.getElementById("detailFilter");
|
|
|
59 |
if (x.style.display == "block") {
|
|
|
60 |
document.getElementById("detailTabArrow").innerHTML = '<i class="material-icons material-text">expand_more</i>';
|
|
|
61 |
x.style.display = "none";
|
|
|
62 |
} else {
|
|
|
63 |
document.getElementById("detailTabArrow").innerHTML = '<i class="material-icons material-text">expand_less</i>';
|
|
|
64 |
x.style.display = "block";
|
|
|
65 |
}
|
107 |
- |
66 |
});
|
116 |
- |
67 |
|
107 |
- |
68 |
$(".detailFilterButton").click(function() {
|
|
|
69 |
var formData = $("#detailFilterForm").serializeArray();
|
|
|
70 |
formData.push({
|
|
|
71 |
name: this.name,
|
121 |
- |
72 |
value: this.value,
|
107 |
- |
73 |
});
|
121 |
- |
74 |
formData.push({
|
|
|
75 |
name: "nonce",
|
|
|
76 |
value: document.getElementById("nonce").value
|
|
|
77 |
});
|
107 |
- |
78 |
$.post("filterTable.php",
|
|
|
79 |
formData,
|
|
|
80 |
function(data, status) {
|
|
|
81 |
if (status == "success") {
|
|
|
82 |
document.getElementById("productTable").innerHTML = data;
|
|
|
83 |
detailTableFilterButtons();
|
|
|
84 |
tableFilterButtons();
|
143 |
- |
85 |
dataTableSetup();
|
107 |
- |
86 |
}
|
|
|
87 |
}
|
|
|
88 |
);
|
|
|
89 |
});
|
66 |
- |
90 |
}
|
|
|
91 |
|
113 |
- |
92 |
function barcodeFormButtons() {
|
|
|
93 |
$("#barcodeForm").on('submit', function(e) {
|
107 |
- |
94 |
e.preventDefault();
|
113 |
- |
95 |
return false;
|
107 |
- |
96 |
});
|
|
|
97 |
|
113 |
- |
98 |
$(".barcodeButton").click(function() {
|
|
|
99 |
var formData = $("#barcodeForm").serializeArray();
|
|
|
100 |
formData.push({
|
|
|
101 |
name: this.name,
|
|
|
102 |
value: this.value
|
|
|
103 |
});
|
121 |
- |
104 |
formData.push({
|
|
|
105 |
name: "nonce",
|
|
|
106 |
value: document.getElementById("nonce").value
|
|
|
107 |
});
|
113 |
- |
108 |
$.post("barcode.php",
|
|
|
109 |
formData,
|
|
|
110 |
function(data, status) {
|
|
|
111 |
if (status == "success") {
|
|
|
112 |
document.getElementById("barcodeResult").innerHTML = data;
|
|
|
113 |
}
|
|
|
114 |
}
|
|
|
115 |
);
|
121 |
- |
116 |
|
|
|
117 |
new MutationObserver(function() {
|
|
|
118 |
$("#barcodeSearchForm").off("submit");
|
|
|
119 |
if (document.getElementById("barcodeSearchTerm") && document.getElementById("barcodeSearchTerm").value !== "") {
|
|
|
120 |
$("#barcodeSearchForm").submit(function() {
|
134 |
- |
121 |
searchTitle = "Searching for:<br><br><strong>" + document.getElementById("barcodeSearchTerm").value + "</strong>";
|
|
|
122 |
if (window.google_tag_manager && window.ga && ga.create) {
|
|
|
123 |
window.dataLayer.push({ "event" : "search", "search_term" : document.getElementById("barcodeSearchTerm").value, "eventCallback": function () {progressBar(searchTitle);}});
|
|
|
124 |
} else {
|
|
|
125 |
progressBar(searchTitle);
|
|
|
126 |
}
|
121 |
- |
127 |
});
|
|
|
128 |
}
|
|
|
129 |
}).observe(document.getElementById("barcodeResult"), { childList: true, subtree: true });
|
113 |
- |
130 |
});
|
66 |
- |
131 |
}
|
116 |
- |
132 |
|
64 |
- |
133 |
function alertAutoClose() {
|
107 |
- |
134 |
window.setTimeout(function() {
|
|
|
135 |
$(".alert").fadeTo(1000, 0).slideUp(1000, function() {
|
|
|
136 |
$(this).remove();
|
|
|
137 |
});
|
|
|
138 |
}, 3000);
|
64 |
- |
139 |
}
|
|
|
140 |
|
15 |
- |
141 |
function initProgressBarModal(title) {
|
107 |
- |
142 |
var elem = document.getElementById("progressBar");
|
143 |
- |
143 |
elem.style.width = '0';
|
107 |
- |
144 |
elem.innerHTML = '0%';
|
15 |
- |
145 |
|
107 |
- |
146 |
elem = document.getElementById("progressBarHeader");
|
|
|
147 |
elem.innerHTML = title;
|
15 |
- |
148 |
|
107 |
- |
149 |
elem = document.getElementById("progressBarMessage");
|
|
|
150 |
elem.innerHTML = "";
|
84 |
- |
151 |
|
107 |
- |
152 |
$("#progressBarDiv").modal({
|
|
|
153 |
backdrop: "static"
|
|
|
154 |
});
|
15 |
- |
155 |
}
|
|
|
156 |
|
|
|
157 |
function updateProgressBar(width, message) {
|
107 |
- |
158 |
var elem = document.getElementById("progressBar");
|
|
|
159 |
if (elem && width) {
|
|
|
160 |
elem.style.width = width + '%';
|
|
|
161 |
elem.innerHTML = width.toFixed(0) + '%';
|
|
|
162 |
// bugbug document.getElementById("progressBarMessage").innerHTML = message;
|
|
|
163 |
}
|
15 |
- |
164 |
}
|
|
|
165 |
|
|
|
166 |
function endProgressBarModal() {
|
107 |
- |
167 |
$("#progressBarDiv").modal("hide");
|
15 |
- |
168 |
}
|
|
|
169 |
|
|
|
170 |
// Refresh the progress bar.
|
|
|
171 |
function refreshProgress() {
|
107 |
- |
172 |
$.ajax({
|
122 |
- |
173 |
url: "pbChecker.php?file=" + document.getElementById("sessionId").value + "_" + document.getElementById("sessionTab").value + "&nonce=" + document.getElementById("nonce").value,
|
107 |
- |
174 |
success: function(data) {
|
|
|
175 |
updateProgressBar(data.percent, data.message);
|
|
|
176 |
if (data.percent >= 100) {
|
120 |
- |
177 |
window.clearInterval(myTimer);
|
|
|
178 |
myTimer = window.setInterval(function() { completeProgress(); }, 1000);
|
107 |
- |
179 |
}
|
|
|
180 |
}
|
|
|
181 |
});
|
15 |
- |
182 |
}
|
|
|
183 |
|
|
|
184 |
// End the progress bar.
|
|
|
185 |
function completeProgress() {
|
107 |
- |
186 |
updateProgressBar(100, "Completed");
|
120 |
- |
187 |
window.clearInterval(myTimer);
|
107 |
- |
188 |
endProgressBarModal();
|
15 |
- |
189 |
}
|
|
|
190 |
|
|
|
191 |
// Start the progress bar.
|
|
|
192 |
function progressBar(title) {
|
107 |
- |
193 |
initProgressBarModal(title);
|
121 |
- |
194 |
myTimer = window.setInterval(function() { refreshProgress(); }, 500);
|
28 |
- |
195 |
}
|
|
|
196 |
|
52 |
- |
197 |
function saveTransfer(url) {
|
107 |
- |
198 |
var xhttp = new XMLHttpRequest();
|
|
|
199 |
xhttp.open("POST", "savetransfer.php", true);
|
|
|
200 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
122 |
- |
201 |
xhttp.send("target=" + btoa(url) + "&sessionTab=" + document.getElementById("sessionTab").value + "&nonce=" + document.getElementById("nonce").value);
|
43 |
- |
202 |
}
|
|
|
203 |
|
52 |
- |
204 |
function addWishlist(id, field, cnt, wl) {
|
107 |
- |
205 |
$(field).tooltip('hide');
|
141 |
- |
206 |
$(field).children('i').first().html('library_add_check');
|
107 |
- |
207 |
var xhttp = new XMLHttpRequest();
|
|
|
208 |
xhttp.onreadystatechange = function() {
|
|
|
209 |
if (this.readyState == 4) {
|
|
|
210 |
json = JSON.parse(this.responseText);
|
|
|
211 |
switch (json.retval) {
|
|
|
212 |
case 0:
|
|
|
213 |
msg = "Added to wishlist.";
|
|
|
214 |
alertTxt = "alert-success";
|
|
|
215 |
break;
|
|
|
216 |
case 1:
|
|
|
217 |
msg = "Already on the wishlist.";
|
|
|
218 |
alertTxt = "alert-warning";
|
|
|
219 |
break;
|
|
|
220 |
default:
|
|
|
221 |
msg = "ERROR! Could not add to the wishlist.";
|
|
|
222 |
alertTxt = "alert-danger";
|
|
|
223 |
break;
|
|
|
224 |
}
|
|
|
225 |
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>";
|
|
|
226 |
alertAutoClose();
|
|
|
227 |
}
|
|
|
228 |
};
|
|
|
229 |
xhttp.open("POST", "wishlistDB.php", true);
|
|
|
230 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
122 |
- |
231 |
xhttp.send("id=" + id + "&function=add&wl=" + wl + "&sessionTab=" + document.getElementById("sessionTab").value + "&nonce=" + document.getElementById("nonce").value);
|
52 |
- |
232 |
}
|
|
|
233 |
|
|
|
234 |
function deleteWishlist(id, field, title, artist) {
|
107 |
- |
235 |
$(field).tooltip('hide');
|
|
|
236 |
if (confirm('Remove ' + title + ' by ' + artist + ' from wishlist?')) {
|
|
|
237 |
var xhttp = new XMLHttpRequest();
|
|
|
238 |
xhttp.open("POST", "wishlistDB.php", true);
|
|
|
239 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
122 |
- |
240 |
xhttp.send("function=delete&id=" + id + "&sessionTab=" + document.getElementById("sessionTab").value + "&nonce=" + document.getElementById("nonce").value);
|
143 |
- |
241 |
row = field.closest("tr");
|
|
|
242 |
if ($(row).hasClass("child")) {
|
|
|
243 |
row.previousElementSibling.remove();
|
|
|
244 |
}
|
|
|
245 |
row.remove();
|
107 |
- |
246 |
}
|
52 |
- |
247 |
}
|
|
|
248 |
|
|
|
249 |
function editWishlist(id, field) {
|
107 |
- |
250 |
if (field !== null) {
|
|
|
251 |
$(field).tooltip('hide');
|
143 |
- |
252 |
var row = field.closest("tr");
|
|
|
253 |
if ($(row).hasClass("child")) {
|
|
|
254 |
row = row.previousElementSibling;
|
|
|
255 |
}
|
52 |
- |
256 |
|
143 |
- |
257 |
var artist = mysqliHtmlDecode(row.getElementsByTagName("td")[1].innerHTML);
|
|
|
258 |
var title = mysqliHtmlDecode(row.getElementsByTagName("td")[2].innerHTML);
|
|
|
259 |
var barcode = row.getElementsByTagName("td")[3].getAttribute("data-order");
|
|
|
260 |
var cond = row.getElementsByTagName("td")[4].innerHTML;
|
|
|
261 |
var format = row.getElementsByTagName("td")[5].innerHTML;
|
|
|
262 |
var price = row.getElementsByTagName("td")[6].getAttribute("data-order");
|
52 |
- |
263 |
|
107 |
- |
264 |
document.getElementById("wlMsg").innerHTML = "";
|
|
|
265 |
document.getElementById("wlId").value = id;
|
|
|
266 |
document.getElementById("wlArtist").value = artist;
|
|
|
267 |
document.getElementById("wlTitle").value = title;
|
|
|
268 |
document.getElementById("wlBarcode").value = barcode;
|
|
|
269 |
document.getElementById("wlCond").value = cond;
|
|
|
270 |
document.getElementById("wlFormat").value = format;
|
|
|
271 |
document.getElementById("wlPrice").value = price;
|
|
|
272 |
}
|
52 |
- |
273 |
|
116 |
- |
274 |
$("#editWishlistModal").modal({
|
|
|
275 |
backdrop: 'static',
|
|
|
276 |
keyboard: false
|
|
|
277 |
});
|
52 |
- |
278 |
}
|
|
|
279 |
|
|
|
280 |
function saveEditedWishlist() {
|
107 |
- |
281 |
var id = document.getElementById("wlId").value;
|
143 |
- |
282 |
var row = document.getElementById("wlIdRow" + id);
|
107 |
- |
283 |
var artist = document.getElementById("wlArtist").value;
|
|
|
284 |
var title = document.getElementById("wlTitle").value;
|
|
|
285 |
var barcode = document.getElementById("wlBarcode").value;
|
|
|
286 |
var cond = document.getElementById("wlCond").value;
|
|
|
287 |
var format = document.getElementById("wlFormat").value;
|
|
|
288 |
var price = document.getElementById("wlPrice").value;
|
143 |
- |
289 |
var table = row.closest("table");
|
52 |
- |
290 |
|
107 |
- |
291 |
var xhttp = new XMLHttpRequest();
|
|
|
292 |
xhttp.onreadystatechange = function() {
|
|
|
293 |
if (this.readyState == 4) {
|
|
|
294 |
json = JSON.parse(this.responseText);
|
|
|
295 |
switch (json.retval) {
|
|
|
296 |
case 0:
|
143 |
- |
297 |
$(table).DataTable().cell(row.getElementsByTagName("td")[1]).data(artist);
|
|
|
298 |
row.setAttribute("data-artist", artist);
|
|
|
299 |
$(table).DataTable().cell(row.getElementsByTagName("td")[2]).data(title);
|
|
|
300 |
row.setAttribute("data-title", title);
|
|
|
301 |
row.getElementsByTagName("td")[3].setAttribute("data-order", barcode);
|
|
|
302 |
$(table).DataTable().cell(row.getElementsByTagName("td")[3]).data(barcode); // bugbug Format
|
|
|
303 |
row.setAttribute("data-barcode", barcode);
|
|
|
304 |
$(table).DataTable().cell(row.getElementsByTagName("td")[4]).data(cond);
|
|
|
305 |
$(table).DataTable().cell(row.getElementsByTagName("td")[5]).data(format);
|
|
|
306 |
row.getElementsByTagName("td")[6].setAttribute("data-order", price);
|
|
|
307 |
$(table).DataTable().cell(row.getElementsByTagName("td")[6]).data('$' + Number(price).toFixed(2));
|
|
|
308 |
$(table).DataTable().draw();
|
107 |
- |
309 |
$("#editWishlistModal").modal('hide');
|
|
|
310 |
break;
|
|
|
311 |
case 1:
|
|
|
312 |
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>";
|
|
|
313 |
editWishlist(id, null);
|
|
|
314 |
break;
|
|
|
315 |
default:
|
|
|
316 |
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>";
|
|
|
317 |
break;
|
|
|
318 |
}
|
|
|
319 |
}
|
|
|
320 |
};
|
|
|
321 |
xhttp.open("POST", "wishlistDB.php", true);
|
|
|
322 |
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
122 |
- |
323 |
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 + "&nonce=" + document.getElementById("nonce").value);
|
52 |
- |
324 |
}
|
|
|
325 |
|
116 |
- |
326 |
// Flex Data List
|
|
|
327 |
function flexdatalistSetup() {
|
143 |
- |
328 |
if ($.fn.flexdatalist) {
|
116 |
- |
329 |
$('.flexdatalist').flexdatalist({
|
138 |
- |
330 |
valueProperty: "value",
|
116 |
- |
331 |
minLength: 0,
|
|
|
332 |
searchContain: true,
|
143 |
- |
333 |
searchByWord: true,
|
116 |
- |
334 |
noResultsText: ""
|
143 |
- |
335 |
});
|
138 |
- |
336 |
$("input[id='searchTerm-flexdatalist']").val($("input[id='searchTerm']").val());
|
141 |
- |
337 |
$("input.flexdatalist").on("select:flexdatalist", function (event) { handleFlexdataSelect(); });
|
116 |
- |
338 |
} else {
|
120 |
- |
339 |
setTimeout(function () { flexdatalistSetup(); }, 100);
|
116 |
- |
340 |
}
|
|
|
341 |
}
|
|
|
342 |
|
141 |
- |
343 |
function handleFlexdataSelect() {
|
|
|
344 |
var i, v, t, f;
|
143 |
- |
345 |
|
141 |
- |
346 |
v = $("input.flexdatalist").val();
|
|
|
347 |
if (v.substr(0, 5) != "*ADV*") {
|
143 |
- |
348 |
$('input.clearable').trigger("change");
|
141 |
- |
349 |
return;
|
|
|
350 |
}
|
143 |
- |
351 |
|
141 |
- |
352 |
t = v.substr(5).split("*|*");
|
|
|
353 |
for (i = 0; i < t.length; i++) {
|
|
|
354 |
f = t[i].split("*:*");
|
|
|
355 |
if (f[0] == "a") {
|
|
|
356 |
$("#advArtist").val(f[1]);
|
|
|
357 |
} else if (f[0] == "t") {
|
|
|
358 |
$("#advTitle").val(f[1]);
|
|
|
359 |
} else if (f[0] == "tr") {
|
|
|
360 |
$("#advTrack").val(f[1]);
|
|
|
361 |
} else if (f[0] == "b") {
|
|
|
362 |
$("#advBarcode").val(f[1]);
|
|
|
363 |
} else if (f[0] == "c") {
|
|
|
364 |
$("#advCatno").val(f[1]);
|
|
|
365 |
} else if (f[0] == "l") {
|
|
|
366 |
$("#advLabel").val(f[1]);
|
|
|
367 |
} else if (f[0] == "co") {
|
|
|
368 |
$("#advCountry").val(f[1]);
|
|
|
369 |
} else if (f[0] == "y") {
|
|
|
370 |
$("#advYear").val(f[1]);
|
|
|
371 |
}
|
|
|
372 |
}
|
|
|
373 |
|
|
|
374 |
$("#simpleSearchDiv").addClass("d-none");
|
|
|
375 |
$("#advSearchDiv").removeClass("d-none");
|
143 |
- |
376 |
$('input.clearable').trigger("change");
|
141 |
- |
377 |
}
|
|
|
378 |
|
43 |
- |
379 |
// Pagination
|
65 |
- |
380 |
function paginationSetup() {
|
120 |
- |
381 |
if ($.fn.paginate && $.fn.modal && $.fn.tooltip && typeof Popper !== "undefined") {
|
116 |
- |
382 |
if (document.getElementById("discogsDeck") !== null) {
|
|
|
383 |
$("[id^=masterModal]").modal("hide");
|
146 |
- |
384 |
$("[id^=videoModal]").modal("hide");
|
116 |
- |
385 |
$('#discogsDeck').paginate({
|
|
|
386 |
paginateElement: '.card',
|
|
|
387 |
elementsPerPage: paginationPerPage(),
|
|
|
388 |
effect: 'default',
|
|
|
389 |
firstButtonText: '<i class="material-icons material-text">first_page</i>',
|
|
|
390 |
lastButtonText: '<i class="material-icons material-text">last_page</i>',
|
|
|
391 |
prevButtonText: '<i class="material-icons material-text">navigate_before</i>',
|
|
|
392 |
nextButtonText: '<i class="material-icons material-text">navigate_next</i>',
|
124 |
- |
393 |
extraButtonClasses: 'btn bg-info px-2 shadow-sm',
|
143 |
- |
394 |
functionOnNav: function () { tooltipSetup(); }
|
116 |
- |
395 |
});
|
|
|
396 |
tooltipSetup();
|
|
|
397 |
}
|
|
|
398 |
} else {
|
120 |
- |
399 |
setTimeout(function () { paginationSetup(); }, 100);
|
116 |
- |
400 |
}
|
|
|
401 |
}
|
|
|
402 |
|
|
|
403 |
// Tooltip Setup
|
|
|
404 |
function tooltipSetup() {
|
|
|
405 |
if ($.fn.tooltip && typeof Popper != 'undefined') {
|
107 |
- |
406 |
$('[data-toggle="tooltip"]').tooltip({
|
|
|
407 |
trigger: 'hover'
|
|
|
408 |
});
|
116 |
- |
409 |
|
107 |
- |
410 |
$('[data-toggle2="tooltip"]').tooltip({
|
|
|
411 |
trigger: 'hover'
|
|
|
412 |
});
|
116 |
- |
413 |
} else {
|
120 |
- |
414 |
setTimeout(function () { tooltipSetup(); }, 100);
|
107 |
- |
415 |
}
|
43 |
- |
416 |
}
|
|
|
417 |
|
143 |
- |
418 |
// Tooltip Setup
|
|
|
419 |
function dataTableSetup() {
|
|
|
420 |
if ($.fn.DataTable) {
|
|
|
421 |
$('table.DataTable').DataTable({
|
|
|
422 |
"infoCallback": function( settings, start, end, max, total, pre ) {return "Showing " + total +" of "+ max + " entries";}
|
|
|
423 |
});
|
|
|
424 |
$('div.dataTables_filter input').attr('type', 'text').addClass('clearable');
|
|
|
425 |
} else {
|
|
|
426 |
setTimeout(function () { dataTableSetup(); }, 100);
|
107 |
- |
427 |
}
|
52 |
- |
428 |
}
|
|
|
429 |
|
|
|
430 |
function mysqliHtmlDecode(str) {
|
107 |
- |
431 |
str = str.replace(/&/g, '&');
|
|
|
432 |
str = str.replace(/</g, '<');
|
|
|
433 |
str = str.replace(/>/g, '>');
|
|
|
434 |
return str;
|
52 |
- |
435 |
}
|
|
|
436 |
|
46 |
- |
437 |
// number of discogs entries per page according to screen size
|
43 |
- |
438 |
function paginationPerPage() {
|
107 |
- |
439 |
var width = $(window).width();
|
|
|
440 |
var num = Math.floor(width / 210);
|
|
|
441 |
if (num > 9) {
|
|
|
442 |
num = 9;
|
|
|
443 |
} else if (width < 576) {
|
|
|
444 |
num = 1;
|
|
|
445 |
}
|
|
|
446 |
return num;
|
43 |
- |
447 |
}
|
46 |
- |
448 |
|
81 |
- |
449 |
function topFunction() {
|
107 |
- |
450 |
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
124 |
- |
451 |
}
|
137 |
- |
452 |
|
138 |
- |
453 |
String.prototype.toProperCase = function () {
|
|
|
454 |
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
|
|
|
455 |
};
|
143 |
- |
456 |
|
|
|
457 |
/* clearable input fields, toggle class */
|
|
|
458 |
function tog(v){return v?'addClass':'removeClass';}
|
|
|
459 |
|
|
|
460 |
function inputClearerSetup() {
|
|
|
461 |
$(document).on('input focus change select', '.clearable', function(){
|
|
|
462 |
$(this)[tog(this.value)]('x');
|
|
|
463 |
}).on('mousemove', '.x', function( e ){
|
|
|
464 |
$(this)[tog(this.offsetWidth-18 < e.clientX-this.getBoundingClientRect().left)]('onX');
|
|
|
465 |
}).on('touchstart click', '.onX', function( ev ){
|
|
|
466 |
ev.preventDefault();
|
|
|
467 |
$(this).removeClass('x onX').val('').change();
|
146 |
- |
468 |
if (ev.target.id == "searchTerm-flexdatalist") {
|
|
|
469 |
$('#' + ev.target.id).trigger("focusin");
|
|
|
470 |
} else {
|
|
|
471 |
$(this).trigger("keyup");
|
|
|
472 |
}
|
143 |
- |
473 |
}).on('shown.bs.modal', function(e){
|
|
|
474 |
$('#' + e.target.id + ' input.clearable').trigger("input");
|
|
|
475 |
});
|
|
|
476 |
|
|
|
477 |
$('input.clearable').trigger("change");
|
|
|
478 |
}
|