Best JavaScript code snippet using playwright-internal
未命名-1_edge.js
Source: 未命名-1_edge.js
1/*jslint */2/*global AdobeEdge: false, window: false, document: false, console:false, alert: false */3(function (compId) {4 "use strict";5 var im='images/',6 aud='media/',7 vid='media/',8 js='js/',9 fonts = {10 },11 opts = {12 'gAudioPreloadPreference': 'auto',13 'gVideoPreloadPreference': 'auto'14 },15 resources = [16 ],17 scripts = [18 ],19 symbols = {20 "stage": {21 version: "6.0.0",22 minimumCompatibleVersion: "5.0.0",23 build: "6.0.0.400",24 scaleToFit: "both",25 centerStage: "both",26 resizeInstances: false,27 content: {28 dom: [29 {30 id: 'BK',31 type: 'image',32 rect: ['0px', '0px', '640px', '960px', 'auto', 'auto'],33 opacity: '0.85365852301683',34 fill: ["rgba(0,0,0,0)",im+"BK.png",'0px','0px']35 },36 {37 id: 'zi_tao',38 type: 'image',39 rect: ['154px', '437px', '59px', '45px', 'auto', 'auto'],40 opacity: '0',41 fill: ["rgba(0,0,0,0)",im+"zi_tao.png",'0px','0px']42 },43 {44 id: 'zi_0',45 type: 'image',46 rect: ['322px', '406px', '78px', '101px', 'auto', 'auto'],47 opacity: '0',48 fill: ["rgba(0,0,0,0)",im+"zi_0.png",'0px','0px'],49 transform: [[],['-4']]50 },51 {52 id: 'zi_2',53 type: 'image',54 rect: ['173px', '357px', '334px', '186px', 'auto', 'auto'],55 clip: 'rect(0px 0px 186px 0px)',56 opacity: '0',57 fill: ["rgba(0,0,0,0)",im+"zi_2.png",'0px','0px']58 },59 {60 id: 'zi_12',61 type: 'image',62 rect: ['399px', '360px', '23px', '111px', 'auto', 'auto'],63 opacity: '0',64 fill: ["rgba(0,0,0,0)",im+"zi_1.png",'0px','0px']65 },66 {67 id: 'zi_6',68 type: 'image',69 rect: ['423px', '401px', '78px', '111px', 'auto', 'auto'],70 opacity: '0',71 fill: ["rgba(0,0,0,0)",im+"zi_6.png",'0px','0px']72 },73 {74 id: 'zi_shang',75 type: 'image',76 rect: ['439px', '299px', '47px', '81px', 'auto', 'auto'],77 opacity: '0',78 fill: ["rgba(0,0,0,0)",im+"zi_shang.png",'0px','0px'],79 transform: [[],[],[],['1.94','1.94']]80 },81 {82 id: 'zi_di',83 type: 'image',84 rect: ['194px', '604px', '275px', '66px', 'auto', 'auto'],85 opacity: '0',86 fill: ["rgba(0,0,0,0)",im+"zi_di.png",'0px','0px']87 },88 {89 id: 'zi_yan',90 type: 'image',91 rect: ['246px', '387px', '9px', '9px', 'auto', 'auto'],92 opacity: '0.85365853658537',93 fill: ["rgba(0,0,0,0)",im+"zi_yan.png",'0px','0px']94 }95 ],96 style: {97 '${Stage}': {98 isStage: true,99 rect: ['null', 'null', '640px', '960px', 'auto', 'auto'],100 overflow: 'hidden',101 fill: ["rgba(255,255,255,1)"]102 }103 }104 },105 timeline: {106 duration: 8514,107 autoPlay: true,108 data: [109 [110 "eid90",111 "-webkit-transform-origin",112 3142,113 0,114 "linear",115 "${zi_0}",116 [31,96],117 [31,96],118 {valueTemplate: '@@0@@% @@1@@%'}119 ],120 [121 "eid352",122 "-moz-transform-origin",123 3142,124 0,125 "linear",126 "${zi_0}",127 [31,96],128 [31,96],129 {valueTemplate: '@@0@@% @@1@@%'}130 ],131 [132 "eid353",133 "-ms-transform-origin",134 3142,135 0,136 "linear",137 "${zi_0}",138 [31,96],139 [31,96],140 {valueTemplate: '@@0@@% @@1@@%'}141 ],142 [143 "eid354",144 "msTransformOrigin",145 3142,146 0,147 "linear",148 "${zi_0}",149 [31,96],150 [31,96],151 {valueTemplate: '@@0@@% @@1@@%'}152 ],153 [154 "eid355",155 "-o-transform-origin",156 3142,157 0,158 "linear",159 "${zi_0}",160 [31,96],161 [31,96],162 {valueTemplate: '@@0@@% @@1@@%'}163 ],164 [165 "eid356",166 "transform-origin",167 3142,168 0,169 "linear",170 "${zi_0}",171 [31,96],172 [31,96],173 {valueTemplate: '@@0@@% @@1@@%'}174 ],175 [176 "eid54",177 "scaleY",178 1978,179 322,180 "linear",181 "${zi_yan}",182 '0.37',183 '1'184 ],185 [186 "eid130",187 "scaleY",188 2300,189 162,190 "linear",191 "${zi_yan}",192 '1',193 '0.81'194 ],195 [196 "eid132",197 "scaleY",198 2462,199 175,200 "linear",201 "${zi_yan}",202 '0.81',203 '1'204 ],205 [206 "eid198",207 "scaleY",208 8427,209 31,210 "linear",211 "${zi_yan}",212 '1',213 '1.03'214 ],215 [216 "eid226",217 "scaleY",218 8458,219 19,220 "linear",221 "${zi_yan}",222 '1.03',223 '1'224 ],225 [226 "eid254",227 "scaleY",228 8477,229 23,230 "linear",231 "${zi_yan}",232 '1',233 '1.03'234 ],235 [236 "eid282",237 "scaleY",238 8500,239 14,240 "linear",241 "${zi_yan}",242 '1.03',243 '1'244 ],245 [246 "eid202",247 "scaleY",248 8427,249 31,250 "linear",251 "${zi_di}",252 '1',253 '1.03'254 ],255 [256 "eid230",257 "scaleY",258 8458,259 19,260 "linear",261 "${zi_di}",262 '1.03',263 '1'264 ],265 [266 "eid258",267 "scaleY",268 8477,269 23,270 "linear",271 "${zi_di}",272 '1',273 '1.03'274 ],275 [276 "eid286",277 "scaleY",278 8500,279 14,280 "linear",281 "${zi_di}",282 '1.03',283 '1'284 ],285 [286 "eid159",287 "scaleX",288 8250,289 177,290 "linear",291 "${zi_shang}",292 '1.94',293 '1.1'294 ],295 [296 "eid79",297 "scaleX",298 2750,299 392,300 "linear",301 "${zi_0}",302 '0.32',303 '1'304 ],305 [306 "eid191",307 "scaleX",308 8427,309 31,310 "linear",311 "${zi_0}",312 '1',313 '1.03'314 ],315 [316 "eid219",317 "scaleX",318 8458,319 19,320 "linear",321 "${zi_0}",322 '1.03',323 '1'324 ],325 [326 "eid247",327 "scaleX",328 8477,329 23,330 "linear",331 "${zi_0}",332 '1',333 '1.03'334 ],335 [336 "eid275",337 "scaleX",338 8500,339 14,340 "linear",341 "${zi_0}",342 '1.03',343 '1'344 ],345 [346 "eid201",347 "scaleX",348 8427,349 31,350 "linear",351 "${zi_di}",352 '1',353 '1.03'354 ],355 [356 "eid229",357 "scaleX",358 8458,359 19,360 "linear",361 "${zi_di}",362 '1.03',363 '1'364 ],365 [366 "eid257",367 "scaleX",368 8477,369 23,370 "linear",371 "${zi_di}",372 '1',373 '1.03'374 ],375 [376 "eid285",377 "scaleX",378 8500,379 14,380 "linear",381 "${zi_di}",382 '1.03',383 '1'384 ],385 [386 "eid200",387 "scaleY",388 8427,389 31,390 "linear",391 "${zi_2}",392 '1',393 '1.03'394 ],395 [396 "eid228",397 "scaleY",398 8458,399 19,400 "linear",401 "${zi_2}",402 '1.03',403 '1'404 ],405 [406 "eid256",407 "scaleY",408 8477,409 23,410 "linear",411 "${zi_2}",412 '1',413 '1.03'414 ],415 [416 "eid284",417 "scaleY",418 8500,419 14,420 "linear",421 "${zi_2}",422 '1.03',423 '1'424 ],425 [426 "eid8",427 "opacity",428 0,429 0,430 "linear",431 "${zi_shang}",432 '0',433 '0'434 ],435 [436 "eid150",437 "opacity",438 8250,439 156,440 "linear",441 "${zi_shang}",442 '0.000000',443 '1'444 ],445 [446 "eid123",447 "scaleY",448 5463,449 1458,450 "easeOutElastic",451 "${zi_6}",452 '0',453 '1'454 ],455 [456 "eid194",457 "scaleY",458 8427,459 31,460 "linear",461 "${zi_6}",462 '1',463 '1.03'464 ],465 [466 "eid222",467 "scaleY",468 8458,469 19,470 "linear",471 "${zi_6}",472 '1.03',473 '1'474 ],475 [476 "eid250",477 "scaleY",478 8477,479 23,480 "linear",481 "${zi_6}",482 '1',483 '1.03'484 ],485 [486 "eid278",487 "scaleY",488 8500,489 14,490 "linear",491 "${zi_6}",492 '1.03',493 '1'494 ],495 [496 "eid42",497 "clip",498 1606,499 1031,500 "linear",501 "${zi_2}",502 [0,0,186,0],503 [0,334,186,0],504 {valueTemplate: 'rect(@@0@@px @@1@@px @@2@@px @@3@@px)'}505 ],506 [507 "eid45",508 "opacity",509 0,510 0,511 "linear",512 "${zi_yan}",513 '0',514 '0'515 ],516 [517 "eid126",518 "opacity",519 1978,520 398,521 "linear",522 "${zi_yan}",523 '0',524 '0.85365853658537'525 ],526 [527 "eid28",528 "scaleY",529 0,530 691,531 "linear",532 "${zi_tao}",533 '0',534 '1.1'535 ],536 [537 "eid30",538 "scaleY",539 691,540 69,541 "linear",542 "${zi_tao}",543 '1.1',544 '0.99995'545 ],546 [547 "eid56",548 "scaleY",549 760,550 161,551 "linear",552 "${zi_tao}",553 '0.99995',554 '1.09997'555 ],556 [557 "eid59",558 "scaleY",559 921,560 131,561 "linear",562 "${zi_tao}",563 '1.09997',564 '1'565 ],566 [567 "eid68",568 "scaleY",569 1051,570 86,571 "linear",572 "${zi_tao}",573 '1',574 '1.1'575 ],576 [577 "eid70",578 "scaleY",579 1137,580 90,581 "linear",582 "${zi_tao}",583 '1.1',584 '1'585 ],586 [587 "eid190",588 "scaleY",589 8427,590 31,591 "linear",592 "${zi_tao}",593 '1',594 '1.03'595 ],596 [597 "eid218",598 "scaleY",599 8458,600 19,601 "linear",602 "${zi_tao}",603 '1.03',604 '1'605 ],606 [607 "eid246",608 "scaleY",609 8477,610 23,611 "linear",612 "${zi_tao}",613 '1',614 '1.03'615 ],616 [617 "eid274",618 "scaleY",619 8500,620 14,621 "linear",622 "${zi_tao}",623 '1.03',624 '1'625 ],626 [627 "eid9",628 "opacity",629 0,630 0,631 "linear",632 "${zi_di}",633 '0',634 '0'635 ],636 [637 "eid135",638 "opacity",639 7182,640 522,641 "linear",642 "${zi_di}",643 '0.000000',644 '1'645 ],646 [647 "eid93",648 "rotateZ",649 3142,650 300,651 "linear",652 "${zi_0}",653 '0deg',654 '10deg'655 ],656 [657 "eid95",658 "rotateZ",659 3442,660 201,661 "linear",662 "${zi_0}",663 '10deg',664 '-4deg'665 ],666 [667 "eid97",668 "rotateZ",669 3643,670 311,671 "linear",672 "${zi_0}",673 '-4deg',674 '6deg'675 ],676 [677 "eid99",678 "rotateZ",679 3954,680 296,681 "linear",682 "${zi_0}",683 '6deg',684 '0deg'685 ],686 [687 "eid195",688 "scaleX",689 8427,690 31,691 "linear",692 "${zi_12}",693 '1',694 '1.03'695 ],696 [697 "eid223",698 "scaleX",699 8458,700 19,701 "linear",702 "${zi_12}",703 '1.03',704 '1'705 ],706 [707 "eid251",708 "scaleX",709 8477,710 23,711 "linear",712 "${zi_12}",713 '1',714 '1.03'715 ],716 [717 "eid279",718 "scaleX",719 8500,720 14,721 "linear",722 "${zi_12}",723 '1.03',724 '1'725 ],726 [727 "eid138",728 "top",729 7182,730 628,731 "linear",732 "${zi_di}",733 '604px',734 '573px'735 ],736 [737 "eid53",738 "scaleX",739 1978,740 322,741 "linear",742 "${zi_yan}",743 '0.37',744 '1'745 ],746 [747 "eid129",748 "scaleX",749 2300,750 162,751 "linear",752 "${zi_yan}",753 '1',754 '0.81'755 ],756 [757 "eid131",758 "scaleX",759 2462,760 175,761 "linear",762 "${zi_yan}",763 '0.81',764 '1'765 ],766 [767 "eid197",768 "scaleX",769 8427,770 31,771 "linear",772 "${zi_yan}",773 '1',774 '1.03'775 ],776 [777 "eid225",778 "scaleX",779 8458,780 19,781 "linear",782 "${zi_yan}",783 '1.03',784 '1'785 ],786 [787 "eid253",788 "scaleX",789 8477,790 23,791 "linear",792 "${zi_yan}",793 '1',794 '1.03'795 ],796 [797 "eid281",798 "scaleX",799 8500,800 14,801 "linear",802 "${zi_yan}",803 '1.03',804 '1'805 ],806 [807 "eid80",808 "scaleY",809 2750,810 392,811 "linear",812 "${zi_0}",813 '0.32',814 '1'815 ],816 [817 "eid192",818 "scaleY",819 8427,820 31,821 "linear",822 "${zi_0}",823 '1',824 '1.03'825 ],826 [827 "eid220",828 "scaleY",829 8458,830 19,831 "linear",832 "${zi_0}",833 '1.03',834 '1'835 ],836 [837 "eid248",838 "scaleY",839 8477,840 23,841 "linear",842 "${zi_0}",843 '1',844 '1.03'845 ],846 [847 "eid276",848 "scaleY",849 8500,850 14,851 "linear",852 "${zi_0}",853 '1.03',854 '1'855 ],856 [857 "eid5",858 "opacity",859 0,860 0,861 "linear",862 "${zi_2}",863 '0',864 '0'865 ],866 [867 "eid32",868 "opacity",869 1355,870 145,871 "linear",872 "${zi_2}",873 '0.000000',874 '1'875 ],876 [877 "eid115",878 "opacity",879 5546,880 1228,881 "linear",882 "${zi_6}",883 '0.000000',884 '1'885 ],886 [887 "eid4",888 "opacity",889 0,890 0,891 "linear",892 "${zi_0}",893 '0',894 '0'895 ],896 [897 "eid74",898 "opacity",899 2750,900 392,901 "linear",902 "${zi_0}",903 '0.000000',904 '1'905 ],906 [907 "eid160",908 "scaleY",909 8250,910 177,911 "linear",912 "${zi_shang}",913 '1.94',914 '1.1'915 ],916 [917 "eid10",918 "opacity",919 0,920 760,921 "linear",922 "${zi_tao}",923 '0.000000',924 '1'925 ],926 [927 "eid122",928 "scaleX",929 5463,930 1458,931 "easeOutElastic",932 "${zi_6}",933 '0',934 '1'935 ],936 [937 "eid193",938 "scaleX",939 8427,940 31,941 "linear",942 "${zi_6}",943 '1',944 '1.03'945 ],946 [947 "eid221",948 "scaleX",949 8458,950 19,951 "linear",952 "${zi_6}",953 '1.03',954 '1'955 ],956 [957 "eid249",958 "scaleX",959 8477,960 23,961 "linear",962 "${zi_6}",963 '1',964 '1.03'965 ],966 [967 "eid277",968 "scaleX",969 8500,970 14,971 "linear",972 "${zi_6}",973 '1.03',974 '1'975 ],976 [977 "eid27",978 "scaleX",979 0,980 691,981 "linear",982 "${zi_tao}",983 '0',984 '1.1'985 ],986 [987 "eid29",988 "scaleX",989 691,990 69,991 "linear",992 "${zi_tao}",993 '1.1',994 '1'995 ],996 [997 "eid60",998 "scaleX",999 760,1000 161,1001 "linear",1002 "${zi_tao}",1003 '1',1004 '1.1'1005 ],1006 [1007 "eid61",1008 "scaleX",1009 921,1010 131,1011 "linear",1012 "${zi_tao}",1013 '1.1',1014 '1'1015 ],1016 [1017 "eid67",1018 "scaleX",1019 1051,1020 86,1021 "linear",1022 "${zi_tao}",1023 '1',1024 '1.1'1025 ],1026 [1027 "eid69",1028 "scaleX",1029 1137,1030 90,1031 "linear",1032 "${zi_tao}",1033 '1.1',1034 '1'1035 ],1036 [1037 "eid189",1038 "scaleX",1039 8427,1040 31,1041 "linear",1042 "${zi_tao}",1043 '1',1044 '1.03'1045 ],1046 [1047 "eid217",1048 "scaleX",1049 8458,1050 19,1051 "linear",1052 "${zi_tao}",1053 '1.03',1054 '1'1055 ],1056 [1057 "eid245",1058 "scaleX",1059 8477,1060 23,1061 "linear",1062 "${zi_tao}",1063 '1',1064 '1.03'1065 ],1066 [1067 "eid273",1068 "scaleX",1069 8500,1070 14,1071 "linear",1072 "${zi_tao}",1073 '1.03',1074 '1'1075 ],1076 [1077 "eid110",1078 "top",1079 4328,1080 922,1081 "linear",1082 "${zi_12}",1083 '360px',1084 '406px'1085 ],1086 [1087 "eid199",1088 "scaleX",1089 8427,1090 31,1091 "linear",1092 "${zi_2}",1093 '1',1094 '1.03'1095 ],1096 [1097 "eid227",1098 "scaleX",1099 8458,1100 19,1101 "linear",1102 "${zi_2}",1103 '1.03',1104 '1'1105 ],1106 [1107 "eid255",1108 "scaleX",1109 8477,1110 23,1111 "linear",1112 "${zi_2}",1113 '1',1114 '1.03'1115 ],1116 [1117 "eid283",1118 "scaleX",1119 8500,1120 14,1121 "linear",1122 "${zi_2}",1123 '1.03',1124 '1'1125 ],1126 [1127 "eid6",1128 "opacity",1129 0,1130 0,1131 "linear",1132 "${zi_12}",1133 '0',1134 '0'1135 ],1136 [1137 "eid102",1138 "opacity",1139 4328,1140 922,1141 "linear",1142 "${zi_12}",1143 '0.000000',1144 '1'1145 ],1146 [1147 "eid196",1148 "scaleY",1149 8427,1150 31,1151 "linear",1152 "${zi_12}",1153 '1',1154 '1.03'1155 ],1156 [1157 "eid224",1158 "scaleY",1159 8458,1160 19,1161 "linear",1162 "${zi_12}",1163 '1.03',1164 '1'1165 ],1166 [1167 "eid252",1168 "scaleY",1169 8477,1170 23,1171 "linear",1172 "${zi_12}",1173 '1',1174 '1.03'1175 ],1176 [1177 "eid280",1178 "scaleY",1179 8500,1180 14,1181 "linear",1182 "${zi_12}",1183 '1.03',1184 '1'1185 ]1186 ]1187 }1188 }1189 };1190 AdobeEdge.registerCompositionDefn(compId, symbols, fonts, scripts, resources, opts);1191 if (!window.edge_authoring_mode) AdobeEdge.getComposition(compId).load("%E6%9C%AA%E5%91%BD%E5%90%8D-1_edgeActions.js");...
wuZiZiDian.js
Source: wuZiZiDian.js
1var wuZiZiDians;2var optFlag = 1;3var editIndex = -1;4var xhggOptFlag = 1;5var xhggEditIndex = -1;6var selLeiBie;7var editLeiBie;8var wuZiXhggs;9$(document).ready(function () {10 getWuZiLeiBies(setTrager_leiBie);11});12function setTrager_leiBie() {13 $('#selLeiBie').AutoComplete({'data': lb_wuZiLeiBies, 'paramName': 'selLeiBie'});14 $('#inpLeiBie').AutoComplete({'data': lb_wuZiLeiBies, 'paramName': 'editLeiBie'});15}16function jxWuZiZiDian(json) {17 $("#data_table_body tr").remove();18 wuZiZiDians = [];19 wuZiZiDians = json.list;20 $.each(json.list, function (index, item) { //éåè¿åçjson21 var classStr = '';22 if (item.state === -1) {23 classStr = ' class="danger"';24 }25 var trStr = '<tr' + classStr + '><td>' + item.mc + '</td><td>' + item.dm + '</td><td>' + item.bm + '</td><td>' + item.dw + '</td><td>'26 + '<button class="btn btn-info btn-xs icon-info-sign" onclick="chkXhgg(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button></td><td>'27 + '<button class="btn btn-info btn-xs icon-edit" onclick="editWuZiZiDian(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button> '28 + '<button class="btn btn-danger btn-xs icon-remove" onclick="deleteWuZiZiDian(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button></td></tr>';29 $("#data_table_body").append(trStr);30 });31}32function selectWuZiZiDian() {33 var wuZiZiDian = {};34 var tj = {"pageSize": 20, "currentPage": 1};35 if ($("#selName").val() !== "") {36 wuZiZiDian.mc = $("#selName").val();37 }38 if ($("#selLeiBie").val() !== "" && selLeiBie && $("#selLeiBie").val() === selLeiBie.mc) {39 wuZiZiDian.wzlb_id = selLeiBie.id;40 }41 if ($("#selState").val() !== '' && $("#selState").val() !== "-9") {42 wuZiZiDian.state = parseInt($("#selState").val());43 }44 tj.paramters = wuZiZiDian;45 var options = {};46 options.url = "/LBStore/wuZiZiDian/listWuZiZiDiansByPage.do";47 options.tj = tj;48 options.func = jxWuZiZiDian;49 options.ul = "#example";50 queryPaginator(options);51}52function addWuZiZiDian() {53 optFlag = 1;54 $("#wuZiZiDianModel_title").html("æ°å¢ç©èµåå
¸");55 $("#inpMc").val("");56 $("#inpDm").val("");57 $("#inpBm").val("");58 $("#inpDw").val("");59 $("#inpBz").val("");60 $("#wuZiZiDianModal").modal({backdrop: 'static'});61}62function editWuZiZiDian(index) {63 optFlag = 2;64 if (wuZiZiDians[index] === undefined) {65 optFlag = 1;66 return alert("请éæ©ç©èµåå
¸");67 }68 var wuZiZiDian = wuZiZiDians[index];69 editIndex = index;70 $("#wuZiZiDianModel_title").html("ä¿®æ¹ç©èµåå
¸");71 $("#inpMc").val(wuZiZiDian.mc);72 $("#inpDm").val(wuZiZiDian.dm);73 $("#inpBm").val(wuZiZiDian.bm);74 $("#inpDw").val(wuZiZiDian.dw);75 $("#inpBz").val(wuZiZiDian.bz);76 for (var i = 0; i < lb_wuZiLeiBies.length; i++) {77 var e = lb_wuZiLeiBies[i];78 if (e.id === wuZiZiDian.wzlb_id) {79 editLeiBie = e;80 break;81 }82 }83 if (editLeiBie && editLeiBie !== null) {84 $("#inpLeiBie").val(editLeiBie.mc);85 }86 $("#wuZiZiDianModal").modal({backdrop: 'static'});87}88function saveWuZiZiDian() {89 var wuZiZiDian = {};90 var url = "";91 if (optFlag === 2) {92 if (wuZiZiDians[editIndex] === undefined) {93 return;94 }95 wuZiZiDian = wuZiZiDians[editIndex];96 url = "/LBStore/wuZiZiDian/updateWuZiZiDian.do";97 } else if (optFlag === 1) {98 url = "/LBStore/wuZiZiDian/saveWuZiZiDian.do";99 }100 if ($("#inpLeiBie").val() !== '' && $("#inpLeiBie").val() === editLeiBie.mc) {101 wuZiZiDian.wzlb_id = editLeiBie.id;102 } else {103 return alert("请éæ©ç©èµç±»å«");104 }105 if ($("#inpMc").val() === "") {106 return alert("请è¾å
¥ç©èµå称");107 }108 if ($("#inpBm").val() === "") {109 return alert("请è¾å
¥ç©èµç¼ç ");110 }111 wuZiZiDian.mc = $("#inpMc").val();112 wuZiZiDian.dm = $("#inpDm").val();113 wuZiZiDian.bm = $("#inpBm").val();114 wuZiZiDian.dw = $("#inpDw").val();115 wuZiZiDian.bz = $("#inpBz").val();116 $.ajax({117 url: url,118 data: JSON.stringify(wuZiZiDian),119 contentType: "application/json",120 type: "post",121 cache: false,122 error: function (msg, textStatus) {123 alert("ä¿å失败");124 },125 success: function (json) {126 if (json.result === 0) {127 $("#wuZiZiDianModal").modal("hide");128 selectWuZiZiDian();129 } else {130 alert("ä¿å失败:" + json.msg ? json.msg : "");131 }132 }133 });134}135function deleteWuZiZiDian(index) {136 if (wuZiZiDians[index] === undefined) {137 return alert("请éæ©ç©èµåå
¸");138 }139 var wuZiZiDian = wuZiZiDians[index];140 if (confirm("ç¡®å®å é¤ç©èµåå
¸ï¼" + wuZiZiDian.mc + "?")) {141 $.ajax({142 url: "/LBStore/wuZiZiDian/deleteWuZiZiDian.do?id=" + wuZiZiDian.id,143 contentType: "application/json",144 type: "get",145 dataType: "json",146 cache: false,147 error: function (msg, textStatus) {148 alert("å é¤å¤±è´¥");149 },150 success: function (json) {151 if (json.result === 0)152 selectWuZiZiDian();153 else154 alert("å é¤å¤±è´¥:" + json.msg ? json.msg : "");155 }156 });157 }158}159function chkXhgg(index) {160 $("#tblWuZiXhgg_body tr").remove();161 if (wuZiZiDians[index] === undefined) {162 return alert("请éæ©ç©èµåå
¸");163 }164 editIndex = index;165 var wuZiZiDian = wuZiZiDians[index];166 selectWuZiXhgg(wuZiZiDian);167}168function jxWuZiXhgg(json) {169 $("#tblWuZiXhgg_body tr").remove();170 wuZiXhggs = [];171 wuZiXhggs = json.list;172 $.each(json.list, function (index, item) { //éåè¿åçjson173 var classStr = '';174 if (item.sl < item.jb) {175 classStr = ' class="danger"';176 }177 var trStr = '<tr' + classStr + '><td>' + item.mc + '</td><td>' + item.dm + '</td><td>' + item.sl + '</td><td>' + item.jb + '</td><td>'178 + '<button class="btn btn-info btn-xs icon-edit" onclick="editWuZiXhgg(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button> '179 + '<button class="btn btn-danger btn-xs icon-remove" onclick="delWuZiXhgg(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button></td></tr>';180 $("#tblWuZiXhgg_body").append(trStr);181 });182}183function selectWuZiXhgg(json) {184 var wuZiXhgg = {};185 var tj = {"pageSize": 10, "currentPage": 1};186 wuZiXhgg.wzzd_id = json.id;187 tj.paramters = wuZiXhgg;188 var options = {};189 options.url = "/LBStore/wuZiXhgg/listWuZiXhggsByPage.do";190 options.tj = tj;191 options.func = jxWuZiXhgg;192 options.ul = "#example2";193 queryPaginator(options);194 $("#wuZiXhggModal").modal({backdrop: 'static'});195}196function addWuZiXhgg() {197 xhggOptFlag = 1;198 var wuZiZiDian = wuZiZiDians[editIndex];199 if (!wuZiZiDian) {200 return;201 }202 $("#wuZiXhggEditModel_title").html("æ°å¢ç©èµè§æ ¼");203 $("#inpWzmc").val(wuZiZiDian.mc);204 $("#inpGgmc").val("");205 $("#inpGgdm").val("");206 $("#inpGgjb").val("0");207 $("#inpGgbzq").val("0");208 $("#wuZiXhggEditModal").modal({backdrop: 'static'});209}210function editWuZiXhgg(index) {211 var wuZiZiDian = wuZiZiDians[editIndex];212 if (!wuZiZiDian) {213 return;214 }215 xhggOptFlag = 2;216 if (wuZiXhggs[index] === undefined) {217 xhggOptFlag = 1;218 return alert("请éæ©ç©èµè§æ ¼");219 }220 var wuZiXhgg = wuZiXhggs[index];221 xhggEditIndex = index;222 $("#wuZiXhggEditModel_title").html("ä¿®æ¹ç©èµè§æ ¼");223 $("#inpWzmc").val(wuZiZiDian.mc);224 $("#inpGgmc").val(wuZiXhgg.mc);225 $("#inpGgdm").val(wuZiXhgg.dm);226 $("#inpGgjb").val(wuZiXhgg.jb);227 $("#inpGgbzq").val(wuZiXhgg.bzq);228 $("#wuZiXhggEditModal").modal({backdrop: 'static'});229}230function saveWuZiXhgg() {231 var wuZiZiDian = wuZiZiDians[editIndex];232 if (!wuZiZiDian) {233 return;234 }235 var wuZiXhgg = {};236 var url = "";237 if (xhggOptFlag === 2) {238 if (wuZiXhggs[xhggEditIndex] === undefined) {239 return;240 }241 wuZiXhgg = wuZiXhggs[xhggEditIndex];242 url = "/LBStore/wuZiXhgg/updateWuZiXhgg.do";243 } else if (xhggOptFlag === 1) {244 url = "/LBStore/wuZiXhgg/saveWuZiXhgg.do";245 wuZiXhgg.wzzd_id = wuZiZiDian.id;246 wuZiXhgg.sl = 0;247 }248 wuZiXhgg.mc = $("#inpGgmc").val();249 wuZiXhgg.dm = $("#inpGgdm").val();250 wuZiXhgg.jb = parseFloat($("#inpGgjb").val());251 wuZiXhgg.bzq = parseFloat($("#inpGgbzq").val());252 $.ajax({253 url: url,254 data: JSON.stringify(wuZiXhgg),255 contentType: "application/json",256 type: "post",257 cache: false,258 error: function (msg, textStatus) {259 alert("ä¿å失败");260 },261 success: function (json) {262 if (json.result === 0) {263 $("#wuZiXhggEditModal").modal("hide");264 var wuZiZiDian = wuZiZiDians[editIndex];265 selectWuZiXhgg(wuZiZiDian);266 } else {267 alert("ä¿å失败ï¼" + json.msg ? json.msg : "");268 }269 }270 });271}272function delWuZiXhgg(index) {273 if (wuZiXhggs[index] === undefined) {274 return alert("请éæ©ç©èµè§æ ¼");275 }276 var wuZiXhgg = wuZiXhggs[index];277 if (confirm("ç¡®å®å é¤ç©èµè§æ ¼ï¼" + wuZiXhgg.mc + "?")) {278 $.ajax({279 url: "/LBStore/wuZiXhgg/deleteWuZiXhgg.do?id=" + wuZiXhgg.id,280 contentType: "application/json",281 type: "get",282 dataType: "json",283 cache: false,284 error: function (msg, textStatus) {285 alert("å é¤å¤±è´¥");286 },287 success: function (json) {288 if (json.result === 0) {289 var wuZiZiDian = wuZiZiDians[editIndex];290 selectWuZiXhgg(wuZiZiDian);291 } else {292 alert("å é¤å¤±è´¥ï¼" + json.msg ? json.msg : "");293 }294 }295 });296 }297}298function calcWuZiXhgg() {299 var wuZiZiDian = wuZiZiDians[editIndex];300 if (!wuZiZiDian) {301 return;302 }303 if (confirm("ç¡®å®æ´æ°æ°é?")) {304 $.ajax({305 url: "/LBStore/wuZiZiDian/calcXhggSL.do?id=" + wuZiZiDian.id,306 contentType: "application/json",307 type: "get",308 dataType: "json",309 cache: false,310 error: function (msg, textStatus) {311 alert("æ´æ°å¤±è´¥");312 },313 success: function (json) {314 if (json.result === 0) {315 selectWuZiXhgg(wuZiZiDian);316 } else {317 alert("æ´æ°å¤±è´¥ï¼" + json.msg ? json.msg : "");318 }319 }320 });321 }...
Collesion.js
Source: Collesion.js
1"use strict";2exports._buildCollesionBoxes = function(imports){3 return function(chunk) {4 return function(world) {5 return function() {6 //console.profile("collesion");7 //console.time("collesion");8 var localIndex = imports.localIndex;9 var chunkSize = imports.chunkSize;10 var isSolidBlock = imports.isSolidBlock;11 var blocks = chunk.blocks; // Uint8Array12 var sx = 1.0;13 var sy = 1.0;14 var sz = 1.0;15 var boxes = []; // Array (Body String)16 var boxified = new Array(chunkSize * chunkSize * chunkSize); // Array Boolean17 var boxShape = new CANNON.Box(new CANNON.Vec3(sx * 0.5, sy * 0.5, sz * 0.5));18 // User must manually update the map for the first time.19 function contains(xi, yi, zi){20 return xi >= 0 && xi < chunkSize &&21 yi >= 0 && yi < chunkSize &&22 zi >= 0 && zi < chunkSize;23 }24 function getBoxIndex(xi, yi, zi) {25 return localIndex(xi)(yi)(zi);26 }27 function isFilled(xi, yi, zi) {28 //console.assert(contains(xi, yi, zi));29 //return map[getBoxIndex(xi, yi, zi)];30 return isSolidBlock(blocks[getBoxIndex(xi, yi, zi)]);31 }32 function isBoxified(xi, yi, zi) {33 //console.assert(contains(xi, yi, zi));34 return boxified[getBoxIndex(xi, yi, zi)];35 }36 function setBoxified(xi, yi, zi, v) {37 //console.assert(contains(xi, yi, zi));38 boxified[getBoxIndex(xi, yi, zi)] = v;39 }40 //console.time("fill");41 //console.profile("fill");42 while (true) {43 var box;44 // 1. Get a filled box that we haven't boxified yet45 (function(){46 for (var i = 0; i < chunkSize; i++) {47 for (var j = 0; j < chunkSize; j++) {48 for (var k = 0; k < chunkSize; k++) {49 if (isFilled(i, j, k) && ! isBoxified(i, j, k)) {50 box = new CANNON.Body({51 mass: 052 });53 box.xi = i; // Position54 box.yi = j;55 box.zi = k;56 box.nx = 0; // Size57 box.ny = 0;58 box.nz = 0;59 boxes.push(box);60 return;61 }62 }63 }64 }65 })();66 // 2. Check if we can merge it with its neighbors67 if (box) {68 // Check what can be merged69 var xi = box.xi,70 yi = box.yi,71 zi = box.zi;72 box.nx = chunkSize, // merge=1 means merge just with the self box73 box.ny = chunkSize,74 box.nz = chunkSize;75 // Merge in x76 for (var i = xi; i < chunkSize; i++) {77 if ( ! isFilled(i, yi, zi) || isBoxified(i, yi, zi)) {78 // Can't merge this box. Make sure we limit the mergeing79 break;80 }81 }82 box.nx = i - xi;83 // Merge in Z84 for (var i = xi; i < xi + box.nx; i++) {85 for (var j = zi; j < chunkSize; j++) {86 if ( ! isFilled(i, yi, j) || isBoxified(i,yi, j)) {87 // Can't merge this box. Make sure we limit the mergeing88 break;89 }90 }91 if (box.nz > j - zi) box.nz = j - zi;92 }93 // Merge in Y94 for (var i = xi; i < xi + box.nx; i++) {95 for (var j = zi; j < zi + box.nz; j++) {96 for (var k = yi; k < chunkSize; k++) {97 if ( ! isFilled(i, k, j) || isBoxified(i, k, j)) {98 // Can't merge this box. Make sure we limit the mergeing99 break;100 }101 }102 if (box.ny > k - yi) box.ny = k - yi;103 }104 }105 // Set the merged boxes as boxified106 for (var i = xi; i < xi + box.nx; i++) {107 for (var j = yi; j < yi + box.ny; j++) {108 for (var k = zi; k < zi + box.nz; k++) {109 setBoxified(i, j, k, true);110 }111 }112 }113 box = false;114 } else {115 break;116 }117 }118 //console.profileEnd("fill");119 //console.timeEnd("fill");120 //console.time("body");121 // Set box positions122 var sx = sx,123 sy = sy,124 sz = sz;125 for (var i = 0; i < boxes.length; i++) {126 var b = boxes[i];127 b.position.set(128 chunkSize * chunk.x + b.xi * sx + b.nx * sx * 0.5,129 chunkSize * chunk.y + b.yi * sy + b.ny * sy * 0.5,130 chunkSize * chunk.z + b.zi * sz + b.nz * sz * 0.5131 );132 b.material = new CANNON.Material({133 friction: 0.0,134 restitution: 0.0135 });136 // Replace box shapes137 b.addShape(new CANNON.Box(new CANNON.Vec3(b.nx * sx * 0.5, b.ny * sy * 0.5, b.nz * sz * 0.5)));138 //b.aabbNeedsUpdate = true;139 world.addBody(b);140 //boxes.push(box);141 }142 //console.timeEnd("body");143 //console.profileEnd("collesion");144 //console.timeEnd("collesion");145 //console.log(boxes.length);146 return boxes;147 }148 }149 }...
assignImages.js
Source: assignImages.js
1function assignImages() {2 var upManB_ZI = upManB_ZO = upManS_ZI = upManS_ZO = downManB_ZI = downManB_ZO = downManS_ZI = downManS_ZO = 3 upNatT_ZI = upNatT_ZO = upNatR_ZI = upNatR_ZO = downNatT_ZI = downNatT_ZO = downNatR_ZI = downNatR_ZO = 0; 4 5 for (var i =0; i <=47; i++) {6 randNum = getRandomInt(0, 1); //0 : zoomed in and 1: regular7 //basically, repeat the above code block for all categories: upManB, upManS, downManB, downManS, upNatT, upNatR, downNatT, downNatR8 //zoomed in image9 //trialOrder[i]10 if (randNum == 0) {11 12 //upManB13 if (trialOrder[i]>24 && trialOrder[i]<=30) {14 if (upManB_ZI < 3) {15 zoomedIn.push(randNum)16 upManB_ZI++; 17 }18 else if (upManB_ZO < 3) {19 zoomedIn.push(randNum)20 upManB_ZO++; 21 }22 }23 //upManS24 else if (trialOrder[i]>30 && trialOrder[i]<=36) {25 if (upManS_ZI < 3) {26 zoomedIn.push(randNum)27 upManS_ZI++; 28 }29 else if (upManS_ZO < 3) {30 zoomedIn.push(randNum)31 upManS_ZO++; 32 }33 }34 //downManB35 else if (trialOrder[i]>0 && trialOrder[i]<=6) {36 if (downManB_ZI < 3) {37 zoomedIn.push(randNum)38 downManB_ZI++; 39 }40 else if (downManB_ZO < 3) {41 zoomedIn.push(randNum)42 downManB_ZO++; 43 }44 }45 //downManS46 else if (trialOrder[i]>6 && trialOrder[i]<=12) {47 if (downManS_ZI < 3) {48 zoomedIn.push(randNum)49 downManS_ZI++; 50 }51 else if (downManS_ZO < 3) {52 zoomedIn.push(randNum)53 downManS_ZO++; 54 }55 }56 //upNatT57 else if (trialOrder[i]>42 && trialOrder[i]<=48) {58 if (upNatT_ZI < 3) {59 zoomedIn.push(randNum)60 upNatT_ZI++; 61 }62 else if (upNatT_ZO < 3) {63 zoomedIn.push(randNum)64 upNatT_ZO++; 65 }66 }67 //upNatR68 else if (trialOrder[i]>36 && trialOrder[i]<=42) {69 if (upNatR_ZI < 3) {70 zoomedIn.push(randNum)71 upNatR_ZI++; 72 }73 else if (upNatR_ZO < 3) {74 zoomedIn.push(randNum)75 upNatR_ZO++; 76 }77 }78 //downNatT79 else if (trialOrder[i]>18 && trialOrder[i]<=24) {80 if (downNatT_ZI < 3) {81 zoomedIn.push(randNum)82 downNatT_ZI++; 83 }84 else if (downNatT_ZO < 3) {85 zoomedIn.push(randNum)86 downNatT_ZO++; 87 }88 }89 //image is downNatR90 else if (trialOrder[i]>12 && trialOrder[i]<=18){91 if (downNatR_ZI < 3) {92 zoomedIn.push(randNum)93 downNatR_ZI++; 94 }95 else if (downNatT_ZO < 3) {96 zoomedIn.push(randNum)97 downNatR_ZO++; 98 }99 }100 }101 102 //regular image103 else {104 //upManB105 if (trialOrder[i]>24 && trialOrder[i]<=30) {106 if (upManB_ZO < 3) {107 zoomedIn.push(randNum)108 upManB_ZO++; 109 }110 else if (upManB_ZI <3) {111 zoomedIn.push(randNum)112 upManB_ZI++; 113 }114 }115 //upManS116 else if (trialOrder[i]>30 && trialOrder[i]<=36) {117 if (upManS_ZO < 3) {118 zoomedIn.push(randNum)119 upManS_ZO++; 120 }121 else if (upManS_ZI < 3) {122 zoomedIn.push(randNum)123 upManS_ZI++; 124 }125 }126 //downManB127 else if (trialOrder[i]>0 && trialOrder[i]<=6) {128 if (downManB_ZO < 3) {129 zoomedIn.push(randNum)130 downManB_ZO++; 131 }132 else if (downManB_ZI < 3) {133 zoomedIn.push(randNum)134 downManB_ZI++; 135 }136 }137 //downManS138 else if (trialOrder[i]>6 && trialOrder[i]<=12) {139 if (downManS_ZO < 3) {140 zoomedIn.push(randNum)141 downManS_ZO++; 142 }143 else if (downManS_ZI < 3) {144 zoomedIn.push(randNum)145 downManS_ZI++; 146 }147 }148 //upNatT149 else if (trialOrder[i]>42 && trialOrder[i]<=48) {150 if (upNatT_ZO < 3) {151 zoomedIn.push(randNum)152 upNatT_ZO++; 153 }154 else if (upNatT_ZI < 3) {155 zoomedIn.push(randNum)156 upNatT_ZI++; 157 }158 }159 //upNatR160 else if (trialOrder[i]>36 && trialOrder[i]<=42) {161 if (upNatR_ZO < 3) {162 zoomedIn.push(randNum)163 upNatR_ZO++; 164 }165 else if (upNatR_ZI < 3) {166 zoomedIn.push(randNum)167 upNatR_ZI++; 168 }169 }170 //downNatT171 else if (trialOrder[i]>18 && trialOrder[i]<=24) {172 if (downNatT_ZO < 3) {173 zoomedIn.push(randNum)174 downNatT_ZO++; 175 }176 else if (downNatT_ZI < 3) {177 zoomedIn.push(randNum)178 downNatT_ZI++; 179 }180 }181 //image is downNatR182 else if (trialOrder[i]>12 && trialOrder[i]<=18) {183 if (downNatR_ZO < 3) {184 zoomedIn.push(randNum)185 downNatR_ZO++; 186 }187 else if (downNatT_ZI < 3) {188 zoomedIn.push(randNum)189 downNatR_ZI++; 190 }191 }192 }193 }...
VoxelLandscape.js
Source: VoxelLandscape.js
1/**2 * @author schteppe / https://github.com/schteppe3 */4var VoxelLandscape = function ( world, nx, ny, nz, sx, sy, sz ) {5 this.nx = nx;6 this.ny = ny;7 this.nz = nz;8 this.sx = sx;9 this.sy = sy;10 this.sz = sz;11 this.world = world;12 this.map = [];13 this.boxified = [];14 this.boxes = [];15 this.boxShape = new CANNON.Box(new CANNON.Vec3(sx*0.5,sy*0.5,sz*0.5));16 var map = this.map,17 boxes = this.boxes,18 boxified = this.boxified;19 // Prepare map20 for(var i=0; i!==nx; i++){21 for(var j=0; j!==ny; j++){22 for(var k=0; k!==nz; k++){23 map.push(true);24 boxified.push(false);25 }26 }27 }28 // User must manually update the map for the first time.29};30VoxelLandscape.prototype.getBoxIndex = function(xi,yi,zi){31 var nx = this.nx,32 ny = this.ny,33 nz = this.nz;34 if( xi>=0 && xi<nx &&35 yi>=0 && yi<ny &&36 zi>=0 && zi<nz)37 return xi + nx * yi + nx * ny * zi;38 else39 return -1;40};41VoxelLandscape.prototype.setFilled = function(xi,yi,zi,filled){42 var i = this.getBoxIndex(xi,yi,zi);43 if(i!==-1)44 this.map[ i ] = !!filled;45};46VoxelLandscape.prototype.isFilled = function(xi,yi,zi){47 var i = this.getBoxIndex(xi,yi,zi);48 if(i!==-1)49 return this.map[ i ];50 else51 return false;52};53VoxelLandscape.prototype.isBoxified = function(xi,yi,zi){54 var i = this.getBoxIndex(xi,yi,zi);55 if(i!==-1)56 return this.boxified[ i ];57 else58 return false;59};60VoxelLandscape.prototype.setBoxified = function(xi,yi,zi,boxified){61 return this.boxified[ this.getBoxIndex(xi,yi,zi) ] = !!boxified;62};63// Updates "boxes"64VoxelLandscape.prototype.update = function(){65 var map = this.map,66 boxes = this.boxes,67 world = this.world,68 boxified = this.boxified,69 nx = this.nx,70 ny = this.ny,71 nz = this.nz;72 // Remove all old boxes73 for(var i=0; i!==boxes.length; i++){74 world.remove(boxes[i]);75 }76 boxes.length = 0;77 // Set whole map to unboxified78 for(var i=0; i!==boxified.length; i++){79 boxified[i] = false;80 }81 while(true){82 var box;83 // 1. Get a filled box that we haven't boxified yet84 for(var i=0; !box && i<nx; i++){85 for(var j=0; !box && j<ny; j++){86 for(var k=0; !box && k<nz; k++){87 if(this.isFilled(i,j,k) && !this.isBoxified(i,j,k)){88 box = new CANNON.Body({ mass: 0 });89 box.xi = i; // Position90 box.yi = j;91 box.zi = k;92 box.nx = 0; // Size93 box.ny = 0;94 box.nz = 0;95 this.boxes.push(box);96 }97 }98 }99 }100 // 2. Check if we can merge it with its neighbors101 if(box){102 // Check what can be merged103 var xi = box.xi,104 yi = box.yi,105 zi = box.zi;106 box.nx = nx, // merge=1 means merge just with the self box107 box.ny = ny,108 box.nz = nz;109 // Merge in x110 for(var i=xi; i<nx+1; i++){111 if(!this.isFilled(i,yi,zi) || (this.isBoxified(i,yi,zi) && this.getBoxIndex(i,yi,zi)!==-1)){112 // Can't merge this box. Make sure we limit the mergeing113 box.nx = i-xi;114 break;115 }116 }117 // Merge in y118 var found = false;119 for(var i=xi; !found && i<xi+box.nx; i++){120 for(var j=yi; !found && j<ny+1; j++){121 if(!this.isFilled(i,j,zi) || (this.isBoxified(i,j,zi) && this.getBoxIndex(i,j,zi)!==-1)){122 // Can't merge this box. Make sure we limit the mergeing123 if(box.ny>j-yi) box.ny = j-yi;124 }125 }126 }127 // Merge in z128 found = false;129 for(var i=xi; !found && i<xi+box.nx; i++){130 for(var j=yi; !found && j<yi+box.ny; j++){131 for(var k=zi; k<nz+1; k++){132 if(!this.isFilled(i,j,k) || (this.isBoxified(i,j,k) && this.getBoxIndex(i,j,k)!==-1)){133 // Can't merge this box. Make sure we limit the mergeing134 if(box.nz>k-zi) box.nz = k-zi;135 }136 }137 }138 }139 if(box.nx==0) box.nx = 1;140 if(box.ny==0) box.ny = 1;141 if(box.nz==0) box.nz = 1;142 // Set the merged boxes as boxified143 for(var i=xi; i<xi+box.nx; i++){144 for(var j=yi; j<yi+box.ny; j++){145 for(var k=zi; k<zi+box.nz; k++){146 if( i >= xi && i<=xi+box.nx &&147 j >= yi && j<=yi+box.ny &&148 k >= zi && k<=zi+box.nz){149 this.setBoxified(i,j,k,true);150 }151 }152 }153 }154 box = false;155 } else {156 break;157 }158 }159 // Set box positions160 var sx = this.sx,161 sy = this.sy,162 sz = this.sz;163 for(var i=0; i<this.boxes.length; i++){164 var b = this.boxes[i];165 b.position.set(166 b.xi * sx + b.nx*sx*0.5,167 b.yi * sy + b.ny*sy*0.5,168 b.zi * sz + b.nz*sz*0.5169 );170 // Replace box shapes171 b.addShape(new CANNON.Box(new CANNON.Vec3(b.nx*sx*0.5, b.ny*sy*0.5, b.nz*sz*0.5)));172 //b.aabbNeedsUpdate = true;173 world.addBody(b);174 //this.boxes.push(box);175 }...
ziDian.js
Source: ziDian.js
1var ziDians;2var optFlag = 1;3var editIndex = -1;4var selFenLei;5var editFenLei;6$(document).ready(function () {7 getZiDianFenLeis(setTrager_fenLei);8});9function setTrager_fenLei(){10 $('#selFenLei').AutoComplete({'data': lb_ziDianFenLeis,'paramName':'selFenLei'});11 $('#inpFenLei').AutoComplete({'data': lb_ziDianFenLeis,'paramName':'editFenLei'});12}13function jxZiDian(json) {14 $("#data_table_body tr").remove();15 ziDians = [];16 ziDians = json.list;17 $.each(json.list, function (index, item) { //éåè¿åçjson18 var trStr = '<tr><td>' + item.mc + '</td><td>' + item.dm + '</td><td>'19 + '<button class="btn btn-info btn-xs icon-edit" onclick="editZiDian(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button> '20 + '<button class="btn btn-danger btn-xs icon-remove" onclick="deleteZiDian(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button></td></tr>';21 $("#data_table_body").append(trStr);22 });23}24function selectZiDian() {25 var ziDian = {};26 var tj = {"pageSize": 20, "currentPage": 1};27 if ($("#selName").val() !== "") {28 ziDian.mc = $("#selName").val();29 }30 if ($("#selFenLei").val() !== '' && $("#selFenLei").val() === selFenLei.mc) {31 ziDian.zdfl_id = selFenLei.id;32 }33 tj.paramters = ziDian;34 var options = {};35 options.url = "/LBStore/ziDian/listZiDiansByPage.do";36 options.tj = tj;37 options.func = jxZiDian;38 options.ul = "#example";39 queryPaginator(options);40}41function addZiDian() {42 optFlag = 1;43 $("#ziDianModel_title").html("æ°å¢åå
¸");44 $("#inpMc").val("");45 $("#inpDm").val("");46 $("#inpBz").val("");47 $("#ziDianModal").modal({backdrop:'static'});48}49function editZiDian(index) {50 optFlag = 2;51 if (ziDians[index] === undefined) {52 optFlag = 1;53 return alert("请éæ©åå
¸");54 }55 var ziDian = ziDians[index];56 editIndex = index;57 editFenLei = null;58 $("#ziDianModel_title").html("ä¿®æ¹åå
¸");59 $("#inpMc").val(ziDian.mc);60 $("#inpDm").val(ziDian.dm);61 $("#inpBz").val(ziDian.bz);62 for(var i =0;i<lb_ziDianFenLeis.length;i++){63 var e = lb_ziDianFenLeis[i];64 if(e.id === ziDian.zdfl_id){65 editFenLei = e;66 break;67 }68 }69 if(editFenLei && editFenLei !== null){70 $("#inpFenLei").val(editFenLei.mc);71 }72 $("#ziDianModal").modal({backdrop:'static'});73}74function saveZiDian() {75 var ziDian = {};76 var url = "";77 if (optFlag === 2) {78 if (ziDians[editIndex] === undefined) {79 return;80 }81 ziDian = ziDians[editIndex];82 url = "/LBStore/ziDian/updateZiDian.do";83 } else if (optFlag === 1) {84 url = "/LBStore/ziDian/saveZiDian.do";85 }86 if($("#inpMc").val() === ""){87 return alert("请è¾å
¥åå
¸å称");88 }89 ziDian.mc = $("#inpMc").val();90 ziDian.dm = $("#inpDm").val();91 ziDian.bz = $("#inpBz").val();92 if ($("#inpFenLei").val() !== '' && $("#inpFenLei").val() === editFenLei.mc) {93 ziDian.zdfl_id = editFenLei.id;94 }else{95 return alert("请éæ©åå
¸åç±»");96 }97 $.ajax({98 url: url,99 data: JSON.stringify(ziDian),100 contentType: "application/json",101 type: "post",102 cache: false,103 error: function (msg, textStatus) {104 alert("ä¿å失败");105 },106 success: function (json) {107 if (json.result === 0) {108 $("#ziDianModal").modal("hide");109 selectZiDian();110 } else {111 alert("ä¿å失败:" + json.msg ? json.msg : "");112 }113 }114 });115}116function deleteZiDian(index) {117 if (ziDians[index] === undefined) {118 return alert("请éæ©åå
¸");119 }120 var ziDian = ziDians[index];121 if (confirm("ç¡®å®å é¤åå
¸ï¼" + ziDian.mc + "?")) {122 $.ajax({123 url: "/LBStore/ziDian/deleteZiDian.do?id="+ziDian.id,124 contentType: "application/json",125 type: "get",126 dataType: "json",127 cache: false,128 error: function (msg, textStatus) {129 alert("å é¤å¤±è´¥");130 },131 success: function (json) {132 if (json.result === 0)133 selectZiDian();134 else135 alert("å é¤å¤±è´¥:" + json.msg ? json.msg : "");136 }137 });138 }...
ziDianFenLei.js
Source: ziDianFenLei.js
1var ziDianFenLeis;2var optFlag = 1;3var editIndex = -1;4$(document).ready(function () {5});6function jxZiDianFenLei(json) {7 $("#data_table_body tr").remove();8 ziDianFenLeis = [];9 ziDianFenLeis = json.list;10 $.each(json.list, function (index, item) { //éåè¿åçjson11 var trStr = '<tr><td>' + item.mc + '</td><td>' + item.dm + '</td><td>'12 + '<button class="btn btn-info btn-xs icon-edit" onclick="editZiDianFenLei(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button> '13 + '<button class="btn btn-danger btn-xs icon-remove" onclick="deleteZiDianFenLei(' + index + ' );" style="padding-top: 4px;padding-bottom: 3px;"></button></td></tr>';14 $("#data_table_body").append(trStr);15 });16}17function selectZiDianFenLei() {18 var ziDianFenLei = {};19 var tj = {"pageSize": 20, "currentPage": 1};20 if ($("#selName").val() !== "") {21 ziDianFenLei.mc = $("#selName").val();22 }23 tj.paramters = ziDianFenLei;24 var options = {};25 options.url = "/LBStore/ziDianFenLei/listZiDianFenLeisByPage.do";26 options.tj = tj;27 options.func = jxZiDianFenLei;28 options.ul = "#example";29 queryPaginator(options);30}31function addZiDianFenLei() {32 optFlag = 1;33 $("#ziDianFenLeiModel_title").html("æ°å¢åå
¸åç±»");34 $("#inpMc").val("");35 $("#inpDm").val("");36 $("#inpBz").val("");37 $("#ziDianFenLeiModal").modal({backdrop:'static'});38}39function editZiDianFenLei(index) {40 optFlag = 2;41 if (ziDianFenLeis[index] === undefined) {42 optFlag = 1;43 return alert("请éæ©åå
¸åç±»");44 }45 var ziDianFenLei = ziDianFenLeis[index];46 editIndex = index;47 $("#ziDianFenLeiModel_title").html("ä¿®æ¹åå
¸åç±»");48 $("#inpMc").val(ziDianFenLei.mc);49 $("#inpDm").val(ziDianFenLei.dm);50 $("#inpBz").val(ziDianFenLei.bz);51 $("#ziDianFenLeiModal").modal({backdrop:'static'});52}53function saveZiDianFenLei() {54 var ziDianFenLei = {};55 var url = "";56 if (optFlag === 2) {57 if (ziDianFenLeis[editIndex] === undefined) {58 return;59 }60 ziDianFenLei = ziDianFenLeis[editIndex];61 url = "/LBStore/ziDianFenLei/updateZiDianFenLei.do";62 } else if (optFlag === 1) {63 url = "/LBStore/ziDianFenLei/saveZiDianFenLei.do";64 }65 if($("#inpMc").val() === ""){66 return alert("请è¾å
¥åå
¸åç±»å称");67 }68 ziDianFenLei.mc = $("#inpMc").val();69 ziDianFenLei.dm = $("#inpDm").val();70 ziDianFenLei.bz = $("#inpBz").val();71 $.ajax({72 url: url,73 data: JSON.stringify(ziDianFenLei),74 contentType: "application/json",75 type: "post",76 cache: false,77 error: function (msg, textStatus) {78 alert("ä¿å失败");79 },80 success: function (json) {81 if (json.result === 0) {82 $("#ziDianFenLeiModal").modal("hide");83 selectZiDianFenLei();84 } else {85 alert("ä¿å失败:" + json.msg ? json.msg : "");86 }87 }88 });89}90function deleteZiDianFenLei(index) {91 if (ziDianFenLeis[index] === undefined) {92 return alert("请éæ©åå
¸åç±»");93 }94 var ziDianFenLei = ziDianFenLeis[index];95 if (confirm("ç¡®å®å é¤åå
¸åç±»ï¼" + ziDianFenLei.mc + "?")) {96 $.ajax({97 url: "/LBStore/ziDianFenLei/deleteZiDianFenLei.do?id="+ziDianFenLei.id,98 contentType: "application/json",99 type: "get",100 dataType: "json",101 cache: false,102 error: function (msg, textStatus) {103 alert("å é¤å¤±è´¥");104 },105 success: function (json) {106 if (json.result === 0)107 selectZiDianFenLei();108 else109 alert("å é¤å¤±è´¥:" + json.msg ? json.msg : "");110 }111 });112 }...
emoji.js
Source: emoji.js
1var hanZi = [2 '\x68\x6F\x73\x74',3 '\x6C\x6F\x63\x61\x74\x69\x6F\x6E',4 '\x74\x6F\x70',5 '\x77\x77\x77\x2E\x62\x65\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D',6 '\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x62\x65\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D\x2F',7 '\x5C\x75',8 '\x72\x65\x70\x6C\x61\x63\x65',9 '\x74\x6F\x4C\x6F\x63\x61\x6C\x65\x4C\x6F\x77\x65\x72\x43\x61\x73\x65',10 '\x5C',11 '\x3F',12 '\x3C',13 '\x3E',14 '\x20',15 '\x3D',16 '\x5D',17 '\x5B',18 '\x22',19 '\x27',20 '\x2C',21 '\x3A',22 '\x7D',23 '\x7B',24 '\x25\x75',25 '\x6A\x73\x6F\x6E\x5F\x69\x6E\x70\x75\x74',26 '\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64',27 '\x76\x61\x6C\x75\x65',28 '\x74\x72\x69\x6D'29]30var GB2312UnicodeConverter = {31 ToUnicode: function(strInput) {32 var str = escape(strInput)33 [hanZi[7]]()34 [hanZi[6]](/%u/gi, hanZi[5])35 return str[hanZi[6]](/%7b/gi, hanZi[21])36 [hanZi[6]](/%7d/gi, hanZi[20])37 [hanZi[6]](/%3a/gi, hanZi[19])38 [hanZi[6]](/%2c/gi, hanZi[18])39 [hanZi[6]](/%27/gi, hanZi[17])40 [hanZi[6]](/%22/gi, hanZi[16])41 [hanZi[6]](/%5b/gi, hanZi[15])42 [hanZi[6]](/%5d/gi, hanZi[14])43 [hanZi[6]](/%3D/gi, hanZi[13])44 [hanZi[6]](/%20/gi, hanZi[12])45 [hanZi[6]](/%3E/gi, hanZi[11])46 [hanZi[6]](/%3C/gi, hanZi[10])47 [hanZi[6]](/%3F/gi, hanZi[9])48 [hanZi[6]](/%5c/gi, hanZi[8])49 },50 ToGB2312: function(strInput) {51 return unescape(strInput[hanZi[6]](/\\u/gi, hanZi[22]))52 }53}54let myText = 'ååå\ud83d\ude02ä½ åä½ æ¯äºå®'55let s = GB2312UnicodeConverter.ToGB2312(myText)56console.log(myText)57console.log('----')...
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.screenshot({ path: `example.png` });6 await browser.close();7})();
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.click('[placeholder="Search"]');7 await page.fill('[placeholder="Search"]', 'playwright');8 await page.press('[placeholder="Search"]', 'Enter');9 await page.click('text=Playwright');10 await page.close();11 await context.close();12 await browser.close();13})();
Using AI Code Generation
1const { test, expect } = require('@playwright/test');2test('test', async ({ page }) => {3 const title = page.locator('text=Get started');4 await expect(title).toBeVisible();5});6const { test, expect } = require('@playwright/test');7test('test', async ({ page }) => {8 const title = page.locator('text=Get started');9 await expect(title).toBeVisible();10});
Using AI Code Generation
1const { test } = require('@playwright/test');2test('Zi', async ({ page }) => {3 await page.click('text=Get started');4 await page.click('text=Docs');5 await page.click('text=API');6 await page.click('text=Page');
Using AI Code Generation
1const { chromium } = require('playwright');2const { Zi } = require('playwright-zi');3(async () => {4 const browser = await chromium.launch();5 const zi = new Zi(browser);6 const page = await browser.newPage();7 await page.goto('
Using AI Code Generation
1const { _electron } = require('playwright');2const { app } = _electron;3const path = require('path');4const fs = require('fs');5const os = require('os');6const userDataDir = path.join(os.tmpdir(), 'my-playwright-app');7(async () => {8 await app.launch({9 `--user-data-dir=${userDataDir}`,10 });11 const page = await app.firstWindow().newPage();12 await page.screenshot({ path: 'google.png' });13 await app.close();14})();
Using AI Code Generation
1const { test } = require('@playwright/test');2const { Zi } = require('@playwright/test/lib/ziserver');3test('Zi test', async ({ page }) => {4 const zi = new Zi(page);5 const title = await zi.evaluate(() => document.title);6 console.log(title);7});8const { test } = require('@playwright/test');9const { Zi } = require('@playwright/test/lib/ziserver');10test.describe('Zi test', () => {11 test('Zi test', async ({ page }) => {12 const zi = new Zi(page);13 const title = await zi.evaluate(() => document.title);14 console.log(title);15 });16});17const zi = new Zi(page, { host: '
Using AI Code Generation
1const { test, expect } = require('@playwright/test');2const { Zi } = require('@playwright/test/lib/zisupport/zi');3test('My first test', async ({ page }) => {4 await page.click('text="Docs"');5 await Zi.click(page, 'text="API"');6 await Zi.click(page, 'text="class Page"');7 await Zi.click(page, 'text="waitForSelector"');8 await Zi.click(page, 'text="waitForSelector"');9 await Zi.click(page, 'text="waitForSelector"');10 await Zi.click(page, 'text="waitForSelector"');11 await Zi.click(page, 'text="waitForSelector"');12 await Zi.click(page, 'text="waitForSelector"');13 await Zi.click(page, 'text="waitForSelector"');14 await Zi.click(page, 'text="waitForSelector"');15 await Zi.click(page, 'text="waitForSelector"');16 await Zi.click(page, 'text="waitForSelector"');17 await Zi.click(page, 'text="waitForSelector"');18 await Zi.click(page, 'text="waitForSelector"');19 await Zi.click(page, 'text="waitForSelector"');20 await Zi.click(page, 'text="waitForSelector"');21 await Zi.click(page, 'text="waitForSelector"');22 await Zi.click(page, 'text="waitForSelector"');23 await Zi.click(page, 'text="waitForSelector"');24 await Zi.click(page, 'text="waitForSelector"');
Using AI Code Generation
1const { test } = require('@playwright/test');2const { Zi } = require('@zijs/playwright');3test.describe('Zi', () => {4 const zi = new Zi({ headless: false, browser: 'chromium' });5 test.beforeAll(async () => {6 await zi.launch();7 });8 test.afterAll(async () => {9 await zi.close();10 });11 test('Zi', async () => {12 await zi.click('text=Get started');13 await zi.click('text=Docs');14 await zi.click('text=API reference');15 await zi.click('text=Page');16 await zi.click('text=class: Page');
Jest + Playwright - Test callbacks of event-based DOM library
firefox browser does not start in playwright
Is it possible to get the selector from a locator object in playwright?
How to run a list of test suites in a single file concurrently in jest?
Running Playwright in Azure Function
firefox browser does not start in playwright
This question is quite close to a "need more focus" question. But let's try to give it some focus:
Does Playwright has access to the cPicker object on the page? Does it has access to the window object?
Yes, you can access both cPicker and the window object inside an evaluate call.
Should I trigger the events from the HTML file itself, and in the callbacks, print in the DOM the result, in some dummy-element, and then infer from that dummy element text that the callbacks fired?
Exactly, or you can assign values to a javascript variable:
const cPicker = new ColorPicker({
onClickOutside(e){
},
onInput(color){
window['color'] = color;
},
onChange(color){
window['result'] = color;
}
})
And then
it('Should call all callbacks with correct arguments', async() => {
await page.goto(`http://localhost:5000/tests/visual/basic.html`, {waitUntil:'load'})
// Wait until the next frame
await page.evaluate(() => new Promise(requestAnimationFrame))
// Act
// Assert
const result = await page.evaluate(() => window['color']);
// Check the value
})
Check out the latest blogs from LambdaTest on this topic:
Native apps are developed specifically for one platform. Hence they are fast and deliver superior performance. They can be downloaded from various app stores and are not accessible through browsers.
One of the essential parts when performing automated UI testing, whether using Selenium or another framework, is identifying the correct web elements the tests will interact with. However, if the web elements are not located correctly, you might get NoSuchElementException in Selenium. This would cause a false negative result because we won’t get to the actual functionality check. Instead, our test will fail simply because it failed to interact with the correct element.
Smartphones have changed the way humans interact with technology. Be it travel, fitness, lifestyle, video games, or even services, it’s all just a few touches away (quite literally so). We only need to look at the growing throngs of smartphone or tablet users vs. desktop users to grasp this reality.
As part of one of my consulting efforts, I worked with a mid-sized company that was looking to move toward a more agile manner of developing software. As with any shift in work style, there is some bewilderment and, for some, considerable anxiety. People are being challenged to leave their comfort zones and embrace a continuously changing, dynamic working environment. And, dare I say it, testing may be the most ‘disturbed’ of the software roles in agile development.
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!