PageSourceSearch

http://swedesboropets.com/static/assets/js/cms.js

js swedesboropets.com collected 2026-10-06 12:38:22 UTC 59,627 bytes, 1,249 lines download raw bytes

1/* xunruicms */
2if(typeof jQuery == 'undefined'){
3    window.alert("没有引用jquery库");
4}
5
6// js语言函数
7function dr_lang(str) {
8
9    if (typeof lang[str] != "undefined" && lang[str]) {
10        return lang[str];
11    }
12
13    return str;
14}
15
16
17$(function(){
18    if ($(document).width() < 600) {
19        $('.hidden-mobile').hide();
20        $('.table').attr('style', 'table-layout: inherit!important;');
21    } else {
22        $('.hidden-mobile').show();
23    }
24    // 排序操作
25    $('.table .heading th').click(function(e) {
26        var _class = $(this).attr("class");
27        if (_class == '' || _class == undefined) {
28            return;
29        }
30        var _name = $(this).attr("name");
31        if (_name == '' || _name == undefined) {
32            return;
33        }
34        var _order = '';
35        if (_class == "order_sorting") {
36            _order = 'desc';
37        } else if (_class == "order_sorting_desc") {
38            _order = 'asc';
39        } else {
40            _order = 'desc';
41        }
42        var url = decodeURI(window.location.href);
43        url = url.replace("&order=", "&");
44        url+= "&order="+_name+" "+_order;
45        window.location.href=url;
46    });
47    // tabl
48    if ($('.table-checkable')) {
49        var table = $('.table-checkable');
50        table.find('.group-checkable').change(function () {
51            var set = jQuery(this).attr("data-set");
52            var checked = jQuery(this).is(":checked");
53            jQuery(set).each(function () {
54                if (checked) {
55                    $(this).prop("checked", true);
56                    $(this).parents('tr').addClass("active");
57                } else {
58                    $(this).prop("checked", false);
59                    $(this).parents('tr').removeClass("active");
60                }
61            });
62        });
63    }
64});
65
66// 时间戳转换
67function dr_strtotime(datetime) {
68    if (datetime.indexOf(" ") == -1) {
69        datetime+= ' 00:00:00';
70    }
71    var tmp_datetime = datetime.replace(/:/g,'-');
72    tmp_datetime = tmp_datetime.replace(/ /g,'-');
73    var arr = tmp_datetime.split("-");
74    var now = new Date(Date.UTC(arr[0],arr[1]-1,arr[2],arr[3]-8,arr[4],arr[5]));
75    return parseInt(now.getTime()/1000);
76}
77// 主目录相对路径
78function dr_get_web_dir() {
79    if (typeof web_dir != "undefined" && web_dir) {
80        return web_dir;
81    }
82    return '/';
83}
84
85// 是否有隐藏区域
86function dr_isEllipsis(dom) {
87	var checkDom = dom.cloneNode(), parent, flag;
88	checkDom.style.width = dom.offsetWidth + 'px';
89	checkDom.style.height = dom.offsetHeight + 'px';
90	checkDom.style.overflow = 'auto';
91	checkDom.style.position = 'absolute';
92	checkDom.style.zIndex = -1;
93	checkDom.style.opacity = 0;
94	checkDom.style.whiteSpace = "nowrap";
95	checkDom.innerHTML = dom.innerHTML;
96
97	parent = dom.parentNode;
98	parent.appendChild(checkDom);
99	flag = checkDom.scrollWidth > checkDom.offsetWidth;
100	parent.removeChild(checkDom);
101	return flag;
102};
103
104// 判断当前终端是否是移动设备
105function dr_is_mobile() {
106	var ua = navigator.userAgent,
107	 isWindowsPhone = /(?:Windows Phone)/.test(ua),
108	 isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone, 
109	 isAndroid = /(?:Android)/.test(ua), 
110	 isFireFox = /(?:Firefox)/.test(ua), 
111	 isChrome = /(?:Chrome|CriOS)/.test(ua),
112	 isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)),
113	 isPhone = /(?:iPhone)/.test(ua) && !isTablet,
114	 isPc = !isPhone && !isAndroid && !isSymbian;
115	 if (isPc) {
116		// pc
117		return false;
118	 } else {
119		return true;
120	 }
121}
122
123// 显示视频
124function dr_preview_video(file) {
125
126    var width = '450px';
127    var height = '330px';
128    var att = 'width="350" height="280"';
129
130    if (is_mobile_cms == 1) {
131        width = height = '90%';
132        var att = 'width="90%" height="200"';
133    }
134    layer.alert('<p style="text-align: center"><a href="'+file+'" target="_blank">'+file+'</a></p><p style="text-align: center"> <video class="video-js vjs-default-skin" controls="" preload="auto" '+att+'><source src="'+file+'" type="video/mp4"/></video>\n</p>', {
135        shade: 0,
136        //scrollbar: false,
137        shadeClose: true,
138        title: '',
139        area: [width, width],
140        btn: []
141    });
142}
143
144// 显示图片
145function dr_preview_image(file) {
146
147    var width = '400px';
148    var height = '300px';
149
150    if (is_mobile_cms == 1) {
151        width = height = '90%';
152    }
153    layer.alert('<p style="text-align: center"><a href="'+file+'" target="_blank">'+file+'</a></p><p style="text-align: center"><a href="'+file+'" target="_blank"><img style="max-width:100%" src="'+file+'?'+Date.parse(new Date())+'"></a></p>', {
154        shade: 0,
155        //scrollbar: false,
156        shadeClose: true,
157        title: '',
158        area: [width, width],
159        btn: []
160    });
161}
162// 显示url
163function dr_preview_url(url) {
164
165    var width = '400px';
166    var height = '200px';
167    if (is_mobile_cms == 1) {
168        width = height = '90%';
169    }
170    layer.alert('<div style="text-align: center;"><a href="'+url+'" target="_blank">
170'+url+'</a></div>', {
171        shade: 0,
172        title: '',
173        area: [width, width],
174        btn: []
175    });
176}
177
178// 提示信息
179function dr_layer_tips(msg, time) {
180    layer.msg(msg);
181}
182
183// 弹出显示信息
184function dr_show_info(msg, width) {
185    if (!width) {
186        width = 50;
187    }
188    if (is_mobile_cms == 1) {
189        width = height = '90';
190    } else {
191        height = '50';
192    }
193    layer.open({
194        type: 1,
195        shade: 0,
196        fix:true,
197        //scrollbar: false,
198        shadeClose: true,
199        title: lang['show'],
200        area: [width+'%', height+'%'],
201        content: '<div style="padding:20px;overflow-y:scroll">'+(msg)+'</div>'
202    });
203}
204function dr_tips(code, msg, time) {
205
206    if (!time || time == "undefined") {
207        time = 3000;
208    } else {
209        time = time * 1000;
210    }
211
212    var is_tip = 0;
213    if (time < 0) {
214        is_tip = 1;
215    } else if (code == 0 && msg.length > 15) {
216        is_tip = 1;
217    }
218
219    if (is_tip) {
220        if (code == 0) {
221            layer.alert(msg, {
222                shade: 0,
223                title: "",
224                icon: 2
225            })
226        } else {
227            layer.alert(msg, {
228                shade: 0,
229                title: "",
230                icon: 1
231            })
232        }
233    } else {
234        var tip = '<i class="fa fa-info-circle"></i>';
235        //var theme = 'teal';
236        if (code >= 1) {
237            tip = '<i class="fa fa-check-circle"></i>';
238            //theme = 'lime';
239        } else if (code == 0) {
240            tip = '<i class="fa fa-times-circle"></i>';
241            //theme = 'ruby';
242        }
243        layer.msg(tip+'&nbsp;&nbsp;'+msg, {time: time});
244    }
245
246}
247function dr_cmf_tips(code, msg, time) {
248    dr_tips(code, msg, time);
249}
250
251// 窗口提交
252function dr_iframe(type, url, width, height, rt) {
253
254    var title = '';
255    if (type == 'add') {
256        title = '<i class="fa fa-plus"></i> '+lang['add'];
257    } else if (type == 'edit') {
258        title = '<i class="fa fa-edit"></i> '+lang['edit'];
259    } else if (type == 'send') {
260        title = '<i class="fa fa-send"></i> '+lang['send'];
261    } else if (type == 'save') {
262        title = '<i class="fa fa-save"></i> '+lang['save'];
263    } else {
264        title = type;
265    }
266    if (!width) {
267        width = '500px';
268    }
269    if (!height) {
270        height = '70%';
271    }
272
273    if (is_mobile_cms == 1) {
274       width = '95%';
275       height = '90%';
276    }
277
278    layer.open({
279        type: 2,
280        title: title,
281        fix:true,
282        scrollbar: false,
283        maxmin: true,
284        resize: true,
285        shadeClose: true,
286        shade: 0,
287        area: [width, height],
288        btn: [lang['ok'], lang['esc']],
289        yes: function(index, layero){
290            var body = layer.getChildFrame('body', index);
291            $(body).find('.form-group').removeClass('has-error');
292            // 延迟加载
293            var loading = layer.load(2, {
294                shade: [0.3,'#fff'], //0.1透明度的白色背景
295                time: 100000000
296            });
297            $.ajax({type: "POST",dataType:"json", url: url, data: $(body).find('#myform').serialize(),
298                success: function(json) {
299                    layer.close(loading);
300                    if (json.code) {
301                        layer.close(index);
302                        if (json.data.tourl) {
303                            setTimeout("window.location.href = '"+json.data.tourl+"'", 2000);
304                        } else {
305                            if (rt == 'nogo') {
306
307                            } else {
308                                setTimeout("window.location.reload(true)", 2000);
309                            }
310                        }
311                        if (json.data.htmlfile) {
312                            // 执行生成htmljs
313                            $.ajax({
314                                type: "GET",
315                                url: json.data.htmlfile,
316                                dataType: "jsonp",
317                                success: function(json){ },
318                                error: function(){ }
319                            });
320                        }
321                        if (json.data.htmllist) {
322                            // 执行生成htmljs
323                            $.ajax({
324                                type: "GET",
325                                url: json.data.htmllist,
326                                dataType: "jsonp",
327                                success: function(json){ },
328                                error: function(){ }
329                            });
330                        }
331                        dr_cmf_tips(1, json.msg);
332                    } else {
333                        $(body).find('#dr_row_'+json.data.field).addClass('has-error');
334                        dr_cmf_tips(0, json.msg, json.data.time);
335                    }
336                    return false;
337                },
338                error: function(HttpRequest, ajaxOptions, thrownError) {
339                    dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
340                }
341            });
342            return false;
343        },
344        success: function(layero, index){
345            // 主要用于后台权限验证
346            var body = layer.getChildFrame('body', index);
347            var json = $(body).html();
348            if (json.indexOf('"code":0') > 0 && json.length < 500){
349                var obj = JSON.parse(json);
350                layer.close(index);
351                dr_cmf_tips(0, obj.msg);
352            }
353        },
354        content: url+'&is_ajax=1'
355    });
356}
357// ajax 显示内容
358function dr_iframe_show(type, url, width, height) {
359
360    var title = '';
361    if (type == 'show') {
362        title = '<i class="fa fa-search"></i> '+lang['show'];
363    } else if (type == 'edit') {
364        title = '<i class="fa fa-edit"></i> '+lang['edit'];
365    } else if (type == 'code') {
366        title = '<i class="fa fa-code"></i> '+lang['code'];
367    } else if (type == 'cart') {
368        title = '<i class="fa fa-shopping-cart"></i> '+lang['paylog'];
369    } else {
370        title = type;
371    }
372    if (!width) {
373        width = '60%';
374    }
375    if (!height) {
376        height = '70%';
377    }
378
379    if (is_mobile_cms == 1) {
380        width = '95%';
381        height = '90%';
382    }
383
384    layer.open({
385        type: 2,
386        title: title,
387        fix:true,
388        scrollbar: false,
389        shadeClose: true,
390        shade: 0,
391        area: [width, height],
392        success: function(layero, index){
393            // 主要用于后台权限验证
394            var body = layer.getChildFrame('body', index);
395            var json = $(body).html();
396            if (json.indexOf('"code":0') > 0 && json.length < 500){
397                var obj = JSON.parse(json);
398                layer.close(index);
399                dr_cmf_tips(0, obj.msg);
400            }
401        },
402        content: url+'&is_ajax=1'
403    });
404}
405
406// 插入emoji表情
407function dr_insert_emoji(name) {
408
409    if (is_mobile_cms == 1) {
410        width = '95%';
411        height = '90%';
412    } else {
413        width = height = '70%';
414    }
415
416    layer.open({
417        type: 2,
418        title: '<i class="fa fa-smile-o"></i> Emoji',
419        fix:true,
420        scrollbar: false,
421        shadeClose: true,
422        shade: 0,
423        area: [width, height],
424        content: dr_get_web_dir()+'index.php?s=api&c=emoji&name='+name
425    });
426}
427
428// ajax 操作确认 并跳转
429function dr_ajax_confirm_url(url, msg, tourl) {
430    layer.confirm(
431        msg,
432        {
433            icon: 3,
434            shade: 0,
435            title: lang['ts'],
436            btn: [lang['ok'], lang['esc']]
437        }, function(index){
438            layer.close(index);
439            var loading = layer.load(2, {
440                shade: [0.3,'#fff'], //0.1透明度的白色背景
441                time: 100000000
442            });
443            $.ajax({
444                type: "GET",
445                dataType: "json",
446                url: url,
447                success: function(json) {
448                    layer.close(loading);
449                    if (json.code) {
450                        if (json.data.url) {
451                            setTimeout("window.location.href = '"+json.data.url+"'", 2000);
452                        } else if (tourl) {
453                            setTimeout("window.location.href = '"+tourl+"'", 2000);
454                        }
455                    }
456                    dr_cmf_tips(json.code, json.msg);
457                },
458                error: function(HttpRequest, ajaxOptions, thrownError) {
459                    dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
460                }
461            });
462        });
463}
464
465// ajax操作
466function dr_ajax_url(url) {
467    var index = layer.load(2, {
468        shade: [0.3,'#fff'], //0.1透明度的白色背景
469        time: 100000000
470    });
471    $.ajax({
472        type: "GET",
473        url: url,
474        dataType: "json",
475        success: function (json) {
476            layer.close(index);
477			if (json.code == 0) {
478                $('.fc-code img').click();
479                if (json.data.field) {
480                    $('#dr_row_'+json.data.field).addClass('has-error');
481                    $('#dr_'+json.data.field).focus();
482                }
483			}
484            dr_cmf_tips(json.code, json.msg, json.data.time);
485            if (json.data.url) {
486                setTimeout("window.location.href = '"+json.data.url+"'", 2000);
487            }
488        },
489        error: function(HttpRequest, ajaxOptions, thrownError) {
490            dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
491        }
492    });
493}
494
495// ajax操作 jsonp
496function dr_ajaxp_url(url) {
497    var index = layer.load(2, {
498        shade: [0.3,'#fff'], //0.1透明度的白色背景
499        time: 100000000
500    });
501    $.ajax({
502        type: "GET",
503        url: url,
504        dataType: "jsonp",
505        success: function (json) {
506            layer.close(index);
507            dr_cmf_tips(json.code, json.msg, json.data.time);
508            if (json.data.url) {
509                setTimeout("window.location.href = '"+json.data.url+"'", 2000);
510            }
511        },
512        error: function(HttpRequest, ajaxOptions, thrownError) {
513            dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
514        }
515    });
516}
517
518
519// ajax保存数据
520function dr_ajax_save(value, url, name) {
521    var index = layer.load(2, {
522        shade: [0.3,'#fff'], //0.1透明度的白色背景
523        time: 5000
524    });
525    $.ajax({
526        type: "GET",
527        url: url+'&name='+name+'&value='+value,
528        dataType: "json",
529        success: function (json) {
530            layer.close(index);
531            dr_tips(json.code, json.msg, json.data.time);
532        },
533        error: function(HttpRequest, ajaxOptions, thrownError) {
534            dr_ajax_admin_alert_error(HttpRequest, ajaxOptions, thrownError);
535        }
536    });
537}
538
539
540// ajax 批量操作确认
541function dr_ajax_option(url, msg, remove) {
542    layer.confirm(
543        msg,
544        {
545            icon: 3,
546            shade: 0,
547            title: lang['ts'],
548            btn: [lang['ok'], lang['esc']]
549        }, function(index){
550            layer.close(index);
551            var loading = layer.load(2, {
552                shade: [0.3,'#fff'], //0.1透明度的白色背景
553                time: 100000000
554            });
555            $.ajax({
556                type: "POST",
557                dataType: "json",
558                url: url,
559                data: $("#myform").serialize(),
560                success: function(json) {
561                    layer.close(loading);
562                    if (json.code) {
563                        if (remove) {
564                            // 批量移出去
565                            var ids = json.data.ids;
566                            if (typeof ids != "undefined" ) {
567                                console.log(ids);
568                                for ( var i = 0; i < ids.length; i++){
569                                    $("#dr_row_"+ids[i]).remove();
570                                }
571                            }
572                        }
573                        if (json.data.htmlfile) {
574                            // 执行生成htmljs
575                            $.ajax({
576                                type: "GET",
577                                url: json.data.htmlfile,
578                                dataType: "jsonp",
579                                success: function(json){ },
580                                error: function(){ }
581                            });
582                        }
583                        if (json.data.url) {
584                            setTimeout("window.location.href = '"+json.data.url+"'", 2000);
585                        } else {
586                            setTimeout("window.location.reload(true)", 3000)
587                        }
588                    }
589                    dr_cmf_tips(json.code, json.msg, json.data.time);
590                },
591                error: function(HttpRequest, ajaxOptions, thrownError) {
592                    dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
593                }
594            });
595        });
596}
597
598// ajax 批量操作确认 并跳转
599function dr_ajax_option_url(url, msg, tourl) {
600    layer.confirm(
601        msg,
602        {
603            icon: 3,
604            shade: 0,
605            title: lang['ts'],
606            btn: [lang['ok'], lang['esc']]
607        }, function(index){
608            layer.close(index);
609            var loading = layer.load(2, {
610                shade: [0.3,'#fff'], //0.1透明度的白色背景
611                time: 100000000
612            });
613            $.ajax({
614                type: "POST",
615                dataType: "json",
616                url: url,
617                data: $("#myform").serialize(),
618                success: function(json) {
619                    layer.close(loading);
620                    if (json.code) {
621                        if (json.data.url) {
622                            setTimeout("window.location.href = '"+json.data.url+"'", 2000);
623                        } else {
624                            setTimeout("window.location.href = '" + tourl + "'", 2000);
625                        }
626                    }
627                    dr_cmf_tips(json.code, json.msg, json.data.time);
628                },
629                error: function(HttpRequest, ajaxOptions, thrownError) {
630                    dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
631                }
632            });
633        });
634}
635
636// ajax提交
637function dr_ajax_submit(url, form, time, go) {
638
639    var flen = $('[id='+form+']').length;
640    // 验证id是否存在
641    if (flen == 0) {
642        dr_cmf_tips(0, lang['unformid'] + ' ('+form+')');
643        return;
644    }
645    // 验证重复
646    if (flen > 1) {
647        dr_cmf_tips(0, lang['repeatformid'] + ' ('+form+')');
648        return;
649    }
650
651    // 验证必填项管理员
652    var tips_obj = $('#'+form).find('[name=is_tips]');
653    if (tips_obj.val() == 'required') {
654        tips_obj.val('');
655    }
656    if ($('#'+form).find('[name=is_admin]').val() == 1) {
657        $('#'+form).find('.dr_required').each(function () {
658            if (!$(this).val()) {
659                tips_obj.val('required');
660            }
661        });
662    }
663
664    var tips = tips_obj.val();
665    if (tips) {
666        if (tips == 'required') {
667            tips = '有必填字段未填写,确认提交吗ï¼
667Ÿ';
668        }
669        layer.confirm(
670        tips,
671        {
672            icon: 3,
673            shade: 0,
674            title: lang['ts'],
675            btn: [lang['ok'], lang['esc']]
676        }, function(index){
677            dr_post_submit(url, form, time, go);
678        });
679    } else {
680        dr_post_submit(url, form, time, go);
681    }
682}
683
684// 处理post提交
685function dr_post_submit(url, form, time, go) {
686
687    var p = url.split('/');
688    if ((p[0] == 'http:' || p[0] == 'https:') && document.location.protocol != p[0]) {
689        alert('当前提交的URL是'+p[0]+'模式,请使用'+document.location.protocol+'模式访问再提交');
690        return;
691    }
692
693    url = url.replace(/&page=\d+&page/g, '&page');
694
695    var loading = layer.load(2, {
696        shade: [0.3,'#fff'], //0.1透明度的白色背景
697        time: 100000000
698    });
699
700    $("#"+form+' .form-group').removeClass('has-error');
701
702    $('.dr_ueditor').each(function () {
703        var uev = $(this).attr('id');
704        if(UE.getEditor(uev).queryCommandState('source')!=0){
705            UE.getEditor(uev).execCommand('source');
706        }
707    });
708
709    $.ajax({
710        type: "POST",
711        dataType: "json",
712        url: url,
713        data: $("#"+form).serialize(),
714        success: function(json) {
715            layer.close(loading);
716            if (json.code) {
717                dr_cmf_tips(1, json.msg, json.data.time);
718                if (json.data.htmlfile) {
719                    // 执行生成htmljs
720                    $.ajax({
721                        type: "GET",
722                        url: json.data.htmlfile,
723                        dataType: "jsonp",
724                        success: function(json){ },
725                        error: function(){ }
726                    });
727                }
728                if (json.data.htmllist) {
729                    // 执行生成htmljs
730                    $.ajax({
731                        type: "GET",
732                        url: json.data.htmllist,
733                        dataType: "jsonp",
734                        success: function(json){ },
735                        error: function(){ }
736                    });
737                }
738                if (time) {
739                    var gourl = url;
740                    if (go != '' && go != undefined && go != 'undefined') {
741                        gourl = go;
742                    } else if (json.data.url) {
743                        gourl = json.data.url;
744                    }
745                    setTimeout("window.location.href = '"+gourl+"'", time);
746                }
747            } else {
748                dr_cmf_tips(0, json.msg, json.data.time);
749                $('.fc-code img').click();
750                if (json.data.field) {
751                    $('#dr_row_'+json.data.field).addClass('has-error');
752                    $('#dr_'+json.data.field).focus();
753                }
754            }
755        },
756        error: function(HttpRequest, ajaxOptions, thrownError) {
757            dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
758        }
759    });
760}
761// 退出登录
762function dr_loginout(msg) {
763    $.ajax({type: "GET",dataType:"json", url: dr_get_web_dir()+'index.php?s=api&c=api&m=loginout',
764        success: function(json) {
765            var oss_url = json.data.sso;
766            // 发送同步登录信息
767            for ( var i = 0; i < oss_url.length; i++){
768                var result = fetchJsonp(oss_url[i], {
769				  jsonpCallback: 'callback',
770				  timeout: 3000
771				})
772				result.then(function(response) {
773				  return response.json()
774				}).then(function(json) {
775					console.log(JSON.stringify(json));
776				})['catch'](function(ex) {
777				  console.log('failed:' + ex);
778				});
779            }
780            dr_cmf_tips(1, json.msg, json.data.time);
781            setTimeout('window.location.href="'+json.data.url+'"', 2000);
782        },
783        error: function(HttpRequest, ajaxOptions, thrownError) {
784            dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
785        }
786    });
787}
788// ajax提交登录或者注册
789function dr_ajax_member(url, form) {
790
791    var flen = $('[id='+form+']').length;
792    // 验证id是否存在
793    if (flen == 0) {
794        dr_cmf_tips(0, lang['unformid'] + ' ('+form+')');
795        return;
796    }
797    // 验证重复
798    if (flen > 1) {
799        dr_cmf_tips(0, lang['repeatformid'] + ' ('+form+')');
800        return;
801    }
802
803    var loading = layer.load(2, {
804        shade: [0.3,'#fff'], //0.1透明度的白色背景
805        time: 100000000
806    });
807
808    $("#"+form+' .form-group').removeClass('has-error');
809    
810    $.ajax({
811        type: "POST",
812        dataType: "json",
813        url: url,
814        data: $("#"+form).serialize(),
815        success: function(json) {
816            layer.close(loading);
817            if (json.code) {
818                var oss_url = json.data.sso;
819                // 发送同步登录信息
820                for ( var i = 0; i < oss_url.length; i++){
821                    //alert(oss_url[i]);
822				   var result = fetchJsonp(oss_url[i], {
823                      jsonpCallback: 'callback',
824                      timeout: 3000
825                    })
826                    result.then(function(response) {
827                      return response.json()
828                    }).then(function(json) {
829                        console.log(JSON.stringify(json));
830                    })['catch'](function(ex) {
831                      console.log('failed:' + ex);
832                    });
833				   
834                }
835                if (json.data.url) {
836                    if (oss_url.length > 2) {
837                        dr_cmf_tips(1, json.msg, json.data.time);
838                        setTimeout('window.location.href="'+json.data.url+'"', 
8381000);
839                    } else {
840                        window.location.href = json.data.url;
841                    }
842                }
843            } else {
844                dr_cmf_tips(0, json.msg, json.data.time);
845                $('.fc-code img').click();
846                if (json.data.field) {
847                    $('#dr_row_'+json.data.field).addClass('has-error');
848                    $('#dr_'+json.data.field).focus();
849                }
850            }
851        },
852        error: function(HttpRequest, ajaxOptions, thrownError) {
853            dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
854        }
855    });
856}
857
858function d_topinyin(name, from, letter) {
859    var val = $("#dr_" + from).val();
860    if ($("#dr_" + name).val()) {
861        return false
862    }
863    $.get("/index.php?s=api&c=api&m=pinyin&name=" + val + "&rand=" + Math.random(),
864        function(data) {
865            $("#dr_" + name).val(data);
866            if (letter) {
867                $("#dr_letter").val(data.substr(0, 1))
868            }
869        })
870}
871
872// 多文件上传删除元素
873function dr_file_remove(e) {
874    $(e).parents(".files_row").remove();
875}
876
877// 删除文件
878function dr_file_delete(e, id) {
879    $.get("/index.php?s=api&c=file&m=file_delete&id=" + id + "&rand=" + Math.random(),
880    function(data) {
881        top.dr_cmf_tips(data.code, data.msg);
882        if (data.code) {
883            $(e).parents(".files_row").remove();
884        }
885    }, 'json');
886}
887
888// 多文件上传修改文件
889function dr_file_edit(e) {
890    var name_obj = $(e).parents(".files_row").find(".files_row_name");
891    name_obj.focus();
892    return;
893}
894
895// 显示ip信息
896function dr_show_ip(name) {
897    $.get(dr_get_web_dir()+'index.php?is_ajax=1&s=api&c=api&m=ip_address&value='+$('#dr_'+name).val(), function(html){
898        layer.alert(html, {
899            shade: 0,
900            title: "",
901            icon: 1
902        })
903    }, 'text');
904}
905
906function dr_diy_func(name) {
907    dr_cmf_tips(1, '这是一个自定义函数');
908}
909
910// 模块收藏
911function dr_module_favorite(dir, id) {
912    $.get(dr_get_web_dir()+"index.php?is_ajax=1&s=api&app="+dir+"&c=module&m=favorite&id="+id, function(data){
913        dr_cmf_tips(data.code, data.msg);
914        if (data.code) {
915            $('#module_favorite_'+id).html(data.data);
916        }
917    }, 'json');
918}
919
920// 模块支持反对
921function dr_module_digg(dir, id, value) {
922    $.get(dr_get_web_dir()+"index.php?is_ajax=1&s=api&app="+dir+"&c=module&m=digg&id="+id+'&value='+value, function(data){
923        dr_cmf_tips(data.code, data.msg);
924        if (data.code) {
925            $('#module_digg_'+id+'_'+value).html(data.data);
926        }
927    }, 'json');
928}
929
930// 选中支付方式
931function dr_select_paytype(name) {
932    $('#dr_payselect').val(name);
933}
934
935// 注册阅读网站协议
936function dr_show_protocol() {
937    layer.open({
938        type: 2,
939        title: lang['protocol'],
940        shadeClose: true,
941        area: ['70%', '70%'],
942        content: dr_get_web_dir()+'index.php?s=member&c=api&m=protocol'
943    });
944}
945
946function d_tips(name, status, code) {
947    var obj = $("#dr_" + name + "_tips");
948    var value = obj.html();
949    if (!value) {
950        obj.html("")
951    }
952    if (status) {
953        if (code) {
954            dr_cmf_tips(1, code)
955        }
956    } else {
957        $("#dr_" + name).focus();
958        if (code) {
959            dr_cmf_tips(0, code)
960        }
961    }
962}
963function check_title(t) {
964    var id = $("#dr_id").val();
965    var val = $("#dr_title").val();
966    var mod = $("#dr_module").val();
967    $.get(dr_get_web_dir()+"index.php?s=api&c=api&m=checktitle&title=" + val + "&module=" + mod + "&id=" + id+'&is_ajax=1',
968    function(data) {
969        if (data) {
970            dr_cmf_tips(0, data);
971        }
972    });
973}
974function get_keywords(to) {
975    var title = $("#dr_title").val();
976    var module = $("#dr_module").val();
977    if ($("#dr_"+to).val()) {
978        return false
979    }
980    $.get(dr_get_web_dir()+"index.php?s=api&c=api&m=getkeywords&title="+title+"&module="+module+'&is_ajax=1',
981        function(data) {
982            $("#dr_"+to).val(data);
983            $("#dr_"+to).tagsinput('add', data);
984        }
985    );
986}
987
988function d_required(name) {
989    if ($("#dr_" + name).val() == "") {
990        d_tips(name, false);
991        return true
992    } else {
993        d_tips(name, true);
994        return false
995    }
996}
997function d_isemail(name) {
998    var val = $("#dr_" + name).val();
999    var reg = /^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;
1000    if (reg.test(val)) {
1001        d_tips(name, true);
1002        return false
1003    } else {
1004        d_tips(name, false);
1005        return true
1006    }
1007}
1008function d_isurl(name) {
1009    var val = $("#dr_" + name).val();
1010    var reg = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
1011    var Exp = new RegExp(reg);
1012    if (Exp.test(val) == true) {
1013        d_tips(name, true);
1014        return false
1015    } else {
1016        d_tips(name, false);
1017        return true
1018    }
1019}
1020function d_isdomain(name) {
1021    var val = $("#dr_" + name).val();
1022    if (val.indexOf("/") > 0) {
1023        d_tips(name, false);
1024        return true
1025    } else {
1026        d_tips(name, true);
1027        return false
1028    }
1029};
1030
1031function dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError) {
1032    layer.closeAll('loading');
1033    if (typeof is_admin != "undefined" && is_admin) {
1034        var msg = HttpRequest.responseText;
1035        //console.log(HttpRequest, ajaxOptions, thrownError);
1036        if (!msg) {
1037            dr_cmf_tips(0, lang['error_admin']);
1038        } else {
1039            if (is_admin == '1') {
1040                layer.open({
1041                    type: 1,
1042                    title: lang['error_admin'],
1043                    fix:true,
1044                    shadeClose: true,
1045                    shade: 0,
1046                    area: ['50%', '50%'],
1047                    btn: [dr_lang('查看日志')],
1048                    yes: function(index, layero) {
1049                        layer.close(index);
1050                        dr_iframe_show(dr_lang('错误日志'), admin_file+"?c=error&m=log_show");
1051                    },
1052                    content: "<div style=\"padding:10px;\">"+msg+"</div>"
1053                });
1054            } else {
1055                layer.open({
1056                    type: 1,
1057                    title: lang['error_admin'],
1058                    fix:true,
1059                    shadeClose: true,
1060                    shade: 0,
1061                    area: ['50%', '50%'],
1062                    content: "<div style=\"padding:10px;\">"+msg+"</div>"
1063                });
1064            }
1065
1066        }
1067    } else {
1068        dr_cmf_tips(0, lang['error']);
1069    }
1070
1071}
1072
1073// 初始化滚动区域
1074function dr_slimScroll_init(div, ht) {
1075
1076    if (!$().slimScroll) {
1077        return;
1078    }
1079
1080    var obj = div+' .scroller';
1081    var obj2 = div+' .scroller_body';
1082
1083    if ($(obj).attr("data-inited") === "1") { // destroy existing instance before updating the height
1084        $(obj).removeAttr("data-inited");
1085        $(obj).removeAttr("style");
1086
1087        var attrList = {};
1088
1089        // store the custom attribures so later we will reassign.
1090        if ($(obj).attr("data-handle-color")) {
1091            attrList["data-handle-color"] = $(obj).attr("data-handle-color");
1092        }
1093        if ($(obj).attr("data-wrapper-class")) {
1094            attrList["data-wrapper-class"] = $(obj).attr("data-wrapper-class");
1095        }
1096        if ($(obj).attr("data-rail-color")) {
1097            attrList["data-rail-color"] = $(obj).attr("data-rail-color");
1098        }
1099        if ($(obj).attr("data-always-visible")) {
1100            attrList["data-always-visible"] = $(obj).attr("data-always-visible");
1101        }
1102        if ($(obj).attr("data-rail-visible")) {
1103            attrList["data-rail-visible"] = $(obj).attr("data-rail-visible");
1104        }
1105
1106        $(obj).slimScroll({
1107            wrapperClass: ($(obj).attr("data-wrapper-class") ? $(obj).attr("data-wrapper-class") : 'slimScrollDiv'),
1108            destroy: true
1109        });
1110
1111        var the = $(obj);
1112
1113        // reassign custom attributes
1114        $.each(attrList, function(key, value) {
1115            the.attr(key, value);
1116        });
1117
1118    }
1119
1120    var nht = $(obj2).height();
1121    var height;
1122
1123    if (nht > ht) {
1124        height = ht;
1125    } else {
1126        height = 'auto';
1127    }
1128
1129    $(obj).slimScroll({
1130        allowPageScroll: false, // allow page scroll when the element scroll is ended
1131        size: '7px',
1132        color: ($(obj).attr("data-handle-color") ? $(obj).attr("data-handle-color") : '#bbb'),
1133        wrapperClass: ($(obj).attr("data-wrapper-class") ? $(obj).attr("data-wrapper-class") : 'slimScrollDiv'),
1134        railColor: ($(obj).attr("data-rail-color") ? $(obj).attr("data-rail-color") : '#eaeaea'),
1135        position: 'right',
1136        height: height,
1137        alwaysVisible: ($(obj).attr("data-always-visible") == "1" ? true : false),
1138        railVisible: ($(obj).attr("data-rail-visible") == "1" ? true : false),
1139        disableFadeOut: true
1140    });
1141
1142    $(obj).attr("data-inited", "1");
1143
1144}
1145
1146// fetchJsonp
1147(function (global, factory) {
1148  if (typeof define === 'function' && define.amd) {
1149    define(['exports', 'module'], factory);
1150  } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
1151    factory(exports, module);
1152  } else {
1153    var mod = {
1154      exports: {}
1155    };
1156    factory(mod.exports, mod);
1157    global.fetchJsonp = mod.exports;
1158  }
1159})(this, function (exports, module) {
1160  'use strict';
1161
1162  var defaultOptions = {
1163    timeout: 5000,
1164    jsonpCallback: 'callback',
1165    jsonpCallbackFunction: null
1166  };
1167
1168  function generateCallbackFunction() {
1169    return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
1170  }
1171
1172  function clearFunction(functionName) {
1173    try {
1174      delete window[functionName];
1175    } catch (e) {
1176      window[functionName] = undefined;
1177    }
1178  }
1179
1180  function removeScript(scriptId) {
1181    var script = document.getElementById(scriptId);
1182    if (script) {
1183      document.getElementsByTagName('head')[0].removeChild(script);
1184    }
1185  }
1186
1187  function fetchJsonp(_url) {
1188    var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
1189
1190    var url = _url;
1191    var timeout = options.timeout || defaultOptions.timeout;
1192    var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
1193
1194    var timeoutId = undefined;
1195
1196    return new Promise(function (resolve, reject) {
1197      var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
1198      var scriptId = jsonpCallback + '_' + callbackFunction;
1199
1200      window[callbackFunction] = function (response) {
1201        resolve({
1202          ok: true,
1203          json: function json() {
1204            return Promise.resolve(response);
1205          }
1206        });
1207
1208        if (timeoutId) clearTimeout(timeoutId);
1209
1210        removeScript(scriptId);
1211
1212        clearFunction(callbackFunction);
1213      };
1214
1215      url += url.indexOf('?') === -1 ? '?' : '&';
1216
1217      var jsonpScript = document.createElement('script');
1218      jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
1219      if (options.charset) {
1220        jsonpScript.setAttribute('charset', options.charset);
1221      }
1222      jsonpScript.id = scriptId;
1223      document.getElementsByTagName('head')[0].appendChild(jsonpScript);
1224
1225      timeoutId = setTimeout(function () {
1226        reject(new Error('JSONP request to ' + _url + ' timed out'));
1227
1228        clearFunction(callbackFunction);
1229        removeScript(scriptId);
1230        window[callbackFunction] = function () {
1231          clearFunction(callbackFunction);
1232        };
1233      }, timeout);
1234
1235      jsonpScript.onerror = function () {
1236        reject(new Error('JSONP request to ' + _url + ' failed'));
1237
1238        clearFunction(callbackFunction);
1239        removeScript(scriptId);
1240        if (timeoutId) clearTimeout(timeoutId);
1241      };
1242    });
1243  }
1244
1245  module.exports = fetchJsonp;
1246});
1247
1248// layer
1249;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:[lang['ok'],lang['esc']],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"layer/theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:lang['show'],offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+(r.fixed?"":";position:absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div>
1249<span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="layui-layer-move"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow1","hidden1").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/ 2, e.offsetLeft = (n.width() - a[0]) /2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/ 100 : parseFloat(e.offsetTop), e.offsetLeft = /%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left
vendor: 12,970 bytes, line 1249
1249:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+">"+(e.value||"")+"</textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input" value="'+(e.value||"")+'">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:[lang['ok'],lang['esc']],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no  content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/ o[0], a[1] /o[1]];r[0]>r[1]?(a[0]=a[0]/ r[0], a[1] = a[1] /r[0]):r[0]<r[1]&&(a[0]=a[0]/ r[1], a[1] = a[1] /r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'"><div class="layui-layer-imgsee">'+(u.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+"/"+u.length+"</em></span></div></div></div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常<br>是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window);

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.