Subversion Repositories cheapmusic

Rev

Rev 39 | Rev 46 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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');
14
    });
15
 
43 - 16
    $(window).bind('resize orientationchange', paginationSetup);
17
 
15 - 18
    tableFilterButtons();
43 - 19
    paginationSetup();
6 - 20
});
11 - 21
 
15 - 22
function tableFilterButtons() {
23
    $(".filterButton").click(function() {
24
        $.post("filterTable.php", {
25
            submit: $(this).attr("value"),
26
            sessionTab: document.getElementById("sessionTab").value
27
        }, function(data, status) {
28
            if (status == "success") {
29
                document.getElementById("productTable").innerHTML = data;
30
                tableFilterButtons();
31
            }
32
        });
33
    });
34
}
35
 
36
function initProgressBarModal(title) {
37
    var elem = document.getElementById("progressBar");
38
    elem.style.width = '0%';
39
    elem.innerHTML = '0%';
40
 
41
    elem = document.getElementById("progressBarHeader");
42
    elem.innerHTML = title;
43
 
23 - 44
    $("#progressBarDiv").modal({backdrop: "static"});
15 - 45
}
46
 
47
function updateProgressBar(width, message) {
48
    var elem = document.getElementById("progressBar");
49
    elem.style.width = width + '%';
50
    elem.innerHTML = width.toFixed(0) + '%';
51
    // bugbug document.getElementById("progressBarMessage").innerHTML = message;
52
}
53
 
54
function endProgressBarModal() {
55
    $("#progressBarDiv").modal("hide");
56
}
57
 
58
// Refresh the progress bar.
59
function refreshProgress() {
60
    $.ajax({
61
        url: "pbChecker.php?file=" + document.getElementById("sessionId").value + "_" + document.getElementById("sessionTab").value,
62
        success: function(data) {
63
            updateProgressBar(data.percent, data.message);
64
            if (data.percent == 100) {
65
                window.clearInterval(timer);
66
                timer = window.setInterval(completeProgress, 1000);
67
            }
68
        }
69
    });
70
}
71
 
72
// End the progress bar.
73
function completeProgress() {
74
    updateProgressBar(100, "Completed");
75
    window.clearInterval(timer);
39 - 76
    endProgressBarModal();
15 - 77
}
78
 
79
// Start the progress bar.
80
function progressBar(title) {
81
    initProgressBarModal(title);
82
    timer = window.setInterval(refreshProgress, 1000);
28 - 83
}
84
 
85
function saveTransfer($url) {
86
    var xhttp = new XMLHttpRequest();
87
    xhttp.open("POST", "savetransfer.php", true);
88
    xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
89
    xhttp.send("target=" + btoa($url) + "&sessionTab=" + document.getElementById("sessionTab").value);
43 - 90
}
91
 
92
// Pagination
93
function paginationSetup(){
94
    $('#discogsDeck').paginate({
95
        paginateElement: '.card',
96
        elementsPerPage: paginationPerPage(),
97
        effect: 'default',
98
        firstButtonText: '<i class="fas fa-angle-double-left"></i>',
99
        lastButtonText: '<i class="fas fa-angle-double-right"></i>',
100
        prevButtonText: '<i class="fas fa-angle-left"></i>',
101
        nextButtonText: '<i class="fas fa-angle-right"></i>',
102
        extraButtonClasses: 'btn btn-primary px-2 shadow-sm'
103
    });
104
    $('[data-toggle="tooltip"]').tooltip({trigger : 'hover'});
105
    $('[data-toggle2="tooltip"]').tooltip({trigger : 'hover'});
106
}
107
 
108
function paginationPerPage() {
109
    width = $( document ).width();
110
    if (width < 576){
111
        return 1;
112
    } else if (width < 768){
113
        return 2;
114
    } else if (width < 992){
115
        return 3;
116
    } else if (width < 1200){
117
        return 4;
118
    } else {
119
        return 6;
120
    }
121
}