diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index db3543eff..c00906b4b 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -1,16 +1,4 @@ $(function(){ - //扩展jquery,增加全局函数 - $.ipcommon=function(){ - return {}; - } - $.extend($.ipcommon, { - ipType:[], - ipPattern:[], - portPattern:[], - protocol:[], - direction:[] - - }); $("select[name$='isHexbin']").each(function(){ setIsHexBin(this); }); @@ -33,9 +21,9 @@ $(function(){ text=$(element).text().trim() } //增加换行 - var count = Math.floor(text.length/34); + var count = Math.floor(text.length/52); for(var i=1;i<=count;i++){ - text=text.substring(0,i*34-1)+"\n"+text.substring(i*34-1); + text=text.substring(0,i*52-1)+"\n"+text.substring(i*52-1); } //特殊字符转义 text=text.replace(/[<>&"]/g,function(c){return {'<':'<','>':'>','&':'&','"':'"'}[c];}); @@ -49,7 +37,7 @@ $(function(){ }) html +=""; - top.$.jBox(html,{height:400,width:400,title:" Log Info",showIcon:false,opacity:0.5}); + top.$.jBox(html,{height:450,width:600,title:" Log Info",showIcon:false,opacity:0.5}); }) var tree2 = $("select[name=lableTest]").treeMultiselect({ searchable: true, @@ -1465,7 +1453,6 @@ var initCommIpVal=function(){ //ip类型处理 if(ipType){ var arr=ipType.split(','); - $.ipcommon.ipType=$("select[name$='ipPattern'] option"); $("select[name$='ipType'] option").each(function(){ var has=false; for(var type in arr){ @@ -1478,14 +1465,13 @@ var initCommIpVal=function(){ } } if(!has){ - $(this).remove(); + $(this).attr("disabled",true); } }); } //ip格式处理 if(ipPattern){ arr=ipPattern.split(','); - $.ipcommon.ipPattern=$("select[name$='ipPattern'] option"); $("select[name$='ipPattern'] option").each(function(){ var has=false; for(var type in arr){ @@ -1498,16 +1484,13 @@ var initCommIpVal=function(){ } } if(!has){ - $(this).remove(); + $(this).attr("disabled",true); } }); - }else{ - $.ipcommon.ipPattern=[]; } //端口格式处理 if(portPattern){ arr=portPattern.split(','); - $.ipcommon.portPattern=$("select[name$='portPattern'] option"); $("select[name$='portPattern'] option").each(function(){ var has=false; for(var type in arr){ @@ -1520,16 +1503,13 @@ var initCommIpVal=function(){ } } if(!has){ - $(this).remove(); + $(this).attr("disabled",true); } }); - }else{ - $.ipcommon.portPattern=[]; } //方向处理 if(direction){ arr=direction.split(','); - $.ipcommon.direction=$("select[name$='direction'] option"); $("select[name$='direction'] option").each(function(){ var has=false; for(var type in arr){ @@ -1542,16 +1522,13 @@ var initCommIpVal=function(){ } } if(!has){ - $(this).remove(); + $(this).attr("disabled",true); } }); - }else{ - $.ipcommon.direction=[]; } //协议处理 if(protocol){ arr=protocol.split(','); - $.ipcommon.protocol=$("select[name$='protocol'] option"); $("select[name$='protocol'] option").each(function(){ var has=false; for(var type in arr){ @@ -1564,10 +1541,8 @@ var initCommIpVal=function(){ } } if(!has){ - $(this).remove(); + $(this).attr("disabled",true); } }); - }else{ - $.ipcommon.protocol=[]; } } \ No newline at end of file diff --git a/src/main/webapp/static/pages/scripts/pageLogs.js b/src/main/webapp/static/pages/scripts/pageLogs.js index 252d4efda..d42f8929a 100644 --- a/src/main/webapp/static/pages/scripts/pageLogs.js +++ b/src/main/webapp/static/pages/scripts/pageLogs.js @@ -10,7 +10,7 @@ $(document).ready(function() { this.title=str; }); var fontSize = 0; - $("table.logTb th").each(function(){ + $("table.logTb th").each(function(j){ // 判断是否支持currentStyle属性 是:IE 否:FF or Chrome var finalStyle = this.currentStyle ? this.currentStyle : document.defaultView.getComputedStyle(this , null); fontSize = (finalStyle.fontSize).replace("px",""); @@ -20,11 +20,15 @@ $(document).ready(function() { // URL列加宽 var th = this; var thText = this.innerText; - $("table.logTb td").each(function(){ - var tdText = this.innerText; - if((tdText.trim().length > thText.trim().length) && (thText == "URL" || thText == "Log URI")){ - th.setAttribute('width','110px'); - } + //将字符串过宽的列增加宽度 + $("table.logTb tbody tr").each(function(){ + $(this).find("td").each(function(i){ + var tdText = this.innerText; + if((tdText.trim().length > thText.trim().length) && j==i && tdText.trim().length>7){ + var px = getPixelsCount(thText,fontSize)+100; + th.setAttribute('width',px+'px'); + } + }); }); });