/*2024-09-30 17:41:48*/;
/*
 * @Autor: chenqinglong
 * @Date: 2021-10-29 21:40:05
 * @LastEditors: 蜻蜓队长 1770815539@163.com
 * @LastEditTime: 2022-11-21 18:02:03
 * @Introduce: 公共js
 * @FilePath: \135editor\webroot\js\public.js
 */

// const { log } = require("console");


// ##########chenqinglong###########

// 优惠券提醒
 // 会员弹框
window.anti_shake = true; // 防抖
function onCouponTips() {
    var html_h4 = '', html_p = '', html_btn = '';
    if (!window.anti_shake) { return false; }
    window.anti_shake = false;
    // 判断是否会员
    ajaxAction("/users/nav_info",null,null,function(data){
        localStorage.setItem('my_con_',data.data.coupon_nums);
     })
    if (!window.vip_user) {
        var is_used = false; // 是否使用
        var is_used50 = false; // 50是否使用
        var is_used100 = false; // 100是否使用
        // 不是首页进入
        // if (window.MSG_TYPE != 2 && window.MSG_TYPE != 3) {
        // 	// 默认领取优惠券
        // 	$.ajax({
        // 		type: 'get',
        // 		async: false,  // 同步执行,true为异步
        // 		dataType: 'json',
        // 		url: '/coupons/get',
        // 		success: function (res) {
        // 			is_used = res.used // 是否使用
        // 			is_used50 = res.used50 // 50是否使用
        // 			is_used100 = res.used100 // 100是否使用
        // 		}
        // 	});
        // }

        // 阻止关闭
        $(document).on('hide.bs.modal', "#role-vip-dialog", function (e) {
            if (is_payStatus) { is_payStatus = false; return true; } // 是否支付成功
            if (dialog_type == 'company') { return true; } // 企业弹框直接关闭

            var coupon_data = localStorage.getItem('coupon_data');
            var dataObj = JSON.parse(coupon_data);
            var startTime = dataObj ? dataObj.time : new Date().getTime() // 开始时间
            var showNnm = dataObj ? dataObj.value : 0 // 弹出次数
            var days = (new Date().getTime() - startTime) / (24 * 60 * 60 * 1000); // 天
            // 判断小于两次并且第一天或者大于一天，或者大于15天，并且未使用，并且不是首页（双十一后：is_used需要改成!is_used）
            if (((showNnm < 2 && (days == 0 || days > 1)) || days > 15) && is_used && window.MSG_TYPE != 2 && window.MSG_TYPE != 3) { // && window.MSG_TYPE == undefined
                if (days > 15) { // 大于15重新存储
                    var curTime = new Date().getTime();
                    localStorage.setItem('coupon_data', JSON.stringify({ value: 1, time: curTime }));
                } else {
                    localStorage.setItem('coupon_data', JSON.stringify({ value: showNnm + 1, time: startTime }));
                }
                $('#role-vip-dialog').find('.close.btn').hide(); // 隐藏关闭按钮
                $("#pay_all").contents().find("#coupon").show(); // 显示优惠券
                var _hmt = window._hmt || [];
                _hmt.push(['_trackEvent', 'coupon', 'click', 'coupon_show']); // 百度统计优惠券弹出
                return false
            } else {
                // // 判断是否使用
                // if(is_used){ // 已使用
                // 	// 替换字样
                // 	$("#pay_all").contents().find("#Retain_tips").find("h4").html(`你还可享受<span>1元</span>换购`);
                // 	$("#pay_all").contents().find("#Retain_tips").find("p").html(`图片设计<span>年会员</span>福利，过期失效！`);
                // 	$("#pay_all").contents().find("#Retain_tips").find(".benefits").html(`低价换购`);
                // }
                
                // 挽留提示
                $('#role-vip-dialog').find('.close.btn').hide(); // 隐藏关闭按钮
                $("#pay_all").contents().find("#Retain_tips").show(); // 显示挽留

                if (vip_select_type == 8) { // 标准会员
                    // 替换字样
                    if (vip_data_time == 12 || vip_data_time != 36) {
                        html_h4 = `8月宠粉送福利<span>，最高领6个月会员</span>`;
                        html_p = `8月宠粉送福利<span>，最高领6个月会员</span>     8月宠粉送福利`;
                        html_btn = `立即购买`;

                        // 双十一后可删
                        // html_h4 = `您有<span>50元</span>立减券待使用`;
                        // html_p = ` 虎年开工季专享 过时无效`;
                        // html_btn = `立即购买`;
                    } else {
                        html_h4 = `8月宠粉送福利<span>，最高领6个月会员</span>`;
                        html_p = `8月宠粉送福利<span>，最高领6个月会员</span>     8月宠粉送福利`;
                        html_btn = `立即购买`;
                    }
                } else if (vip_select_type == 10) { // 高级会员
                    // 替换字样
                    if (vip_data_time == 12 || vip_data_time != 36) {
                        html_h4 = `8月宠粉送福利<span>，最高领12个月会员</span>`;
                        html_p = `8月宠粉送福利<span>，最高领12个月会员</span>     8月宠粉送福利`;
                        html_btn = `立即购买`;

                        // 双十一后可删
                        // html_h4 = `您有机会获赠<span>100元</span>京东卡`;
                        // html_btn = `立即开通`;
                    } else {
                        // return true;
                        html_h4 = `8月宠粉送福利<span>，最高领12个月会员</span>`;
                        html_p = `8月宠粉送福利<span>，最高领12个月会员</span>     8月宠粉送福利`;
                        html_btn = `立即购买`;
                        
                    }
                } else if (vip_select_type == 12) { // 超级会员
                    // 替换字样

                    html_h4 = `8月宠粉送福利<span>限时送100-200京东卡</span>`;
                    // html_h4 = `<br/>全站会员买一年送一年`;
                    html_p = `购年会员限时送100-200元京东卡`;
                    html_btn = `立即购买`;

                    // 双十一后可删
                    // html_h4 = `您有机会获赠<span>200元</span>京东卡`;
                    // html_btn = `立即购买`;
                }
                else if(vip_select_type == 1188){ // 终身会员
                    // 替换字样 
                    html_h4 = `8月宠粉送福利<span>限量终身会员锦鲤</span> `;
                    html_p = `限量终身会员锦鲤`;
                    html_btn = `立即购买`;
                }

                return false;
                // return true
            }
        });
    } else {
        $(document).on('hide.bs.modal', "#role-vip-dialog", function (e) {
            // vip_user_info.forEach(element => {
            //     console.log(element);
            //     var EndTime = new Date(element.ended);
            //     // 当前系统时间
            //     var NowTime = new Date();
            //     var t = EndTime.getTime() - NowTime.getTime();
            //     var d = Math.floor(t / 1000 / 60 / 60 / 24);
            // });
           for (var j = 0; j < vip_user_info.length; j++) {
              var d=(new Date(vip_user_info[j].ended).getTime() - new Date().getTime()) / (24 * 60 * 60 * 1000);
                if (d<30) {
                    if (is_payStatus) { is_payStatus = false; return true; } // 是否支付成功
                if (dialog_type == 'company') { return true; } // 企业弹框直接关闭
    
                var state = true; // 返回状态
                var no_standard_vip = false; // 不是标准会员
    
                // 选中超级会员弹挽留
                if (vip_select_type == 12) {
                    // 替换字样
                    html_h4 = `约惠春季<span>限时送100-200京东卡</span> `;
                    html_p = `购年会员限时送100-200元京东卡`;
                    html_btn = `立即购买`;
                }
    
                // 是否终身会员
                for (var i = 0; i < vip_user_info.length; i++) {
                    var res = vip_user_info[i]
                    var day = (new Date(res.ended).getTime() - new Date().getTime()) / (24 * 60 * 60 * 1000); // 天
                    if (res.id == 8) { // 8 才会有终身会员
                        var year = (new Date(res.ended).getTime() - new Date().getTime()) / (24 * 60 * 60 * 1000 * 365); // 年
    
                        // 选中终身会员弹挽留
                        if(vip_select_type == 1188 && year < 20){ // 判断是否终身会员（大于20终身会员）
                            // 替换字样
                            html_h4 = `约惠春季<span>限时送100-200京东卡</span> `;
                            html_p = `购年会员限时送100-200元京东卡`;
                            html_btn = `立即购买`;
                            state = false;
                        }
    
                        if (year > 20) { // 大于20年是终身-胡英说的为了保险，改为大于20为终身会员
    
                            // 双十一后可删
                            if (vip_select_type == 8) { // 标准会员
                                console.log(232);
                                // 替换字样
                                if (vip_data_time == 12 || vip_data_time != 36) {
                                    html_h4 = `约惠春季<span>送会员/午睡枕</span>`;
                                    html_p = `约惠春季<span>送会员/午睡枕</span>     约惠春季`;
                                    html_btn = `立即购买`;
    
                                    // 双十一后可删
                                    // html_h4 = `您有<span>50元</span>立减券待使用`;
                                    // html_p = ` 虎年开工季专享 过时无效`;
                                    // html_btn = `立即购买`;
                                } else {
                                    html_h4 = `约惠春季<span>送会员/午睡枕</span>`;
                                    html_p = `约惠春季<span>送会员/午睡枕</span>     约惠春季`;
                                    html_btn = `立即购买`;
                                }
                            }
                            
                            else if (vip_select_type == 10) {
                                if (vip_data_time == 12 || vip_data_time != 36) {
                                    html_h4 = `约惠春季<span>送无线键鼠</span>`;
                                    html_p = `约惠春季<span>送无线键鼠</span>     约惠春季`;
                                    html_btn = `立即购买`;
    
                                    // 双十一后可删
                                    // html_h4 = `您有机会获赠<span>100元</span>京东卡`;
                                    // html_btn = `立即购买`;
                                } else {
                                    // return true;
                                    html_h4 = `约惠春季<span>送无线键鼠</span>`;
                                    html_p = `约惠春季<span>送无线键鼠</span>     约惠春季`;
                                    html_btn = `立即购买`;
                                }
                                state = false;
                            } else if (vip_select_type == 12) {
                                html_h4 = `约惠春季<span>限时送100-200京东卡</span> `;
                                html_p = `购年会员限时送100-200元京东卡`;
                                html_btn = `立即购买`;
                                state = false;
                            }
                        } else if (day < 60) { // 判断会员剩余天数是否小于60天
                            no_standard_vip = true;
                        }
                    } else { // 其他会员 双十一后可删
                        if (day < 60) { // 判断会员剩余天数是否小于60天
                            no_standard_vip = true;
                        }
                    }
                    if (no_standard_vip) { break; }
                }
    
                // 双十一后可删
                if (no_standard_vip) {
                    // 双十一后可删
                    if (vip_select_type == 8) {
                        if (vip_data_time == 12 || vip_data_time != 36) {
                            html_h4 = `约惠春季<span>送会员/午睡枕</span>`;
                            html_p = `约惠春季<span>送会员/午睡枕</span>     约惠春季`;
                            html_btn = `立即购买`;
                        } else {
                            html_h4 = `约惠春季<span>送会员/午睡枕</span>`;
                            html_p = `约惠春季<span>送会员/午睡枕</span>     约惠春季`;
                            html_btn = `立即购买`;
                        }
                        state = false;
                    } else if (vip_select_type == 10) {
                        if (vip_data_time == 12 || vip_data_time != 36) {
                            html_h4 = `约惠春季<span>送无线键鼠</span>`;
                            html_p = `约惠春季<span>送无线键鼠</span>     约惠春季`;
                            html_btn = `立即购买`;
                        } else {
                            // return true;
                            html_h4 = `约惠春季<span>送无线键鼠</span>`;
                            html_p = `约惠春季<span>送无线键鼠</span>     约惠春季`;
                            html_btn = `立即购买`;
                        }
                        state = false;
                    } else if (vip_select_type == 12) {
                        html_h4 = `约惠春季<span>限时送100-200京东卡</span>`;
                        html_p = `购年会员限时送100-200元京东卡`;
                        html_btn = `立即购买`;
                        state = false;
                    }
                }
    
                // 除标准会员外，其他会员选中终身弹窗
                if(no_standard_vip && vip_select_type == 1188){
                    // 替换字样
                    html_h4 = `约惠春季<span>限时送100-200京东卡</span>`;
                    html_p = `购年会员限时送100-200元京东卡`;
                    html_btn = `立即购买`;
                    state = false;
                }
    
                return state
                }
             }
        });
    }

    // 替换字样
    function Replace_words(html_h4, html_p, html_btn) {
        var my_con_=localStorage.getItem('my_con_');
        if (parseInt(my_con_)>0) {
            if(vip_select_type==10||vip_select_type==12){// 高级会员或超级会员
                $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find("p").html('你若现在离开,将会失去更多专属会员权益哦!');
                $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find(".benefits_img").attr('src','https://bcn.135editor.com/files/202211/images/liji_lingqu.png');
            }else{
                $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find(".recommended").hide();
                $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find(".Retain_mina").addClass('Retain_minaquan');
                $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find("p").html('您还有大额优惠券尚未使用');
                $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find(".benefits_img").attr('src','https://bcn.135editor.com/files/202211/images/mashangshiyong.png');
            }
        }else{
            $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find(".recommended").show();
            $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find(".Retain_mina").removeClass('Retain_minaquan');
            $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find("p").html('你若现在离开，将会失去更多专属会员权益哦！');
            $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find(".benefits_img").attr('src','https://bcn.135editor.com/files/202211/images/liji_lingqu.png');
        }
        $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find("h4").html(html_h4);
         $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find("p").html(html_p);
         $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").find(".benefits").html(html_btn);
        // 挽留提示
        $('#role-vip-dialog').find('.close.btn').hide(); // 隐藏关闭按钮
        $("#role-vip-dialog [id=pay_all]").contents().find("#Retain_tips").show(); // 显示挽留
    }
}

