From 8030eb59fccc390ac183e30d9c83b11e001d8f8f Mon Sep 17 00:00:00 2001 From: skycaiji <10957468+skycaiji@user.noreply.gitee.com> Date: Wed, 27 Sep 2023 22:35:43 +0800 Subject: [PATCH] 2.6 --- public/static/css/admin.css | 26 +- public/static/js/admin.js | 43 +- public/static/js/admin/collector.js | 78 +- public/static/js/admin/cpattern_test.js | 14 +- public/static/js/admin/index.js | 7 +- public/static/js/admin/release.js | 2 +- public/static/js/admin/setting.js | 14 +- public/static/js/admin/task.js | 19 +- public/static/js/langs/zh-cn.js | 2 +- skycaiji | 11 +- vendor/skycaiji/app/admin/behavior/Init.php | 4 + vendor/skycaiji/app/admin/command/Collect.php | 34 +- .../app/admin/controller/Backstage.php | 82 +- .../admin/controller/CollectController.php | 1 - .../app/admin/controller/Collector.php | 56 +- .../app/admin/controller/Cpattern.php | 40 +- .../app/admin/controller/CpatternTest.php | 59 +- .../skycaiji/app/admin/controller/Index.php | 38 +- .../skycaiji/app/admin/controller/Release.php | 10 +- .../skycaiji/app/admin/controller/Setting.php | 140 +++- vendor/skycaiji/app/admin/controller/Task.php | 34 +- .../skycaiji/app/admin/event/CollectBase.php | 25 + vendor/skycaiji/app/admin/event/Cpattern.php | 91 ++- .../skycaiji/app/admin/event/CpatternBase.php | 68 +- .../skycaiji/app/admin/event/CpatternColl.php | 770 +++++++++++++----- .../app/admin/event/CpatternEvent.php | 23 +- vendor/skycaiji/app/admin/event/Rapi.php | 2 +- vendor/skycaiji/app/admin/event/Rcms.php | 4 +- vendor/skycaiji/app/admin/event/Rdb.php | 5 +- vendor/skycaiji/app/admin/event/Rdiy.php | 2 +- .../skycaiji/app/admin/event/ReleaseBase.php | 58 +- vendor/skycaiji/app/admin/event/Rfile.php | 2 +- vendor/skycaiji/app/admin/event/Rtoapi.php | 3 +- vendor/skycaiji/app/admin/lang/zh-cn.php | 10 +- vendor/skycaiji/app/admin/model/Collector.php | 41 +- vendor/skycaiji/app/admin/model/Config.php | 185 ++++- .../skycaiji/app/admin/model/ReleaseApp.php | 2 +- vendor/skycaiji/app/admin/model/Task.php | 31 +- vendor/skycaiji/app/admin/model/User.php | 7 +- .../app/admin/view/backstage/index.html | 7 +- .../admin/view/collector/echo_url_msg.html | 28 + .../app/admin/view/collector/set.html | 2 +- .../app/admin/view/common/header_public.html | 2 +- .../skycaiji/app/admin/view/common/main.html | 5 +- .../app/admin/view/cpattern/content_sign.html | 44 +- .../app/admin/view/cpattern/field.html | 14 +- .../admin/view/cpattern/process_module.html | 18 +- .../skycaiji/app/admin/view/cpattern/set.html | 4 +- .../app/admin/view/cpattern/set_page.html | 160 +--- .../admin/view/cpattern/set_page_rule.html | 9 +- .../app/admin/view/cpattern/set_page_url.html | 202 +++++ .../admin/view/cpattern/set_pagination.html | 25 +- .../app/admin/view/cpattern/set_tpl.html | 14 +- .../admin/view/cpattern/test_source_urls.html | 6 +- .../skycaiji/app/admin/view/release/set.html | 22 +- .../app/admin/view/setting/caiji.html | 51 +- .../app/admin/view/setting/download_file.html | 47 +- .../view/setting/download_file_func.html | 49 ++ .../app/admin/view/setting/download_img.html | 47 +- .../admin/view/setting/download_img_func.html | 49 ++ .../app/admin/view/task/save_form.html | 91 +-- vendor/skycaiji/app/admin/view/user/add.html | 2 +- vendor/skycaiji/app/admin/view/user/edit.html | 2 +- vendor/skycaiji/app/command.php | 2 +- vendor/skycaiji/app/common.php | 2 +- .../app/common/command/SkycaijiCli.php | 116 +++ vendor/skycaiji/app/common/model/Config.php | 2 +- .../skycaiji/app/extend/util/ChromeSocket.php | 69 +- vendor/skycaiji/app/extend/util/Funcs.php | 27 +- vendor/skycaiji/app/extend/util/Param.php | 25 + .../skycaiji/app/extend/util/SwooleSocket.php | 408 ++++++++++ vendor/skycaiji/app/extend/util/Tools.php | 112 ++- vendor/skycaiji/app/extend/util/UnmaxPost.php | 90 ++ vendor/skycaiji/app/install/data/check_db | 2 +- vendor/skycaiji/app/install/data/check_file | 2 +- .../skycaiji/app/public/think_exception.tpl | 2 +- vendor/skycaiji/tp/base.php | 2 +- 77 files changed, 2797 insertions(+), 1007 deletions(-) create mode 100644 vendor/skycaiji/app/admin/view/collector/echo_url_msg.html create mode 100644 vendor/skycaiji/app/admin/view/cpattern/set_page_url.html create mode 100644 vendor/skycaiji/app/admin/view/setting/download_file_func.html create mode 100644 vendor/skycaiji/app/admin/view/setting/download_img_func.html create mode 100644 vendor/skycaiji/app/common/command/SkycaijiCli.php create mode 100644 vendor/skycaiji/app/extend/util/SwooleSocket.php create mode 100644 vendor/skycaiji/app/extend/util/UnmaxPost.php diff --git a/public/static/css/admin.css b/public/static/css/admin.css index df53a6c..25fc658 100644 --- a/public/static/css/admin.css +++ b/public/static/css/admin.css @@ -6,9 +6,33 @@ .info-box-content .info-box-number{font-weight:normal;line-height:25px;} .info-box-content .info-box-number .tips{margin-left:5px;font-size:14px;display:inline;} .help-block{color:#aaa;} +/*取消动画*/ +.content-wrapper, + .main-footer, + .main-header .navbar, + .main-header .logo, + .main-sidebar, + .sidebar-menu li>a>.fa-angle-left, + .sidebar-menu li>a>.pull-right-container>.fa-angle-left, + .control-sidebar-bg, + .control-sidebar, + .small-box .icon, + .direct-chat-messages, + .direct-chat-contacts, + .fc-color-picker>li .fa, + #add-new-event { + -webkit-transition:none!important; + -moz-transition:none!important; + -o-transition:none!important; + transition:none!important; +} /*全局*/ +.modal-body .form-group:last-child{margin-bottom:0;} +.modal-body .form-group .help-block:last-child{margin-bottom:0;} + .panel .form-group:last-child{margin-bottom:0;} .panel .form-group .help-block:last-child{margin-bottom:0;} +.panel .panel:last-child{margin-bottom:5px;} .label-custom-opened{font-weight:normal;background-color:#dedede;color:#555;} @@ -72,7 +96,7 @@ div.in-line-mg{display:inline;margin-right:5px;} .echo-msg-clear{width:100%;overflow:hidden;clear:both;} .echo-msg-lt{float:left;} -.echo-msg-lurl{float:left;margin-right:3px;height:16px;max-width:70%;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;word-break:break-all;} +.echo-msg-lurl{float:left;margin-right:3px;height:17px;max-width:70%;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;word-break:break-all;} /*皮肤*/ .skin-blue-light .treeview-skins,.skin-black-light .treeview-skins,.skin-red-light .treeview-skins,.skin-yellow-light .treeview-skins,.skin-purple-light .treeview-skins,.skin-green-light .treeview-skins{ diff --git a/public/static/js/admin.js b/public/static/js/admin.js index ba42247..fccc17f 100644 --- a/public/static/js/admin.js +++ b/public/static/js/admin.js @@ -7,15 +7,16 @@ | 使用协议 https://www.skycaiji.com/licenses |-------------------------------------------------------------------------- */ -'use strict';function admincpInit(){var bodyWidth=$(document.body).width();var admincp_skin=getCookie('admincp_skin');if(admincp_skin){$('body').removeClass('skin-blue').addClass(admincp_skin)} -if(bodyWidth>767){var admincp_sd_mini=getCookie('admincp_sd_mini');if(admincp_sd_mini==1){$('body').addClass('sidebar-collapse').addClass('sidebar-mini')}} -$(document).ready(function(){$('#treeview_skins').bind('click',function(){if($('#sidebar_skins').html().length<=0){initSkins()}});if(bodyWidth>767){var admincp_sd_mini=getCookie('admincp_sd_mini');if(admincp_sd_mini==1){$('#chk_sidebar_mini').prop('checked','checked')} -$('#chk_sidebar_mini').bind('click',function(){var setMini=0;if($(this).is(':checked')){$('body').addClass('sidebar-collapse').addClass('sidebar-mini');setMini=1}else{$('body').removeClass('sidebar-collapse').removeClass('sidebar-mini')} -setCookie('admincp_sd_mini',setMini,30)});$('.sidebar-toggle[data-toggle="push-menu"]').bind('click',function(){$('body').addClass('sidebar-mini')})}else{$('#chk_sidebar_mini').parents('li').eq(0).hide()} -if($('#menu_backstage_task').length>0){$('#menu_backstage_task').bind('click',function(){windowModal('采集任务',ulink('admin/backstage/backstageTask'),{lg:1})});winBackstageTask.count()}})} -function insertAtCaret(myField,myValue){myField=$(myField);var curObj=myField[0];if(document.selection){myField.focus();var sel=document.selection.createRange();sel.text=myValue;sel.select()}else if(curObj.selectionStart||curObj.selectionStart=='0'){var startPos=curObj.selectionStart;var endPos=curObj.selectionEnd;var restoreTop=curObj.scrollTop;var value=myField.val();value=value.substring(0,startPos)+myValue+value.substring(endPos,value.length);myField.val(value);myField.focus();curObj.selectionStart=startPos+myValue.length;curObj.selectionEnd=startPos+myValue.length}else{myField.val(myField.val()+myValue);myField.focus()}} -function initSkins(){var $skinsList=$('
'+window.tpl_lang.skin_blue+'
');$skinsList.append($skinBlue);var $skinBlack=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_black+'
');$skinsList.append($skinBlack);var $skinPurple=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_purple+'
');$skinsList.append($skinPurple);var $skinGreen=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_green+'
');$skinsList.append($skinGreen);var $skinRed=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_red+'
');$skinsList.append($skinRed);var $skinYellow=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_yellow+'
');$skinsList.append($skinYellow);var $skinBlueLight=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_blue_light+'
');$skinsList.append($skinBlueLight);var $skinBlackLight=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_black_light+'
');$skinsList.append($skinBlackLight);var $skinPurpleLight=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_purple_light+'
');$skinsList.append($skinPurpleLight);var $skinGreenLight=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_green_light+'
');$skinsList.append($skinGreenLight);var $skinRedLight=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_red_light+'
');$skinsList.append($skinRedLight);var $skinYellowLight=$('',{style:'float:left; width: 33.33333%; padding: 5px;'}).append(''+''+window.tpl_lang.skin_yellow_light+'
');$skinsList.append($skinYellowLight);$('#sidebar_skins').html($skinsList);var mySkins=new Array('skin-blue','skin-black','skin-red','skin-yellow','skin-purple','skin-green','skin-blue-light','skin-black-light','skin-red-light','skin-yellow-light','skin-purple-light','skin-green-light');$('#sidebar_skins li a[data-skin]').bind('click',function(){var skin=$(this).attr('data-skin');for(var i in mySkins){$('body').removeClass(mySkins[i])} -$('body').addClass(skin);setCookie('admincp_skin',skin,30)})} +'use strict';var admincpOp={init:function(){var bodyWidth=$(document.body).width();var cpConfig=window.site_config.admincp;cpConfig=cpConfig?cpConfig:{};if(cpConfig.skin){$('body').removeClass('skin-blue').addClass(cpConfig.skin)} +var menuOpts={};if(bodyWidth>767){if(cpConfig.mini==1){$('body').addClass('sidebar-collapse').addClass('sidebar-mini')} +if(cpConfig.narrow==1){$('body').addClass('layout-boxed')} +menuOpts={};if(window.navigator.userAgent.indexOf('MSIE')>-1){menuOpts={animationSpeed:0}}}else{menuOpts={animationSpeed:0}} +$('.sidebar-menu').tree(menuOpts);$(document).ready(function(){$('#treeview_skins').bind('click',function(){if($('#sidebar_skins').html().length<=0){admincpOp.skins()}});if(bodyWidth>767){if(cpConfig.mini==1){$('#chk_sidebar_mini').prop('checked','checked')} +$('#chk_sidebar_mini').bind('click',function(){var setMini=$(this).is(':checked')?1:0;admincpOp.config('mini',setMini,function(){if(setMini){$('body').addClass('sidebar-collapse').addClass('sidebar-mini')}else{$('body').removeClass('sidebar-collapse').removeClass('sidebar-mini')}})});$('.sidebar-toggle[data-toggle="push-menu"]').bind('click',function(){$('body').addClass('sidebar-mini')});if(cpConfig.narrow==1){$('#chk_sidebar_narrow').prop('checked','checked')} +$('#chk_sidebar_narrow').bind('click',function(){var setNarrow=$(this).is(':checked')?1:0;admincpOp.config('narrow',setNarrow,function(){if(setNarrow){$('body').addClass('layout-boxed')}else{$('body').removeClass('layout-boxed')}})})}else{$('#chk_sidebar_mini').parents('li').eq(0).hide();$('#chk_sidebar_narrow').parents('li').eq(0).hide()} +if($('#menu_backstage_task').length>0){$('#menu_backstage_task').bind('click',function(){windowModal('采集任务',ulink('admin/backstage/backstageTask'),{lg:1})});winBackstageTask.count()}})},config:function(op,val,successFunc){ajaxOpen({type:'post',url:ulink('backstage/admincp'),data:{op:op,val:val},success:function(data){if(successFunc&&typeof(successFunc)=='function'){successFunc()}}})},skins:function(){var skinList={'blue':{'name':window.tpl_lang.skin_blue,'top_l_style':'background:#367fa9','top_r_class':'bg-light-blue','left_style':'background: #222d32','right_style':'background: #f4f5f7'},'black':{'name':window.tpl_lang.skin_black,'top_style':'box-shadow: 0 0 2px rgba(0,0,0,0.1)','top_l_style':'background: #fefefe','top_r_style':'background: #fefefe','left_style':'background: #222','right_style':'background: #f4f5f7'},'purple':{'name':window.tpl_lang.skin_purple,'top_l_class':'bg-purple-active','top_r_class':'bg-purple','left_style':'background: #222d32','right_style':'background: #f4f5f7'},'green':{'name':window.tpl_lang.skin_green,'top_l_class':'bg-green-active','top_r_class':'bg-green','left_style':'background: #222d32','right_style':'background: #f4f5f7'},'red':{'name':window.tpl_lang.skin_red,'top_l_class':'bg-red-active','top_r_class':'bg-red','left_style':'background: #222d32','right_style':'background: #f4f5f7'},'yellow':{'name':window.tpl_lang.skin_yellow,'top_l_class':'bg-yellow-active','top_r_class':'bg-yellow','left_style':'background: #222d32','right_style':'background: #f4f5f7'},'blue-light':{'name':window.tpl_lang.skin_blue_light,'top_l_style':'background: #367fa9','top_r_class':'bg-light-blue','left_style':'background: #f9fafc"','right_style':'background: #f4f5f7'},'black-light':{'name':window.tpl_lang.skin_black_light,'top_style':'box-shadow: 0 0 2px rgba(0,0,0,0.1)','top_l_style':'background: #fefefe','top_r_style':'background: #fefefe','left_style':'background: #f9fafc','right_style':'background: #f4f5f7'},'purple-light':{'name':window.tpl_lang.skin_purple_light,'top_l_class':'bg-purple-active','top_r_class':'bg-purple','left_style':'background: #f9fafc','right_style':'background: #f4f5f7'},'green-light':{'name':window.tpl_lang.skin_green_light,'top_l_class':'bg-green-active','top_r_class':'bg-green','left_style':'background: #f9fafc','right_style':'background: #f4f5f7'},'red-light':{'name':window.tpl_lang.skin_red_light,'top_l_class':'bg-red-active','top_r_class':'bg-red','left_style':'background: #f9fafc','right_style':'background: #f4f5f7'},'yellow-light':{'name':window.tpl_lang.skin_yellow_light,'top_l_class':'bg-yellow-active','top_r_class':'bg-yellow','left_style':'background: #f9fafc','right_style':'background: #f4f5f7'},};var html=''+skinSet.name+'
';+'如需扩展系统函数,请在根目录/data/config.php中添加配置:
'+"'EXTEND_PROCESS_FUNC'=>array('PHP函数名'=>'描述')
"+'如需扩展插件函数,可创建函数插件
'}else if(module=='processIf'){tips='选择函数,取反可获取函数结果的相反值
'+'默认将当前字段作为参数传入,如需传入多个参数,一行一个值,可输入任何内容或调用字段
'+'请按函数传参,否则运行出错!
'+'如需扩展系统函数,请在根目录/data/config.php中添加配置:
'+"'EXTEND_PROCESS_IF'=>array('PHP函数名'=>'描述')
"+'如需扩展插件函数,可创建函数插件
'}else if(module=='downloadImg'||module=='downloadFile'||module=='contentSign'){window.open(ulink('develop/func?module='+module));return!1} -confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})} -function tipsCurlPost(){var tips='表单数据:模拟form表单输入的数据
表单上传:模拟form表单输入并上传的数据
'+'JSON数组:以json格式发送数据,可在“发送数据”的“值”中直接输入json字符串。在“名称”中填入json数组键名,根节点名称使用###表示,子节点名称使用.分隔,例如:a.b.c
';confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})} +funcObj.append(html);if(params.cache){window[winCacheName]=html}}}},error:function(xhr,status,error){funcObj.removeAttr('data-is-loaded');toastr.error('函数插件载入失败:'+status+' '+error+' 查看详细')},complete:function(xhr,status){setFuncVal()}})}}},addHtml:function(params,loadParams){if(!isObject(params)){params={}} +var funcData=isObject(params.funcData)?params.funcData:{};var funcName=params.funcName?params.funcName:'';var funcParamName=params.funcParamName?params.funcParamName:'';var tplId=params.tplId?params.tplId:'';tplId='#'+tplId;var listId=params.listId?params.listId:'';listId='#'+listId;var funcId=params.funcId?params.funcId:'';var html=$(tplId).html();html=$(html);var randId=generateUUID();funcName=funcName.replace('{id}',randId);funcParamName=funcParamName.replace('{id}',randId);funcId=funcId.replace('{id}',randId);html.find('[data-func-a]').attr('href','#'+funcId).html('使用函数'+(funcData.func?(':'+funcData.func):''));html.find('[data-func-panel]').attr('id',funcId);html.find('[data-func-func]').attr('name',funcName);html.find('[data-func-func-param]').attr('name',funcParamName).val(funcData.func_param?funcData.func_param:'');$(listId).append(html);if(!isObject(loadParams)){loadParams={}} +loadParams.funcObj='[name="'+funcName+'"]';loadParams.paramObj='[name="'+funcParamName+'"]';loadParams.funcVal=funcData.func;pluginFuncOp.load(loadParams)},initHtml:function(listObj){$(listObj).on('click','a[data-func-insert]',function(){var val=$(this).attr('data-func-insert');if(val){var obj=$(this).parents('[data-func-box]').eq(0).find('textarea[data-func-func-param]');insertAtCaret(obj,obj.val()?("\r\n"+val):val)}});$(listObj).on('click','a[data-func-remove]',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents('[data-func-box]').eq(0).remove()})});eleExchange(listObj,'a[data-func-move]','[data-func-box]')},tips:function(module){var tips='';if(module=='process'){tips='如需扩展系统函数,请在根目录/data/config.php中添加配置:
'+"'EXTEND_PROCESS_FUNC'=>array('PHP函数名'=>'描述')
"+'如需扩展插件函数,可创建函数插件
'}else if(module=='processIf'){tips='选择函数,取反可获取函数结果的相反值
'+'默认将当前字段作为参数传入,如需传入多个参数,一行一个值,可输入任何内容或调用字段
'+'请按函数传参,否则运行出错!
'+'如需扩展系统函数,请在根目录/data/config.php中添加配置:
'+"'EXTEND_PROCESS_IF'=>array('PHP函数名'=>'描述')
"+'如需扩展插件函数,可创建函数插件
'}else if(module=='downloadImg'||module=='downloadFile'||module=='contentSign'){window.open(ulink('develop/func?module='+module));return!1} +confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})}};function tipsCurlPost(){var tips='表单数据:模拟form表单输入的数据
表单上传:模拟form表单输入并上传的数据
'+'JSON数组:以json格式发送数据,可在“发送数据”的“值”中直接输入json字符串。在“名称”中填入json数组键名,根节点名称使用###表示,子节点名称使用.分隔,例如:a.b.c
';confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})} function collectorWindow(title,uri,uriVals,options){options=options?options:{};options.backdrop_static=1;title=isNull(title)?'':title;title+='';window.win_collector_window_params={title:title,uri:uri,uriVals:uriVals,options:options};windowModal(title,ulink('admin/collector/echo_msg?op=run'),{lg:options.lg})} var collectorEchoMsg={config:{},processes:{},close_non_stop:!1,end_set_timeout:null,run:function(config){collectorEchoMsg.config=isObject(config)?config:{};collectorEchoMsg.processes={};collectorEchoMsg.close_non_stop=!1;var winParams=window.win_collector_window_params;winParams=isObject(winParams)?winParams:{};var uri=winParams.uri?winParams.uri:'';var uriVals=isObject(winParams.uriVals)?winParams.uriVals:{};var options=isObject(winParams.options)?winParams.options:{};var winProcessBox=$('#myModal #win_cem_process_box').clone();if(uri){var title=winParams.title+'日志读取间隔秒';var closeFuncs=new Array();if(!isNull(options.close_func)){if(isObject(options.close_func)){closeFuncs=options.close_func}else{closeFuncs.push(options.close_func)}} closeFuncs.push(function(){if(!collectorEchoMsg.close_non_stop){collectorEchoMsg.stop_all()}});options.close_func=closeFuncs;windowIframe(title,'',options);$('#myModal #myModalIframe').hide();$('#myModal #win_cem_interval_btn').bind('click',function(){collectorEchoMsg.set_interval($('#win_cem_interval').val())});var runUrl=ulink(uri,uriVals);ajaxOpen({type:'get',url:runUrl,dataType:'json',async:!0,success:function(data){if(data.code==1){var processes=data.data?data.data:{};var collectorKey=processes.collector_key?processes.collector_key:'';var processKeys=isObject(processes.process_keys)?processes.process_keys:[];var processNum=processKeys.length;if(!collectorKey||processNum<=0){return} @@ -58,12 +59,14 @@ if(collectorProcess){if(isTimeout){var errorHtml='');ajaxOpen({type:'get',dataType:'json',async:!0,url:(url?url:ulink('admin/backstage/backstageTask?op=tasks'+taskType)),success:function(data){if(data.code==1&&data.data){var count0=toInt(data.data.count0);var count1=toInt(data.data.count1);$('#win_backstage_task').find('a[href="#win_bk_tasks_nav_0"]').find('span').text(count0);$('#win_backstage_task').find('a[href="#win_bk_tasks_nav_1"]').find('span').text(count1);$('#win_backstage_task').find('a[href="#win_bk_tasks_nav_'+taskType+'"]').tab('show');$('#win_bk_tasks_nav_'+taskType).html(data.data.html)}else{$('#win_bk_tasks_nav_'+taskType).html('无任务')} +if(collectorEchoMsg.processes[collectorProcess].read_timeout){window.clearTimeout(collectorEchoMsg.processes[collectorProcess].read_timeout)}}},echo_url_msg:function(data){var fid='ifr_collectorEchoMsg_show_url_data';if(!document.getElementById(fid)){$('body').append('')} +if(!isObject(data)){data={}} +data=JSON.stringify(data);$('#'+fid).find('[name="data"]').val(data);$('#'+fid).submit()},};var winBackstageTask={count:function(delay){delay=toInt(delay);var countFunc=function(){ajaxOpen({type:'get',dataType:'json',async:!0,url:ulink('admin/backstage/backstageTask?op=count'),success:function(data){if(data.code==1&&data.data){var count=toInt(data.data.count);count=count>0?count:'';$('#menu_backstage_task .label').text(count)}else{$('#menu_backstage_task .label').text('')}}})};if(delay>0){window.setTimeout(countFunc,delay)}else{countFunc()}},collected_set_timeout:null,init:function(){$('#win_backstage_task a[href^="#win_bk_tasks_nav_"]').bind('click',function(){var curTaskType=$($(this).attr('href')).attr('data-task-type');winBackstageTask.tasks(curTaskType)});$('#win_backstage_task a[href="#win_bk_tasks_nav_0"]').trigger('click');$('#myModal').on('hidden.bs.modal',function(e){winBackstageTask.count()})},tasks:function(taskType,url){$('#win_bk_tasks_nav_'+taskType).html('');ajaxOpen({type:'get',dataType:'json',async:!0,url:(url?url:ulink('admin/backstage/backstageTask?op=tasks'+taskType)),success:function(data){if(data.code==1&&data.data){var count0=toInt(data.data.count0);var count1=toInt(data.data.count1);$('#win_backstage_task').find('a[href="#win_bk_tasks_nav_0"]').find('span').text(count0);$('#win_backstage_task').find('a[href="#win_bk_tasks_nav_1"]').find('span').text(count1);$('#win_backstage_task').find('a[href="#win_bk_tasks_nav_'+taskType+'"]').tab('show');$('#win_bk_tasks_nav_'+taskType).html(data.data.html)}else{$('#win_bk_tasks_nav_'+taskType).html('无任务')} winBackstageTask.count();winBackstageTask.status()}})},init_tasks:function(taskType){taskType=toInt(taskType);$('#win_bk_tasks_box_'+(taskType==0?1:0)).html('');$('[id^="win_bk_tasks_box_"] a[data-parent^="#win_bk_tasks_box_"]').bind('click',function(){var curTaskId=$($(this).attr('href')).attr('data-task-id');var curTaskType=$(this).parents('[id^="win_bk_tasks_nav_"]').eq(0).attr('data-task-type');winBackstageTask.collected(curTaskId,curTaskType)});$('[id^="win_bk_tasks_box_"] .fa-remove').bind('click',function(){var obj=$(this);var curTaskId=$(this).attr('data-task-id');ajaxOpen({type:'get',dataType:'json',async:!0,url:ulink('admin/task/bkdelete?id='+curTaskId),success:function(data){obj.parents('.panel').remove();var spanObj=$('#win_backstage_task').find('a[href="#win_bk_tasks_nav_'+taskType+'"]').find('span');var spanCount=spanObj.text();spanCount=spanCount?parseInt(spanCount):0;spanCount=spanCount>0?(spanCount-1):0;spanObj.text(spanCount)}})});$('#win_bk_tasks_box_'+taskType+' .pagination').addClass('pagination-sm');$('#win_bk_tasks_box_'+taskType+' .pagination a').bind('click',function(){var curTaskType=$(this).parents('[id^="win_bk_tasks_nav_"]').eq(0).attr('data-task-type');winBackstageTask.tasks(curTaskType,$(this).attr('href'));return!1})},collected:function(taskId,taskType,url){if(!url){url=ulink('admin/backstage/backstageTask?op=collected&tid='+taskId)} ajaxOpen({type:'get',dataType:'html',async:!0,url:url,success:function(data){$('#win_bk_collected_'+taskId).html(data)},complete:function(){if(!isNull(taskType)&&0==toInt(taskType)){winBackstageTask.collected_set_timeout=window.setTimeout(function(){var isEnd=$('#win_bk_tasks_box_0').find('a[href="#win_bk_collected_'+taskId+'"]').attr('data-is-end');var isVisible=$('#win_bk_tasks_box_0 #win_bk_collected_'+taskId).is(':visible');if(!isEnd&&isVisible){winBackstageTask.collected(taskId,taskType,url)}else{window.clearTimeout(winBackstageTask.collected_set_timeout)}},3000)}}})},init_collected:function(taskStatus,taskId){$('[id^="win_bk_collected_"] .pagination').addClass('pagination-sm');$('[id^="win_bk_collected_"] .pagination a').bind('click',function(){var curTaskId=$(this).parents('[id^="win_bk_collected_"]').eq(0).attr('data-task-id');var curTaskType=$(this).parents('[id^="win_bk_tasks_nav_"]').eq(0).attr('data-task-type');winBackstageTask.collected(curTaskId,curTaskType,$(this).attr('href'));return!1});if(taskStatus&&taskId){winBackstageTask.set_task_end(taskId,taskStatus);winBackstageTask.count();winBackstageTask.status()}},set_task_end:function(taskId,status){if(taskId&&status){$('#win_bk_tasks_box_0').find('a[href="#win_bk_collected_'+taskId+'"]').attr('data-is-end','1').find('.is_loading').html(''+status+'')}},status_set_timeout:null,status:function(isLoop){if(!isLoop){window.clearTimeout(winBackstageTask.status_set_timeout)} var taskIds=[];$('#win_bk_tasks_box_0').find('[id^="win_bk_collected_"]').each(function(){var taskId=$(this).attr('data-task-id');taskIds.push(taskId)});if(taskIds.length>0){ajaxOpen({type:'post',dataType:'json',async:!0,data:{tids:taskIds},url:ulink('admin/backstage/backstageTask?op=status'),success:function(data){var statusList=data.data;if(isObject(statusList)){for(var tid in statusList){if(statusList[tid]){winBackstageTask.set_task_end(tid,statusList[tid])}}} var isVisible=$('#win_bk_tasks_box_0').is(':visible');var isEnd=!0;$('#win_bk_tasks_box_0').find('a[href^="#win_bk_collected_"]').each(function(){if(!$(this).attr('data-is-end')){isEnd=!1;return!1}});if(!isEnd&&isVisible){winBackstageTask.status_set_timeout=window.setTimeout(function(){winBackstageTask.status(!0)},3000)}else{window.clearTimeout(winBackstageTask.status_set_timeout)}}})}}};function ajax_check_userpwd(ajaxSet){var oldSuccess=ajaxSet.success;ajaxSet.success=function(data){if(data.data&&data.data._check_pwd_){if(data.msg){toastr.error(data.msg)} -var msg='1、规则中的特殊字符:^$.*+|?[]{}() 必须加上“\\”才能转义为字符,否则会识别为正则符号
2、[内容]标签的标识可由数字、字母及下划线组成
';if(isPage){tips+='3、页面级别:多级页 > 多级页子页 > 内容页 > 关联页 > 关联页子页
';tips+='4、[内容]标签可全局调用,但只能调用比自己级别高的页面中的标签,即内容页可调用多级页中的标签而不能调用关联页中的标签
';tips+='5、同一页面中有相同标识的[内容]标签时,后面的标签会覆盖前面的同名标签。不同页面中有相同标识的[内容]标签时,低级别页面会覆盖高级别页面中的同名标签
'} +var wildcard=window.tpl_lang.sign_wildcard;if(options.only){if($(toObj).val().indexOf(wildcard)<0){insertAtCaret($(toObj),wildcard)}}else{insertAtCaret($(toObj),wildcard)}},tips:function(isPage,isPn){var tips='1、规则中的特殊字符:^$.*+|?[]{}() 必须加上“\\”才能转义为字符,否则会识别为正则符号
2、[内容]标签的标识可由数字、字母及下划线组成
';if(isPage){if(isPn){tips+='3、分页[内容]标签不可全局调用,只能在当前分页中调用
'}else{tips+='3、页面级别:多级页 > 多级页子页 > 内容页 > 关联页 > 关联页子页
';tips+='4、[内容]标签可全局调用,但只能调用比自己级别高的页面中的标签,即内容页可调用多级页中的标签而不能调用关联页中的标签
';tips+='5、同一页面中有相同标识的[内容]标签时,后面的标签会覆盖前面的同名标签。不同页面中有相同标识的[内容]标签时,低级别页面会覆盖高级别页面中的同名标签
'}} confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})}} \ No newline at end of file diff --git a/public/static/js/admin/collector.js b/public/static/js/admin/collector.js index a06c407..5561c0e 100644 --- a/public/static/js/admin/collector.js +++ b/public/static/js/admin/collector.js @@ -8,9 +8,14 @@ |-------------------------------------------------------------------------- */ 'use strict';function CollectorPattern(){this.formid='#form_coll';this.cpFrontUrl=null;this.cpLevelUrl=null;this.cpRelationUrl=null;this.cpUrlWeb=null;this.cpRenderer=null;this.cpContentSign=null;this.cpPagination=null;this.cpField=null;this.cpProcess=null} -CollectorPattern.prototype={constructor:CollectorPattern,init_test:function(){var $_o=this;$_o.formid='#win_form_cache';$_o.cpUrlWeb=new CpUrlWeb($_o);$_o.cpRenderer=new CpRenderer($_o);$_o.cpUrlWeb.page_init('test');$_o.cpRenderer.page_init('test')},init:function(){var $_o=this;$($_o.formid).bind('submit',function(){$('#coll_tab_content').find('.tab-pane[id^="coll_pattern_"]').each(function(){if($(this).hasClass('active')){$($_o.formid+' [name="tab_link"]').val($(this).attr('id'));return}});var settings=getFormAjaxSettings($(this));ajaxOpen(settings);return!1});$_o.cpFrontUrl=new CpFrontUrl($_o);$_o.cpLevelUrl=new CpLevelUrl($_o);$_o.cpRelationUrl=new CpRelationUrl($_o);$_o.cpUrlWeb=new CpUrlWeb($_o);$_o.cpRenderer=new CpRenderer($_o);$_o.cpContentSign=new CpContentSign($_o);$_o.cpPagination=new CpPagination($_o);$_o.cpField=new CpField($_o);$_o.cpProcess=new CpProcess($_o);inputSelectCustom($_o.formid+' select[name="config[charset]"]','config[charset_custom]',null,null,function(){$_o.cpUrlWeb.def_config_charset('')});inputSelectCustom($_o.formid+' select[name="config[encode]"]','config[encode_custom]',null,null,function(){$_o.cpUrlWeb.def_config_encode('')});$($_o.formid+' [name="config[page_render]"]').bind('click',function(){$_o.cpRenderer.def_config_renderer_open('')});$($_o.formid+' [name="config[request_headers][open]"]').bind('click',function(){$_o.cpUrlWeb.def_config_header_global('')});$($_o.formid+' #coll_pattern_request_headers .dm-useragent li a').bind('click',function(){$($_o.formid+' [name="config[request_headers][useragent]"]').val($(this).attr('data-useragent'))});$($_o.formid+' #coll_pattern_request_headers .add-request-header').bind('click',function(){$_o.add_request_header('','')});$($_o.formid+' #coll_pattern_request_headers .add-request-header-img').bind('click',function(){$_o.add_request_header_img('','')});$($_o.formid+' #coll_pattern_request_headers .add-request-header-file').bind('click',function(){$_o.add_request_header_file('','')});$($_o.formid+' .c-p-request-headers').on('click','.delete-request-header',function(){$(this).parents('tr').eq(0).remove()});$($_o.formid+' .c-p-request-headers-img').on('click','.delete-request-header-img',function(){$(this).parents('tr').eq(0).remove()});$($_o.formid+' .c-p-request-headers-file').on('click','.delete-request-header-file',function(){$(this).parents('tr').eq(0).remove()});$_o.init_page_list_op('front_url');$(this.formid+' #coll_pattern_source_url .add-source-url').bind('click',function(){windowModal('添加起始网址',ulink("cpattern/source"),{lg:1})});$(this.formid+' #coll_pattern_source_url .clear-source-url').bind('click',function(){$_o.source_op('clear_all')});$(this.formid+' #coll_pattern_source_url').on('click','.edit-source-url',function(){var parent=$(this).parents('[id^="source_url_"]').eq(0);var objid=parent.attr('id');var sourceUrl=parent.find('[name="config[source_url][]"]').val();sourceUrl=sourceUrl?sourceUrl:'';var url=ulink("cpattern/source");var options={lg:1};if(objid||sourceUrl){options.ajax={type:'post',data:{'source_url':sourceUrl,'objid':objid}}} -windowModal('添加起始网址',url,options)});$(this.formid+' #coll_pattern_source_url').on('click','.delete-source-url',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){obj.parents('[id^="source_url_"]').eq(0).remove()})});eleExchange(this.formid+' #coll_pattern_source_url','.icon-drag-move','[id^="source_url_"]');$(this.formid+' [name="config[source_is_url]"]').bind('click',function(){if($_o.source_is_url()){$('#alert_coll_pattern_link').show();$('#panel_coll_pattern_source_url_web').hide();$('#panel_coll_pattern_source_url_renderer').hide();$('#panel_coll_pattern_source_url_content_sign').hide();$('#panel_coll_pattern_source_url_pagination').hide();$('#panel_coll_pattern_level_url').hide();$('#panel_coll_pattern_url_content_sign').siblings('.panel').hide();$('#panel_coll_pattern_url_web').show();$('#panel_coll_pattern_url_renderer').show()}else{$('#alert_coll_pattern_link').hide();$('#panel_coll_pattern_source_url_web').show();$('#panel_coll_pattern_source_url_renderer').show();$('#panel_coll_pattern_source_url_content_sign').show();$('#panel_coll_pattern_source_url_pagination').show();$('#panel_coll_pattern_level_url').show();$('#panel_coll_pattern_url_content_sign').siblings('.panel').show()}});$_o.init_page('source_url');$_o.init_page('url');$($_o.formid).on('click','.c-p-url-page-signs .btn-page-signs',function(){$_o.parent_page_signs(this)});$_o.init_page_list_op('level_url');$_o.init_page_list_op('relation_url');$(this.formid+' #coll_pattern_field').on('click','.add-field',function(){$_o.field_editor(null,null)});$(this.formid+' #coll_pattern_field').on('click','.field-name',function(){$_o.field_editor($(this),null)});$(this.formid+' #coll_pattern_field').on('click','.add-field-default',function(){$_o.cpField.add_default()});$(this.formid+' #coll_pattern_field').on('click','.sort-field',function(){var fieldNames=$_o.get_field_names(!0);for(var i in fieldNames){var fieldTr=$($_o.formid+' #coll_pattern_field').find('.field-name[data-val="'+fieldNames[i]+'"]').parents('tr[id^="field_"]').eq(0);if(fieldTr.length>0){$($_o.formid+' #coll_pattern_field .c-p-field-list tbody').append(fieldTr)}} -toastr.success('调整完成')});$(this.formid+' #coll_pattern_field').on('click','.field-del',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){$_o.field_delete_tr(obj)})});$(this.formid+' #coll_pattern_field').on('click','.field-clone',function(){var tr=$(this).parents('tr[id^="field_"]').eq(0);var field=tr.find('[name="config[field_list][]"]').val();var process=tr.find('[name="config[field_process][]"]').val();confirmRight('确定复制字段?',function(){ajaxOpen({type:'POST',dataType:'json',url:ulink("cpattern/clone_field"),data:{field:field,process:process},success:function(data){if(data.code==1){data=data.data;var hasField=!1;do{data.field.name+='_1';hasField=$('#coll_pattern_field .c-p-field-list').find('.field-name[data-val="'+data.field.name+'"]');if(hasField&&hasField.length>0){hasField=!0}else{hasField=!1}}while(hasField);$_o.cpField.add(null,data.field,data.process);toastr.success('字段复制成功:'+data.field.name)}else{toastr.error(data.msg)}}})})});$(this.formid+' #coll_pattern_field').on('click','.field-process',function(){var process=$(this).parent().find('input[name="config[field_process][]"]').val();var prt=$(this).parents('tr[id^="field_"]').eq(0);var objid=prt.attr('id');var field=prt.find('.field-name').attr('data-val');var url=ulink("cpattern/process?task_id=_tid_&field=_field_",{'_tid_':$_o.get_task_id(),'_field_':field});windowModal('数据处理:'+field+'',url,{lg:1,ajax:{type:'post',data:{objid:objid,process:process}}});$_o.process_paste()});$(this.formid+' #coll_pattern_process').on('click','.add-process',function(){var url=ulink("cpattern/process?task_id=_tid_&type=common",{'_tid_':$_o.get_task_id()});windowModal('数据处理(通用)',url,{lg:1});$_o.process_paste()});eleExchange(this.formid+' #coll_pattern_field','.icon-drag-move','tr[id^="field_"]');$(this.formid+' [name="effective"]').val(1)},load:function(config){var $_o=this;if(config){$(this.formid+' [name="config[charset_custom]"]').val(config.charset_custom);$(this.formid+' [name="config[charset]"]').val(config.charset).trigger('change');$(this.formid+' [name="config[encode_custom]"]').val(config.encode_custom);$(this.formid+' [name="config[encode]"]').val(config.encode).trigger('change');$(this.formid+' [name="config[url_complete]"][value="'+toInt(config.url_complete)+'"]').prop('checked',!0);$(this.formid+' [name="config[url_reverse]"][value="'+toInt(config.url_reverse)+'"]').prop('checked',!0);$(this.formid+' [name="config[page_render]"][value="'+toInt(config.page_render)+'"]').prop('checked',!0).trigger('click');$(this.formid+' [name="config[url_repeat]"][value="'+toInt(config.url_repeat)+'"]').prop('checked',!0);$(this.formid+' [name="config[url_no_name]"][value="'+toInt(config.url_no_name)+'"]').prop('checked',!0);$(this.formid+' [name="config[url_encode]"][value="'+toInt(config.url_encode)+'"]').prop('checked',!0);if(config.regexp_flags){for(var i in config.regexp_flags){$(this.formid).find('[name="config[regexp_flags][]"][value="'+config.regexp_flags[i]+'"]').prop('checked',!0)}} +CollectorPattern.prototype={constructor:CollectorPattern,init:function(){var $_o=this;$($_o.formid).bind('submit',function(){$('#coll_tab_content').find('.tab-pane[id^="coll_pattern_"]').each(function(){if($(this).hasClass('active')){$($_o.formid+' [name="tab_link"]').val($(this).attr('id'));return}});var settings=getFormAjaxSettings($(this));settings.data={'_post_data_':settings.data};ajaxOpen(settings);return!1});$_o.cpFrontUrl=new CpFrontUrl($_o);$_o.cpLevelUrl=new CpLevelUrl($_o);$_o.cpRelationUrl=new CpRelationUrl($_o);$_o.cpUrlWeb=new CpUrlWeb($_o);$_o.cpRenderer=new CpRenderer($_o);$_o.cpContentSign=new CpContentSign($_o);$_o.cpPagination=new CpPagination($_o);$_o.cpField=new CpField($_o);$_o.cpProcess=new CpProcess($_o);inputSelectCustom($_o.formid+' select[name="config[charset]"]','config[charset_custom]',null,null,function(){$_o.cpUrlWeb.def_config_charset('')});inputSelectCustom($_o.formid+' select[name="config[encode]"]','config[encode_custom]',null,null,function(){$_o.cpUrlWeb.def_config_encode('')});$($_o.formid+' [name="config[page_render]"]').bind('click',function(){$_o.cpRenderer.def_config_renderer_open('')});$($_o.formid+' [name="config[request_headers][open]"]').bind('click',function(){$_o.cpUrlWeb.def_config_header_global('')});$($_o.formid+' #coll_pattern_request_headers .dm-useragent li a').bind('click',function(){$($_o.formid+' [name="config[request_headers][useragent]"]').val($(this).attr('data-useragent'))});$($_o.formid+' #coll_pattern_request_headers .add-request-header').bind('click',function(){$_o.add_request_header('','')});$($_o.formid+' #coll_pattern_request_headers .add-request-header-img').bind('click',function(){$_o.add_request_header_img('','')});$($_o.formid+' #coll_pattern_request_headers .add-request-header-file').bind('click',function(){$_o.add_request_header_file('','')});$($_o.formid+' .c-p-request-headers').on('click','.delete-request-header',function(){$(this).parents('tr').eq(0).remove()});$($_o.formid+' .c-p-request-headers-img').on('click','.delete-request-header-img',function(){$(this).parents('tr').eq(0).remove()});$($_o.formid+' .c-p-request-headers-file').on('click','.delete-request-header-file',function(){$(this).parents('tr').eq(0).remove()});$_o.init_page_list_op('front_url');$(this.formid+' #coll_pattern_source_url .add-source-url').bind('click',function(){windowModal('添加起始网址',ulink("cpattern/source"),{lg:1})});$(this.formid+' #coll_pattern_source_url .clear-source-url').bind('click',function(){$_o.source_op('clear_all')});$(this.formid+' #coll_pattern_source_url').on('click','.edit-source-url',function(){var parent=$(this).parents('[id^="source_url_"]').eq(0);var objid=parent.attr('id');var sourceUrl=parent.find('[name="config[source_url][]"]').val();sourceUrl=sourceUrl?sourceUrl:'';var url=ulink("cpattern/source");var options={lg:1};if(objid||sourceUrl){options.ajax={type:'post',data:{'source_url':sourceUrl,'objid':objid}}} +windowModal('添加起始网址',url,options)});$(this.formid+' #coll_pattern_source_url').on('click','.delete-source-url',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){obj.parents('[id^="source_url_"]').eq(0).remove()})});eleExchange(this.formid+' #coll_pattern_source_url','.icon-drag-move','[id^="source_url_"]');$(this.formid+' [name="config[source_is_url]"]').bind('click',function(){if($_o.source_is_url()){$('#coll_pattern_source_url').css('margin-bottom','0px');$('#alert_coll_pattern_link').show();$('#panel_coll_pattern_source_url_web').hide();$('#panel_coll_pattern_source_url_renderer').hide();$('#panel_coll_pattern_source_url_content_sign').hide();$('#panel_coll_pattern_source_url_pagination').hide();$('#panel_coll_pattern_level_url').hide();$('#panel_coll_pattern_url_content_sign').siblings('.panel').hide();$('#panel_coll_pattern_url_web').show();$('#panel_coll_pattern_url_renderer').show()}else{$('#coll_pattern_source_url').css('margin-bottom','15px');$('#alert_coll_pattern_link').hide();$('#panel_coll_pattern_source_url_web').show();$('#panel_coll_pattern_source_url_renderer').show();$('#panel_coll_pattern_source_url_content_sign').show();$('#panel_coll_pattern_source_url_pagination').show();$('#panel_coll_pattern_level_url').show();$('#panel_coll_pattern_url_content_sign').siblings('.panel').show()}});$_o.init_page('source_url');$_o.init_page('url');$($_o.formid).on('click','.c-p-url-page-signs .btn-page-signs',function(){$_o.parent_page_signs(this)});$_o.init_page_list_op('level_url');$_o.init_page_list_op('relation_url');$(this.formid+' #coll_pattern_field').on('click','.add-field',function(){$_o.field_editor(null,null)});$(this.formid+' #coll_pattern_field').on('click','.field-name',function(){$_o.field_editor($(this),null)});$(this.formid+' #coll_pattern_field').on('click','.add-field-default',function(){$_o.cpField.add_default()});$(this.formid+' #coll_pattern_field').on('click','.sort-field',function(){var fieldNames=$_o.get_field_names(!0);for(var i in fieldNames){var fieldTr=$($_o.formid+' #coll_pattern_field').find('.field-name[data-val="'+fieldNames[i]+'"]').parents('tr[id^="field_"]').eq(0);if(fieldTr.length>0){$($_o.formid+' #coll_pattern_field .c-p-field-list tbody').append(fieldTr)}} +toastr.success('调整完成')});$(this.formid+' #coll_pattern_field').on('click','.field-del',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){$_o.field_delete_tr(obj)})});$(this.formid+' #coll_pattern_field').on('click','.field-clone',function(){var tr=$(this).parents('tr[id^="field_"]').eq(0);var field=tr.find('[name="config[field_list][]"]').val();var process=tr.find('[name="config[field_process][]"]').val();confirmRight('确定复制字段?',function(){ajaxOpen({type:'POST',dataType:'json',url:ulink("cpattern/clone_field"),data:{field:field,process:process},success:function(data){if(data.code==1){data=data.data;var hasField=!1;do{data.field.name+='_1';hasField=$('#coll_pattern_field .c-p-field-list').find('.field-name[data-val="'+data.field.name+'"]');if(hasField&&hasField.length>0){hasField=!0}else{hasField=!1}}while(hasField);$_o.cpField.add(null,data.field,data.process);toastr.success('字段复制成功:'+data.field.name)}else{toastr.error(data.msg)}}})})});$(this.formid+' #coll_pattern_field').on('click','.field-process',function(){var process=$(this).parent().find('input[name="config[field_process][]"]').val();var prt=$(this).parents('tr[id^="field_"]').eq(0);var objid=prt.attr('id');var field=prt.find('.field-name').attr('data-val');var url=ulink("cpattern/process?task_id=_tid_&field=_field_",{'_tid_':$_o.get_task_id(),'_field_':field});windowModal('数据处理:'+field+'',url,{lg:1,ajax:{type:'post',data:{objid:objid,process:process}}});$_o.process_paste()});$(this.formid+' #coll_pattern_process').on('click','.add-process',function(){var url=ulink("cpattern/process?task_id=_tid_&type=common",{'_tid_':$_o.get_task_id()});windowModal('数据处理(通用)',url,{lg:1});$_o.process_paste()});eleExchange(this.formid+' #coll_pattern_field','.icon-drag-move','tr[id^="field_"]');$(this.formid+' [name="effective"]').val(1)},init_test:function(){var $_o=this;$_o.formid='#win_form_cache';$_o.cpUrlWeb=new CpUrlWeb($_o);$_o.cpRenderer=new CpRenderer($_o);$_o.cpUrlWeb.page_init('test');$_o.cpRenderer.page_init('test')},init_echo_url_msg:function(dataUrlWeb,dataRenderer){this.init_test();if(!isObject(dataUrlWeb)){dataUrlWeb={}} +if(!isObject(dataRenderer)){dataRenderer={}} +var hasUrlWeb=!1;for(var i in dataUrlWeb){hasUrlWeb=!0} +var hasRenderer=!1;for(var i in dataRenderer){hasRenderer=!0} +this.cpUrlWeb.page_load('test',dataUrlWeb);this.cpRenderer.page_load('test',dataRenderer);var urlWebForm=$('.c-p-url-web-form').parents('.form-group').eq(0);var urlWebBox=urlWebForm.parents('.panel[id]').eq(0);if(hasUrlWeb){urlWebBox=urlWebBox.find('.panel-body').eq(0);urlWebBox.html(urlWebForm)}else{urlWebBox.hide()} +var rendererList=$('.c-p-url-renderer-list').parents('.form-group').eq(0);var rendererBox=rendererList.parents('.panel[id]').eq(0);if(hasRenderer){rendererBox=rendererBox.find('.panel-body').eq(0);rendererBox.html(rendererList)}else{rendererBox.hide()}},load:function(config){var $_o=this;if(config){$(this.formid+' [name="config[charset_custom]"]').val(config.charset_custom);$(this.formid+' [name="config[charset]"]').val(config.charset).trigger('change');$(this.formid+' [name="config[encode_custom]"]').val(config.encode_custom);$(this.formid+' [name="config[encode]"]').val(config.encode).trigger('change');$(this.formid+' [name="config[url_complete]"][value="'+toInt(config.url_complete)+'"]').prop('checked',!0);$(this.formid+' [name="config[url_reverse]"][value="'+toInt(config.url_reverse)+'"]').prop('checked',!0);$(this.formid+' [name="config[page_render]"][value="'+toInt(config.page_render)+'"]').prop('checked',!0).trigger('click');$(this.formid+' [name="config[url_repeat]"][value="'+toInt(config.url_repeat)+'"]').prop('checked',!0);$(this.formid+' [name="config[url_no_name]"][value="'+toInt(config.url_no_name)+'"]').prop('checked',!0);$(this.formid+' [name="config[url_encode]"][value="'+toInt(config.url_encode)+'"]').prop('checked',!0);if(config.regexp_flags){for(var i in config.regexp_flags){$(this.formid).find('[name="config[regexp_flags][]"][value="'+config.regexp_flags[i]+'"]').prop('checked',!0)}} if(isObject(config.front_urls)){for(var i in config.front_urls){$_o.cpFrontUrl.add(null,config.front_urls[i])} showPanelCollapse('#coll_pattern_front_url')} if(config.source_url){var source_url_html_list='';var sourceParams={get:1};for(var i in config.source_url){sourceParams.source_url=config.source_url[i];source_url_html_list+=this.source_op('add',sourceParams)} @@ -31,7 +36,8 @@ if(config.request_headers.img>0){showPanelCollapse('#coll_pattern_request_header if(config.request_headers.img_names){var r_h_img_vals=config.request_headers.img_vals?config.request_headers.img_vals:{};for(var i in config.request_headers.img_names){$_o.add_request_header_img(config.request_headers.img_names[i],r_h_img_vals[i])}} if(config.request_headers.file>0){showPanelCollapse('#coll_pattern_request_headers');showPanelCollapse('#c_p_request_headers_file')} if(config.request_headers.file_names){var r_h_file_vals=config.request_headers.file_vals?config.request_headers.file_vals:{};for(var i in config.request_headers.file_names){$_o.add_request_header_file(config.request_headers.file_names[i],r_h_file_vals[i])}}}} -$(this.formid+' [name="effective_edit"]').val(1)},get_page_vars:function(pageType,returnKey){var title='';var boxId='';var namePre='';var formId='';if('front_url'==pageType){title='前置页';boxId='#c_p_front_url';namePre='front_url';formId=this.cpFrontUrl.formObj}else if('source_url'==pageType){title='起始页';boxId='#coll_pattern_source_url';namePre='config[source_config]';formId=this.formid}else if('level_url'==pageType){title='多级页';boxId='#c_p_level_url';namePre='level_url';formId=this.cpLevelUrl.formObj}else if('relation_url'==pageType){title='关联页';boxId='#c_p_relation_url';namePre='relation_url';formId=this.cpRelationUrl.formObj}else if('url'==pageType){title='内容页';boxId='#coll_pattern_url';namePre='config';formId=this.formid}else if('test'==pageType){title='';boxId='#win_coll_pattern_test';namePre='config';formId='#win_form_test'} +$(this.formid+' [name="effective_edit"]').val(1)},get_page_vars:function(pageType,returnKey,isPagination){var title='';var boxId='';var namePre='';var formId='';if('front_url'==pageType){title='前置页';boxId='#c_p_front_url';namePre='front_url';formId=this.cpFrontUrl.formObj}else if('source_url'==pageType){title='起始页';boxId='#coll_pattern_source_url';namePre='config[source_config]';formId=this.formid}else if('level_url'==pageType){title='多级页';boxId='#c_p_level_url';namePre='level_url';formId=this.cpLevelUrl.formObj}else if('relation_url'==pageType){title='关联页';boxId='#c_p_relation_url';namePre='relation_url';formId=this.cpRelationUrl.formObj}else if('url'==pageType){title='内容页';boxId='#coll_pattern_url';namePre='config';formId=this.formid}else if('test'==pageType){title='';boxId='#win_coll_pattern_test';namePre='config';formId='#win_form_test'} +if(isPagination){boxId+='_pagination';namePre+='[pagination]'} var data={title:title,boxId:boxId,namePre:namePre,formId:formId};if(returnKey){return data[returnKey]}else{return data}},page_is_list:function(pageType){if(pageType=='front_url'||pageType=='level_url'||pageType=='relation_url'){return!0}else{return!1}},init_page_list_op:function(pageType){var $_o=this;if(!$_o.page_is_list(pageType)){return} var pageVars=$_o.get_page_vars(pageType);var listObj='#c_p_'+pageType+'s';var parentObj='[id^="'+pageType+'_"]';$($_o.formid+' #coll_pattern_'+pageType+' .add-'+pageType.replace('_','-')).bind('click',function(){var url=ulink('cpattern/'+pageType);windowModal('添加'+pageVars.title+'规则',url,{lg:1})});$($_o.formid+' '+listObj).on('click','.name',function(){var parent=$(this).parents(parentObj).eq(0);var options={lg:1,ajax:{type:'post',data:{}}};options.ajax.data.objid=parent.attr('id');options.ajax.data[pageType]=parent.find('[name="config['+pageType+'s][]"]').val();windowModal('编辑'+pageVars.title+'规则',ulink('cpattern/'+pageType),options)});$($_o.formid+' '+listObj).on('click','.clone',function(){var parent=$(this).parents(parentObj).eq(0);var pageConfig=parent.find('[name="config['+pageType+'s][]"]').val();var postData={};postData[pageType]=pageConfig;confirmRight('确定复制'+pageVars.title+'?',function(){ajaxOpen({type:'POST',dataType:'json',url:ulink('cpattern/clone_'+pageType),data:postData,success:function(data){if(data.code==1){data=data.data;var hasName=!1;do{data[pageType].name+='_1';hasName=$($_o.formid+' '+listObj).find('.name[data-val="'+data[pageType].name+'"]');if(hasName&&hasName.length>0){hasName=!0}else{hasName=!1}}while(hasName);if(pageType=='front_url'){$_o.cpFrontUrl.add(null,data[pageType])}else if(pageType=='level_url'){$_o.cpLevelUrl.add(null,data[pageType])}else if(pageType=='relation_url'){$_o.cpRelationUrl.add(null,data[pageType])} toastr.success(pageVars.title+'复制成功:'+data[pageType].name)}else{toastr.error(data.msg)}}})})});$($_o.formid+' '+listObj).on('click','.delete',function(){var curObj=$(this);confirmRight('确定删除?',function(){curObj.parents(parentObj).eq(0).remove()})});eleExchange($_o.formid+' '+listObj,'.icon-drag-move','tbody tr')},init_page:function(pageType){var $_o=this;var pageVars=$_o.get_page_vars(pageType);var formId=pageVars.formId;var boxId=pageVars.boxId;var namePre=pageVars.namePre;if(!formId||!boxId||!namePre){return} @@ -47,7 +53,8 @@ $_o.cpUrlWeb.page_load(pageType,config.url_web);$_o.cpRenderer.page_load(pageTyp $(this).parents('div[source-param]').find('input[name="source[param]"]').prop('checked',!0)});if(params.source){$(formObj+' .nav-tabs').find('a[source-type="'+params.source.type+'"]').click();if(params.source.type=='custom'){$(formObj+' textarea[name="source[urls]"]').val(params.source.urls)}else if(params.source.type=='batch'){$(formObj+' input[name="source[url]"]').val(params.source.url);var param_type=params.source.param;if(param_type=='num'){$(formObj+' input[name="source[param_num_start]"]').val(params.source.param_num_start);$(formObj+' input[name="source[param_num_end]"]').val(params.source.param_num_end);$(formObj+' input[name="source[param_num_inc]"]').val(params.source.param_num_inc);if(params.source.param_num_desc){$(formObj+' input[name="source[param_num_desc]"]').prop('checked',!0)}}else if(param_type=='letter'){$(formObj+' input[name="source[param_letter_start]"]').val(params.source.param_letter_start);$(formObj+' input[name="source[param_letter_end]"]').val(params.source.param_letter_end);if(params.source.param_letter_desc){$(formObj+' input[name="source[param_letter_desc]"]').prop('checked',!0)}}else if(param_type=='custom'){$(formObj+' textarea[name="source[param_custom]"]').val(params.source.param_custom)} $(formObj+' input[name="source[param]"][value="'+param_type+'"]').prop('checked',!0)}else if(params.source.type=='large'){$(formObj+' textarea[name="source[large_urls]"]').val(params.source.large_urls)}else if(params.source.type=='api'){$(formObj+' input[name="source[api]"]').val(params.source.api);$(formObj+' input[name="source[api_json]"]').val(params.source.api_json)}}}else if(op=='add'){var html='';if(params.html){html=params.html}else{var htmlObj=$_o.clone_tpl('#coll_tpl_source_url');htmlObj.find('[data-id="source_url_"]').attr('id','source_url_'+generateUUID()).removeAttr('data-id');var regLarge=/[\r\n]/;if(regLarge.test(params.source_url)){htmlObj.find('input[name="config[source_url][]"]').remove()}else{htmlObj.find('textarea[name="config[source_url][]"]').remove()} html=htmlObj.html();html=html?html:'';html=html.replace('[_source_url_]',htmlspecialchars(params.source_url))} -if(params.get){return html}else{this.source_op('clear_null');$($_o.formid+' #coll_pattern_source_url .c-p-source-urls').append(html)}}else if(op=='add_sub'){ajaxOpen({type:'POST',dataType:'json',url:$(formObj).attr('action'),data:$(formObj).serialize(),success:function(data){var dataList=data.data?data.data:{};var objid=dataList.objid?dataList.objid:'';var addParams={};if(data.code==1){var source_type=$(formObj).find('input[name="source[type]"]').val();if(source_type=='custom'){$('#myModal').modal('hide');var urls=dataList.urls;var ix=0;var url_html_list='';for(var i in urls){addParams.get=1;addParams.source_url=urls[i];ix++;if(ix==1){if(objid){var newSource=$_o.source_op('add',addParams);$('#'+objid).replaceWith(newSource);continue}} +if(params.get){return html}else{this.source_op('clear_null');$($_o.formid+' #coll_pattern_source_url .c-p-source-urls').append(html)}}else if(op=='add_sub'){ajaxOpen({type:'POST',dataType:'json',url:$(formObj).attr('action'),data:$(formObj).serialize(),success:function(data){var dataList=data.data?data.data:{};var objid=dataList.objid?dataList.objid:'';var addParams={};if(data.code==1){var source_type=$(formObj).find('input[name="source[type]"]').val();if(source_type=='custom'&&isObject(dataList.urls)&&dataList.urls.length>20){source_type='large'} +if(source_type=='custom'){$('#myModal').modal('hide');var urls=dataList.urls;var ix=0;var url_html_list='';for(var i in urls){addParams.get=1;addParams.source_url=urls[i];ix++;if(ix==1){if(objid){var newSource=$_o.source_op('add',addParams);$('#'+objid).replaceWith(newSource);continue}} url_html_list+=$_o.source_op('add',addParams)} if(url_html_list){$_o.source_op('add',{html:url_html_list})}}else if(source_type=='batch'){if(params.preview==1){var urls=dataList.urls;var txt='';for(var i in urls){txt+=urls[i]+"\r\n"} $(formObj).find('#source_preview').val(txt)}else{if(objid){addParams.get=1;addParams.source_url=dataList.url;var newSource=$_o.source_op('add',addParams);$('#'+objid).replaceWith(newSource)}else{addParams.source_url=dataList.url;$_o.source_op('add',addParams)} @@ -70,16 +77,18 @@ if(returnMergeSigns){var mergeSigns=[];for(var i in signs.area){var curSign=sign for(var i in signs.url){var curSign=signs.url[i];if(mergeSigns.indexOf(curSign)<=-1&&signs.content.indexOf(curSign)<=-1){mergeSigns.push(curSign)}} for(var i in signs.content){var curSign=signs.content[i];if(mergeSigns.indexOf(curSign)<=-1){mergeSigns.push(curSign)}} return mergeSigns}else{return signs}},parent_page_signs:function(dropdownBtn){var $_o=this;var boxObj=$(dropdownBtn).parents('.c-p-url-page-signs').eq(0);if(!boxObj||boxObj.length<=0){return} -var pageType=boxObj.attr('data-page-type');var inputName=boxObj.attr('data-input-name');var pageVars=$_o.get_page_vars(pageType);var formId=pageVars.formId;var namePre=pageVars.namePre;if(!pageType||!inputName||!formId){return} +var pageType=boxObj.attr('data-page-type');var inputName=boxObj.attr('data-input-name');var isPagination=boxObj.attr('data-is-pagination');var pageVars=$_o.get_page_vars(pageType);var formId=pageVars.formId;var namePre=pageVars.namePre;if(!pageType||!inputName||!formId){return} var dropdownMenu=boxObj.find('.dropdown-menu');if(dropdownMenu.length>0){$(dropdownMenu).html('')} var iptObj=boxObj.find('[name="'+inputName+'"]');if(!iptObj||iptObj.length<=0){iptObj=null} -var frontUrls=new Array();$('#c_p_front_urls [id^="front_url_"]').each(function(){var frontUrl=$(this).find('[name="config[front_urls][]"]').val();frontUrls.push(frontUrl)});var levelUrls=new Array();$('#c_p_level_urls [id^="level_url_"]').each(function(){var levelUrl=$(this).find('[name="config[level_urls][]"]').val();levelUrls.push(levelUrl)});var relationUrls=new Array();$('#c_p_relation_urls [id^="relation_url_"]').each(function(){var relationUrl=$(this).find('[name="config[relation_urls][]"]').val();relationUrls.push(relationUrl)});var sourceConfig={};sourceConfig.area='';sourceConfig.url_rule='';sourceConfig.content_signs=$_o.get_content_signs($_o.formid+' [name="config[source_config][content_signs][]"]');var urlConfig={};urlConfig.area=$($_o.formid+' [name="config[area]').val();urlConfig.url_rule=$($_o.formid+' [name="config[url_rule]"]').val();urlConfig.content_signs=$_o.get_content_signs($_o.formid+' [name="config[content_signs][]"]');var pageConfig={name:'',area:'',url_rule:'',content_signs:''};var mergeType=iptObj.attr('data-merge-type');mergeType=mergeType?mergeType:'';if($_o.page_is_list(pageType)){var objid='';if(mergeType=='content_sign'){var csPageConfig=$_o.cpContentSign.curPageConfig;objid=csPageConfig.objid;if(pageType=='relation_url'){pageConfig.page=csPageConfig.relation_url.page} +var frontUrls=new Array();$('#c_p_front_urls [id^="front_url_"]').each(function(){var frontUrl=$(this).find('[name="config[front_urls][]"]').val();frontUrls.push(frontUrl)});var levelUrls=new Array();$('#c_p_level_urls [id^="level_url_"]').each(function(){var levelUrl=$(this).find('[name="config[level_urls][]"]').val();levelUrls.push(levelUrl)});var relationUrls=new Array();$('#c_p_relation_urls [id^="relation_url_"]').each(function(){var relationUrl=$(this).find('[name="config[relation_urls][]"]').val();relationUrls.push(relationUrl)});var sourceConfig={};sourceConfig.area='';sourceConfig.url_rule='';sourceConfig.content_signs=$_o.get_content_signs($_o.formid+' [name="config[source_config][content_signs][]"]');if(isPagination){sourceConfig.pagination={area:$($_o.formid).find('[name="config[source_config][pagination][area]"]').val(),url_rule:$($_o.formid).find('[name="config[source_config][pagination][url_rule]"]').val()}} +var urlConfig={};urlConfig.area=$($_o.formid+' [name="config[area]"]').val();urlConfig.url_rule=$($_o.formid+' [name="config[url_rule]"]').val();urlConfig.content_signs=$_o.get_content_signs($_o.formid+' [name="config[content_signs][]"]');if(isPagination){urlConfig.pagination={area:$($_o.formid).find('[name="config[pagination][area]"]').val(),url_rule:$($_o.formid).find('[name="config[pagination][url_rule]"]').val()}} +var pageConfig={name:'',area:'',url_rule:'',content_signs:''};var mergeType=iptObj.attr('data-merge-type');mergeType=mergeType?mergeType:'';if($_o.page_is_list(pageType)){var objid='';if(mergeType=='content_sign'){var csPageConfig=$_o.cpContentSign.curPageConfig;objid=csPageConfig.objid;if(pageType=='relation_url'){pageConfig.page=csPageConfig.relation_url.page} pageConfig.area=csPageConfig[namePre].area;pageConfig.url_rule=csPageConfig[namePre].url_rule;pageConfig.content_signs=csPageConfig[namePre].content_signs}else{objid=$(formId).find('[name="objid"]').val();if(pageType=='relation_url'){pageConfig.page=$(formId).find('[name="relation_url[page]"]').val()} pageConfig.area=$(formId).find('[name="'+namePre+'[area]"]').val();pageConfig.url_rule=$(formId).find('[name="'+namePre+'[url_rule]"]').val();pageConfig.content_signs=$_o.get_content_signs(formId+' [name="'+namePre+'[content_signs][]"]')} if(objid){pageConfig.name=$('#'+objid).find('.name').attr('data-val')} -pageConfig.name=pageConfig.name?pageConfig.name:'';pageConfig.area=pageConfig.area?pageConfig.area:'';pageConfig.url_rule=pageConfig.url_rule?pageConfig.url_rule:''} +pageConfig.name=pageConfig.name?pageConfig.name:'';pageConfig.area=pageConfig.area?pageConfig.area:'';pageConfig.url_rule=pageConfig.url_rule?pageConfig.url_rule:'';if(isPagination){pageConfig.pagination={area:$(formId).find('[name="'+namePre+'[pagination][area]"]').val(),url_rule:$(formId).find('[name="'+namePre+'[pagination][url_rule]"]').val()}}} if(mergeType=='content_sign'){mergeType+=':'+$($_o.cpContentSign.formObj+' [name="objid"]').attr('data-identity')} -var sourceIsUrl=$_o.source_is_url();ajaxOpen({type:'POST',dataType:'json',url:ulink("cpattern/page_signs"),data:{front_urls:frontUrls,source_config:sourceConfig,level_urls:levelUrls,relation_urls:relationUrls,url_config:urlConfig,page_config:pageConfig,page_type:pageType,merge_type:mergeType,source_is_url:sourceIsUrl},success:function(data){if(data.code==1){data=data.data;var pageSort=data.sort;var allSigns=data.signs;var html='';var valSigns=null;if(iptObj){valSigns=ruleInsertSign.matchN(null,null,{rule:iptObj.val()})} +var sourceIsUrl=$_o.source_is_url();ajaxOpen({type:'POST',dataType:'json',url:ulink("cpattern/page_signs"),data:{front_urls:frontUrls,source_config:sourceConfig,level_urls:levelUrls,relation_urls:relationUrls,url_config:urlConfig,page_config:pageConfig,page_type:pageType,merge_type:mergeType,source_is_url:sourceIsUrl,is_pagination:isPagination},success:function(data){if(data.code==1){data=data.data;var pageSort=data.sort;var allSigns=data.signs;var html='';var valSigns=null;if(iptObj){valSigns=ruleInsertSign.matchN(null,null,{rule:iptObj.val()})} if(!valSigns||typeof(valSigns)!='object'){valSigns=new Array()} var nullTips='';if(sourceIsUrl){nullTips='起始页已设为内容页'} for(var asi in allSigns){var pageSigns=allSigns[asi]?allSigns[asi]:{};var pageName=pageSigns.name;var signs=pageSigns.signs;signs=signs?signs:{};html+='执行顺序:从上至下判断,逻辑符“并且”的优先级高于“或者”
'+'例如(字母表示条件):
'+'a && b || c && d && e || f || g && h && i && j 等同于
'+'(a && b) || (c && d && e) || f || (g && h && i && j)
'+'括号中的条件都为真时才是真否则为假,整条语句中任意一个括号的结果为真最终结果为真,都为假最终结果为假
';confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})});$($_o.processForm).on('click','.p-m-api-add',function(){var apiTable=$(this).parents('section').eq(0).find('.p-m-api-table table');apiTable.find('tbody').append('执行顺序:从上至下判断,逻辑符“并且”的优先级高于“或者”
'+'例如(字母表示条件):
'+'a && b || c && d && e || f || g && h && i && j 等同于
'+'(a && b) || (c && d && e) || f || (g && h && i && j)
'+'括号中的条件都为真时才是真否则为假,整条语句中任意一个括号的结果为真最终结果为真,都为假最终结果为假
';confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})});$_o.txt_insert_field($_o.processForm,'.p-m-api-url-field select',function(sltObj){return $(sltObj).parents('section').eq(0).find('[data-process="api:api_url"]')});$($_o.processForm).on('click','.p-m-api-add',function(){var apiTable=$(this).parents('section').eq(0).find('.p-m-api-table table');apiTable.find('tbody').append('抓取第'+level+'级页面 “'+data.levelName+'”:'+data.levelOpened+urls[i]+'
抓取第'+level+'级页面 “'+data.levelName+'”:'+data.levelOpened+urls[i]+urlMsgLink+'
'+htmlspecialchars($(objId).val())+'')});$($_o.box_id).off('click','[data-test-visualize]').on('click','[data-test-visualize]',function(){var objId='#'+$(this).attr('data-test-visualize');visualizeData($(objId).val())});$($_o.box_id+' button.test-sub').bind('click',function(){$_o.abort_test();var testOp=$($_o.box_id+' button.dropdown-toggle').attr('data-test');testOp=testOp?testOp:'get_fields';$_o.test_async=testOp=='get_browser'?false:!0;$_o.load_input_url(function(){var test_url=$($_o.box_id+' input[name="test_url"]').val();var page_source=$($_o.box_id+' [name="page_source"]').val();if(!test_url){toastr.error('请输入网址')}else{$($_o.box_id+' .field-vals').html('');var url=ulink('cpattern_test/_op_?coll_id=_collid_&page_source=_source_&test_url=_url_',{'_op_':testOp,'_source_':page_source,'_collid_':$_o.coll_id,'_url_':test_url});$('#win_input_urls').find('[name]').each(function(){url+='&'+$(this).attr('name')+'='+encodeURIComponent($(this).val())});if(testOp=='get_html'){$_o.ajax({type:'get',url:url,dataType:'html',success:function(data){if(dataIsJson(data)){var json=eval('('+data+')');if(json.msg){$($_o.box_id+' .field-vals').html(json.msg)}else{var html='';$($_o.box_id+' .field-vals').html(html);var jsonTreeFunc=function(){window.tool_json_tree.treeId='#win_json_tree';window.tool_json_tree.load(data)};if(window.tool_json_tree){jsonTreeFunc()}else{$.getScript(window.site_config.pub+'/static/js/admin/tool_json_tree.js',jsonTreeFunc)}}}else{var eleId=generateUUID();data=data.replace(/\/g,'>');var html=' 预览/分析网页';$($_o.box_id+' .field-vals').html(html);$($_o.box_id).find('[data-test-browser]').bind('click',function(){var pageSource=$($_o.box_id+' [name="page_source"]').val();var testUrl=$($_o.box_id+' input[name="test_url"]').val();var inputedUrls={};$('#win_input_urls').find('[name]').each(function(){inputedUrls[$(this).attr('name')]=$(this).val()});var browserUrl=cpBrowserUrl($_o.coll_id,pageSource,testUrl,inputedUrls);window.open(browserUrl,'_blank')})}}})}else{if(testOp=='get_signs'){if($('#win_test_signs').find('[name="signs_cur_all"]').is(':checked')){url+='&signs_cur_all=1'}}else if(testOp=='get_pagination'){url+='&pagination_type='+$('#win_test_pagination').find('[name="pagination_type"]:checked').val()} -$_o.ajax({type:'get',url:url,dataType:'json',async:$_o.test_async,success:function(data){if(data.code==1){var html='';if(testOp=='get_pagination'){var pnType=data.data.pagination_type;var pnUrls=data.data.urls;if(!pnType){html='