From e08d08c6d44a410054a738972fcaeae49cf31937 Mon Sep 17 00:00:00 2001 From: zhengyingying Date: Fri, 28 Mar 2014 14:43:42 +0800 Subject: [PATCH] fix the bug on insertAfter function in pluign-new.js --- .../src/main/webapp/bench4q-css/plugin.css | 4 +++ .../src/main/webapp/script/plugin-new.js | 35 +++++++++++++------ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Bench4Q-Web/src/main/webapp/bench4q-css/plugin.css b/Bench4Q-Web/src/main/webapp/bench4q-css/plugin.css index aaa51172..0e4f6bef 100644 --- a/Bench4Q-Web/src/main/webapp/bench4q-css/plugin.css +++ b/Bench4Q-Web/src/main/webapp/bench4q-css/plugin.css @@ -105,4 +105,8 @@ td,th{ #submitBehaviors p{ margin-top:10px; margin-left:10px; +} + +.visited{ + background-color:#FFFBD1; } \ No newline at end of file diff --git a/Bench4Q-Web/src/main/webapp/script/plugin-new.js b/Bench4Q-Web/src/main/webapp/script/plugin-new.js index abf724b5..5720e86c 100644 --- a/Bench4Q-Web/src/main/webapp/script/plugin-new.js +++ b/Bench4Q-Web/src/main/webapp/script/plugin-new.js @@ -193,22 +193,25 @@ function showPluginMethod(plugin, method) { $(documentChild[j]).attr("id",parseInt(j+1)); } mark=clickNode; + pluginMethodList[mark]=behaviorData; } else if (place == "after") { mark=parseInt(clickNode+1); - for(var j=length-1;j>=clickNode+1;j--){ - pluginMethodList[j+1]=pluginMethodList[j]; - $(documentChild[j]).attr("id",parseInt(j+1)); + if(clickNode==(length-1) && clickNode!=-1){ + pluginMethodList.push(behaviorData); + }else{ + for(var j=length-1;j>=clickNode+1;j--){ + pluginMethodList[j+1]=pluginMethodList[j]; + $(documentChild[j]).attr("id",parseInt(j+1)); + } + pluginMethodList[mark]=behaviorData; } - } $('#insertBefore').attr("class","show"); - pluginMethodList[mark]=behaviorData; $('#myModal_Behavior').modal('hide'); - createPluginMethodLines(behaviorData,mark); - + createPluginMethodLines(); } -function createPluginMethodLines(behaviorData,mark){ +function createPluginMethodLines(){ document.getElementById("showPluginMethod").innerHTML=""; document.getElementById('behaviorArea').innerHTML=""; for(var j=0;j