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i0Y5CNT5PrsgAOWKRFhuI2UEb/I0U06INnEVSYZtmmuIEEukhk49xEyK6fEt4co1E4FOwCTWdNZjEqyQWn63pz+LEPYlVO4aAaaaeRUOP55uwDzRLut8H0K9n5G7r4yYKxhCmBnIYDKonzhV8j5/2sQzVXBbYC4lZiJwB1gU2CgdmKBaajlT8MknOLqmk4TDlDFbwjzRo7yLcmIKh2g1ETgM1BZsnPnkriO8VTAHnDIR8K7b+ViVMxKh2oa/G+GlggUIG4KW4lzc7ZCs+ygNAXqBbI4nDDMr9RmZn21LwSeYjoHSLBE2JgUco4IE932+42x39wBTA0wEKhHKA+tRYsRZaHrE9IbENAgfBiaBXeKwx+aAf91PJ1a+kAjms0rriIK0ZJnqpiogd0tmK9kcoA2Y7xsJ5QrCDXsF6xFe97WB/E1pytjt6ca49FTa8hDvSI0VbR3+X4PJz8QJBxpMxiOR7Hp3Ah/5/uv5Y58czcr4VsLEc8Ge3nAKpxll95SH02y14+O5aTSURe54DiZpzepF3Sk4OZ7HuBB0PP8X+s83WFbJv84AAAAASUVORK5CYII=';

