PageSourceSearch

https://static.to8to.com/gb_js/new_service_bar/new_service_bar.js?v=1756313560

js to8to.com collected 2026-10-02 18:55:04 UTC 9,742 bytes, 259 lines download raw bytes

1/**
2 * 展开收起动画
3 */
4// let jQuery = jQuery.noConflict();
5function serviceAnimate() {
6    //展开
7    this.unfold = function () {
8        jQuery('.service__form').show()
9        jQuery('.service__form__box').stop(true).animate({
10            marginLeft: '0',
11            opacity: '1'
12        }, 500)
13    }
14
15    //收起
16    this.retract = function () {
17        jQuery('.service__form__box').stop(true).animate({
18            marginLeft: '170px',
19            opacity: '0'
20        }, 500, function () {
21            jQuery('.service-bar').removeClass('border__none')
22
23            //客服形态(隐藏)--> 初始形态(显示)
24            jQuery('.service__form').hide()
25            jQuery(".service__form__initial").show()
26            if (jQuery(window).scrollTop() > jQuery(window).height()) {
27                jQuery(".slide-help-new").show()
28            }
29        })
30    }
31}
32
33var service_main = {
34    service: function () {
35        var serviceStr = '<div class="service-bar first-screen">' +
36                    '<div class="service__form__initial">' +
37                        '<a href="javascript:void(0)" class="service-item">' +
38                            '<i class="service-icons"></i>' +
39                            '<p class="service_tips">在线客服</p>' +
40                        '</a>' +
41                    '</div>' +
42                '</div>';
43        jQuery('body').append(serviceStr);
44        this.initEvent();
45    },
46
47    initEvent: function () {
48        var that = this;
49        // 标记是否有点击事件被触发
50        var Flag = false;
51        var paramsObj = this.getConsultParams()
52        var paramsInit = '{"tmpYid":' + paramsObj.tmpYid + ',"encryptNumber":' + paramsObj.encryptNumber +
53            ',"pro_sourceid":3,"engine":"' + paramsObj.engine +
54            '","ptag":"4_58_86_3874","crmUrl":"//www.to8to.com/crm/index.php/Projects/manual/thirdissue/pro_sourceid/3/engine/' +
55            paramsObj.engine + '/ptag/4_58_86_3874/tmpYid/' + paramsObj.tmpYid + '/encryptNumber/' + paramsObj.encryptNumber +
56            '"}'
57
58
59        //调起网易七鱼客服
60        jQuery('body').find('.service__form__initial').click(function() {
61            that.wyqyOpen();
62
63            //点击统计
64            that.reportExposureData('click', {ptag: '1_1_1_7488', title: '右侧客服浮层-左侧输入框'})
65        });
66        var winHgt = jQuery(window).height() / 2
67        var swpBtn = null
68        var rightBar = jQuery('.service-bar')
69        var gap = 80
70        var condition = false
71        if (jQuery('.index-banner .arrow-right').length) {
72            swpBtn = jQuery('.index-banner .arrow-right')
73        } else if (jQuery('.tumax-banner .arrow-right').length) {
74            swpBtn = jQuery('.tumax-banner .arrow-right')
75        } else {
76            swpBtn = false
77        }
78
79        this.showRightBar(winHgt)
80        window.onscroll = function() {
81            that.showRightBar(winHgt)
82            that.controlRightBar(swpBtn, rightBar)
83        };
84
85        this.controlRightBar(swpBtn, rightBar)
86        window.onresize = function () {
87            that.controlRightBar(swpBtn, rightBar);
88        };
89
90    },
91
92    controlRightBar: function (swpBtn, rightBar) {
93        if (!swpBtn) {
94            return
95        }
96        gap = jQuery('.header-page-nav').length ? (80 + swpBtn.height()) : 80
97        condition = (swpBtn.offset().top + swpBtn.height() + rightBar.height() + gap) < jQuery(window).height()
98        /**
99         * 判断是否需要手动控制top值
100         */
101        if (condition || jQuery(window).scrollTop() > (swpBtn.offset().top + swpBtn.height() + 45)) {
102            rightBar.attr('style', '')
103        } else {
104            rightBar.attr('style', 'top:' + (swpBtn.offset().top + swpBtn.height() + gap - jQuery(window).scrollTop()) + 'px')
105        }
106    },
107
108    reportExposureData: function (type, data) {
109        if (typeof t8tc !== 'undefined') {
110            t8tc.postParams({
111                evt: type,
112                pg: data.ptag,
113                rsc: [
114                    {
115                        rty: '',
116                        rid: '',
117                        rtt: data.title,
118                        app_name: 'to8to_pc'
119                    },
120                ],
121            })
122        }
123    },
124
125    showRightBar: function (winHgt) {
126        if (winHgt > jQuery(window).scrollTop()) {
127            jQuery('.service-bar').addClass('first-screen')
128            if (window.location.host.match(/xiaoguotu/g)) {
129                jQuery('.service-bar').css('bottom', '140px')
130            }
131            jQuery(".slide-help-new").hide()
132            // jQuery('.service__form').css({
133            //     top: 'auto',
134            // })
135        } else {
136            jQuery('.service-bar').removeClass('first-screen')
137            if (window.location.host.match(/xiaoguotu/g)) {
138                jQuery('.service-bar').css('bottom', '370px')
139            }
140            jQuery(".slide-help-new").show()
141            // jQuery('.service__form').css({
142            //     top: '0',
143            //     bottom: 'auto'
144            // })
145        }
146    },
147    /**
148     * 打开客服聊天窗口
149     */
150    wyqyOpen: function () {
151        var data = this.getConsultParams(),
152            userId = this.getCookie('to8tocookieid') || '';
153        ysf.config({
154            uid: userId,
155            "data": JSON.stringify([
156                {"index": 0, "key": "engine", "label": "engine", "value": data.engine},
157                {"index": 1, "key": "pro_sourceid", "label": "pro_sourceid", "value": data.pro_sourceid},
158                {"index": 2, "key": "ptag", "label": "ptag", "value": (data.ptag || '4_58_86_3874')},
159                {"index": 3, "key": "tmpYid", "label": "tmpYid", "value": data.tmpYid},
160                {"index": 4, "key": "encryptNumber", "label": "encryptNumber", "value": data.encryptNumber},
161                {"index": 5, "key": "crmUrl", "label": "crmUrl", "value": "crm后台链接", "href": data.crmUrl}
162            ]),
163            success: function () {     // 成功回调
164                ysf.open();
165            },
166            error: function () {       // 错误回调
167                // handle error
168            }
169        });
170    },
171
172    getConsultParams: function () {
173        var tmpYid = this.getCookie('tmpYid')
174        var encryptNumber = this.getCookie('encryptNumber')
175        // 获取渠道编码
176        var to8toNowpage = this.getCookie('to8to_nowpage')
177        var to8toNowpageDecode = to8toNowpage ? decodeURIComponent(to8toNowpage) : false
178        var engine = ''
179        var href = location.href
180        var channel = this.getQueryString('channel', to8toNowpageDecode || href)
181        var to8toFrom = this.getQueryString('to8to_from', to8toNowpageDecode || href)
182        var utmSource = this.getQueryString('utm_source', to8toNowpageDecode || href)
183        var to8toSourcepage = this.getCookie('to8to_sourcepage')
184        var to8toSourcepageDecode = (decodeURIComponent(to8toSourcepage) || href)
185        var utmFrom = this.getQueryString('utm_from', to8toSourcepageDecode || href)
186        if (channel || to8toFrom || utmFrom || utmSource) {
187            engine = (channel || to8toFrom || utmFrom || utmSource)
188        } else {
189            var host = to8toSourcepageDecode.replace(/((?:https?:\/\/)?\w+\.(\w+)\..*)/, 'jQuery2')
190            switch (host) {
191                case 'baidu':
192                case 'tradaquan':
193                    engine = 'baidu'
194                    break;
195                case 'google':
196                    engine = 'google'
197                    break;
198                case 'soso':
199                    engine = 'soso'
200                    break;
201                case 'sogou':
202                    engine = 'sogou'
203                    break;
204                case '360':
205                case 'so':
206                case 'haosou':
207                    engine = '360'
208                    break;
209                case 'sm':
210                    engine = 'sm'
211                    break;
212                default:
213                    engine = ''
214            }
215        }
216
217        return {
218            pro_sourceid: '3',
219            engine: engine || 'null',
220            ptag: '4_58_86_3874',
221            tmpYid: tmpYid || 'null',
222            encryptNumber: encryptNumber || 'null',
223            crmUrl: '//www.to8to.com/crm/index.php/Projects/manual/thirdissue/pro_sourceid/3/engine/' + (engine || null) + '/ptag/4_58_86_3874/tmpYid/' + (tmpYid || 'null') + '/encryptNumber/' + (encryptNumber || 'null')
224        }
225    },
226    getCookie: function (c_name) {
227        var c_value = document.cookie;
228        var c_start = c_value.indexOf(" " + c_name + "=");
229        if (c_start == -1) {
230            c_start = c_value.indexOf(c_name + "=");
231        }
232        if (c_start == -1) {
233            c_value = null;
234        } else {
235            c_start = c_value.indexOf("=", c_start) + 1;
236            var c_end = c_value.indexOf(";", c_start);
237            if (c_end == -1) {
238                c_end = c_value.length;
239            }
240            c_value = unescape(c_value.substring(c_start, c_end));
241        }
242        return c_value;
243    },
244
245    getQueryString: function (name, url) {
246        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|jQuery)");
247        var str = url.split('?')[1];
248        var r = null;
249        if (str) {
250            r = str.match(reg);
251        }
252        if (r != null) return r[2];
253        return '';
254    },
255}
256
257jQuery(function () {
258    service_main.service()
259})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.