// $(document).ready(function() {
// 	$('#nav-header #link-145, #top #link-145').append('<span>春节大促</sapn>'); // 个人VIP
// 	$('#nav-header #link-290, #top #link-290').append('<span>送京东卡</sapn>'); // 企业VIP
// });

/*
 * 支付成功弹窗页面
 * 处理支付成功内容展示，data返回数据，num月数，state是否勾选比格
 * data.param.product_id：8:vip会员; 10:白银会员; 12:黄金会员
*/
function handle_pay_ok_show(data, num, state) {
    $('.success-mode-mask').find('.title_0').hide(); // 初始隐藏
    $('.success-mode-mask').find('.title_1').hide(); // 初始隐藏
    $('.success-mode-mask').find('.right').hide(); // 初始隐藏
    $('.success-mode-mask').find(".youji_2").hide();

    console.log("支付成功data:",data)
    // 个人会员
    if (data.pages == "category-vip") {
        
        /**
         * 标准年vip
         */
        if (data.param.product_id == 8 && (num >= 12 || num >= 36)){
            $('.success-mode-mask .youji_2').show();
            if(state){
                $('.success-mode-mask').find('.explain').show(); // 隐藏换购比格信息
            }else{
                //$('.success-mode-mask').find('.title_0').show(); // 新媒体工具
                $('.success-mode-mask').find('.explain').hide(); // 隐藏换购比格信息
            }
            // $('.success-mode-mask').find('.youji_1').css("display","block");
        }
        
        /**
         * 高级年会员
         */
        if (data.param.product_id == 10 && (num >= 12 || num >= 36)){
            // 年会员都赠送实物
            $('.success-mode-mask .youji_2').show();
            // $('.success-mode-mask').find('.youji_1').css("display","block");
            if(state){
                $('.success-mode-mask').find('.explain').show(); // 隐藏换购比格信息
            }else{
                //$('.success-mode-mask').find('.title_0').show();
                $('.success-mode-mask').find('.explain').hide(); // 隐藏换购比格信息
            }
        }

        // 用户购买高级年会员、超级年会员并且选中比格
        if ((data.param.product_id == 10 || data.param.product_id == 12) && num >= 12) {
            if (num >= 12 && data.param.product_id == 12) {
                $('.success-mode-mask .youji_2').show();
                $('.success-mode-mask').find('.right').show(); // 显示客服二维码
            } else if (!state) {//是否购买比格
                //$('.success-mode-mask').find('.title_0').show(); // 新媒体工具
                // if (data.param.product_id == 10) {
                //     // $('.success-mode-mask').find('.youji_1').show();//新春活动链接
                //     $('.success-mode-mask').find('.youji_2').show();
                //     // $('.success-mode-mask').find('.youji_2').hide();
                // }
                if (num == 12 && data.param.product_id == 12) {
                    // $('.success-mode-mask').find('.right').show(); // 显示客服二维码
                }
            }
        } else if (num < 12) { // 购买标准、高级、超级  月会员时
            $('.success-mode-mask').find('.title_1').show(); // 新媒体课程
            $('.success-mode-mask').find('.explain').hide(); // 隐藏换购比格信息
        }
        // 黄金会员
        // if(data.param.product_id == 12){
        //     $('.success-mode-mask').find('.youji_1').hide(); 
        // }
        // 终身会员
        if(data.param.product_id == 8 && num == 1188){
            $('.success-mode-mask').find('.youji_2').hide(); 
            $('.success-mode-mask').find('.youji_1').hide();
        }
    } else if (data.pages == "vip-company") { // 企业会员
        $('.success-mode-mask .youji_2').hide();
        $('.success-mode-mask').find('.title_0').show(); // 新媒体工具
        $('.success-mode-mask').find('.right').show(); // 显示客服二维码
        $('.success-mode-mask').find('.explain2').show();// 显示比格赠送时长
    }

    // const total_price = Math.floor(data.total_price)
    if(data.Order&&data.Order.serialize_info&&data.Order.serialize_info['135tools_voucher_code']&&data.miaoShaPayType==3){
        // 949套餐（有飞鸟办公会员）
        $(".file-handle_wrapper .file-handle input").val(data.Order.serialize_info['135tools_voucher_code']);
        $(".file-handle_wrapper").show();
        $(".aipaibanVipBox").show();
        $('.success-mode-mask').find(".youji_2").hide();
    }else if(data.miaoShaPayType==1){
        // 898会员套餐
        // $(".aipaibanVipBox").show();
        $('.success-mode-mask').find(".youji_2").hide();
    }else if(data.miaoShaPayType==2){
        // 298会员套餐
        $(".aipaibanVipBox").show();
        $('.success-mode-mask').find(".youji_2").hide();
    }
};
// ######################公共方法######################//