function $modal(data) {
    if (data === undefined) { data = {} }
    if (data.type === undefined) { data.type = 'alert' }
    tipIconImg = '';
    if (data.icon === 'success') { tipIconImg = success_modal } else if (data.icon === 'warning') { tipIconImg = warning_modal } else if (data.icon === 'error') { tipIconImg = error_modal } else if (data.icon === 'question') { tipIconImg = question_modal } else { tipIconImg = info_modal }
    if (data.timeout === undefined && data.type != 'confirm') { data.timeout = 2000; } else { data.timeout < 500 ? data.timeout = 500 : data.timeout = data.timeout; }
    if (data.transition === undefined) { data.transition = 200 }
    if (data.mask === undefined) { data.mask }
    if (data.width === undefined) { data.width = 300 }
    if (data.pageScroll === undefined) { data.pageScroll = true }
    if (data.title === undefined) { data.title = '提示' }
    if (data.maskClose === undefined) { data.maskClose = false }
    if (data.cancelText === undefined) { data.cancelText = '取消' }
    if (data.confirmText === undefined) { data.confirmText = "确认" }
    if (data.top === undefined) { data.top = 100 }
    if (data.center === undefined) { data.center = false }

    function calculate(e, sun) {
        if (data.center) {
            var tipHeight = e.height() + sun;
            console.log(tipHeight)
            var windowHeight = $(window).height();
            console.log((windowHeight / 2) - (tipHeight / 2))
            data.top = (windowHeight / 2) - (tipHeight / 2)
        }
    }
    var idText = "modailItem";
    var date = (new Date().getTime() * Math.random() + '').substr(0, 10)
    idText += date;
    var titleSize = 16;
    var fontSize = 14;
    if ($('#modail-dialog-box').index() < 0) {
        var modelBox = '<div id="modail-dialog-box"></div>'
        $('body').append(modelBox)
        $('#modail-dialog-box').css({ fontFamily: '微软雅黑', fontSize: fontSize + 'px', color: '#666666', })
    }
    if (data.type === 'message') {
        $('#modail_message_box').html('');
        $('#modail-dialog-box').append('<div id="modail_message_box"></div>')
        var width_s = 40 + (fontSize * data.content.length) + fontSize + 4;
        $('#modail_message_box').append('<div id="' + idText + '_box"></div>');
        $('#' + idText + '_box').append('<div class="' + idText + '_item item1 msg-icon"><img class="msg-icon" src="' + tipIconImg + '" /></div>');
        $('#' + idText + '_box').append('<div class="' + idText + '_item item2">' + data.content + '</div>');
        if (data.closable) { width_s += fontSize + 4;
            $('#' + idText + '_box').append('<div class="' + idText + '_item item3"><img src="' + close_modal + '" /></div>'); }
        $('#' + idText + '_box').css({ width: width_s + 'px', padding: '10px 15px', background: '#fff', boxShadow: '0 1px 6px rgba(0,0,0,.2)', borderRadius: '5px', position: 'fixed', left: '0', margin: 'auto', right: '0', opacity: '0', })
        $('.' + idText + '_item.item2').css({ margin: '0 8px' })
        $('.' + idText + '_item.item3').css({ position: 'absolute', right: '15px', cursor: 'pointer' })
        $('.' + idText + '_item').css({ display: 'inline-block' })
        $('.' + idText + '_item msg-icon').css({ width: fontSize + 4 + 'px', verticalAlign: 'top', position: 'relative', top: '-12px' })
        // $('.' + idText + '_item img').css({ width: fontSize + 4 + 'px', verticalAlign: 'top', position: 'relative', top: '1px' })
        $('.' + idText + '_item img').css({ width: fontSize + 4 + 'px', position: 'relative', top: '1px' })
        calculate($('#' + idText + '_box'), 20)
        $('#' + idText + '_box').css({ top: data.top - 60, })
        $('#' + idText + '_box').animate({ 'top': data.top, 'opacity': '1', }, data.transition)

        function close() {
            $('#' + idText + '_box').animate({ 'top': data.top - 60, 'opacity': '0', }, data.transition)
            setTimeout(function() { $('#' + idText + '_box').remove(); }, data.transition)
        }
        var timers;
        if (!data.manual) { timers = setTimeout(close, data.timeout); }
        $('.' + idText + '_item.item3').click(function() {
            clearInterval(timers)
            close();
        })
    } else if (data.type === 'alert') {
        if (data.pageScroll) { $('body').css('overflow', 'hidden') }
        $('#modail-dialog-box').append('<div id="' + idText + '_box"></div>')
        if (data.mask) {
            $('#' + idText + '_box').append('<div class="' + idText + '_mask"></div>')
            $('.' + idText + '_mask').css({ position: 'fixed', top: 0, right: 0, left: 0, bottom: 0, background: 'rgba(0,0,0,0.4)', });
        }
        $('#' + idText + '_box').append('<div class="' + idText + 'centerBox"></div>');
        $('.' + idText + 'centerBox').css({ width: data.width + 'px', padding: '20px', background: '#ffffff', position: 'fixed', right: 0, left: 0, margin: 'auto', borderRadius: '5px', boxShadow: '0 1px 6px rgba(0,0,0,.2)', opacity: '0' })
        $('.' + idText + 'centerBox').append('<div class="' + idText + 'title"></div>')
        $('.' + idText + 'title').append('<div class="' + idText + '_item item1"><img class="msg-icon" src="' + tipIconImg + '" /></div>');
        $('.' + idText + 'title').append('<div class="' + idText + '_item item2">' + data.title + '</div>');
        if (data.closable) { $('.' + idText + 'title').append('<div class="' + idText + '_item item3"><img src="' + close_modal + '" /></div>'); }
        $('.' + idText + '_item.item2').css({ margin: '0 8px', fontSize: titleSize + 'px', color: '#333333' })
        $('.' + idText + '_item.item3').css({ position: 'absolute', right: '15px', cursor: 'pointer' })
        $('.' + idText + '_item').css({ display: 'inline-block' })
        $('.' + idText + '_item img').css({ width: titleSize + 4 + 'px', verticalAlign: 'top', position: 'relative', top: '-1px' })
        $('.' + idText + 'title').css({ marginBottom: '10px' })
        $('.' + idText + 'centerBox').append('<div class="' + idText + 'body">' + data.content + '</div>')
        $('.' + idText + 'body').css({ padding: '0 ' + (titleSize + 10) + 'px' })
        calculate($('.' + idText + 'centerBox'), 40);
        $('.' + idText + 'centerBox').css({ top: data.top + 40, })
        $('.' + idText + 'centerBox').animate({ 'top': data.top, 'opacity': '1', }, data.transition);

        function close() {
            $('.' + idText + 'centerBox').animate({ 'top': data.top + 40, 'opacity': '0', }, data.transition)
            setTimeout(function() { $('#' + idText + '_box').remove(); if (data.pageScroll) { $('body').css('overflow', 'auto') } }, data.transition)
        }
        var timers;
        if (!data.manual) { timers = setTimeout(close, data.timeout); }
        $('.' + idText + '_item.item3').click(function() {
            clearInterval(timers)
            close();
        })
        if (data.maskClose) {
            $('.' + idText + '_mask').click(function() {
                clearInterval(timers)
                close();
            })
        }
    } else if (data.type === 'confirm') {
        if (data.pageScroll) { $('body').css('overflow', 'hidden') }
        $('#modail-dialog-box').append('<div id="' + idText + '_box"></div>')
        if (data.mask) {
            $('#' + idText + '_box').append('<div class="' + idText + '_mask"></div>')
            $('.' + idText + '_mask').css({ position: 'fixed', top: 0, right: 0, left: 0, bottom: 0, background: 'rgba(0,0,0,0.4)', });
        }
        $('#' + idText + '_box').append('<div class="' + idText + 'centerBox"></div>');
        $('.' + idText + 'centerBox').css({ width: data.width + 'px', padding: '20px', background: '#ffffff', position: 'fixed', right: 0, left: 0, margin: 'auto', borderRadius: '5px', boxShadow: '0 1px 6px rgba(0,0,0,.2)', opacity: '0' })
        $('.' + idText + 'centerBox').append('<div class="' + idText + 'title"></div>')
        $('.' + idText + 'title').append('<div class="' + idText + '_item item1"><img class="msg-icon" src="' + tipIconImg + '" /></div>');
        $('.' + idText + 'title').append('<div class="' + idText + '_item item2">' + data.title + '</div>');
        if (data.closable) { $('.' + idText + 'title').append('<div class="' + idText + '_item item3"><img src="' + close_modal + '" /></div>'); }
        $('.' + idText + '_item.item2').css({ margin: '0 8px', fontSize: titleSize + 'px', color: '#333333' })
        $('.' + idText + '_item.item3').css({ position: 'absolute', right: '15px', cursor: 'pointer' })
        $('.' + idText + '_item').css({ display: 'inline-block' })
        $('.' + idText + '_item img').css({ width: titleSize + 4 + 'px', verticalAlign: 'top', position: 'relative', top: '-1px' })
        $('.' + idText + 'title').css({ marginBottom: '10px' })
        $('.' + idText + 'centerBox').append('<div class="' + idText + 'body">' + data.content + '</div>')
        $('.' + idText + 'body').css({ padding: '0 ' + (titleSize + 10) + 'px' })
        $('.' + idText + 'centerBox').append('<div class="' + idText + 'footer"><button  class="button_s_model ' + idText + '_confirm">' + data.confirmText + '</button><button class="button_s_model ' + idText + '_cancel">' + data.cancelText + '</button><div class="clearBoth"></div></div>')
        $('.' + idText + 'footer').css({ paddingTop: '20px' })
        $('.button_s_model').css({ float: 'right', marginLeft: '20px', outline: 'none', border: 'none', padding: '8px 30px', cursor: 'pointer', borderRadius: '5px', })
        calculate($('.' + idText + 'centerBox'), 40)
        $('.' + idText + 'centerBox').css({ top: data.top + 40, })
        $('.' + idText + 'centerBox').animate({ 'top': data.top, 'opacity': '1', }, data.transition);
        $('.button_s_model').hover(function() { $(this).css({ 'opacity': '.8' }) }, function() { $(this).css({ 'opacity': '1' }) })
        $('.button_s_model').mousedown(function() { $(this).css({ 'opacity': '1' }) }).mouseup(function() { $(this).css({ 'opacity': '.8' }) })
        $('.button_s_model.' + idText + '_cancel').css({ background: '#fff', borderBox: 'box-sizing', border: '1px solid #eee', }).click(function() { data.cancel(close) })
        $('.button_s_model.' + idText + '_confirm').css({ background: '#2d8cf0', color: '#fff', }).click(function() { data.confirm(close) })
        $('.clearBoth').css({ clear: 'both' })

        function close() {
            $('.' + idText + 'centerBox').animate({ 'top': data.top + 40, 'opacity': '0', }, data.transition)
            setTimeout(function() { $('#' + idText + '_box').remove(); if (data.pageScroll) { $('body').css('overflow', 'auto') } }, data.transition)
        }
        $('.' + idText + '_item.item3').click(function() { close(); })
        if (data.maskClose) { $('.' + idText + '_mask').click(function() { close(); }) }
    }
}

function $error(e) { $modal({ type: 'message', icon: 'error', timeout: 2000, content: e, center: true, top: 100, transition: 300, closable: true, }) }

function $success(e) { $modal({ type: 'message', icon: 'success', timeout: 2000, content: e, center: true, top: 100, transition: 300, closable: true, }) }