svg.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. if (!String.prototype.encodeHTML) {
  2. String.prototype.encodeHTML = function () {
  3. return this.replace(/&/g, '&')
  4. .replace(/</g, '&lt;')
  5. .replace(/>/g, '&gt;')
  6. .replace(/"/g, '&quot;')
  7. .replace(/'/g, '&apos;');
  8. };
  9. }
  10. var transition = {pid: '', port: '8080' };
  11. // BERT Protocol
  12. var players = ["Gabrielo","Mustafa","Alina","Me"];
  13. function statsRow(start_name,i,games) {
  14. var start_score = 200;
  15. var name = template_engine(
  16. '<tspan xmlns="http://www.w3.org/2000/svg" x="{this.x}" y="{this.y}">{this.body}</tspan>',{
  17. x: start_name,
  18. y: 180+25*i,
  19. body: games[i].value[0][0] + " — " + games[i].value[0][1]});
  20. var element1 = svg(name);
  21. document.getElementById('Stat-Right').appendChild(element1);
  22. }
  23. var user_count = 0;
  24. function handle_web_socket(body) {
  25. // console.log(dec(body).value[0][0].value);
  26. switch (dec(body).value[0][0].value) {
  27. case 'roster_item':
  28. var id = dec(body).value[0][1].value;
  29. var names = dec(body).value[0][2].value;
  30. var surnames = dec(body).value[0][3].value;
  31. addOnlineUser(id,names+" "+surnames+ " "+user_count++,'appendChild');
  32. break;
  33. case 'roster_end':
  34. onlineHover();
  35. mouseWheelHandler({'detail':5,'wheelDelta':5});
  36. onlineHoverOut();
  37. break;
  38. case 'online_number':
  39. var number = dec(body).value[0][1];
  40. document.getElementById("723").textContent = number.toString();
  41. break;
  42. case 'stats_event':
  43. document.getElementById('Player-Statistics').style.display = '';
  44. var games = dec(body).value[0][2];
  45. var reveals = dec(body).value[0][3];
  46. var protocol = dec(body).value[0][4];
  47. removeChilds(document.getElementById('Stat-Left'));
  48. removeChilds(document.getElementById('Stat-Right'));
  49. for (var i=0;i<games.length;i++) { statsRow(24, i,games); }
  50. for (var i=0;i<protocol.length;i++) { statsRow(340,i,protocol); }
  51. // for (var i=0;i<reveals.length;i++) { statsRow(340,i,reveals); }
  52. break;
  53. }
  54. switch (dec(body).value[0][2].value) {
  55. case 'okey_game_info':
  56. var a = dec(body).value[0][3][0].value[0][1];
  57. // console.log("Players: " + a.length);
  58. for (var i=0;i<a.length;i++) {
  59. var c = a[i].value[0][3].value;
  60. var v = a[i].value[0][4].value;
  61. setPlayerName(players[i],c + " " + v);
  62. // console.log("Player: " + c + " " + v);
  63. }
  64. break;
  65. case 'okey_game_started':
  66. var a = dec(body).value[0][3][0].value[0][1];
  67. // console.log("Cards: " + a.length);
  68. for (var i=1;i<=a.length;i++) {
  69. var c = a[i-1].value[0][1];
  70. var v = a[i-1].value[0][2];
  71. // console.log("Card: " + c + " " + v);
  72. place_card(i,rand(1,2),c,v);
  73. }
  74. break;
  75. case 'okey_game_player_state': /// these two messages should be combined
  76. var a = dec(body).value[0][3][3].value[0][1];
  77. // console.log("Cards: " + a.length);
  78. for (var i=1;i<=a.length;i++) {
  79. var c = a[i-1].value[0][1];
  80. var v = a[i-1].value[0][2];
  81. // console.log("Card: " + c + " " + v);
  82. place_card(i,1,c,v);
  83. }
  84. break;
  85. case 'okey_tile_discarded':
  86. console.log(String(dec(body)));
  87. var player = dec(body).value[0][3][0].value[0][1];
  88. var tile = dec(body).value[0][3][1].value[0][1];
  89. if (player.value == document.user) {
  90. console.log("Discard: " + player.value);
  91. var p = findCardOnTable(tile.value[0][1],tile.value[0][2]);
  92. empty_card(p.x,p.y);
  93. }
  94. break;
  95. case 'okey_tile_taken':
  96. console.log(String(dec(body)));
  97. var player = dec(body).value[0][3][0].value[0][1];
  98. var taken = dec(body).value[0][3][2].value[0][1];
  99. if (taken.value != 'null' && player.value == document.user) {
  100. console.log("Taken: " + player.value);
  101. var c = taken.value[0][1];
  102. var v = taken.value[0][2];
  103. var pos = findPlace();
  104. // console.log(pos);
  105. place_card(pos.x,pos.y,c,v);
  106. }
  107. break;
  108. default:
  109. // console.log(String(dec(body)));
  110. }
  111. }
  112. // SVG DOM and Template Engine
  113. function template_engine(html, data) {
  114. var re = /{([^}]+)?}/g, code = 'var r=[];', cursor = 0;
  115. var add = function(line,js) {
  116. js? (code += 'r.push(' + line + ');') :
  117. (code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");' : '');
  118. return add; }
  119. while(match = re.exec(html)) {
  120. add(html.slice(cursor, match.index))(match[1],true);
  121. cursor = match.index + match[0].length; }
  122. add(html.substr(cursor, html.length - cursor));
  123. code += 'return r.join("");';
  124. return new Function(code.replace(/[\r\t\n]/g, '')).apply(data); }
  125. function reload(file, name) { var slot = document.getElementById(name);
  126. slot.parentNode.replaceChild(svg(localStorage.getItem(file)),slot);}
  127. function reload_cont(cont,name,element) { if (null != cont) (cont)(); else reload(name,element); }
  128. function loadFile(name,cont,element) {
  129. if (localStorage.getItem(name) == null) {
  130. var client = new XMLHttpRequest();
  131. client.open('GET', name, true);
  132. client.onload = function() {
  133. localStorage.setItem(name,client.responseText);
  134. reload_cont(cont,name,element); }
  135. client.send(); }
  136. else reload_cont(cont,name,element); }
  137. function svg(html) {
  138. return new DOMParser().parseFromString(html, "text/xml").firstChild;
  139. }
  140. function svgBulk() {
  141. var res = [];
  142. var node = new DOMParser().parseFromString(html, "text/xml").firstChild;
  143. for (var i=0;i<node.childnode.length;i++) { var child = childNodes.item(i);
  144. if (child.tagName != undefined) res.push(child); } }
  145. // The Card
  146. //var color = ['#CE290F','#3B5998','#48AF5E','#FFEC00'];
  147. var color = ['#DE3F26','#606060','#48AF5E','#FFC800'];
  148. var slotName = slotNameDef;
  149. function slotNameDef(x,y) { return "Slot-"+y+","+x; }
  150. function card(line,pos,col,v) {
  151. return template_engine(
  152. localStorage.getItem("templates/Card.svg"),
  153. { name: slotName(pos,line),
  154. suit: color[col-1],
  155. value: v,
  156. y: (line-1)*69,
  157. x: (pos-1)*42 }); }
  158. // Game Scene
  159. function setPlayerName(e, playerName) {
  160. var dx = (document.getElementById(e).attributes['fill'].value == "#FFFFFF") ? 65 : 20;
  161. document.getElementById(e).setAttribute("y",27);
  162. document.getElementById(e).setAttribute("x",dx);
  163. document.getElementById(e).textContent = playerName;
  164. // console.log("Bounding Box: " + document.getElementById(e).getBBox().width);
  165. document.getElementById(e+"-Pad").setAttribute('width',
  166. document.getElementById(e).getBBox().width + 45); }
  167. function place_card(x,y,c,v) {
  168. var slot = document.getElementById(slotName(x,y));
  169. slot.parentNode.replaceChild(svg(card(y,x,c,v)),slot); }
  170. function empty_card(x,y) { var slot = document.getElementById(slotName(x,y));
  171. var html = '<g xmlns="http://www.w3.org/2000/svg" id="'+slotName(x,y)+'"/>';
  172. slot.parentNode.replaceChild(svg(html),slot); }
  173. function rand(lo,hi) { return Math.floor((Math.random()*hi)+lo); }
  174. function loadScene() {
  175. reload("Kakaranet-Scene.svg", "Refined");
  176. for (var i=1;i<16;i++) { empty_card(i,2); empty_card(i,1); }
  177. //drawSampleCards();
  178. }
  179. function findPlace() {
  180. for (var y=1;y<3;y++) for (var x=1;x<15;x++) {
  181. var e = document.getElementById(slotName(x,y));
  182. if (e.childElementCount == 0) {
  183. var pos = e.attributes['id'].value.split("-")[1].split(",");
  184. console.log("Free");
  185. console.log(pos[0]);
  186. console.log(pos[1]);
  187. return { y: pos[0], x: pos[1] }; } } }
  188. function findCardOnTable(c,v) {
  189. console.log("Find Card " + c + " " + v);
  190. for (var y=1;y<3;y++) for (var x=1;x<15;x++) {
  191. var e = document.getElementById(slotName(x,y));
  192. if (e.childElementCount > 0) {
  193. var value = e.lastChild.textContent;
  194. var col = color.indexOf(e.lastChild.attributes['fill'].value) + 1;
  195. console.log(col + " " + value);
  196. if (c == col && v == value) return { 'x': x, 'y': y }; } }
  197. console.log("Card Not Found");
  198. return ""; }
  199. function loadAppend(file, animation, name) {
  200. loadFile(file, function() {
  201. var slot = document.getElementById(name);
  202. var r = template_engine(localStorage.getItem(file),{'name': animation});
  203. document.getElementById(name).appendChild(svg(r)); }); }
  204. function loadAnimationForButton(a, b) { return loadAppend('templates/ButtonAnimation.svg', a, b); }
  205. // TODO: Rollout Monadic Chain here
  206. loadFile('templates/Card.svg', function() {
  207. loadFile('Kakaranet-Scene.svg', function() {
  208. loadScene();
  209. var a = [{button: "Create", pathes: ["CreateShow", "CreateHide"]},
  210. {button: "Play", pathes: ["PlayShow", "PlayHide"]}];
  211. for (var y=0;y<a.length;y++) for (var x=0;x<a[y].pathes.length;x++)
  212. loadAnimationForButton(a[y].pathes[x],a[y].button);
  213. document.getElementById("Right-Menu") .setAttribute('onclick', 'onRightMenu(evt)');
  214. document.getElementById("Play") .setAttribute('onclick', 'onRightMenuDown(evt)');
  215. document.getElementById("Create") .setAttribute('onclick', 'onRightMenuDown(evt)');
  216. document.getElementById("Point-Table").setAttribute('onclick', 'onPlayerInfo(evt)');
  217. document.getElementById("Player-Statistics").setAttribute('onclick', 'onPlayerInfoClose(evt)');
  218. document.getElementById('Page-1').addEventListener("mousewheel", mouseWheelHandler, false);
  219. onRightMenuDown();
  220. });
  221. });
  222. var clipPath1 = svg('<clipPath id="myClip1"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path-Left" x="0" y="0" width="216" height="400"/></clipPath>');
  223. var clipPath2 = svg('<clipPath id="myClip2"><rect xmlns="http://www.w3.org/2000/svg" id="Clip-Path-Right" x="0" y="0" width="216" height="400"/></clipPath>');
  224. document.getElementsByTagName('defs').item(0).appendChild(clipPath1);
  225. document.getElementsByTagName('defs').item(0).appendChild(clipPath2);
  226. document.getElementById("Online-List").setAttribute("clip-path","url(#myClip1)");
  227. document.getElementById("Chat").setAttribute("clip-path","url(#myClip2)");
  228. document.getElementById("Clip-Path-Left").setAttribute("transform", "translate(0,0)");
  229. document.getElementById("Clip-Path-Right").setAttribute("transform", "translate(0,0)");
  230. document.getElementById('Player-Statistics').style.display = 'none';
  231. document.getElementById("Right-Bar").setAttribute("fill","skyblue");
  232. document.getElementById("Right-Bar").onmouseover = barHover;
  233. document.getElementById("Right-Bar").onmouseout = barHoverOut;
  234. document.getElementById("Left-Bar").onmouseover = onlineHover;
  235. document.getElementById("Left-Bar").onmouseout = onlineHoverOut;
  236. document.getElementById('edit').setAttribute("contentEditable","true");
  237. document.getElementById('edit').onkeydown = chatEditor;
  238. var removeChilds = function (node) {
  239. var last;
  240. while (last = node.lastChild) node.removeChild(last);
  241. };
  242. function onPlayerInfo(evt) {
  243. ws.send(enc(tuple(atom('client'),
  244. tuple(atom('stats_action'),bin(document.user),atom('game_okey')))));
  245. }
  246. function onPlayerInfoClose(evt) {
  247. document.getElementById('Player-Statistics').style.display = 'none';
  248. }
  249. function onRightMenu(evt) {
  250. localStorage.clear();
  251. ["PlayShow","CreateShow"].map(function (x) {
  252. document.getElementById(x+"-Motion").beginElement(); }); }
  253. function onRightMenuDown(evt) {
  254. ["PlayHide","CreateHide"].map(function (x) {
  255. document.getElementById(x+"-Motion").beginElement(); }); }
  256. // SVG Samples for svg.htm
  257. /*
  258. loadFile('templates/Mustafa-Persona.svg', null, "Mustafa-Persona-Sample");
  259. loadFile('templates/Mustafa-Selection.svg', null, "Mustafa-Selection-Sample");
  260. document.getElementById("MustafaSelection").addEventListener('click', function() {
  261. var style = document.getElementById("Mustafa-Selection-Sample").style;
  262. if (style.display == 'none') style.display = 'block';
  263. else style.display = 'none'; });
  264. */
  265. function slotName1(x,y) { return "1Slot-"+y+","+x; }
  266. function drawSampleCards() {
  267. slotName = slotName1;
  268. for (var i=1;i<15;i++) { place_card(i,rand(1,2),rand(1,4),rand(1,13)); }
  269. slotName = slotNameDef; }
  270. var scrollSensitivity = 0.2;
  271. var scroll_left = 5;
  272. var scroll_right = -10000;
  273. function chatMessage(id, me, string) {
  274. var i=0;
  275. var colors=['#FDFDFD','#DFF1F4'];
  276. var x1 = 7;
  277. var y1 = 0;
  278. var translate_y = parseFloat(document.getElementById("Chat").getBBox().height);
  279. var x2 = 205;
  280. var textElement = chatText(id,me,string);
  281. var dy = translate_y == 0 ? 0 : translate_y + 10;
  282. var html = "<g xmlns='http://www.w3.org/2000/svg' " +
  283. "id='Message-"+id+"' transform='translate(0,"+dy+")'></g>";
  284. var messageElement = svg(html);
  285. messageElement.appendChild(textElement);
  286. document.getElementById("Chat").appendChild(messageElement);
  287. create_multiline(textElement);
  288. var y2 = textElement.getBBox().height + 5;
  289. var box = "<path xmlns='http://www.w3.org/2000/svg' d='M"+x1+","+y1+
  290. " L"+x2+","+y1+
  291. ((me == "Maxim") ?
  292. (" L"+x2+","+parseFloat(y2-7)+
  293. " L"+parseFloat(x2+7)+","+y2+
  294. " L"+x1+","+y2)
  295. :
  296. (" L"+x2+","+y2+
  297. " L"+0+","+y2+
  298. " L"+x1+","+parseFloat(y2-7)))
  299. + " L"+x1+","+y1+"' fill='"+colors[me=="Maxim"?1:0]+"'></path>";
  300. var boxElement = svg(box);
  301. messageElement.insertBefore(boxElement,textElement);
  302. boxElement.setAttribute("mouseover","barHover(evt);");
  303. boxElement.setAttribute("mouseout","barHoverOut(evt);");
  304. textElement.setAttribute("mouseover","barHover(evt);");
  305. textElement.setAttribute("mouseout","barHoverOut(evt);");
  306. messageElement.setAttribute("onmouseover","barHover(evt);");
  307. messageElement.setAttribute("onmouseout","barHoverOut(evt);");
  308. // console.log(messageElement);
  309. }
  310. function chatText(id, me, string) {
  311. var i = 0;
  312. var colors=['#3B5998'];
  313. var html = "<text id='ChatText-"+id+"' width='180' " +
  314. " xmlns='http://www.w3.org/2000/svg' "+
  315. " font-family='Exo 2' font-size='16' font-weight='normal' fill='"+colors[i]+"'>" +
  316. string + "</text>";
  317. // console.log(html);
  318. return svg(html);
  319. }
  320. function mouseWheelHandler(e) {
  321. var leftBar = document.getElementById("Left-Bar");
  322. var rightBar = document.getElementById("Right-Bar");
  323. var leftFill = leftBar.getAttribute("fill");
  324. var rightFill = rightBar.getAttribute("fill");
  325. var leftActive = leftFill == "skyblue";
  326. var rightActive = rightFill == "skyblue";
  327. if (!leftActive && !rightActive) return;
  328. // console.log(leftActive);
  329. var evt = e;
  330. var scroll_dy = evt.detail ? evt.detail * scrollSensitivity : evt.wheelDelta * scrollSensitivity;
  331. var ori = leftActive ? scroll_left : scroll_right;
  332. var scroll = parseFloat(scroll_dy) + parseFloat(ori);
  333. var selectedBar = leftActive ? "Online-List" : "Chat";
  334. var selectedClip = leftActive ? "Clip-Path-Left" : "Clip-Path-Right";
  335. var selectedBarShift = leftActive ? 0 : 857;
  336. var limit = parseFloat(document.getElementById(selectedBar).getBBox().height) - 400;
  337. if (scroll > 5) scroll = 5;
  338. if (scroll < -limit) scroll = -limit;
  339. document.getElementById(selectedClip).setAttribute("transform", "translate(0,"+parseFloat(-scroll)+")");
  340. document.getElementById(selectedBar).setAttribute("transform", "translate("+selectedBarShift+","+(parseFloat(95+scroll))+")");
  341. if (leftActive) scroll_left = scroll; else scroll_right = scroll;
  342. return true;
  343. }
  344. var svgNS = "http://www.w3.org/2000/svg";
  345. function create_multiline(target) {
  346. var text_element = target; // evt.target;
  347. var width = 190; //target.getAttribute("width");
  348. var words = text_element.firstChild.data.split('');
  349. // console.log(words);
  350. // var words = [].concat.apply([],lines.map(function(line) { return line.split(' '); }));;
  351. var start_x = 15; //text_element.getAttribute('x');
  352. text_element.firstChild.data = '';
  353. var tspan_element = document.createElementNS(svgNS, "tspan");
  354. tspan_element.setAttribute("x", start_x);
  355. tspan_element.setAttribute("dy", 18);
  356. var text_node = document.createTextNode(words[0]);
  357. tspan_element.appendChild(text_node);
  358. text_element.appendChild(tspan_element);
  359. for(var i=1; i<words.length; i++) {
  360. if (words[i]=="") continue;
  361. var len = tspan_element.firstChild.data.length;
  362. tspan_element.firstChild.data += words[i];
  363. if (tspan_element.getComputedTextLength() > width || words[i]=="\n") {
  364. if (words[i]=='\n') words[i]="";
  365. tspan_element.firstChild.data = tspan_element.firstChild.data.slice(0, len);
  366. var tspan_element = document.createElementNS(svgNS, "tspan");
  367. tspan_element.setAttribute("x", start_x);
  368. tspan_element.setAttribute("dy", 18);
  369. text_node = document.createTextNode(words[i]);
  370. tspan_element.appendChild(text_node);
  371. text_element.appendChild(tspan_element);
  372. }
  373. }
  374. }
  375. function barHover(evt) { document.getElementById("Right-Bar").setAttribute("fill","skyblue"); }
  376. function barHoverOut(evt) { document.getElementById("Right-Bar").setAttribute("fill","lightblue"); }
  377. function onlineHover(evt) { document.getElementById("Left-Bar").setAttribute("fill","skyblue"); }
  378. function onlineHoverOut(evt) { document.getElementById("Left-Bar").setAttribute("fill","lightblue"); }
  379. function onlineHoverColor(evt) {
  380. onlineHover(evt);
  381. var name = evt.target.getAttribute("xmlns:data");
  382. if (null != name) document.getElementById(name).setAttribute("fill","#FFF687");
  383. }
  384. function onlineHoverOutColor(evt) {
  385. onlineHoverOut(evt);
  386. var name = evt.target.getAttribute("xmlns:data");
  387. if (null != name) document.getElementById(name).setAttribute("fill","#DBEBED");
  388. }
  389. function chatEditor(evt) {
  390. if (evt.keyCode == 13 && evt.metaKey == false) {
  391. var e = document.getElementById('edit');
  392. if (e.innerText.trim() != ""){
  393. chatMessage("100","Maxim",e.innerText.trim().encodeHTML());
  394. e.innerHTML = '';
  395. }
  396. } else if (evt.keyCode == 13 && evt.metaKey == true) {
  397. document.execCommand('insertText',false, '\n');
  398. }
  399. var scroll = -1000000;
  400. mouseWheelHandler({'detail':scroll,'wheelDelta':scroll});
  401. }
  402. function addOnlineUser(name,full_name,insertMode) {
  403. var listElement = document.getElementById("Online-List");
  404. var y = listElement.getBBox().height;
  405. // console.log(y);
  406. var html = '<g xmlns="http://www.w3.org/2000/svg" height="60" transform="translate(0, '+y+')">' +
  407. '<g xmlns:data="'+name+'"fill="#DBEBED" onmouseover="onlineHoverColor(evt);" onmouseout="onlineHoverOutColor(evt);">' +
  408. ' <rect xmlns:data="'+name+'"fill="#DBEBED" id="'+name+'" x="10" y="0" width="196" height="48" onmouseover="onlineHoverColor(evt);" onmouseout="onlineHoverOutColor(evt);"></rect></g>' +
  409. '<text xmlns:data="'+name+'" onmouseover="onlineHoverColor(evt);" onmouseout="onlineHoverOutColor(evt);" '+
  410. 'font-family="Exo 2" font-size="18" font-weight="normal" line-spacing="18"'+
  411. ' fill="#3B5998">' +
  412. '<tspan xmlns:data="'+name+'" font-weight="normal" fill="green" x="19" y="22">'+full_name+'</tspan>' +
  413. '<tspan xmlns:data="'+name+'" font-size="14" x="19" y="40">Score: 1043 Pos: 13</tspan></text>'+
  414. '<rect onmouseover="onlineHover(evt);" onmouseout="onlineHoverOut(evt);"'+
  415. ' x="10" y="48" width="196" height="8"></rect></g>';
  416. var element = svg(html);
  417. // element.setAttribute("mouseover","onlineHoverColor(evt);");
  418. // element.setAttribute("mouseout","onlineHoverOutColor(evt);");
  419. // console.log(element);
  420. listElement.appendChild(element);
  421. }
  422. chatMessage("1","Maxim2","Joe:\nHello There!".encodeHTML());
  423. chatMessage("2","Maxim2","Alice:\nYou got new Design. Eh?".encodeHTML());
  424. chatMessage("3","Maxim","Maxim So:\nThis was made with pure SVG".encodeHTML());
  425. /*
  426. for (var i=0;i<5;i++) {
  427. addOnlineUser("Maxim1"+i,"Maxim Sokhatsky",'appendChild');
  428. addOnlineUser("Maxim2"+i,"Sinan Ustel",'appendChild');
  429. addOnlineUser("Maxim3"+i,"Ahmet Tez",'appendChild');
  430. addOnlineUser("Maxim4"+i,"Alice Cooper",'appendChild');
  431. }
  432. */
  433. barHover();
  434. mouseWheelHandler({'detail':-100000,'wheelDelta':-100000});
  435. barHoverOut();