/**
 * 底部JS
 * @author: liangzhifeng<zhifeng.liang@yoho.cn>
 * @date: 2015/10/26
 */

let $ = require('yoho-jquery'),
    Hammer = require('yoho-hammer');

let floatLayerBtnHammer;

require('common');

$('#float-layer-close').on('touchend', function() {
    $('#float-layer-app').hide();
    window.setCookie('_float-layer-app', 'id490655927',
        {
            domain: '.yohobuy.com'
        });
    window.setCookie('_float-layer-app-close', 1,
        {
            domain: '.yohobuy.com',
            expires: 1
        });
    return false;
});

if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
    floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
    floatLayerBtnHammer.on('tap', function(e) {
        window.downLoadApp();
        e.srcEvent.stopPropagation();
    });

    // if (typeof window.cookie === 'function' && !window.cookie('_float-layer-app')) {
    //     $('#float-layer-app').show();
    // } else {
    //     $('#float-layer-app').hide();
    // }
}