// 区间时间处理-年-月-日
function formatDate(date) {
    return `${date.getFullYear()}-${zeroFill(date.getMonth() + 1)}-${zeroFill(date.getDate())}`
}

// 补充零
function zeroFill(res) {
    return res < 10 ? '0' + res : res;
}

// 获取两个时间段的天数
function getDayNum(startTime, endTime) {
    var stTime = Date.parse(new Date(startTime))
    var etTime = Date.parse(new Date(endTime))
    var usedTime = etTime - stTime;
    var days = Math.floor(usedTime / (24 * 3600 * 1000));
    return days
}

// 输入保留两位小数：@keydown="retain_lw"
function retain_lw(res) {
    res.target.value = (res.target.value.match(/^\d*(\.?\d{0,1})/g)[0]) || null
}

// 去空格
function del_space(e) {
    return e.replace(/ /g, '') // 匹配去掉所有空格
}

// 获取地址参数
function get_url_val(name) {
    // 未传参，返回空
    if (!name) return null;
    // 查询参数：先通过search取值，如果取不到就通过hash来取
    var after = window.location.search;
    after = after.substr(1) || window.location.hash.split('?')[1];
    // 地址栏URL没有查询参数，返回空
    if (!after) return null;
    // 如果查询参数中没有"name"，返回空
    if (after.indexOf(name) === -1) return null;

    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
    // 当地址栏参数存在中文时，需要解码，不然会乱码
    var r = decodeURI(after).match(reg);
    // 如果url中"name"没有值，返回空
    if (!r) return null;

    return r[2];
}

