edmtrack.test.lcs-lab.com Open in urlscan Pro
58.220.27.63  Public Scan

Submitted URL: http://edmtrack.test.lcs-lab.com/js/utility.js
Effective URL: https://edmtrack.test.lcs-lab.com/js/utility.js
Submission: On October 24 via api from US — Scanned from US

Form analysis 0 forms found in the DOM

Text Content

+ function ($) {
    function hideAlert() {
        setTimeout(function () {
            $('.alert').hide();
        }, 6000);
    }

    if ($('.alert').is(":visible") && $('.alert').hasClass('auto-hide')) {
        hideAlert();
    }

    $.info = function (message) {
        $('.alert .msg-display')
            .html(message);
        var alert = $('.alert');

        alert.removeClass('alert-warning alert-error')
            .addClass('alert-info auto-hide');

        if ($('body').hasClass('alert-editor')) {
            alert.css('margin-left', -$('.alert').outerWidth() / 2);
        }

        alert.show();
        hideAlert();
    }

    $.warning = function (message) {
        $('.alert .msg-display')
            .html(message);
        var alert = $('.alert');

        alert.removeClass('alert-info alert-error auto-hide')
            .addClass('alert-warning');

        if ($('body').hasClass('alert-editor')) {
            alert.css('margin-left', -$('.alert').outerWidth() / 2);
        }

        alert.show();
    }

    $.error = function (message) {
        $('.alert .msg-display')
            .html(message);
        var alert = $('.alert');

        alert.removeClass('alert-info alert-warning auto-hide')
            .addClass('alert-error');

        if ($('body').hasClass('alert-editor')) {
            alert.css('margin-left', -$('.alert').outerWidth() / 2);
        }

        alert.show();
    }

    $('.alert .close-btn').on('click', function (e) {
        e.preventDefault();
        $('.alert').hide();
    })

    $(document).ready(function () {
        var item = $('.alert');
        if (item.length) {
            item.data('original-top', item.offset().top);
        }
    }).scroll(function (e) {
        var scrollTop = $(e.target).scrollTop();
        var alert = $('.alert');
        if (alert.scrollTop() + alert.data('original-top') < scrollTop) {
            alert.addClass('fixed');
        }
        else {
            alert.removeClass('fixed');
        }
    });


    $.confirm = function (message) {
        return confirm(message);
    }

    $.linkType = function (link) {
        if (link == '#' || link == 'javascript:void' || link == 'javascript:;') {
            return null;
        }
        else if (link.indexOf('/') == 0 || link.indexOf('http://') == 0 || link.indexOf('https://') == 0) {
            return 'url';
        }
        else {
            return 'anchor';
        }
    }
    
    $.updateQuery = function(uri, key, value) {
        var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
        var separator = uri.indexOf('?') !== -1 ? "&" : "?";
        if (uri.match(re)) {
            return uri.replace(re, '$1' + key + "=" + value + '$2');
        }
        else {
            return uri + separator + key + "=" + value;
        }
    }

    $.thumb = function (options) {
        var container = $('<div id="thumb_canvas" style="width:650px">');
        container.html(options.html);
        $('body').append(container);
        doThumb(container[0], options);
       
        function doThumb(container, options) {
            html2canvas(container, {
                allowTaint: true,
                onrendered: function (originalCanvas) {
                    var canvas = $('<canvas width="200" height="200"></canvas>')[0];
                    var ctx = canvas.getContext('2d');
                    ctx.drawImage(originalCanvas, 0, 0, originalCanvas.width, originalCanvas.width, 0, 0, 200, 200);
                    var thumbSuccess = false;
                    var imgData;
                    try {
                        imgData = canvas.toDataURL("image/jpg");
                        thumbSuccess = true;
                    }
                    catch (ex) { 
                    }
                    $('#thumb_canvas').remove();
                    if (thumbSuccess) {
                        $.ajax({
                            url: options.url,
                            type: 'post',
                            data: { imgBaseCode: imgData },
                            success: function (result) {
                                if (options.success) {
                                    options.success();
                                }
                            }
                        });
                    }
                    else {
                        if (options.success) {
                            options.success();
                        }
                    }
                }
            });
        }
    }

}(jQuery);