├── README.md ├── css └── base.css ├── imgs ├── exchanger_icon.png ├── node_icon.png ├── server_icon.png └── subnetwork_icon.png ├── index.html └── js ├── com.js ├── jquery.js ├── jtopo-min.js └── toolbar.js /README.md: -------------------------------------------------------------------------------- 1 | # jTopo 2 | draw the network topology with javascript 3 | 4 | based on canvas 5 | -------------------------------------------------------------------------------- /css/base.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: auto; 3 | font-family: 微软雅黑; 4 | font-size: 14px; 5 | padding-top: 60px; 6 | padding-bottom: 10px; 7 | } 8 | * { 9 | padding: 0px; 10 | margin: 0px; 11 | } 12 | 13 | h1, h2, h3, h4, h5, h6 { 14 | font-weight: 700; 15 | font-family: "klavika-web", "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif !important; 16 | } 17 | 18 | h1 { 19 | font-size: 2em; 20 | margin: 0 0 0.33em; 21 | } 22 | 23 | ol,ul,li{ 24 | list-style: none; 25 | } 26 | 27 | .wrap_div{ 28 | width: 1240px; 29 | } 30 | 31 | 32 | .active{ 33 | box-shadow: inset 0 0 5px rgba(0,0,0, 0.4), rgba(255,255,255,0.1) 0 1px 0; 34 | } 35 | 36 | /* api/demo 展示 开始*/ 37 | .content{ 38 | background-color: white; 39 | min-height: 500px; 40 | } 41 | .content .clear{ 42 | clear: both; 43 | } 44 | 45 | .content .left{ 46 | padding: 20px; 47 | text-align: left; 48 | float: left; 49 | width: 297px; 50 | } 51 | 52 | .content .left ol, ul { 53 | padding: 0; 54 | } 55 | .content .left li { 56 | padding-left: 20px; 57 | line-height: 15px; 58 | list-style-type: none; 59 | background: url(../img/bullet.png) no-repeat 0 14px; 60 | text-shadow: 0 1px 0 #ffffff; 61 | } 62 | 63 | .content .left li a { 64 | color: #4d4d4d; 65 | text-decoration: none; 66 | padding: 8px 0; 67 | display: block; 68 | } 69 | 70 | /* 右侧 */ 71 | .content .right{ 72 | float:right; 73 | width: 900px; 74 | text-align: left; 75 | padding-top: 5px; 76 | } 77 | .content .right h1 { 78 | font-size: 36px; 79 | line-height: 36px; 80 | } 81 | 82 | .content .right article, aside, details, figcaption, figure, footer, header, hgroup, nav, section, summary { 83 | display: block; 84 | } 85 | .content .right .hentry { 86 | padding: 10px 20px; 87 | margin: 15px 0; 88 | border: 1px solid rgba( 0, 0, 0, 0.2 ); 89 | border-radius: 5px; 90 | background-color: #eee; 91 | position: relative; 92 | } 93 | .content .right .entry-title a { 94 | font-size: 20px; 95 | text-shadow: 0 1px 1px #fff; 96 | text-decoration: none; 97 | color: #0769AD; 98 | } 99 | 100 | .content .right .category { 101 | padding: 4px; 102 | background-color: #ddd; 103 | border-radius: 5px; 104 | } 105 | 106 | .content .right .entry-meta { 107 | float: right; 108 | color: #999; 109 | font-size: 12px; 110 | } 111 | 112 | .content .right .entry-meta .category a { 113 | color: #888; 114 | text-decoration: none; 115 | } 116 | /* api demo 展示---结束 */ 117 | @media (min-width: 992px) 118 | .col-md-8 { 119 | width: 66.66666666666666%; 120 | } 121 | @media (min-width: 992px) 122 | .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { 123 | float: left; 124 | } 125 | .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { 126 | position: relative; 127 | min-height: 1px; 128 | padding-right: 15px; 129 | padding-left: 15px; 130 | } 131 | label{ 132 | display: inline-block; 133 | } 134 | #components{ 135 | min-height: 400px; 136 | border: 1px solid #ccc; 137 | padding: 5px; 138 | } 139 | #target{ 140 | min-height: 400px; 141 | border: 1px solid #ccc; 142 | padding: 5px; 143 | } 144 | #components .component{ 145 | text-align: center; 146 | margin: 5px; 147 | } 148 | #target .component{ 149 | border: 1px solid #fff; 150 | } 151 | .icon{ 152 | display: inline-block; 153 | width:48px; 154 | height: 48px; 155 | margin-right: auto; 156 | margin-left: auto; 157 | padding: 4px 0; 158 | text-align: center; 159 | vertical-align: middle; 160 | cursor: pointer; 161 | } 162 | .linkline{ 163 | text-align: center; 164 | } 165 | .line{ 166 | display: inline-block; 167 | width: 48px; 168 | height: 26px; 169 | cursor: pointer; 170 | } 171 | .greenline{ 172 | border-bottom: 4px solid rgba(144,238,144,1); 173 | } 174 | .orangeline{ 175 | border-bottom: 4px solid rgba(255,165,0,1); 176 | } 177 | .redline{ 178 | border-bottom: 4px dotted rgba(255,0,0,1); 179 | } 180 | .exchanger{ 181 | background: url("../imgs/exchanger_icon.png") no-repeat center center; 182 | } 183 | .node{ 184 | background: url("../imgs/node_icon.png") no-repeat center center; 185 | } 186 | .server{ 187 | background: url("../imgs/server_icon.png") no-repeat center center; 188 | } 189 | .subnetwork{ 190 | background: url("../imgs/subnetwork_icon.png") no-repeat center center; 191 | } 192 | 193 | #contextmenu, #linemenu, #detail { 194 | border: 1px solid #aaa; 195 | border-bottom: 0; 196 | background: #eee; 197 | position: absolute; 198 | list-style: none; 199 | margin: 0; 200 | padding: 0; 201 | display: none; 202 | } 203 | #contextmenu li a, #linemenu li a { 204 | display: block; 205 | padding: 10px; 206 | border-bottom: 1px solid #aaa; 207 | cursor: pointer; 208 | } 209 | #contextmenu li a:hover, #linemenu li a:hover { 210 | background: #fff; 211 | } 212 | select{ 213 | width: 160px; 214 | margin-bottom: 0px; 215 | } 216 | .jtopo_toolbar{ 217 | margin-bottom: 5px; 218 | } -------------------------------------------------------------------------------- /imgs/exchanger_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuln/jTopo/6f76905f54ae88a24dae9956fd275ae93a54615c/imgs/exchanger_icon.png -------------------------------------------------------------------------------- /imgs/node_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuln/jTopo/6f76905f54ae88a24dae9956fd275ae93a54615c/imgs/node_icon.png -------------------------------------------------------------------------------- /imgs/server_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuln/jTopo/6f76905f54ae88a24dae9956fd275ae93a54615c/imgs/server_icon.png -------------------------------------------------------------------------------- /imgs/subnetwork_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuln/jTopo/6f76905f54ae88a24dae9956fd275ae93a54615c/imgs/subnetwork_icon.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 31 | 34 | 35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 |
46 |
47 | 48 |
49 |
50 | 51 |
52 |
53 | 54 |
55 |
56 | 57 |
58 |
59 | 60 |
61 |
62 |
63 |
64 | 65 | 66 |
67 |
68 |
69 |
70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /js/com.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | var canvas = document.getElementById('target'); 3 | var stage = new JTopo.Stage(canvas); 4 | //显示工具栏 5 | showJTopoToobar(stage); 6 | var scene = new JTopo.Scene(stage); 7 | // var colors = ['0,0,255','144,238,144','255,165,0','255,0,0']; //蓝色、绿色、橙色、红色 8 | var currentNode = null; 9 | var currentLine = null; 10 | var currentDetail = { 11 | 'OS': "CentOS 7", 12 | 'RAM': "8GB", 13 | 'cpu': "四核", 14 | "磁盘": "256GB" 15 | } 16 | // var currentType = '1'; 17 | var beginNode = null; 18 | var tempNodeA = new JTopo.Node('tempA'); 19 | tempNodeA.setSize(1, 1); 20 | var tempNodeZ = new JTopo.Node('tempZ'); 21 | tempNodeZ.setSize(1, 1); 22 | var link = newLink(tempNodeA, tempNodeZ); 23 | 24 | scene.mousemove(function(e){ 25 | tempNodeZ.setLocation(e.x, e.y); 26 | }); 27 | 28 | $(".coms").delegate(".component", "mousedown", function(md){ 29 | md.preventDefault(); 30 | var mouseX = md.pageX; 31 | var mouseY = md.pageY; 32 | var $this = $(this); 33 | var $temp = $("
").append($this.clone()); 34 | $("body").append($temp); 35 | $temp.css({"position" : "absolute", 36 | "top" : mouseY - ($temp.height()/2) + "px", 37 | "left" : mouseX - ($temp.width()/2) + "px", 38 | "opacity" : "0.9"}).show(); 39 | var half_box_height = ($temp.height()/2); 40 | var half_box_width = ($temp.width()/2); 41 | var $target = $("#target"); 42 | 43 | $(document).delegate("body", "mousemove", function(mm){ 44 | var mm_mouseX = mm.pageX; 45 | var mm_mouseY = mm.pageY; 46 | $temp.css({"top": mm_mouseY - half_box_height + "px" ,"left" : mm_mouseX - half_box_width + "px"}); 47 | }); 48 | 49 | $("body").delegate("#temp", "mouseup", function(mu){ 50 | mu.preventDefault(); 51 | var mu_mouseX = mu.pageX; 52 | var mu_mouseY = mu.pageY; 53 | var tar_pos = $target.position(); 54 | 55 | if (mu_mouseX + half_box_width > tar_pos.left && 56 | mu_mouseX - half_box_width < tar_pos.left + $target.width()&& 57 | mu_mouseY + half_box_height > tar_pos.top && 58 | mu_mouseY - half_box_height < tar_pos.top + $target.height() 59 | ){ 60 | var child = $temp.children()[0]; 61 | 62 | var tmpnode = { 63 | name: child.title, 64 | left: parseInt($temp.css('left')) - tar_pos.left, 65 | top: parseInt($temp.css("top")) - tar_pos.top, 66 | type: child.title + '_icon.png' 67 | }; 68 | addNode(tmpnode); 69 | } 70 | $temp.remove(); 71 | $(document).undelegate("body", "mousemove"); 72 | $("body").undelegate("#temp","mouseup"); 73 | }); 74 | }); 75 | 76 | // $(".coms .line").click(function(e){ 77 | // currentType = e.target.id; 78 | // }); 79 | 80 | function addNode(node){ 81 | var n = new JTopo.Node(node.name); 82 | n.setLocation(node.left, node.top); 83 | n.setImage("imgs/" + node.type); 84 | n.fontColor = '155,123,2'; 85 | n.font = 'bold 12px 微软雅黑'; 86 | scene.add(n); 87 | n.addEventListener('mouseup', function(e){ 88 | currentNode = this; 89 | handler(e); 90 | }); 91 | n.mousedown(function(e){ 92 | if(e.target == null || e.target === beginNode || e.target === link){ 93 | scene.remove(link); 94 | } 95 | }); 96 | } 97 | 98 | function newLink(nodeA, nodeZ){ 99 | var linestyle = $("#linestyle").val(); 100 | var l = null; 101 | if(linestyle == 'defaultline'){ 102 | l = new JTopo.Link(nodeA, nodeZ); 103 | l.lineWidth = 3; 104 | l.strokeColor = '0,200,255'; 105 | l.arrowsRadius = 12; 106 | l.shadow = false; 107 | l.bundleGap = 20; 108 | } else if (linestyle == "simpleline") { 109 | l = new JTopo.Link(nodeA, nodeZ); 110 | l.lineWidth = 3; 111 | l.dashedPattern = 5; 112 | l.arrowsRadius = 12; 113 | l.bundleOffset = 60; 114 | l.bundleGap = 20; 115 | l.textOffsetY = 3; 116 | l.strokeColor = '0,200,255'; 117 | } else if (linestyle == "polyline") { 118 | l = new JTopo.FoldLink(nodeA, nodeZ); 119 | l.direction = 'horizontal'; 120 | l.arrowsRadius = 12; 121 | l.lineWidth = 3; 122 | l.bundleOffset = 60; // 折线拐角处的长度 123 | l.bundleGap = 20; // 线条之间的间隔 124 | l.textOffsetY = 3; // 文本偏移量(向下3个像素) 125 | l.strokeColor = '255,165,0'; 126 | l.dashedPattern = 5; 127 | } else if (linestyle == "dbpolyline") { 128 | l = new JTopo.FlexionalLink(nodeA, nodeZ); 129 | l.direction = 'horizontal'; 130 | l.arrowsRadius = 12; 131 | l.lineWidth = 3; // 线宽 132 | l.offsetGap = 35; 133 | l.bundleGap = 15; // 线条之间的间隔 134 | l.textOffsetY = 10; // 文本偏移量(向下15个像素) 135 | l.strokeColor = '0,250,0'; 136 | l.dashedPattern = 3; 137 | } else if (linestyle == "curve") { 138 | l = new JTopo.CurveLink(nodeA, nodeZ); 139 | l.lineWidth = 3; // 线宽 140 | l.arrowsRadius = 12; 141 | l.strokeColor = '255,0,0'; 142 | } 143 | 144 | return l; 145 | } 146 | 147 | function addLink(l){ 148 | scene.add(l); 149 | l.addEventListener('mouseup', function (e) { 150 | currentLine = this; 151 | handlerLine(e); 152 | }); 153 | } 154 | 155 | function handlerLine(e) { 156 | if (e.button == 2) {// 右键 157 | //当前位置弹出菜单(div) 158 | $("#linemenu").css({ 159 | top: e.pageY, 160 | left: e.pageX 161 | }).show(); 162 | } 163 | } 164 | function handler(e){ 165 | if(e.button == 2){// 右键 166 | //当前位置弹出菜单(div) 167 | $("#contextmenu").css({ 168 | top: e.pageY, 169 | left: e.pageX 170 | }).show(); 171 | scene.remove(link); 172 | } else { 173 | if(e.target != null && e.target instanceof JTopo.Node && $("input[name='modeRadio']:checked").val() == "normal"){ 174 | if(beginNode == null){ 175 | beginNode = e.target; 176 | addLink(link); 177 | tempNodeA.setLocation(e.x, e.y); 178 | tempNodeZ.setLocation(e.x, e.y); 179 | } else if(beginNode !== e.target){ 180 | var endNode = e.target; 181 | var l = newLink(beginNode, endNode); 182 | addLink(l); 183 | beginNode = null; 184 | scene.remove(link); 185 | } else { 186 | beginNode = null; 187 | } 188 | }else{ 189 | scene.remove(link); 190 | } 191 | } 192 | } 193 | 194 | stage.click(function(event){ 195 | if(event.button == 0){ 196 | // 关闭弹出菜单(div) 197 | $("#contextmenu").hide(); 198 | $("#linemenu").hide(); 199 | } 200 | }); 201 | /* 节点右键菜单处理 */ 202 | $("#contextmenu a").click(function(e){ 203 | var text = $(this).text(); 204 | if(text == '删除该节点'){ 205 | scene.remove(currentNode); 206 | currentNode = null; 207 | }else if(text == '撤销上一次操作'){ 208 | currentNode.restore(); 209 | }else if(text == '更改颜色'){ 210 | currentNode.fillColor = JTopo.util.randomColor(); 211 | }else if(text == '顺时针旋转'){ 212 | currentNode.rotate += 0.5; 213 | }else if(text == '逆时针旋转'){ 214 | currentNode.rotate -= 0.5; 215 | }else if(text == '放大'){ 216 | currentNode.scaleX += 0.2; 217 | currentNode.scaleY += 0.2; 218 | }else if(text == '缩小'){ 219 | currentNode.scaleX -= 0.2; 220 | currentNode.scaleY -= 0.2; 221 | }else if(text == '节点详情'){ 222 | var detail = currentNode.detail || currentDetail; 223 | var li = ""; 224 | if(detail != '' && detail != undefined){ 225 | $.each(detail,function(key,item){ 226 | li += "
  • "+key+" : "+item+"
  • "; 227 | }); 228 | }else{ 229 | li = "
  • 暂无详细参数
  • "; 230 | } 231 | $("#detail").html(li); 232 | $("#contextmenu").hide(); 233 | $("#detail li").attr("style","padding:6px"); 234 | $("#detail").css({ 235 | top: currentNode.y, 236 | left: currentNode.x 237 | }).show(); 238 | }else if(text == '前往机器管理平台'){ 239 | var url = currentNode.url; 240 | if(url != '' && url != undefined){ 241 | window.open(url); 242 | }else{ 243 | $("#detail").html("
  • 接口未给出机器管理平台地址,无法跳转
  • "); 244 | $("#contextmenu").hide(); 245 | $("#detail li").attr("style","padding:10px"); 246 | $("#detail").css({ 247 | top: currentNode.y-30, 248 | left: currentNode.x+40 249 | }).show(); 250 | } 251 | }else{ 252 | currentNode.save(); 253 | } 254 | $("#contextmenu").hide(); 255 | }); 256 | 257 | /* 连线右键菜单处理 */ 258 | $("#linemenu a").click(function(){ 259 | var text = $(this).text(); 260 | if(text == '删除该连线'){ 261 | 262 | scene.remove(currentLine); 263 | currentLine = null; 264 | } 265 | $("#linemenu").hide(); 266 | }); 267 | 268 | }); 269 | 270 | -------------------------------------------------------------------------------- /js/jquery.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */ 2 | (function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"":"")+""),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
    a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
    ",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
    t
    ",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
    ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div
    ","
    "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
    ").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
    ";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); -------------------------------------------------------------------------------- /js/jtopo-min.js: -------------------------------------------------------------------------------- 1 | !function(window){function Element(){this.initialize=function(){this.elementType="element",this.serializedProperties=["elementType"],this.propertiesStack=[],this._id=""+(new Date).getTime()},this.distroy=function(){},this.removeHandler=function(){},this.attr=function(a,b){if(null!=a&&null!=b)this[a]=b;else if(null!=a)return this[a];return this},this.save=function(){var a=this,b={};this.serializedProperties.forEach(function(c){b[c]=a[c]}),this.propertiesStack.push(b)},this.restore=function(){if(null!=this.propertiesStack&&0!=this.propertiesStack.length){var a=this,b=this.propertiesStack.pop();this.serializedProperties.forEach(function(c){a[c]=b[c]})}},this.toJson=function(){var a=this,b="{",c=this.serializedProperties.length;return this.serializedProperties.forEach(function(d,e){var f=a[d];"string"==typeof f&&(f='"'+f+'"'),b+='"'+d+'":'+f,c>e+1&&(b+=",")}),b+="}"}}CanvasRenderingContext2D.prototype.JTopoRoundRect=function(a,b,c,d,e){"undefined"==typeof e&&(e=5),this.beginPath(),this.moveTo(a+e,b),this.lineTo(a+c-e,b),this.quadraticCurveTo(a+c,b,a+c,b+e),this.lineTo(a+c,b+d-e),this.quadraticCurveTo(a+c,b+d,a+c-e,b+d),this.lineTo(a+e,b+d),this.quadraticCurveTo(a,b+d,a,b+d-e),this.lineTo(a,b+e),this.quadraticCurveTo(a,b,a+e,b),this.closePath()},CanvasRenderingContext2D.prototype.JTopoDashedLineTo=function(a,b,c,d,e){"undefined"==typeof e&&(e=5);var f=c-a,g=d-b,h=Math.floor(Math.sqrt(f*f+g*g)),i=0>=e?h:h/e,j=g/h*e,k=f/h*e;this.beginPath();for(var l=0;i>l;l++)l%2?this.lineTo(a+l*k,b+l*j):this.moveTo(a+l*k,b+l*j);this.stroke()},JTopo={version:"0.4.8_01",zIndex_Container:1,zIndex_Link:2,zIndex_Node:3,SceneMode:{normal:"normal",drag:"drag",edit:"edit",select:"select"},MouseCursor:{normal:"default",pointer:"pointer",top_left:"nw-resize",top_center:"n-resize",top_right:"ne-resize",middle_left:"e-resize",middle_right:"e-resize",bottom_left:"ne-resize",bottom_center:"n-resize",bottom_right:"nw-resize",move:"move",open_hand:"url(./img/cur/openhand.cur) 8 8, default",closed_hand:"url(./img/cur/closedhand.cur) 8 8, default"},createStageFromJson:function(jsonStr,canvas){eval("var jsonObj = "+jsonStr);var stage=new JTopo.Stage(canvas);for(var k in jsonObj)"childs"!=k&&(stage[k]=jsonObj[k]);var scenes=jsonObj.childs;return scenes.forEach(function(a){var b=new JTopo.Scene(stage);for(var c in a)"childs"!=c&&(b[c]=a[c]),"background"==c&&(b.background=a[c]);var d=a.childs;d.forEach(function(a){var c=null,d=a.elementType;"node"==d?c=new JTopo.Node:"CircleNode"==d&&(c=new JTopo.CircleNode);for(var e in a)c[e]=a[e];b.add(c)})}),stage}},JTopo.Element=Element,window.JTopo=JTopo}(window),function(JTopo){function MessageBus(a){var b=this;this.name=a,this.messageMap={},this.messageCount=0,this.subscribe=function(a,c){var d=b.messageMap[a];null==d&&(b.messageMap[a]=[]),b.messageMap[a].push(c),b.messageCount++},this.unsubscribe=function(a){var c=b.messageMap[a];null!=c&&(b.messageMap[a]=null,delete b.messageMap[a],b.messageCount--)},this.publish=function(a,c,d){var e=b.messageMap[a];if(null!=e)for(var f=0;fd.x&&(b.left=d.x,b.leftNode=d),b.rightd.y&&(b.top=d.y,b.topNode=d),b.bottomb)){var f=0;e(f)}}function cloneEvent(a){var b={};for(var c in a)"returnValue"!=c&&"keyLocation"!=c&&(b[c]=a[c]);return b}function clone(a){var b={};for(var c in a)b[c]=a[c];return b}function isPointInRect(a,b){var c=b.x,d=b.y,e=b.width,f=b.height;return a.x>c&&a.xd&&a.y0&&(c+=",");var e=a[b[d]];"string"==typeof e?e='"'+e+'"':void 0==e&&(e=null),c+=b[d]+":"+e}return c}function loadStageFromJson(json,canvas){var obj=eval(json),stage=new JTopo.Stage(canvas);for(var k in stageObj)if("scenes"!=k)stage[k]=obj[k];else for(var scenes=obj.scenes,i=0;i0&&(d+=","),d+="{",d+=getProperties(h,c),d+="}"}d+="]}"}return d+="]",d+="}"}function changeColor(a,b,c){var d=c.split(","),e=parseInt(d[0]),f=parseInt(d[1]),g=parseInt(d[2]),h=canvas.width=b.width,i=canvas.height=b.height;a.clearRect(0,0,canvas.width,canvas.height),a.drawImage(b,0,0);for(var j=a.getImageData(0,0,b.width,b.height),k=j.data,l=0;h>l;l++)for(var m=0;i>m;m++){var n=4*(l+m*h);0!=k[n+3]&&(null!=e&&(k[n+0]+=e),null!=f&&(k[n+1]+=f),null!=g&&(k[n+2]+=g))}a.putImageData(j,0,0,0,0,b.width,b.height);var o=canvas.toDataURL();return o}function genImageAlarm(a,b){var c=a.src+b;if(alarmImageCache[c])return alarmImageCache[c];var d=new Image;return d.src=changeColor(graphics,a,b),alarmImageCache[c]=d,d}function getOffsetPosition(a){if(!a)return{left:0,top:0};var b=0,c=0;if("getBoundingClientRect"in document.documentElement)var d=a.getBoundingClientRect(),e=a.ownerDocument,f=e.body,g=e.documentElement,h=g.clientTop||f.clientTop||0,i=g.clientLeft||f.clientLeft||0,b=d.top+(self.pageYOffset||g&&g.scrollTop||f.scrollTop)-h,c=d.left+(self.pageXOffset||g&&g.scrollLeft||f.scrollLeft)-i;else do b+=a.offsetTop||0,c+=a.offsetLeft||0,a=a.offsetParent;while(a);return{left:c,top:b}}function lineF(a,b,c,d){function e(a){return a*f+g}var f=(d-b)/(c-a),g=b-a*f;return e.k=f,e.b=g,e.x1=a,e.x2=c,e.y1=b,e.y2=d,e}function inRange(a,b,c){var d=Math.abs(b-c),e=Math.abs(b-a),f=Math.abs(c-a),g=Math.abs(d-(e+f));return 1e-6>g?!0:!1}function isPointInLineSeg(a,b,c){return inRange(a,c.x1,c.x2)&&inRange(b,c.y1,c.y2)}function intersection(a,b){var c,d;return a.k==b.k?null:(1/0==a.k||a.k==-1/0?(c=a.x1,d=b(a.x1)):1/0==b.k||b.k==-1/0?(c=b.x1,d=a(b.x1)):(c=(b.b-a.b)/(a.k-b.k),d=a(c)),0==isPointInLineSeg(c,d,a)?null:0==isPointInLineSeg(c,d,b)?null:{x:c,y:d})}function intersectionLineBound(a,b){var c=JTopo.util.lineF(b.left,b.top,b.left,b.bottom),d=JTopo.util.intersection(a,c);return null==d&&(c=JTopo.util.lineF(b.left,b.top,b.right,b.top),d=JTopo.util.intersection(a,c),null==d&&(c=JTopo.util.lineF(b.right,b.top,b.right,b.bottom),d=JTopo.util.intersection(a,c),null==d&&(c=JTopo.util.lineF(b.left,b.bottom,b.right,b.bottom),d=JTopo.util.intersection(a,c)))),d}requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(a){setTimeout(a,1e3/24)},Array.prototype.del=function(a){if("number"!=typeof a){for(var b=0;ba?this:this.slice(0,a).concat(this.slice(a+1,this.length))},[].indexOf||(Array.prototype.indexOf=function(a){for(var b=0;b0,isIE:!(!window.attachEvent||-1!==navigator.userAgent.indexOf("Opera")),isChrome:null!=navigator.userAgent.toLowerCase().match(/chrome/),clone:clone,isPointInRect:isPointInRect,isPointInLine:isPointInLine,removeFromArray:removeFromArray,cloneEvent:cloneEvent,randomColor:randomColor,isIntsect:isIntsect,toJson:toJson,loadStageFromJson:loadStageFromJson,getElementsBound:getElementsBound,genImageAlarm:genImageAlarm,getOffsetPosition:getOffsetPosition,lineF:lineF,intersection:intersection,intersectionLineBound:intersectionLineBound},window.$for=$for,window.$foreach=$foreach}(JTopo),function(a){function b(a){return{hgap:16,visible:!1,exportCanvas:document.createElement("canvas"),getImage:function(b,c){var d=a.getBound(),e=1,f=1;this.exportCanvas.width=a.canvas.width,this.exportCanvas.height=a.canvas.height,null!=b&&null!=c?(this.exportCanvas.width=b,this.exportCanvas.height=c,e=b/d.width,f=c/d.height):(d.width>a.canvas.width&&(this.exportCanvas.width=d.width),d.height>a.canvas.height&&(this.exportCanvas.height=d.height));var g=this.exportCanvas.getContext("2d");return a.childs.length>0&&(g.save(),g.clearRect(0,0,this.exportCanvas.width,this.exportCanvas.height),a.childs.forEach(function(a){1==a.visible&&(a.save(),a.translateX=0,a.translateY=0,a.scaleX=1,a.scaleY=1,g.scale(e,f),d.left<0&&(a.translateX=Math.abs(d.left)),d.top<0&&(a.translateY=Math.abs(d.top)),a.paintAll=!0,a.repaint(g),a.paintAll=!1,a.restore())}),g.restore()),this.exportCanvas.toDataURL("image/png")},canvas:document.createElement("canvas"),update:function(){this.eagleImageDatas=this.getData(a)},setSize:function(a,b){this.width=this.canvas.width=a,this.height=this.canvas.height=b},getData:function(b,c){function d(a){var b=a.stage.canvas.width,c=a.stage.canvas.height,d=b/a.scaleX/2,e=c/a.scaleY/2;return{translateX:a.translateX+d-d*a.scaleX,translateY:a.translateY+e-e*a.scaleY}}null!=j&&null!=k?this.setSize(b,c):this.setSize(200,160);var e=this.canvas.getContext("2d");if(a.childs.length>0){e.save(),e.clearRect(0,0,this.canvas.width,this.canvas.height),a.childs.forEach(function(a){1==a.visible&&(a.save(),a.centerAndZoom(null,null,e),a.repaint(e),a.restore())});var f=d(a.childs[0]),g=f.translateX*(this.canvas.width/a.canvas.width)*a.childs[0].scaleX,h=f.translateY*(this.canvas.height/a.canvas.height)*a.childs[0].scaleY,i=a.getBound(),j=a.canvas.width/a.childs[0].scaleX/i.width,k=a.canvas.height/a.childs[0].scaleY/i.height;j>1&&(j=1),k>1&&(j=1),g*=j,h*=k,i.left<0&&(g-=Math.abs(i.left)*(this.width/i.width)),i.top<0&&(h-=Math.abs(i.top)*(this.height/i.height)),e.save(),e.lineWidth=1,e.strokeStyle="rgba(255,0,0,1)",e.strokeRect(-g,-h,e.canvas.width*j,e.canvas.height*k),e.restore();var l=null;try{l=e.getImageData(0,0,e.canvas.width,e.canvas.height)}catch(m){}return l}return null},paint:function(){if(null!=this.eagleImageDatas){var b=a.graphics;b.save(),b.fillStyle="rgba(211,211,211,0.3)",b.fillRect(a.canvas.width-this.canvas.width-2*this.hgap,a.canvas.height-this.canvas.height-1,a.canvas.width-this.canvas.width,this.canvas.height+1),b.fill(),b.save(),b.lineWidth=1,b.strokeStyle="rgba(0,0,0,1)",b.rect(a.canvas.width-this.canvas.width-2*this.hgap,a.canvas.height-this.canvas.height-1,a.canvas.width-this.canvas.width,this.canvas.height+1),b.stroke(),b.restore(),b.putImageData(this.eagleImageDatas,a.canvas.width-this.canvas.width-this.hgap,a.canvas.height-this.canvas.height),b.restore()}else this.eagleImageDatas=this.getData(a)},eventHandler:function(a,b,c){var d=b.x,e=b.y;if(d>c.canvas.width-this.canvas.width&&e>c.canvas.height-this.canvas.height){if(d=b.x-this.canvas.width,e=b.y-this.canvas.height,"mousedown"==a&&(this.lastTranslateX=c.childs[0].translateX,this.lastTranslateY=c.childs[0].translateY),"mousedrag"==a&&c.childs.length>0){var f=b.dx,g=b.dy,h=c.getBound(),i=this.canvas.width/c.childs[0].scaleX/h.width,j=this.canvas.height/c.childs[0].scaleY/h.height;c.childs[0].translateX=this.lastTranslateX-f/i,c.childs[0].translateY=this.lastTranslateY-g/j}}else;}}}function c(c){function d(b){var c=a.util.getEventPosition(b),d=a.util.getOffsetPosition(n.canvas);return c.offsetLeft=c.pageX-d.left,c.offsetTop=c.pageY-d.top,c.x=c.offsetLeft,c.y=c.offsetTop,c.target=null,c}function e(a){document.onselectstart=function(){return!1},this.mouseOver=!0;var b=d(a);n.dispatchEventToScenes("mouseover",b),n.dispatchEvent("mouseover",b)}function f(a){p=setTimeout(function(){o=!0},500),document.onselectstart=function(){return!0};var b=d(a);n.dispatchEventToScenes("mouseout",b),n.dispatchEvent("mouseout",b),n.needRepaint=0==n.animate?!1:!0}function g(a){var b=d(a);n.mouseDown=!0,n.mouseDownX=b.x,n.mouseDownY=b.y,n.dispatchEventToScenes("mousedown",b),n.dispatchEvent("mousedown",b)}function h(a){var b=d(a);n.dispatchEventToScenes("mouseup",b),n.dispatchEvent("mouseup",b),n.mouseDown=!1,n.needRepaint=0==n.animate?!1:!0}function i(a){p&&(window.clearTimeout(p),p=null),o=!1;var b=d(a);n.mouseDown?0==a.button&&(b.dx=b.x-n.mouseDownX,b.dy=b.y-n.mouseDownY,n.dispatchEventToScenes("mousedrag",b),n.dispatchEvent("mousedrag",b),1==n.eagleEye.visible&&n.eagleEye.update()):(n.dispatchEventToScenes("mousemove",b),n.dispatchEvent("mousemove",b))}function j(a){var b=d(a);n.dispatchEventToScenes("click",b),n.dispatchEvent("click",b)}function k(a){var b=d(a);n.dispatchEventToScenes("dbclick",b),n.dispatchEvent("dbclick",b)}function l(a){var b=d(a);n.dispatchEventToScenes("mousewheel",b),n.dispatchEvent("mousewheel",b),null!=n.wheelZoom&&(a.preventDefault?a.preventDefault():(a=a||window.event,a.returnValue=!1),1==n.eagleEye.visible&&n.eagleEye.update())}function m(b){a.util.isIE||!window.addEventListener?(b.onmouseout=f,b.onmouseover=e,b.onmousedown=g,b.onmouseup=h,b.onmousemove=i,b.onclick=j,b.ondblclick=k,b.onmousewheel=l,b.touchstart=g,b.touchmove=i,b.touchend=h):(b.addEventListener("mouseout",f),b.addEventListener("mouseover",e),b.addEventListener("mousedown",g),b.addEventListener("mouseup",h),b.addEventListener("mousemove",i),b.addEventListener("click",j),b.addEventListener("dblclick",k),a.util.isFirefox?b.addEventListener("DOMMouseScroll",l):b.addEventListener("mousewheel",l)),window.addEventListener&&(window.addEventListener("keydown",function(b){n.dispatchEventToScenes("keydown",a.util.cloneEvent(b));var c=b.keyCode;(37==c||38==c||39==c||40==c)&&(b.preventDefault?b.preventDefault():(b=b||window.event,b.returnValue=!1))},!0),window.addEventListener("keyup",function(b){n.dispatchEventToScenes("keyup",a.util.cloneEvent(b));var c=b.keyCode;(37==c||38==c||39==c||40==c)&&(b.preventDefault?b.preventDefault():(b=b||window.event,b.returnValue=!1))},!0))}a.stage=this;var n=this;this.initialize=function(c){m(c),this.canvas=c,this.graphics=c.getContext("2d"),this.childs=[],this.frames=24,this.messageBus=new a.util.MessageBus,this.eagleEye=b(this),this.wheelZoom=null,this.mouseDownX=0,this.mouseDownY=0,this.mouseDown=!1,this.mouseOver=!1,this.needRepaint=!0,this.serializedProperties=["frames","wheelZoom"]},null!=c&&this.initialize(c);var o=!0,p=null;document.oncontextmenu=function(){return o},this.dispatchEventToScenes=function(a,b){if(0!=this.frames&&(this.needRepaint=!0),1==this.eagleEye.visible&&-1!=a.indexOf("mouse")){var c=b.x,d=b.y;if(c>this.width-this.eagleEye.width&&d>this.height-this.eagleEye.height)return void this.eagleEye.eventHandler(a,b,this)}this.childs.forEach(function(c){if(1==c.visible){var d=c[a+"Handler"];if(null==d)throw new Error("Function not found:"+a+"Handler");d.call(c,b)}})},this.add=function(a){for(var b=0;b"),this},this.saveAsLocalImage=function(a,b){var c=this.eagleEye.getImage(a,b);return c.replace("image/png","image/octet-stream"),window.location.href=c,this},this.paint=function(){null!=this.canvas&&(this.graphics.save(),this.graphics.clearRect(0,0,this.width,this.height),this.childs.forEach(function(a){1==a.visible&&a.repaint(n.graphics)}),1==this.eagleEye.visible&&this.eagleEye.paint(this),this.graphics.restore())},this.repaint=function(){0!=this.frames&&(this.frames<0&&0==this.needRepaint||(this.paint(),this.frames<0&&(this.needRepaint=!1)))},this.zoom=function(a){this.childs.forEach(function(b){0!=b.visible&&b.zoom(a)})},this.zoomOut=function(a){this.childs.forEach(function(b){0!=b.visible&&b.zoomOut(a)})},this.zoomIn=function(a){this.childs.forEach(function(b){0!=b.visible&&b.zoomIn(a)})},this.centerAndZoom=function(){this.childs.forEach(function(a){0!=a.visible&&a.centerAndZoom()})},this.setCenter=function(a,b){var c=this;this.childs.forEach(function(d){var e=a-c.canvas.width/2,f=b-c.canvas.height/2;d.translateX=-e,d.translateY=-f})},this.getBound=function(){var a={left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE};return this.childs.forEach(function(b){var c=b.getElementsBound();c.lefta.right&&(a.right=c.right,a.rightNode=c.rightNode),c.bottom>a.bottom&&(a.bottom=c.bottom,a.bottomNode=c.bottomNode)}),a.width=a.right-a.left,a.height=a.bottom-a.top,a},this.toJson=function(){{var b=this,c='{"version":"'+a.version+'",';this.serializedProperties.length}return this.serializedProperties.forEach(function(a){var d=b[a];"string"==typeof d&&(d='"'+d+'"'),c+='"'+a+'":'+d+","}),c+='"childs":[',this.childs.forEach(function(a){c+=a.toJson()}),c+="]",c+="}"},function(){0==n.frames?setTimeout(arguments.callee,100):n.frames<0?(n.repaint(),setTimeout(arguments.callee,1e3/-n.frames)):(n.repaint(),setTimeout(arguments.callee,1e3/n.frames))}(),setTimeout(function(){n.mousewheel(function(a){var b=null==a.wheelDelta?a.detail:a.wheelDelta;null!=this.wheelZoom&&(b>0?this.zoomIn(this.wheelZoom):this.zoomOut(this.wheelZoom))}),n.paint()},300),setTimeout(function(){n.paint()},1e3),setTimeout(function(){n.paint()},3e3)}c.prototype={get width(){return this.canvas.width},get height(){return this.canvas.height},set cursor(a){this.canvas.style.cursor=a},get cursor(){return this.canvas.style.cursor},set mode(a){this.childs.forEach(function(b){b.mode=a})}},a.Stage=c}(JTopo),function(a){function b(c){function d(a,b,c,d){return function(e){e.beginPath(),e.strokeStyle="rgba(0,0,236,0.5)",e.fillStyle="rgba(0,0,236,0.1)",e.rect(a,b,c,d),e.fill(),e.stroke(),e.closePath()}}var e=this;this.initialize=function(){b.prototype.initialize.apply(this,arguments),this.messageBus=new a.util.MessageBus,this.elementType="scene",this.childs=[],this.zIndexMap={},this.zIndexArray=[],this.backgroundColor="255,255,255",this.visible=!0,this.alpha=0,this.scaleX=1,this.scaleY=1,this.mode=a.SceneMode.normal,this.translate=!0,this.translateX=0,this.translateY=0,this.lastTranslateX=0,this.lastTranslateY=0,this.mouseDown=!1,this.mouseDownX=null,this.mouseDownY=null,this.mouseDownEvent=null,this.areaSelect=!0,this.operations=[],this.selectedElements=[],this.paintAll=!1;var c="background,backgroundColor,mode,paintAll,areaSelect,translate,translateX,translateY,lastTranslatedX,lastTranslatedY,alpha,visible,scaleX,scaleY".split(",");this.serializedProperties=this.serializedProperties.concat(c)},this.initialize(),this.setBackground=function(a){this.background=a},this.addTo=function(a){this.stage!==a&&null!=a&&(this.stage=a)},null!=c&&(c.add(this),this.addTo(c)),this.show=function(){this.visible=!0},this.hide=function(){this.visible=!1},this.paint=function(a){if(0!=this.visible&&null!=this.stage){if(a.save(),this.paintBackgroud(a),a.restore(),a.save(),a.scale(this.scaleX,this.scaleY),1==this.translate){var b=this.getOffsetTranslate(a);a.translate(b.translateX,b.translateY)}this.paintChilds(a),a.restore(),a.save(),this.paintOperations(a,this.operations),a.restore()}},this.repaint=function(a){0!=this.visible&&this.paint(a)},this.paintBackgroud=function(a){null!=this.background?a.drawImage(this.background,0,0,a.canvas.width,a.canvas.height):(a.beginPath(),a.fillStyle="rgba("+this.backgroundColor+","+this.alpha+")",a.fillRect(0,0,a.canvas.width,a.canvas.height),a.closePath())},this.getDisplayedElements=function(){for(var a=[],b=0;bthis.stage.canvas.width||e>this.stage.canvas.height||0>f||0>g?!1:!0},this.paintOperations=function(a,b){for(var c=0;c=0;e--)for(var f=this.zIndexArray[e],g=this.zIndexMap[f],h=g.length-1;h>=0;h--){var i=g[h];if(i instanceof a.InteractiveElement&&this.isVisiable(i)&&i.isInBound(b,c))return d=i}return d},this.add=function(a){this.childs.push(a),null==this.zIndexMap[a.zIndex]&&(this.zIndexMap[a.zIndex]=[],this.zIndexArray.push(a.zIndex),this.zIndexArray.sort(function(a,b){return a-b})),this.zIndexMap[""+a.zIndex].push(a)},this.remove=function(b){this.childs=a.util.removeFromArray(this.childs,b);var c=this.zIndexMap[b.zIndex];c&&(this.zIndexMap[b.zIndex]=a.util.removeFromArray(c,b)),b.removeHandler(this)},this.clear=function(){var a=this;this.childs.forEach(function(b){b.removeHandler(a)}),this.childs=[],this.operations=[],this.zIndexArray=[],this.zIndexMap={}},this.addToSelected=function(a){this.selectedElements.push(a)},this.cancleAllSelected=function(a){for(var b=0;b=f?f:b,i=c>=g?g:c,j=Math.abs(a.dx)*this.scaleX,k=Math.abs(a.dy)*this.scaleY,l=new d(h,i,j,k);e.clearOperations().addOperation(l),b=a.x,c=a.y,f=this.mouseDownEvent.x,g=this.mouseDownEvent.y,h=b>=f?f:b,i=c>=g?g:c,j=Math.abs(a.dx),k=Math.abs(a.dy);for(var m=h+j,n=i+k,o=0;oh&&p.x+p.widthi&&p.y+p.height1)return;this.zoom(i,i)}this.zoom(a,b)},this.getCenterLocation=function(){return{x:e.stage.canvas.width/2,y:e.stage.canvas.height/2}},this.doLayout=function(a){a&&a(this,this.childs)},this.toJson=function(){{var a=this,b="{";this.serializedProperties.length}this.serializedProperties.forEach(function(c){var d=a[c];"background"==c&&(d=a._background.src),"string"==typeof d&&(d='"'+d+'"'),b+='"'+c+'":'+d+","}),b+='"childs":[';var c=this.childs.length;return this.childs.forEach(function(a,d){b+=a.toJson(),c>d+1&&(b+=",")}),b+="]",b+="}"},e}b.prototype=new a.Element;var c={};Object.defineProperties(b.prototype,{background:{get:function(){return this._background},set:function(a){if("string"==typeof a){var b=c[a];null==b&&(b=new Image,b.src=a,b.onload=function(){c[a]=b}),this._background=b}else this._background=a}}}),a.Scene=b}(JTopo),function(a){function b(){this.initialize=function(){b.prototype.initialize.apply(this,arguments),this.elementType="displayElement",this.x=0,this.y=0,this.width=32,this.height=32,this.visible=!0,this.alpha=1,this.rotate=0,this.scaleX=1,this.scaleY=1,this.strokeColor="22,124,255",this.borderColor="22,124,255",this.fillColor="22,124,255",this.shadow=!1,this.shadowBlur=5,this.shadowColor="rgba(0,0,0,0.5)",this.shadowOffsetX=3,this.shadowOffsetY=6,this.transformAble=!1,this.zIndex=0;var a="x,y,width,height,visible,alpha,rotate,scaleX,scaleY,strokeColor,fillColor,shadow,shadowColor,shadowOffsetX,shadowOffsetY,transformAble,zIndex".split(",");this.serializedProperties=this.serializedProperties.concat(a)},this.initialize(),this.paint=function(a){a.beginPath(),a.fillStyle="rgba("+this.fillColor+","+this.alpha+")",a.rect(-this.width/2,-this.height/2,this.width,this.height),a.fill(),a.stroke(),a.closePath()},this.getLocation=function(){return{x:this.x,y:this.y}},this.setLocation=function(a,b){return this.x=a,this.y=b,this},this.getCenterLocation=function(){return{x:this.x+this.width/2,y:this.y+this.height/2}},this.setCenterLocation=function(a,b){return this.x=a-this.width/2,this.y=b-this.height/2,this},this.getSize=function(){return{width:this.width,height:this.heith}},this.setSize=function(a,b){return this.width=a,this.height=b,this},this.getBound=function(){return{left:this.x,top:this.y,right:this.x+this.width,bottom:this.y+this.height,width:this.width,height:this.height}},this.setBound=function(a,b,c,d){return this.setLocation(a,b),this.setSize(c,d),this},this.getDisplayBound=function(){return{left:this.x,top:this.y,right:this.x+this.width*this.scaleX,bottom:this.y+this.height*this.scaleY}},this.getDisplaySize=function(){return{width:this.width*this.scaleX,height:this.height*this.scaleY}},this.getPosition=function(a){var b,c=this.getBound();return"Top_Left"==a?b={x:c.left,y:c.top}:"Top_Center"==a?b={x:this.cx,y:c.top}:"Top_Right"==a?b={x:c.right,y:c.top}:"Middle_Left"==a?b={x:c.left,y:this.cy}:"Middle_Center"==a?b={x:this.cx,y:this.cy}:"Middle_Right"==a?b={x:c.right,y:this.cy}:"Bottom_Left"==a?b={x:c.left,y:c.bottom}:"Bottom_Center"==a?b={x:this.cx,y:c.bottom}:"Bottom_Right"==a&&(b={x:c.right,y:c.bottom}),b}}function c(){this.initialize=function(){c.prototype.initialize.apply(this,arguments),this.elementType="interactiveElement",this.dragable=!1,this.selected=!1,this.showSelected=!0,this.selectedLocation=null,this.isMouseOver=!1;var a="dragable,selected,showSelected,isMouseOver".split(",");this.serializedProperties=this.serializedProperties.concat(a)},this.initialize(),this.paintSelected=function(a){0!=this.showSelected&&(a.save(),a.beginPath(),a.strokeStyle="rgba(168,202,255, 0.9)",a.fillStyle="rgba(168,202,236,0.7)",a.rect(-this.width/2-3,-this.height/2-3,this.width+6,this.height+6),a.fill(),a.stroke(),a.closePath(),a.restore())},this.paintMouseover=function(a){return this.paintSelected(a)},this.isInBound=function(a,b){return a>this.x&&athis.y&&bf.left&&af.top&&c1&&(this.width=d)}else if("Middle_Left"==this.selectedPoint){var d=this.selectedSize.width-a.dx,b=this.selectedLocation.x+a.dx;b1&&(this.width=d)}else if("Middle_Right"==this.selectedPoint){var d=this.selectedSize.width+a.dx;d>1&&(this.width=d)}else if("Bottom_Left"==this.selectedPoint){var d=this.selectedSize.width-a.dx,b=this.selectedLocation.x+a.dx;d>1&&(this.x=b,this.width=d);var e=this.selectedSize.height+a.dy;e>1&&(this.height=e)}else if("Bottom_Center"==this.selectedPoint){var e=this.selectedSize.height+a.dy;e>1&&(this.height=e)}else if("Bottom_Right"==this.selectedPoint){var d=this.selectedSize.width+a.dx;d>1&&(this.width=d);var e=this.selectedSize.height+a.dy;e>1&&(this.height=e)}this.dispatchEvent("resize",a)}}}b.prototype=new a.Element,Object.defineProperties(b.prototype,{cx:{get:function(){return this.x+this.width/2},set:function(a){this.x=a-this.width/2}},cy:{get:function(){return this.y+this.height/2},set:function(a){this.y=a-this.height/2}}}),c.prototype=new b,d.prototype=new c,a.DisplayElement=b,a.InteractiveElement=c,a.EditableElement=d}(JTopo),function(a){function b(c){this.initialize=function(c){b.prototype.initialize.apply(this,arguments),this.elementType="node",this.zIndex=a.zIndex_Node,this.text=c,this.font="12px Consolas",this.fontColor="255,255,255",this.borderWidth=0,this.borderColor="255,255,255",this.borderRadius=null,this.dragable=!0,this.textPosition="Bottom_Center",this.textOffsetX=0,this.textOffsetY=0,this.transformAble=!0,this.inLinks=null,this.outLinks=null;var d="text,font,fontColor,textPosition,textOffsetX,textOffsetY,borderRadius".split(",");this.serializedProperties=this.serializedProperties.concat(d)},this.initialize(c),this.paint=function(a){if(this.image){var b=a.globalAlpha;a.globalAlpha=this.alpha,null!=this.alarmImage&&null!=this.alarm?a.drawImage(this.alarmImage,-this.width/2,-this.height/2,this.width,this.height):a.drawImage(this.image,-this.width/2,-this.height/2,this.width,this.height),a.globalAlpha=b}else a.beginPath(),a.fillStyle="rgba("+this.fillColor+","+this.alpha+")",null==this.borderRadius||0==this.borderRadius?a.rect(-this.width/2,-this.height/2,this.width,this.height):a.JTopoRoundRect(-this.width/2,-this.height/2,this.width,this.height,this.borderRadius),a.fill(),a.closePath();this.paintText(a),this.paintBorder(a),this.paintCtrl(a),this.paintAlarmText(a)},this.paintAlarmText=function(a){if(null!=this.alarm&&""!=this.alarm){var b=this.alarmColor||"255,0,0",c=this.alarmAlpha||.5;a.beginPath(),a.font=this.alarmFont||"10px 微软雅黑";var d=a.measureText(this.alarm).width+6,e=a.measureText("田").width+6,f=this.width/2-d/2,g=-this.height/2-e-8;a.strokeStyle="rgba("+b+", "+c+")",a.fillStyle="rgba("+b+", "+c+")",a.lineCap="round",a.lineWidth=1,a.moveTo(f,g),a.lineTo(f+d,g),a.lineTo(f+d,g+e),a.lineTo(f+d/2+6,g+e),a.lineTo(f+d/2,g+e+8),a.lineTo(f+d/2-6,g+e),a.lineTo(f,g+e),a.lineTo(f,g),a.fill(),a.stroke(),a.closePath(),a.beginPath(),a.strokeStyle="rgba("+this.fontColor+", "+this.alpha+")",a.fillStyle="rgba("+this.fontColor+", "+this.alpha+")",a.fillText(this.alarm,f+2,g+e-4),a.closePath()}},this.paintText=function(a){var b=this.text;if(null!=b&&""!=b){a.beginPath(),a.font=this.font;var c=a.measureText(b).width,d=a.measureText("田").width;a.fillStyle="rgba("+this.fontColor+", "+this.alpha+")";var e=this.getTextPostion(this.textPosition,c,d);a.fillText(b,e.x,e.y),a.closePath()}},this.paintBorder=function(a){if(0!=this.borderWidth){a.beginPath(),a.lineWidth=this.borderWidth,a.strokeStyle="rgba("+this.borderColor+","+this.alpha+")";var b=this.borderWidth/2;null==this.borderRadius||0==this.borderRadius?a.rect(-this.width/2-b,-this.height/2-b,this.width+this.borderWidth,this.height+this.borderWidth):a.JTopoRoundRect(-this.width/2-b,-this.height/2-b,this.width+this.borderWidth,this.height+this.borderWidth,this.borderRadius),a.stroke(),a.closePath()}},this.getTextPostion=function(a,b,c){var d=null;return null==a||"Bottom_Center"==a?d={x:-this.width/2+(this.width-b)/2,y:this.height/2+c}:"Top_Center"==a?d={x:-this.width/2+(this.width-b)/2,y:-this.height/2-c/2}:"Top_Right"==a?d={x:this.width/2,y:-this.height/2-c/2}:"Top_Left"==a?d={x:-this.width/2-b,y:-this.height/2-c/2}:"Bottom_Right"==a?d={x:this.width/2,y:this.height/2+c}:"Bottom_Left"==a?d={x:-this.width/2-b,y:this.height/2+c}:"Middle_Center"==a?d={x:-this.width/2+(this.width-b)/2,y:c/2}:"Middle_Right"==a?d={x:this.width/2,y:c/2}:"Middle_Left"==a&&(d={x:-this.width/2-b,y:c/2}),null!=this.textOffsetX&&(d.x+=this.textOffsetX),null!=this.textOffsetY&&(d.y+=this.textOffsetY),d},this.setImage=function(a,b){if(null==a)throw new Error("Node.setImage(): 参数Image对象为空!");var c=this;if("string"==typeof a){var d=j[a];null==d?(d=new Image,d.src=a,d.onload=function(){j[a]=d,1==b&&c.setSize(d.width,d.height),c.image=d,c.alarmColor=null==c.alarmColor?"255,0,0":c.alarmColor}):(b&&this.setSize(d.width,d.height),c.image=d,c.alarmColor=null==c.alarmColor?"255,0,0":c.alarmColor)}else this.image=a,c.alarmColor=null==c.alarmColor?"255,0,0":c.alarmColor,1==b&&this.setSize(a.width,a.height)},this.removeHandler=function(a){var b=this;this.outLinks&&(this.outLinks.forEach(function(c){c.nodeA===b&&a.remove(c)}),this.outLinks=null),this.inLinks&&(this.inLinks.forEach(function(c){c.nodeZ===b&&a.remove(c)}),this.inLinks=null)}}function c(){c.prototype.initialize.apply(this,arguments)}function d(a){this.initialize(),this.text=a,this.elementType="TextNode",this.paint=function(a){a.beginPath(),a.font=this.font,this.width=a.measureText(this.text).width,this.height=a.measureText("田").width,a.strokeStyle="rgba("+this.fontColor+", "+this.alpha+")",a.fillStyle="rgba("+this.fontColor+", "+this.alpha+")",a.fillText(this.text,-this.width/2,this.height/2),a.closePath(),this.paintBorder(a),this.paintCtrl(a),this.paintAlarmText(a)}}function e(a,b,c){this.initialize(),this.text=a,this.href=b,this.target=c,this.elementType="LinkNode",this.isVisited=!1,this.visitedColor=null,this.paint=function(a){a.beginPath(),a.font=this.font,this.width=a.measureText(this.text).width,this.height=a.measureText("田").width,this.isVisited&&null!=this.visitedColor?(a.strokeStyle="rgba("+this.visitedColor+", "+this.alpha+")",a.fillStyle="rgba("+this.visitedColor+", "+this.alpha+")"):(a.strokeStyle="rgba("+this.fontColor+", "+this.alpha+")",a.fillStyle="rgba("+this.fontColor+", "+this.alpha+")"),a.fillText(this.text,-this.width/2,this.height/2),this.isMouseOver&&(a.moveTo(-this.width/2,this.height),a.lineTo(this.width/2,this.height),a.stroke()),a.closePath(),this.paintBorder(a),this.paintCtrl(a),this.paintAlarmText(a)},this.mousemove(function(){var a=document.getElementsByTagName("canvas");if(a&&a.length>0)for(var b=0;b0)for(var b=0;b=this.frameImages.length){if(!this.repeatPlay)return;this.frameIndex=0}this.setImage(this.frameImages[this.frameIndex],c),setTimeout(function(){e.nextFrame()},d/a.length)}}}function h(a,b,c,d,e){this.initialize();var f=this;this.setImage(a),this.frameIndex=0,this.isPause=!0,this.repeatPlay=!1;var g=d||1e3;e=e||0,this.paint=function(a){if(this.image){var b=this.width,d=this.height;a.save(),a.beginPath(),a.fillStyle="rgba("+this.fillColor+","+this.alpha+")";var f=(Math.floor(this.frameIndex/c)+e)*d,g=Math.floor(this.frameIndex%c)*b;a.drawImage(this.image,g,f,b,d,-b/2,-d/2,b,d),a.fill(),a.closePath(),a.restore(),this.paintText(a),this.paintBorder(a),this.paintCtrl(a),this.paintAlarmText(a)}},this.nextFrame=function(){if(!this.isStop){if(this.frameIndex++,this.frameIndex>=b*c){if(!this.repeatPlay)return;this.frameIndex=0}setTimeout(function(){f.isStop||f.nextFrame()},g/(b*c))}}}function i(){var a=null;return a=arguments.length<=3?new g(arguments[0],arguments[1],arguments[2]):new h(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]),a.stop=function(){a.isStop=!0},a.play=function(){a.isStop=!1,a.frameIndex=0,a.nextFrame()},a}var j={};b.prototype=new a.EditableElement,c.prototype=new b,Object.defineProperties(c.prototype,{alarmColor:{get:function(){return this._alarmColor},set:function(b){if(this._alarmColor=b,null!=this.image){var c=a.util.genImageAlarm(this.image,b);c&&(this.alarmImage=c)}}}}),d.prototype=new c,e.prototype=new d,f.prototype=new c,Object.defineProperties(f.prototype,{radius:{get:function(){return this._radius},set:function(a){this._radius=a;var b=2*this.radius,c=2*this.radius;this.width=b,this.height=c}},width:{get:function(){return this._width},set:function(a){this._radius=a/2,this._width=a}},height:{get:function(){return this._height},set:function(a){this._radius=a/2,this._height=a}}}),g.prototype=new c,h.prototype=new c,i.prototype=new c,a.Node=c,a.TextNode=d,a.LinkNode=e,a.CircleNode=f,a.AnimateNode=i}(JTopo),function(a){function b(a,b){var c=[];if(null==a||null==b)return c;if(a&&b&&a.outLinks&&b.inLinks)for(var d=0;d0&&(this.nodeIndex=a-1)},this.initialize(b,c,g),this.removeHandler=function(){var a=this;this.nodeA&&this.nodeA.outLinks&&(this.nodeA.outLinks=this.nodeA.outLinks.filter(function(b){return b!==a})),this.nodeZ&&this.nodeZ.inLinks&&(this.nodeZ.inLinks=this.nodeZ.inLinks.filter(function(b){return b!==a}));var b=d(this);b.forEach(function(a,b){a.nodeIndex=b})},this.getStartPosition=function(){var a={x:this.nodeA.cx,y:this.nodeA.cy};return a},this.getEndPosition=function(){var a;return null!=this.arrowsRadius&&(a=h(this.nodeZ,this.nodeA)),null==a&&(a={x:this.nodeZ.cx,y:this.nodeZ.cy}),a},this.getPath=function(){var a=[],b=this.getStartPosition(),c=this.getEndPosition();if(this.nodeA===this.nodeZ)return[b,c];var d=e(this.nodeA,this.nodeZ);if(1==d)return[b,c];var f=Math.atan2(c.y-b.y,c.x-b.x),g={x:b.x+this.bundleOffset*Math.cos(f),y:b.y+this.bundleOffset*Math.sin(f)},h={x:c.x+this.bundleOffset*Math.cos(f-Math.PI),y:c.y+this.bundleOffset*Math.sin(f-Math.PI)},i=f-Math.PI/2,j=f-Math.PI/2,k=d*this.bundleGap/2-this.bundleGap/2,l=this.bundleGap*this.nodeIndex,m={x:g.x+l*Math.cos(i),y:g.y+l*Math.sin(i)},n={x:h.x+l*Math.cos(j),y:h.y+l*Math.sin(j)};return m={x:m.x+k*Math.cos(i-Math.PI),y:m.y+k*Math.sin(i-Math.PI)},n={x:n.x+k*Math.cos(j-Math.PI),y:n.y+k*Math.sin(j-Math.PI)},a.push({x:b.x,y:b.y}),a.push({x:m.x,y:m.y}),a.push({x:n.x,y:n.y}),a.push({x:c.x,y:c.y}),a},this.paintPath=function(a,b){if(this.nodeA===this.nodeZ)return void this.paintLoop(a);a.beginPath(),a.moveTo(b[0].x,b[0].y);for(var c=1;c0&&this.paintText(a,b)}};var i=-(Math.PI/2+Math.PI/4);this.paintText=function(a,b){var c=b[0],d=b[b.length-1];if(4==b.length&&(c=b[1],d=b[2]),this.text&&this.text.length>0){var e=(d.x+c.x)/2+this.textOffsetX,f=(d.y+c.y)/2+this.textOffsetY;a.save(),a.beginPath(),a.font=this.font;var g=a.measureText(this.text).width,h=a.measureText("田").width;if(a.fillStyle="rgba("+this.fontColor+", "+this.alpha+")",this.nodeA===this.nodeZ){var j=this.bundleGap*(this.nodeIndex+1)/2,e=this.nodeA.x+j*Math.cos(i),f=this.nodeA.y+j*Math.sin(i);a.fillText(this.text,e,f)}else a.fillText(this.text,e-g/2,f-h/2);a.stroke(),a.closePath(),a.restore()}},this.paintSelected=function(a){a.shadowBlur=10,a.shadowColor="rgba(0,0,0,1)",a.shadowOffsetX=0,a.shadowOffsetY=0},this.isInBound=function(b,c){if(this.nodeA===this.nodeZ){var d=this.bundleGap*(this.nodeIndex+1)/2,e=a.util.getDistance(this.nodeA,{x:b,y:c})-d;return Math.abs(e)<=3}for(var f=!1,g=1;ga.x?a.x+=this.nodeA.width/2:a.x-=this.nodeA.width/2:this.nodeZ.cy>a.y?a.y+=this.nodeA.height/2:a.y-=this.nodeA.height/2,a},this.getEndPosition=function(){var a={x:this.nodeZ.cx,y:this.nodeZ.cy};return"horizontal"==this.direction?this.nodeA.cy0){var c=b[1],d=c.x+this.textOffsetX,e=c.y+this.textOffsetY;a.save(),a.beginPath(),a.font=this.font;var f=a.measureText(this.text).width,g=a.measureText("田").width;a.fillStyle="rgba("+this.fontColor+", "+this.alpha+")",a.fillText(this.text,d-f/2,e-g/2),a.stroke(),a.closePath(),a.restore()}}}function h(a,b,c){this.initialize=function(){h.prototype.initialize.apply(this,arguments),this.direction="vertical",this.offsetGap=44},this.initialize(a,b,c),this.getStartPosition=function(){var a={x:this.nodeA.cx,y:this.nodeA.cy};return"horizontal"==this.direction?a.x=this.nodeZ.cxthis.nodeZ.cx&&(i=-i),d.push({x:b.x,y:b.y+h}),d.push({x:b.x+i,y:b.y+h}),d.push({x:c.x-i,y:c.y+h}),d.push({x:c.x,y:c.y+h})):(this.nodeA.cy>this.nodeZ.cy&&(i=-i),d.push({x:b.x+h,y:b.y}),d.push({x:b.x+h,y:b.y+i}),d.push({x:c.x+h,y:c.y-i}),d.push({x:c.x+h,y:c.y})),d}}function i(a,b,c){this.initialize=function(){i.prototype.initialize.apply(this,arguments)},this.initialize(a,b,c),this.paintPath=function(a,b){if(this.nodeA===this.nodeZ)return void this.paintLoop(a);a.beginPath(),a.moveTo(b[0].x,b[0].y);for(var c=1;cq&&(q=g);var r=q*i,s=q*j,t=d.animate;if(t){var u=t.time||1e3,v=0;c.forEach(function(b,c){v+=0==c?m[c]:m[c-1]+m[c];var d=e+Math.cos(v)*r,g=f+Math.sin(v)*s;a.Animate.stepByStep(b,{x:d-b.width/2,y:g-b.height/2},u).start()})}else{var v=0;c.forEach(function(a,b){v+=0==b?m[b]:m[b-1]+m[b];var c=e+Math.cos(v)*r,d=f+Math.sin(v)*s;a.cx=c,a.cy=d})}return{cx:e,cy:f,radius:r,radiusA:r,radiusB:s}}function d(a,b){return function(c){var d=c.childs;if(!(d.length<=0))for(var e=c.getBound(),f=d[0],g=(e.width-f.width)/b,h=(e.height-f.height)/a,i=(d.length,0),j=0;a>j;j++)for(var k=0;b>k;k++){var l=d[i++],m=e.left+g/2+k*g,n=e.top+h/2+j*h;if(l.setLocation(m,n),i>=d.length)return}}}function e(a,b){return null==a&&(a=0),null==b&&(b=0),function(c){var d=c.childs;if(!(d.length<=0))for(var e=c.getBound(),f=e.left,g=e.top,h=0;h=e.right&&(f=e.left,g+=b+i.height),i.setLocation(f,g),f+=a+i.width}}}function f(){return function(a,b){if(b.length>0){for(var c=1e7,d=-1e7,e=1e7,f=-1e7,g=d-c,h=f-e,i=0;i=d&&(d=j.x),j.y<=e&&(e=j.y),j.y>=f&&(f=j.y),g=d-c+j.width,h=f-e+j.height}a.x=c,a.y=e,a.width=g,a.height=h}}}function g(b){var c=[],d=b.filter(function(b){return b instanceof a.Link?!0:(c.push(b),!1) 3 | });return b=c.filter(function(a){for(var b=0;b=0;q--)for(var r=k[""+q].nodes,s=k[""+q].childs,m=0;m0?"down"==b||"up"==b?t.x=(u[0].x+u[u.length-1].x)/2:("left"==b||"right"==b)&&(t.y=(u[0].y+u[u.length-1].y)/2):m>0&&("down"==b||"up"==b?t.x=r[m-1].x+r[m-1].width+c:("left"==b||"right"==b)&&(t.y=r[m-1].y+r[m-1].height+c)),m>0)if("down"==b||"up"==b){if(t.x0){f(e.childs,k[0]);var l=a.util.getElementsBound(e.childs),m=e.getCenterLocation(),n=m.x-(l.left+l.right)/2,o=m.y-(l.top+l.bottom)/2;e.childs.forEach(function(b){b instanceof a.Node&&(b.x+=n,b.y+=o)})}}}function l(b){return function(c){function d(a,c,e){var f=q(a,c);if(0!=f.length){null==e&&(e=b);var g=2*Math.PI/f.length;f.forEach(function(b,f){var h=c.x+e*Math.cos(g*f),i=c.y+e*Math.sin(g*f);b.setLocation(h,i);var j=e/2;d(a,b,j)})}}var e=a.layout.getRootNodes(c.childs);if(e.length>0){d(c.childs,e[0]);var f=a.util.getElementsBound(c.childs),g=c.getCenterLocation(),h=g.x-(f.left+f.right)/2,i=g.y-(f.top+f.bottom)/2;c.childs.forEach(function(b){b instanceof a.Node&&(b.x+=h,b.y+=i)})}}}function m(a,b,c,d,e,f){for(var g=[],h=0;c>h;h++)for(var i=0;d>i;i++)g.push({x:a+i*e,y:b+h*f});return g}function n(a,b,c,d,e,f){var g=e?e:0,h=f?f:2*Math.PI,i=h-g,j=i/c,k=[];g+=j/2;for(var l=g;h>=l;l+=j){var m=a+Math.cos(l)*d,n=b+Math.sin(l)*d;k.push({x:m,y:n})}return k}function o(a,b,c,d,e,f){var g=f||"bottom",h=[];if("bottom"==g)for(var i=a-c/2*d+d/2,j=0;c>=j;j++)h.push({x:i+j*d,y:b+e});else if("top"==g)for(var i=a-c/2*d+d/2,j=0;c>=j;j++)h.push({x:i+j*d,y:b-e});else if("right"==g)for(var i=b-c/2*d+d/2,j=0;c>=j;j++)h.push({x:a+e,y:i+j*d});else if("left"==g)for(var i=b-c/2*d+d/2,j=0;c>=j;j++)h.push({x:a-e,y:i+j*d});return h}function m(a,b,c,d,e,f){for(var g=[],h=0;c>h;h++)for(var i=0;d>i;i++)g.push({x:a+i*e,y:b+h*f});return g}function p(a,b){if(a.layout){var c=a.layout,d=c.type,e=null;if("circle"==d){var f=c.radius||Math.max(a.width,a.height);e=n(a.cx,a.cy,b.length,f,a.layout.beginAngle,a.layout.endAngle)}else if("tree"==d){var g=c.width||50,h=c.height||50,i=c.direction;e=o(a.cx,a.cy,b.length,g,h,i)}else{if("grid"!=d)return;e=m(a.x,a.y,c.rows,c.cols,c.horizontal||0,c.vertical||0)}for(var j=0;j150)){for(var a=0;ad&&(d=e);for(var g=0;gMath.PI/2&&j<=Math.PI?k-=i:j>Math.PI&&j<2*Math.PI*3/4?k-=i:j>2*Math.PI*.75,a.fillStyle="#FFFFFF",a.fillText(h,k,l),a.moveTo(this.radius*Math.cos(j),this.radius*Math.sin(j)),j>Math.PI/2&&j<2*Math.PI*3/4&&(k-=i),j>Math.PI,a.fill(),a.stroke(),a.closePath(),e+=g}},b}function c(){var b=new a.Node;return b.showSelected=!1,b.width=250,b.height=180,b.colors=["#3666B0","#2CA8E0","#77D1F6"],b.datas=[.3,.3,.4],b.titles=["A","B","C"],b.paint=function(a){var c=3,d=(this.width-c)/this.datas.length;a.save(),a.beginPath(),a.fillStyle="#FFFFFF",a.strokeStyle="#FFFFFF",a.moveTo(-this.width/2-1,-this.height/2),a.lineTo(-this.width/2-1,this.height/2+3),a.lineTo(this.width/2+c+1,this.height/2+3),a.stroke(),a.closePath(),a.restore();for(var e=0;e0&&a[b]>=this.targetValue||this.step<0&&a[b]<=this.targetValue;return c}}}var l=new b(function(){var b=!0;for(var d in c)h[d].isDone(d)||(a[d]+=h[d].step,b=!1);if(b){if(!e)return this.stop();for(var d in c)if(f){var g=h[d].targetValue;h[d].targetValue=h[d].oldValue,h[d].oldValue=g,h[d].step=-h[d].step}else a[d]=h[d].oldValue}return this},g);return l}function e(a){null==a&&(a={});var b=a.spring||.1,c=a.friction||.8,d=a.grivity||0,e=(a.wind||0,a.minLength||0);return{items:[],timer:null,isPause:!1,addNode:function(a,b){var c={node:a,target:b,vx:0,vy:0};return this.items.push(c),this},play:function(a){this.stop(),a=null==a?1e3/24:a;var b=this;this.timer=setInterval(function(){b.nextFrame()},a)},stop:function(){null!=this.timer&&window.clearInterval(this.timer)},nextFrame:function(){for(var a=0;a2*Math.PI&&(a.rotate=0)))},100),f}function d(){return window.clearInterval(e),f.onStop&&f.onStop(a),f}var e=(b.context,null),f={},g=b.v;return f.run=c,f.stop=d,f.onStop=function(a){return f.onStop=a,f},f}function g(a,b){function c(){return window.clearInterval(g),h.onStop&&h.onStop(a),h}function d(){var d=b.dx||0,i=b.dy||2;return g=setInterval(function(){return o?void h.stop():(i+=f,void(a.y+a.heightg.stage.canvas.width||a.y>g.stage.canvas.height)&&(i.onStop&&i.onStop(a),c(a))))},50),i}function e(){window.clearInterval(h)}var f=.8,g=b.context,h=null,i={};return i.onStop=function(a){return i.onStop=a,i},i.run=d,i.stop=e,i}function j(){o=!0}function k(){o=!1}function l(b,c){function d(){return n=setInterval(function(){if(o)return void m.stop();var a=f.y+h+Math.sin(k)*j;b.setLocation(b.x,a),k+=l},100),m}function e(){window.clearInterval(n)}var f=c.p1,g=c.p2,h=(c.context,f.x+(g.x-f.x)/2),i=f.y+(g.y-f.y)/2,j=a.util.getDistance(f,g)/2,k=Math.atan2(i,h),l=c.speed||.2,m={},n=null;return m.run=d,m.stop=e,m}function m(a,b){function c(){return h=setInterval(function(){if(o)return void g.stop();var b=e.x-a.x,c=e.y-a.y,h=b*f,i=c*f;a.x+=h,a.y+=i,.01>h&&.1>i&&d()},100),g}function d(){window.clearInterval(h)}var e=b.position,f=(b.context,b.easing||.2),g={},h=null;return g.onStop=function(a){return g.onStop=a,g},g.run=c,g.stop=d,g}function n(a,b){function c(){return j=setInterval(function(){a.scaleX+=f,a.scaleY+=f,a.scaleX>=e&&d()},100),i}function d(){i.onStop&&i.onStop(a),a.scaleX=g,a.scaleY=h,window.clearInterval(j)}var e=(b.position,b.context,b.scale||1),f=.06,g=a.scaleX,h=a.scaleY,i={},j=null;return i.onStop=function(a){return i.onStop=a,i},i.run=c,i.stop=d,i}a.Animate={},a.Effect={};var o=!1;a.Effect.spring=e,a.Effect.gravity=c,a.Animate.stepByStep=d,a.Animate.rotate=f,a.Animate.scale=n,a.Animate.move=m,a.Animate.cycle=l,a.Animate.repeatThrow=i,a.Animate.dividedTwoPiece=h,a.Animate.gravity=g,a.Animate.startAll=k,a.Animate.stopAll=j}(JTopo),function(a){function b(a,b){var c=[];if(0==a.length)return c;var d=b.match(/^\s*(\w+)\s*$/);if(null!=d){var e=a.filter(function(a){return a.elementType==d[1]});null!=e&&e.length>0&&(c=c.concat(e))}else{var f=!1;if(d=b.match(/\s*(\w+)\s*\[\s*(\w+)\s*([>=<])\s*['"](\S+)['"]\s*\]\s*/),(null==d||d.length<5)&&(d=b.match(/\s*(\w+)\s*\[\s*(\w+)\s*([>=<])\s*(\d+(\.\d+)?)\s*\]\s*/),f=!0),null!=d&&d.length>=5){var g=d[1],h=d[2],i=d[3],j=d[4];e=a.filter(function(a){if(a.elementType!=g)return!1;var b=a[h];return 1==f&&(b=parseInt(b)),"="==i?b==j:">"==i?b>j:"<"==i?j>b:"<="==i?j>=b:">="==i?b>=j:"!="==i?b!=j:!1}),null!=e&&e.length>0&&(c=c.concat(e))}}return c}function c(a){if(a.find=function(a){return d.call(this,a)},e.forEach(function(b){a[b]=function(a){for(var c=0;c0){var b=a[0];for(var c in b){var f=b[c];"function"==typeof f&&!function(b){a[c]=function(){for(var c=[],d=0;de;e++)a(),c&&d.turn(c),d.move(3)}}function e(a,b){var c=2*Math.PI;return function(d){for(var e=0;b>e;e++)a(),d.turn(c/b)}}function f(a,b,c){return function(d){for(var e=0;b>e;e++)a(),d.resize(c)}}function g(a){var b=2*Math.PI;return function(c){for(var d=0;a>d;d++)c.forward(1),c.turn(b/a)}}function h(a){var b=4*Math.PI;return function(c){for(var d=0;a>d;d++)c.forward(1),c.turn(b/a)}}function i(a,b,c,d){return function(e){for(var f=0;b>f;f++)a(),e.forward(1),e.turn(c),e.resize(d)}}var j={};c.prototype.forward=function(a){var b=this.p,c=this.w;return b.x=b.x+a*c.x,b.y=b.y+a*c.y,this.paint&&this.paint(b.x,b.y),this},c.prototype.move=function(a){var b=this.p,c=this.w;return b.x=b.x+a*c.x,b.y=b.y+a*c.y,this},c.prototype.moveTo=function(a,b){return this.p.x=a,this.p.y=b,this},c.prototype.turn=function(a){var b=(this.p,this.w),c=Math.cos(a)*b.x-Math.sin(a)*b.y,d=Math.sin(a)*b.x+Math.cos(a)*b.y;return b.x=c,b.y=d,this},c.prototype.resize=function(a){var b=this.w;return b.x=b.x*a,b.y=b.y*a,this},c.prototype.save=function(){return null==this._stack&&(this._stack=[]),this._stack.push([this.p,this.w]),this},c.prototype.restore=function(){if(null!=this._stack&&this._stack.length>0){var a=this._stack.pop();this.p=a[0],this.w=a[1]}return this},j.Tortoise=c,j.shift=d,j.spin=e,j.polygon=g,j.spiral=i,j.star=h,j.scale=f,a.Logo=j}(window); -------------------------------------------------------------------------------- /js/toolbar.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 页面工具栏 4 | function showJTopoToobar(stage){ 5 | var toobarDiv = $('
    ').html('' 6 | // +'' 7 | +'' 8 | +' ' 9 | +' ' 10 | +' ' 11 | +'    ' 15 | //+'' 16 | +'  ' 17 | +'  ' 18 | //+'  ' 19 | //+ '' 20 | // + '    ' 21 | +'    ' 22 | +'  ' 23 | //+ '  ' 24 | ); 25 | 26 | $('#content').prepend(toobarDiv); 27 | 28 | // 工具栏按钮处理 29 | $("input[name='modeRadio']").click(function(){ 30 | stage.mode = $("input[name='modeRadio']:checked").val(); 31 | }); 32 | $('#centerButton').click(function(){ 33 | stage.centerAndZoom(); //缩放并居中显示 34 | }); 35 | $('#zoomOutButton').click(function(){ 36 | stage.zoomOut(); 37 | }); 38 | $('#zoomInButton').click(function(){ 39 | stage.zoomIn(); 40 | }); 41 | $('#cloneButton').click(function(){ 42 | stage.saveImageInfo(); 43 | }); 44 | $('#exportButton').click(function() { 45 | stage.saveImageInfo(); 46 | }); 47 | $('#printButton').click(function() { 48 | stage.saveImageInfo(); 49 | }); 50 | $('#zoomCheckbox').click(function(){ 51 | if($('#zoomCheckbox').is(':checked')){ 52 | stage.wheelZoom = 1.2; // 设置鼠标缩放比例 53 | }else{ 54 | stage.wheelZoom = null; // 取消鼠标缩放比例 55 | } 56 | }); 57 | 58 | } 59 | 60 | --------------------------------------------------------------------------------