//true代表移动端，false代表pc端
function isMobile() {
    var mobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
    return mobile != null
}

// 是否安卓
function isAnd() {
    var u = navigator.userAgent; //获取到的是个字符串，包括很多信息，我只匹配我想要的信息
    return u.indexOf("Android") > -1 || u.indexOf("Linux") > -1; //判断是安卓手机
}

// 是否ios
function isIOS() {
    var u = navigator.userAgent; //获取到的是个字符串，包括很多信息，我只匹配我想要的信息
    return !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //判断是苹果手机
}

//获取地址栏中的参数
function get_url_str(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", 'i'); // 匹配目标参数
    var result = window.location.search.substr(1).match(reg); // 对querystring匹配目标参数
    if (result != null) {
        return decodeURIComponent(result[2]);
    } else {
        return null
    }
};

// 模板预览弹框显示
function ifram_onlaod() {
    $("#frame").contents().find("#toTop").css('opacity', '0');
    $("#frame").contents().find("#toTop").css('display', 'none');
}
// 清除缓存
function clearUserCookies() {
	$.cookie.raw = true;
	$.removeCookie('MIAOCMS1[Auth][User]', { 'path': '/' });
	$.removeCookie('MIAOCMS1[Auth][User]', { 'domain': document.domain, 'path': '/' });
	var arr = document.domain.split('.');
	if (arr.length > 2) {
		arr.shift();
		var topdomain = arr.join('.');
		$.removeCookie('MIAOCMS1[Auth][User]', { 'domain': topdomain, 'path': '/' });
	}
	$.cookie.raw = false;
	current_edit_msg_id = '';
	// showSuccessMessage('');
	window._logined = false;
	localStorage.last_maxMsgId = 0;
	return false;
}
// 编辑器页面 模板预览
$('.model_item').click(function () {
    // sessionStorage.setItem("source", "moban-zuoce2")
        $('body').css('overflow', 'hidden')
        var id = $(this).attr('data-id');
        var team_id = $(this).attr('team-id');
        var url = '/editor_styles/view_contribute/' + id + '.html?inajax=1&team_id=' + team_id + '&source=bianjiqi'
        $('#preview_modal_').find('#frame').attr('src', url);
        $('#preview_modal_').show(); 
        $(document).on('click.previewtpl', function (){
            $('#preview_modal_').hide();
            $(document).off('click.previewtpl');
        })
    return clearUserCookies();
});
// emogi标题
$('.Thesample').hover(function(){
    $('.sample').show();
},function(){
    $('.sample').hide();
})
// emoji 表情渲染
// emoji表情
$(document).ready(function(){
    var arrsList = [
        { title: "表情类emoji", value: ['🤣', '🥰', '🤩', '🤪', '🤑', '🤗', '🤭', '🤫', '🤔', '🤐', '🤨', '🤥', '🤤', '🤒', '🤕', '🤢', '🤮', '🤧', '🥵', '🥶', '🥴', '🤯', '🤠', '🥳', '🤓', '🧐', '🥺', '🥱', '🤬', '🤡', '🤖'] },
        { title: "肢体类emoji", value: ['🧡', '🤎', '🤍', '🤚', '🤏', '🤞', '🤟', '🤘', '🤙', '🤛', '🤜', '🤲', '🤝', '🤳', '🦾', '🦿', '🦵', '🦶', '🦻', '🧠', '🦷', '🦴'] },
        { title: "人物类emoji", value: ['🧒', '🧑', '🧔', '🧑', '🦰', '🧑', '🦱', '🧑', '🦳', '🧑', '🦲', '🧓', '🧏', '🤦', '🤷', '🤴', '🧕', '🤵', '🤰', '🤱', '🤶', '🦸', '🦹', '🧙', '🧚', '🧛', '🧜', '🧝', '🧞', '🧟', '🧍', '🧎', '🧑', '🦯', '🧑', '🦼', '🧑', '🦽', '🧖', '🧗', '🤺', '🤸', '🤼', '🤽', '🤾', '🤹', '🧘', '🧑', '🤝', '🧑', '🦰', '🦱', '🦳', '🦲'] },
        { title: "餐饮美食类emoji", value: ['🥭', '🥝', '🥥', '🥑', '🥔', '🥕', '🥒', '🥬', '🥦', '🧄', '🧅', '🥜', '🥐', '🥖', '🥨', '🥯', '🥞', '🧇', '🧀', '🥩', '🥓', '🥪', '🥙', '🧆', '🥚', '🥘', '🥣', '🥗', '🧈', '🧂', '🥫', '🥮', '🥟', '🥠', '🥡', '🦀', '🦞', '🦐', '🦑', '🦪', '🧁', '🥧', '🥛', '🥂', '🥃', '🥤', '🧃', '🧉', '🧊', '🥢', '🥄', '🧭'] },
        { title: "动植物类emoji", value: ['🦍', '🦧', '🦮', '🦊', '🦝', '🦁', '🦄', '🦓', '🦌', '🦙', '🦒', '🦏', '🦛', '🦔', '🦇', '🦥', '🦦', '🦨', '🦘', '🦡', '🦃', '🦅', '🦆', '🦢', '🦉', '🦩', '🦚', '🦜', '🦎', '🦕', '🦖', '🦈', '🦋', '🦗', '🦂', '🦟', '🦠', '🥀'] },
        { title: "生活用品类emoji", value: ['🧱', '🦽', '🦼', '🧳', '🧨', '🧧', '🥇', '🥈', '🥉', '🥎', '🥏', '🥍', '🥊', '🥋', '🥅', '🤿', '🥌', '🧩', '🧸', '🧵', '🧶', '🥽', '🥼', '🦺', '🧣', '🧤', '🧥', '🧦', '🥻', '🥾', '🥿', '🧢', '🥁', '🧮', '🧾', '🦯', '🧰', '🧲', '🧪', '🧫', '🧬', '🧴', '🧷', '🧹', '🧺', '🧻', '🧼', '🧽', '🧯', '🧿'] },
        { title: "特殊符号类emoji", value: ['↗️', '↘️', '↙️', '↖️', '↕️', '↔️', '↩️', '↪️', '⤴️', '⤵️', '▶️', '⏩', '⏭️', '⏯️', '◀️', '⏪', '⏮️', '⏫', '⏬', '⏸️', '⏹️', '⏺️', '⏏️', '‼️', '⁉️', '〰️', '〽', '©', '®', '™', '#️⃣', '*️⃣', '0️⃣', '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣', 'ℹ', 'Ⓜ️', '◼', '◻', '◾', '◽', '▪', '▫'] },
    ];
    var html = "";
    for(var i = 0; i < arrsList.length; i++) {
        var emoji = "";
        var arrs = arrsList[i].value;
        for(var j = 0; j < arrs.length; j++) {
            emoji += `<a herf="javascript:;" class="expression_itemone" onclick="exp_emj('${arrs[j]}')">${arrs[j]}</a>`;
        };
        html += `<div class="list">
            <div class="title">${arrsList[i].title}</div>
            <div class="emoji_list">${ emoji }</div>
        </div>`;
    };
    $('.expressionone').html(html);
})

