Changeset 13935 for trunk/FACT++/www/smartfact
- Timestamp:
- 05/27/12 11:02:10 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/smartfact/index.js
r13931 r13935 9 9 function $new(name) { return document.createElement(name); } 10 10 function $txt(txt) { return document.createTextNode(txt); } 11 function trim(str) { return str.replace( "/^\s\s*/", '').replace("/\s\s*$/", ''); }11 function trim(str) { return str.replace(/^\s\s*/, "").replace(/\s*\s$/, ""); } 12 12 function valid(str) { if (!str) return false; if (str.length==0) return false; return true;} 13 13 function isSliding() { var z = $("body").getAttribute("data-visible"); return $("table"+z) ? $("table"+z).offsetLeft!=0 : false; } … … 191 191 title = title.substr(1); 192 192 193 var table = $("table"+z); 194 if (table) 195 $("body").removeChild(table); 196 197 table = $new("table"); 198 table.setAttribute("class", "tborder"); 199 table.id = "table"+z; 200 table.border = 0; 201 table.cellSpacing = 0; 202 table.cellPadding = "0px"; 203 /*table.width = "100%";*/ 204 //table.setAttribute("style", "overflow:hidden;position:fixed;top:0px;left:"+window.innerWidth+"px;") 205 table.setAttribute("style", "position:absolute;top:0px;left:"+window.innerWidth+"px;width:100%;"); 206 207 // ----------------------------------------------------- 193 // ================================================================== 208 194 209 195 var th = $new("thead"); 210 196 th.colSpan = 3; 211 197 th.width = "100%"; 212 table.appendChild(th);213 198 214 199 var htr = $new("tr"); … … 247 232 hhtr.appendChild(htd1); 248 233 hhtr.appendChild(htd2); 249 /* 250 htd0.style.verticalAlign = "middle"; 251 htd1.style.verticalAlign = "middle"; 252 htd2.style.verticalAlign = "middle"; 253 htd3.style.verticalAlign = "middle"; 254 htd4.style.verticalAlign = "middle"; 255 */ 234 256 235 var div1 = $new("div"); 257 236 var div2 = $new("div"); … … 316 295 htd4.appendChild(div4); // Warning 317 296 318 // ----------------------------------------------------- 319 320 var tbody = $new("tbody"); 321 table.appendChild(tbody); 322 323 // ----------------------------------------------------- 297 // ================================================================== 324 298 325 299 var tf = $new("tfoot"); 326 table.appendChild(tf);327 300 328 301 var ftr = $new("tr"); … … 344 317 var ftd2 = $new("td"); 345 318 var ftd3 = $new("td"); 319 var ftd4 = $new("td"); 346 320 ftdH.setAttribute("width", "1px"); 347 321 ftd2.setAttribute("width", "1px"); 348 322 ftd3.setAttribute("width", "1px"); 323 ftd4.setAttribute("width", "1px"); 349 324 350 325 ftdH.setAttribute("class", "tcell1"); … … 353 328 ftd2.setAttribute("class", "tcell2"); 354 329 ftd3.setAttribute("class", "tcell2"); 330 ftd4.setAttribute("class", "tcell2"); 355 331 356 332 ftab.appendChild(ftdH); … … 359 335 ftab.appendChild(ftd2); 360 336 ftab.appendChild(ftd3); 337 ftab.appendChild(ftd4); 361 338 362 339 var fdivH = $new("div"); … … 365 342 var fdiv2 = $new("div"); 366 343 var fdiv3 = $new("div"); 344 var fdiv4 = $new("div"); 367 345 ftd0.style.paddingLeft = "5px"; 368 fdiv 2.id="cmd"+z;346 fdiv4.id="cmd"+z; 369 347 370 348 fdiv2.setAttribute("class", "icon_white"); 371 349 fdiv3.setAttribute("class", "icon_white"); 350 fdiv4.setAttribute("class", "icon_white"); 372 351 fdiv2.setAttribute("style", "background-position:-72px 50%;"); 352 fdiv4.setAttribute("style", "background-position:-432px 50%;"); 373 353 fdiv2.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; sendCommand('stop'); this.style.backgroundColor=''; }; 374 354 if (is_cmd) … … 395 375 fdivH.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('help-'+name, z, +1); }; 396 376 } 377 fdiv4.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; loadPage('scriptlog', z, +1); }; 397 378 398 379 … … 410 391 if (name!='control') 411 392 ftd3.appendChild(fdiv3); 412 413 $("body").appendChild(table); 393 if (name!='scriptlog') 394 ftd4.appendChild(fdiv4); 395 396 // ================================================================== 397 398 var tbody = $new("tbody"); 414 399 415 400 for (var i=0; i<lines.length; i++) 416 401 { 417 402 lines[i] = trim(lines[i]); 403 418 404 if (lines[i][0] == '#') 419 405 lines.splice(i--, 1); … … 440 426 for (var i=1; i<lines.length; i++) 441 427 { 428 lines[i] = trim(lines[i]); 429 442 430 if (lines[i].length==0) 443 431 continue; … … 596 584 tbody.appendChild(tr); 597 585 } 598 /* 599 if (true) 600 { 601 tr = $new("tr"); 602 tr.setAttribute("class", "row"); 603 604 td = $new("td"); 605 td.colSpan = "3"; 606 tr.appendChild(td); 607 608 var sp = $new("div"); 609 sp.setAttribute("class", "icon_color"); 610 sp.setAttribute("style", "background-position: -144px -14px;"); 611 td.appendChild(sp); 612 613 sp = $new("div"); 614 sp.setAttribute("class", "icon_color"); 615 sp.setAttribute("style", "background-position: -56px -14px;"); 616 td.appendChild(sp); 617 618 tr.appendChild(td); 619 620 tbody.appendChild(tr); 621 } 622 */ 623 // --------------------------------------- 586 587 // ================================================================== 588 624 589 if (debug == true) 625 590 { … … 635 600 } 636 601 637 // --------------------------------------- 602 // ================================================================== 603 604 var table = $("table"+z); 605 if (table) 606 $("body").removeChild(table); 607 608 table = $new("table"); 609 table.id = "table"+z; 610 table.border = 0; 611 table.cellSpacing = 0; 612 table.cellPadding = "0px"; 613 //table.setAttribute("style", "overflow:hidden;position:fixed;top:0px;left:"+window.innerWidth+"px;") 614 table.setAttribute("style", 615 "position:fixed;width:100%;top:0px;"+ 616 "left:"+window.innerWidth+"px;"); 617 618 table.appendChild(th); 619 table.appendChild(tbody); 620 table.appendChild(tf); 621 622 $("body").appendChild(table); 623 624 // ================================================================== 625 626 /* 627 // Scrollbar for just the body 628 table.style.position = "fixed"; 629 th.style.position = "aboslute"; 630 tf.style.position = "aboslute"; 631 tbody.style.overflowY = "auto"; 632 tbody.style.display = "block"; 633 tbody.style.height = (window.innerHeight-th.clientHeight-tf.clientHeight)+"px"; 634 tbody.id = "tbody"+z; 635 th.id = "thead"+z; 636 tf.id = "tfoot"+z; 637 */ 638 639 // ================================================================== 638 640 639 641 table.setAttribute("data-file", name); … … 652 654 return; 653 655 656 // =========================================== 657 /* 658 var tb = $("tbody"+z); 659 var hw = $("thead"+z).clientHeight; 660 var fw = $("tfoot"+z).clientHeight; 661 662 tb.style.height = (window.innerHeight-hw-fw)+"px"; 663 */ 664 // =========================================== 665 654 666 var fixedw = $("body").getAttribute("data-width"); 655 667 var fixedh = $("body").getAttribute("data-height"); … … 657 669 var W = fixedw>0 ? fixedw : window.innerWidth; 658 670 var H = fixedh>0 ? fixedh : window.innerHeight; 659 660 //alert(window.innerWidth+"/"+$("body").scrollWidth+"/"+$("table"+z).scrollWidth);661 662 // wIw bSw tSw663 // 430 / 860 / 430664 // 429 / 430 / 430665 // 366 / 430 / 430666 667 // 672 / 1344 / 672668 // 672 / 1329 / 1329669 670 // Chrome: needs scrollbar671 // wiW bsW tsW bcW tcW boW toW672 // 100 200 100 84 100 84 100673 // 100 85 85 69 85 79 85674 675 // Chrome: does not need scrollbar676 // 100 200 100 84 100 84 100677 // 100 100 100 84 100 84 100678 679 // Firefox: does not need scrollbar680 // 100 84 100 84 100 84 100681 // 100 84 100 84 100 84 100682 683 // Firefox: does need scrollbar684 // 100 84 100 84 100 84 100685 // 100 69 85 69 85 69 85686 687 // opera no scrollbar:688 // 100 84 100 84 100 84 100689 // 100 84 100 84 100 84 100690 671 691 672 var max = $("body").getAttribute("data-max")=="yes";
Note:
See TracChangeset
for help on using the changeset viewer.