class saveToDesk {
    constructor() {
        this.$popupCloseBtn = $('.popup-close-btn')
        this.checkSaveToDesk()
    }
    checkSaveToDesk() {
        var $saveDesk = $('.save-to-desk')
        var $btAD = $('.ad-b1')//底部广告
        //safari浏览器
        if (isSafari()) {
            var saveToDesk = localStorage.getItem('saveToDesk')
            if (saveToDesk == null) {
                $saveDesk.show()
                $btAD.hide()
                this.$popupCloseBtn.click(() => {
                    localStorage.setItem("saveToDesk", 1)
                    $saveDesk.hide()
                    $btAD.show()
                })
            }
        }
        function isSafari() {
            var ua = window.navigator.userAgent.toLowerCase()
            if (ua.indexOf('iphone') == -1) {
                return false
            } else {
                var isIE = window.ActiveXObject != undefined && ua.indexOf("msie") != -1
                var isFirefox = ua.indexOf("firefox") != -1
                var isOpera = window.opr != undefined
                var isChrome = ua.indexOf("chrome") && window.chrome
                var isQQ = ua.indexOf('qq') != -1
                var isBaidu = ua.indexOf('baidu') != -1
                var isSafari = ua.indexOf("safari") != -1 && ua.indexOf("version") != -1
                if (isIE || isFirefox || isOpera || isChrome || isQQ || isBaidu) {
                    return false
                } else if (isSafari) {
                    return true
                } else {
                    return false
                }
            }
        }

        return this
    }
}

$(() => {
    new saveToDesk
})