function exp_emj(str){
    // var inp=$('#input_title_emojione').val();
    // inp=inp+str;
    // $('#input_title_emojione').val(inp)
    var elem = $('#input_title_emojione');
    var cursorPos = elem.prop('selectionStart');
    var textBefore = elem.val().substring(0, cursorPos);
    var textAfter = elem.val().substring(cursorPos, elem.val().length);
    elem.val(textBefore + str + textAfter);
    cursorPos += str.length;
    elem.prop('selectionStart', cursorPos);
    elem.prop('selectionEnd', cursorPos);
    elem.focus();
}
// 光标处插入内容
function insertAtCursor(elem, text) {
    var cursorPos = elem.prop('selectionStart');
    var textBefore = elem.val().substring(0, cursorPos);
    var textAfter = elem.val().substring(cursorPos, elem.val().length);
    elem.val(textBefore + text + textAfter);
    cursorPos += text.length;
    elem.prop('selectionStart', cursorPos);
    elem.prop('selectionEnd', cursorPos);
    elem.focus();
}
$('.copy_use a').click(function(){
        var ele = document.getElementById("input_title_emojione");
        ele.select();
        document.execCommand('copy', false, null);
        showErrorMessage('复制成功')
})
$('.emoji .emoji_shanchu').click(function(){
    $('.emoji').hide();
    $('#input_title_emojione').val("");
})
$('.emoji_model_').click(function(){
    if (!loged_user && !sso.check_userlogin()) {return false;};
    $('.emoji').show();
})
$('#yunytool').click(function(){
    if (window.loged_user) {
        $('#articleFeatures a').addClass('offcial-account-extract')
    }
})
$('#articleFeatures a').unbind('click').bind('click',function(){
	if (window.loged_user) {
        $('#articleFeatures a').addClass('offcial-account-extract')
    }else{
        if (!loged_user && !sso.check_userlogin()) {return false;};
    }
	});
// ######################公共方法结束######################//