Best JavaScript code snippet using cucumber-gherkin
data.js
Source:data.js
1export const x5ContactGroups = [2 {3 X5ContactGroup: {4 x5_contact_group_id: "585",5 super: true,6 type: "1",7 group_name: "Super Admin",8 group_description: "Super Admin",9 create_datetime: "2017-02-13 19:25:55"10 }11 },12 {13 X5ContactGroup: {14 x5_contact_group_id: "668",15 super: false,16 type: "2",17 group_name: "Users",18 group_description: "Users Can only do some operations",19 create_datetime: "2017-04-27 06:47:14"20 }21 },22 {23 X5ContactGroup: {24 x5_contact_group_id: "900",25 super: false,26 type: "2",27 group_name: "demo",28 group_description: "temp",29 create_datetime: "2017-12-15 08:39:42"30 }31 },32 {33 X5ContactGroup: {34 x5_contact_group_id: "901",35 super: false,36 type: "2",37 group_name: "temp",38 group_description: "test",39 create_datetime: "2017-12-15 08:58:04"40 }41 },42 {43 X5ContactGroup: {44 x5_contact_group_id: "902",45 super: false,46 type: "2",47 group_name: "Testdata",48 group_description: "Test1212",49 create_datetime: "2017-12-15 09:25:01"50 }51 },52 {53 X5ContactGroup: {54 x5_contact_group_id: "906",55 super: false,56 type: "2",57 group_name: "Demo123",58 group_description: "test",59 create_datetime: "2017-12-15 09:31:12"60 }61 },62 {63 X5ContactGroup: {64 x5_contact_group_id: "909",65 super: false,66 type: "2",67 group_name: "temp",68 group_description: "hi",69 create_datetime: "2017-12-15 09:54:29"70 }71 },72 {73 X5ContactGroup: {74 x5_contact_group_id: "910",75 super: false,76 type: "2",77 group_name: "ok",78 group_description: "hi",79 create_datetime: "2017-12-15 10:06:42"80 }81 },82 {83 X5ContactGroup: {84 x5_contact_group_id: "911",85 super: false,86 type: "2",87 group_name: "BALAJI TEST",88 group_description: "ok ok",89 create_datetime: "2017-12-15 12:19:09"90 }91 },92 {93 X5ContactGroup: {94 x5_contact_group_id: "924",95 super: false,96 type: "2",97 group_name: "Test",98 group_description: "This is the Test Group",99 create_datetime: "2018-01-05 10:50:06"100 }101 },102 {103 X5ContactGroup: {104 x5_contact_group_id: "925",105 super: false,106 type: "2",107 group_name: "Admin",108 group_description: "Test",109 create_datetime: "2018-01-05 10:50:50"110 }111 },112 {113 X5ContactGroup: {114 x5_contact_group_id: "926",115 super: false,116 type: "2",117 group_name: "Administrator",118 group_description: "Administrator",119 create_datetime: "2018-01-05 10:51:52"120 }121 },122 {123 X5ContactGroup: {124 x5_contact_group_id: "927",125 super: false,126 type: "2",127 group_name: "Admin",128 group_description: "Admin",129 create_datetime: "2018-01-05 10:52:20"130 }131 },132 {133 X5ContactGroup: {134 x5_contact_group_id: "979",135 super: false,136 type: "2",137 group_name: "test",138 group_description: "test test",139 create_datetime: "2018-03-15 10:03:56"140 }141 },142 {143 X5ContactGroup: {144 x5_contact_group_id: "980",145 super: false,146 type: "2",147 group_name: "TEST User",148 group_description: "Test User",149 create_datetime: "2018-03-15 10:23:56"150 }151 },152 {153 X5ContactGroup: {154 x5_contact_group_id: "1081",155 super: false,156 type: "2",157 group_name: "RTPMM",158 group_description: "a",159 create_datetime: "2018-05-26 11:53:35"160 }161 },162 {163 X5ContactGroup: {164 x5_contact_group_id: "1084",165 super: false,166 type: "2",167 group_name: "BAVP",168 group_description: "aaa",169 create_datetime: "2018-05-28 07:00:01"170 }171 },172 {173 X5ContactGroup: {174 x5_contact_group_id: "1085",175 super: false,176 type: "2",177 group_name: "YTEL_TEST",178 group_description: "YTEL_TEST",179 create_datetime: "2018-05-28 07:00:50"180 }181 },182 {183 X5ContactGroup: {184 x5_contact_group_id: "1086",185 super: false,186 type: "2",187 group_name: "YTEL_TEST",188 group_description: "YTEL_TEST",189 create_datetime: "2018-05-28 07:01:17"190 }191 }192];193export const x5Contacts = {194 x5Contacts: [195 {196 X5Contact: {197 x5_contact_id: "345",198 name: "sangeeth",199 username: "sangeeth@xoyal.com",200 enable: true,201 group_ids: "585",202 group_names: "Super Admin"203 }204 },205 {206 X5Contact: {207 x5_contact_id: "1064",208 name: "Krishna Belkune test",209 username: "balaji@ytel.co.in",210 enable: true,211 group_ids: "585,924",212 group_names: "Super Admin,Test"213 }214 },215 {216 X5Contact: {217 x5_contact_id: "2315",218 name: "Sharat",219 username: "sharat@xoyal.com",220 enable: true,221 group_ids: "911,924,926,979",222 group_names: "BALAJI TEST,Test,Administrator"223 }224 }225 ],226 $allowContactGroup: [227 "585",228 "668",229 "899",230 "900",231 "901",232 "902",233 "903",234 "904",235 "905",236 "906",237 "907",238 "908",239 "909",240 "910",241 "911",242 "912",243 "913",244 "914",245 "915",246 "924",247 "925",248 "926",249 "927",250 "979",251 "980",252 "998",253 "1036",254 "1059",255 "1060",256 "1066",257 "1081",258 "1082",259 "1084",260 "1085",261 "1086"262 ],263 status: true264};265export const style_header = {266 backgroundColor: "#15bcd4",267 color: "#FFFFFF",268 fontSize: "20px",269 marginTop: "3px",270 padding: "10px",271 width: "100%"272};273export const permissionList = [274 {275 type: 1,276 name: "Campaign",277 order: 25,278 items: [279 {280 label: "040588",281 key: "040588"282 },283 {284 label: "0406",285 key: "0406"286 },287 {288 label: "1",289 key: "1"290 },291 {292 label: "1000",293 key: "1000"294 },295 {296 label: "1111",297 key: "1111"298 },299 {300 label: "1231",301 key: "1231"302 },303 {304 label: "12312",305 key: "12312"306 },307 {308 label: "123124",309 key: "123124"310 },311 {312 label: "12345",313 key: "12345"314 },315 {316 label: "131313",317 key: "131313"318 },319 {320 label: "15812879",321 key: "15812879"322 },323 {324 label: "18001",325 key: "18001"326 },327 {328 label: "1988",329 key: "1988"330 },331 {332 label: "2004",333 key: "2004"334 },335 {336 label: "2005",337 key: "2005"338 },339 {340 label: "2112",341 key: "2112"342 },343 {344 label: "2173",345 key: "2173"346 },347 {348 label: "2222",349 key: "2222"350 },351 {352 label: "3333",353 key: "3333"354 },355 {356 label: "34343",357 key: "34343"358 },359 {360 label: "40004",361 key: "40004"362 },363 {364 label: "4444",365 key: "4444"366 },367 {368 label: "509070",369 key: "509070"370 },371 {372 label: "52258878",373 key: "52258878"374 },375 {376 label: "606070",377 key: "606070"378 },379 {380 label: "76986116",381 key: "76986116"382 },383 {384 label: "7777",385 key: "7777"386 },387 {388 label: "8214_nw1",389 key: "8214_nw1"390 },391 {392 label: "82141_nw",393 key: "82141_nw"394 },395 {396 label: "87292888",397 key: "87292888"398 },399 {400 label: "883478",401 key: "883478"402 },403 {404 label: "8888",405 key: "8888"406 },407 {408 label: "888888",409 key: "888888"410 },411 {412 label: "9000000",413 key: "9000000"414 },415 {416 label: "95959595",417 key: "95959595"418 },419 {420 label: "9999",421 key: "9999"422 },423 {424 label: "99999999",425 key: "99999999"426 },427 {428 label: "Alest1",429 key: "Alest1"430 },431 {432 label: "ALEX",433 key: "ALEX"434 },435 {436 label: "AlexINBO",437 key: "AlexINBO"438 },439 {440 label: "alexte",441 key: "alexte"442 },443 {444 label: "Aroma",445 key: "Aroma"446 },447 {448 label: "Callbk",449 key: "Callbk"450 },451 {452 label: "callbk2",453 key: "callbk2"454 },455 {456 label: "CSTEST",457 key: "CSTEST"458 },459 {460 label: "DAN598",461 key: "DAN598"462 },463 {464 label: "DustinD",465 key: "DustinD"466 },467 {468 label: "Garthok",469 key: "Garthok"470 },471 {472 label: "Jornaya",473 key: "Jornaya"474 },475 {476 label: "KEVIN",477 key: "KEVIN"478 },479 {480 label: "LeadBeam",481 key: "LeadBeam"482 },483 {484 label: "moh_camp",485 key: "moh_camp"486 },487 {488 label: "Newcar",489 key: "Newcar"490 },491 {492 label: "nw1000",493 key: "nw1000"494 },495 {496 label: "nw1001",497 key: "nw1001"498 },499 {500 label: "nw1002",501 key: "nw1002"502 },503 {504 label: "nwtest1",505 key: "nwtest1"506 },507 {508 label: "nwtest10",509 key: "nwtest10"510 },511 {512 label: "OnHook",513 key: "OnHook"514 },515 {516 label: "Patricio",517 key: "Patricio"518 },519 {520 label: "Patricky",521 key: "Patricky"522 },523 {524 label: "snake",525 key: "snake"526 },527 {528 label: "Solar",529 key: "Solar"530 },531 {532 label: "Solar126",533 key: "Solar126"534 },535 {536 label: "Solar2",537 key: "Solar2"538 },539 {540 label: "spiLOAD",541 key: "spiLOAD"542 },543 {544 label: "SSupport",545 key: "SSupport"546 },547 {548 label: "Test123",549 key: "Test123"550 },551 {552 label: "testvide",553 key: "testvide"554 },555 {556 label: "train",557 key: "train"558 },559 {560 label: "VB_Test",561 key: "VB_Test"562 },563 {564 label: "www",565 key: "www"566 }567 ]568 },569 {570 type: 2,571 name: "Agent Group",572 order: 50,573 items: [574 {575 label: "ADMIN",576 key: "ADMIN"577 },578 {579 label: "1000",580 key: "1000"581 },582 {583 label: "KevinYtel",584 key: "KevinYtel"585 },586 {587 label: "C2C",588 key: "C2C"589 },590 {591 label: "Acurian",592 key: "Acurian"593 },594 {595 label: "VannyTest",596 key: "VannyTest"597 },598 {599 label: "DANIELTEST",600 key: "DANIELTEST"601 },602 {603 label: "Newcarr",604 key: "Newcarr"605 },606 {607 label: "WinBack",608 key: "WinBack"609 },610 {611 label: "Hanyytel",612 key: "Hanyytel"613 },614 {615 label: "1001",616 key: "1001"617 },618 {619 label: "BVP",620 key: "BVP"621 },622 {623 label: "KiranGroup2",624 key: "KiranGroup2"625 },626 {627 label: "3332221",628 key: "3332221"629 },630 {631 label: "8182",632 key: "8182"633 },634 {635 label: "1111",636 key: "1111"637 },638 {639 label: "8183",640 key: "8183"641 },642 {643 label: "8184",644 key: "8184"645 },646 {647 label: "DANI",648 key: "DANI"649 },650 {651 label: "8185",652 key: "8185"653 },654 {655 label: "8186",656 key: "8186"657 },658 {659 label: "RTEEWE",660 key: "RTEEWE"661 },662 {663 label: "8188",664 key: "8188"665 },666 {667 label: "KiranGroup3",668 key: "KiranGroup3"669 },670 {671 label: "KiranGroup",672 key: "KiranGroup"673 },674 {675 label: "8189",676 key: "8189"677 },678 {679 label: "123333",680 key: "123333"681 },682 {683 label: "11233333",684 key: "11233333"685 },686 {687 label: "1111aaa222",688 key: "1111aaa222"689 },690 {691 label: "11111111",692 key: "11111111"693 },694 {695 label: "111111",696 key: "111111"697 },698 {699 label: "33432222",700 key: "33432222"701 },702 {703 label: "qqqrrrr",704 key: "qqqrrrr"705 },706 {707 label: "1111111",708 key: "1111111"709 },710 {711 label: "9999",712 key: "9999"713 },714 {715 label: "wwwwwwww",716 key: "wwwwwwww"717 },718 {719 label: "mohini_group",720 key: "mohini_group"721 },722 {723 label: "group32",724 key: "group32"725 },726 {727 label: "TTTT",728 key: "TTTT"729 },730 {731 label: "qq",732 key: "qq"733 },734 {735 label: "asdff",736 key: "asdff"737 },738 {739 label: "6565",740 key: "6565"741 }742 ]743 },744 {745 type: 3,746 name: "Inbound Queue",747 order: 100,748 items: [749 {750 label: "111",751 key: "111"752 },753 {754 label: "111111",755 key: "111111"756 },757 {758 label: "121",759 key: "121"760 },761 {762 label: "1211",763 key: "1211"764 },765 {766 label: "12111111111111111",767 key: "12111111111111111"768 },769 {770 label: "122",771 key: "122"772 },773 {774 label: "123",775 key: "123"776 },777 {778 label: "12345",779 key: "12345"780 },781 {782 label: "1801",783 key: "1801"784 },785 {786 label: "20012",787 key: "20012"788 },789 {790 label: "212",791 key: "212"792 },793 {794 label: "212333",795 key: "212333"796 },797 {798 label: "2222222222222",799 key: "2222222222222"800 },801 {802 label: "22222222222222222222",803 key: "22222222222222222222"804 },805 {806 label: "2234",807 key: "2234"808 },809 {810 label: "23234",811 key: "23234"812 },813 {814 label: "3000",815 key: "3000"816 },817 {818 label: "3001",819 key: "3001"820 },821 {822 label: "333333",823 key: "333333"824 },825 {826 label: "4444_44",827 key: "4444_44"828 },829 {830 label: "60001",831 key: "60001"832 },833 {834 label: "6222",835 key: "6222"836 },837 {838 label: "6666",839 key: "6666"840 },841 {842 label: "666666",843 key: "666666"844 },845 {846 label: "7000",847 key: "7000"848 },849 {850 label: "767676",851 key: "767676"852 },853 {854 label: "767678",855 key: "767678"856 },857 {858 label: "8000",859 key: "8000"860 },861 {862 label: "8686",863 key: "8686"864 },865 {866 label: "87878787",867 key: "87878787"868 },869 {870 label: "888",871 key: "888"872 },873 {874 label: "88888",875 key: "88888"876 },877 {878 label: "898989",879 key: "898989"880 },881 {882 label: "9000",883 key: "9000"884 },885 {886 label: "963000000",887 key: "963000000"888 },889 {890 label: "963258741",891 key: "963258741"892 },893 {894 label: "96963636",895 key: "96963636"896 },897 {898 label: "9696969696",899 key: "9696969696"900 },901 {902 label: "aaaa",903 key: "aaaa"904 },905 {906 label: "addgroup",907 key: "addgroup"908 },909 {910 label: "addInboundQueue12",911 key: "addInboundQueue12"912 },913 {914 label: "AlexINB",915 key: "AlexINB"916 },917 {918 label: "AlexLBTest_1",919 key: "AlexLBTest_1"920 },921 {922 label: "Americor",923 key: "Americor"924 },925 {926 label: "ASASASAS",927 key: "ASASASAS"928 },929 {930 label: "asd11111",931 key: "asd11111"932 },933 {934 label: "asd12",935 key: "asd12"936 },937 {938 label: "asd123",939 key: "asd123"940 },941 {942 label: "asd1234",943 key: "asd1234"944 },945 {946 label: "asd12345",947 key: "asd12345"948 },949 {950 label: "asdnew",951 key: "asdnew"952 },953 {954 label: "asdnew12",955 key: "asdnew12"956 },957 {958 label: "asdnew123",959 key: "asdnew123"960 },961 {962 label: "asdnew1234",963 key: "asdnew1234"964 },965 {966 label: "BALAJI",967 key: "BALAJI"968 },969 {970 label: "balaji`",971 key: "balaji`"972 },973 {974 label: "balaji1",975 key: "balaji1"976 },977 {978 label: "balajiTR",979 key: "balajiTR"980 },981 {982 label: "balajiVp",983 key: "balajiVp"984 },985 {986 label: "BeaconMorningTest",987 key: "BeaconMorningTest"988 },989 {990 label: "BVPAAAA",991 key: "BVPAAAA"992 },993 {994 label: "CallerID",995 key: "CallerID"996 },997 {998 label: "check",999 key: "check"1000 },1001 {1002 label: "clone1",1003 key: "clone1"1004 },1005 {1006 label: "Closer",1007 key: "Closer"1008 },1009 {1010 label: "CSTEST123",1011 key: "CSTEST123"1012 },1013 {1014 label: "DANIELTEST",1015 key: "DANIELTEST"1016 },1017 {1018 label: "DCurl_Test",1019 key: "DCurl_Test"1020 },1021 {1022 label: "demo",1023 key: "demo"1024 },1025 {1026 label: "dfgfhfj",1027 key: "dfgfhfj"1028 },1029 {1030 label: "dfgfhsdsdfj",1031 key: "dfgfhsdsdfj"1032 },1033 {1034 label: "DNC_Alex_Test",1035 key: "DNC_Alex_Test"1036 },1037 {1038 label: "DNC_goodsell_hq",1039 key: "DNC_goodsell_hq"1040 },1041 {1042 label: "dsdsds",1043 key: "dsdsds"1044 },1045 {1046 label: "dsfdg",1047 key: "dsfdg"1048 },1049 {1050 label: "dsfdgd",1051 key: "dsfdgd"1052 },1053 {1054 label: "eee",1055 key: "eee"1056 },1057 {1058 label: "EndSurvey",1059 key: "EndSurvey"1060 },1061 {1062 label: "fdfgdfghfg",1063 key: "fdfgdfghfg"1064 },1065 {1066 label: "fdfhggvfdj",1067 key: "fdfhggvfdj"1068 },1069 {1070 label: "fdgd",1071 key: "fdgd"1072 },1073 {1074 label: "fffff",1075 key: "fffff"1076 },1077 {1078 label: "fghfg",1079 key: "fghfg"1080 },1081 {1082 label: "fghfgh",1083 key: "fghfgh"1084 },1085 {1086 label: "fhfgghglh",1087 key: "fhfgghglh"1088 },1089 {1090 label: "fhfgh",1091 key: "fhfgh"1092 },1093 {1094 label: "fhfghf",1095 key: "fhfghf"1096 },1097 {1098 label: "fhfghglh",1099 key: "fhfghglh"1100 },1101 {1102 label: "fhfglh",1103 key: "fhfglh"1104 },1105 {1106 label: "fhggvfdj",1107 key: "fhggvfdj"1108 },1109 {1110 label: "fhgvfdj",1111 key: "fhgvfdj"1112 },1113 {1114 label: "fhgvj",1115 key: "fhgvj"1116 },1117 {1118 label: "FID_2173",1119 key: "FID_2173"1120 },1121 {1122 label: "fjhjhj",1123 key: "fjhjhj"1124 },1125 {1126 label: "frytyty",1127 key: "frytyty"1128 },1129 {1130 label: "Garthok_Drop",1131 key: "Garthok_Drop"1132 },1133 {1134 label: "ggg",1135 key: "ggg"1136 },1137 {1138 label: "ghjggh",1139 key: "ghjggh"1140 },1141 {1142 label: "ghjgghhh",1143 key: "ghjgghhh"1144 },1145 {1146 label: "ghjghjhj",1147 key: "ghjghjhj"1148 },1149 {1150 label: "hdfhg",1151 key: "hdfhg"1152 },1153 {1154 label: "hhghgh",1155 key: "hhghgh"1156 },1157 {1158 label: "hhh",1159 key: "hhh"1160 },1161 {1162 label: "iiii",1163 key: "iiii"1164 },1165 {1166 label: "KevInbound",1167 key: "KevInbound"1168 },1169 {1170 label: "KevVM",1171 key: "KevVM"1172 },1173 {1174 label: "KIRTET",1175 key: "KIRTET"1176 },1177 {1178 label: "LBv2_Morning",1179 key: "LBv2_Morning"1180 },1181 {1182 label: "lctest",1183 key: "lctest"1184 },1185 {1186 label: "ljljkl",1187 key: "ljljkl"1188 },1189 {1190 label: "mmmm",1191 key: "mmmm"1192 },1193 {1194 label: "MOHINI",1195 key: "MOHINI"1196 },1197 {1198 label: "Mohini1",1199 key: "Mohini1"1200 },1201 {1202 label: "myclone",1203 key: "myclone"1204 },1205 {1206 label: "myclone1",1207 key: "myclone1"1208 },1209 {1210 label: "myclone12",1211 key: "myclone12"1212 },1213 {1214 label: "Newcari3",1215 key: "Newcari3"1216 },1217 {1218 label: "newclone",1219 key: "newclone"1220 },1221 {1222 label: "newdemo",1223 key: "newdemo"1224 },1225 {1226 label: "newdemoinbound",1227 key: "newdemoinbound"1228 },1229 {1230 label: "NTestGrpId",1231 key: "NTestGrpId"1232 },1233 {1234 label: "NTI",1235 key: "NTI"1236 },1237 {1238 label: "Patrick_DNC1",1239 key: "Patrick_DNC1"1240 },1241 {1242 label: "Patrick_DNC2",1243 key: "Patrick_DNC2"1244 },1245 {1246 label: "PatrickDROP",1247 key: "PatrickDROP"1248 },1249 {1250 label: "ppp",1251 key: "ppp"1252 },1253 {1254 label: "pppp",1255 key: "pppp"1256 },1257 {1258 label: "pppppp",1259 key: "pppppp"1260 },1261 {1262 label: "QAQAQ",1263 key: "QAQAQ"1264 },1265 {1266 label: "QAQAQww",1267 key: "QAQAQww"1268 },1269 {1270 label: "QAQAQww9",1271 key: "QAQAQww9"1272 },1273 {1274 label: "QAQAQww93",1275 key: "QAQAQww93"1276 },1277 {1278 label: "qewe545",1279 key: "qewe545"1280 },1281 {1282 label: "qq",1283 key: "qq"1284 },1285 {1286 label: "qqq",1287 key: "qqq"1288 },1289 {1290 label: "qqw",1291 key: "qqw"1292 },1293 {1294 label: "qwert",1295 key: "qwert"1296 },1297 {1298 label: "qwq",1299 key: "qwq"1300 },1301 {1302 label: "RTRRRRRRRRR",1303 key: "RTRRRRRRRRR"1304 },1305 {1306 label: "RTTTT",1307 key: "RTTTT"1308 },1309 {1310 label: "rwrwe",1311 key: "rwrwe"1312 },1313 {1314 label: "ryrty",1315 key: "ryrty"1316 },1317 {1318 label: "S1_1",1319 key: "S1_1"1320 },1321 {1322 label: "sdfsd",1323 key: "sdfsd"1324 },1325 {1326 label: "sdfsdsdf",1327 key: "sdfsdsdf"1328 },1329 {1330 label: "sdfsf",1331 key: "sdfsf"1332 },1333 {1334 label: "ss",1335 key: "ss"1336 },1337 {1338 label: "sss",1339 key: "sss"1340 },1341 {1342 label: "sss1",1343 key: "sss1"1344 },1345 {1346 label: "sss12",1347 key: "sss12"1348 },1349 {1350 label: "sss123",1351 key: "sss123"1352 },1353 {1354 label: "sss1233",1355 key: "sss1233"1356 },1357 {1358 label: "sss12334",1359 key: "sss12334"1360 },1361 {1362 label: "SSSS",1363 key: "SSSS"1364 },1365 {1366 label: "SurveyINB",1367 key: "SurveyINB"1368 },1369 {1370 label: "test12345",1371 key: "test12345"1372 },1373 {1374 label: "test2",1375 key: "test2"1376 },1377 {1378 label: "TESTR",1379 key: "TESTR"1380 },1381 {1382 label: "TESTTT",1383 key: "TESTTT"1384 },1385 {1386 label: "testVideo",1387 key: "testVideo"1388 },1389 {1390 label: "TESTY",1391 key: "TESTY"1392 },1393 {1394 label: "TRTRRRRR",1395 key: "TRTRRRRR"1396 },1397 {1398 label: "TRTRTR",1399 key: "TRTRTR"1400 },1401 {1402 label: "ttt",1403 key: "ttt"1404 },1405 {1406 label: "ttt123",1407 key: "ttt123"1408 },1409 {1410 label: "ttt12323",1411 key: "ttt12323"1412 },1413 {1414 label: "ttt1233",1415 key: "ttt1233"1416 },1417 {1418 label: "TTTTT",1419 key: "TTTTT"1420 },1421 {1422 label: "TYPOU",1423 key: "TYPOU"1424 },1425 {1426 label: "TYTYRT",1427 key: "TYTYRT"1428 },1429 {1430 label: "uu",1431 key: "uu"1432 },1433 {1434 label: "uuu",1435 key: "uuu"1436 },1437 {1438 label: "Verifier_test",1439 key: "Verifier_test"1440 },1441 {1442 label: "wdfsdfvd",1443 key: "wdfsdfvd"1444 },1445 {1446 label: "ww",1447 key: "ww"1448 },1449 {1450 label: "wwww",1451 key: "wwww"1452 },1453 {1454 label: "wwwww",1455 key: "wwwww"1456 }1457 ]1458 },1459 {1460 type: 10,1461 name: "Recordings",1462 order: 125,1463 items: [1464 {1465 label: "ADMIN",1466 key: "ADMIN"1467 },1468 {1469 label: "1000",1470 key: "1000"1471 },1472 {1473 label: "KevinYtel",1474 key: "KevinYtel"1475 },1476 {1477 label: "C2C",1478 key: "C2C"1479 },1480 {1481 label: "Acurian",1482 key: "Acurian"1483 },1484 {1485 label: "VannyTest",1486 key: "VannyTest"1487 },1488 {1489 label: "DANIELTEST",1490 key: "DANIELTEST"1491 },1492 {1493 label: "Newcarr",1494 key: "Newcarr"1495 },1496 {1497 label: "WinBack",1498 key: "WinBack"1499 },1500 {1501 label: "Hanyytel",1502 key: "Hanyytel"1503 },1504 {1505 label: "1001",1506 key: "1001"1507 },1508 {1509 label: "BVP",1510 key: "BVP"1511 },1512 {1513 label: "KiranGroup2",1514 key: "KiranGroup2"1515 },1516 {1517 label: "3332221",1518 key: "3332221"1519 },1520 {1521 label: "8182",1522 key: "8182"1523 },1524 {1525 label: "1111",1526 key: "1111"1527 },1528 {1529 label: "8183",1530 key: "8183"1531 },1532 {1533 label: "8184",1534 key: "8184"1535 },1536 {1537 label: "DANI",1538 key: "DANI"1539 },1540 {1541 label: "8185",1542 key: "8185"1543 },1544 {1545 label: "8186",1546 key: "8186"1547 },1548 {1549 label: "RTEEWE",1550 key: "RTEEWE"1551 },1552 {1553 label: "8188",1554 key: "8188"1555 },1556 {1557 label: "KiranGroup3",1558 key: "KiranGroup3"1559 },1560 {1561 label: "KiranGroup",1562 key: "KiranGroup"1563 },1564 {1565 label: "8189",1566 key: "8189"1567 },1568 {1569 label: "123333",1570 key: "123333"1571 },1572 {1573 label: "11233333",1574 key: "11233333"1575 },1576 {1577 label: "1111aaa222",1578 key: "1111aaa222"1579 },1580 {1581 label: "11111111",1582 key: "11111111"1583 },1584 {1585 label: "111111",1586 key: "111111"1587 },1588 {1589 label: "33432222",1590 key: "33432222"1591 },1592 {1593 label: "qqqrrrr",1594 key: "qqqrrrr"1595 },1596 {1597 label: "1111111",1598 key: "1111111"1599 },1600 {1601 label: "9999",1602 key: "9999"1603 },1604 {1605 label: "wwwwwwww",1606 key: "wwwwwwww"1607 },1608 {1609 label: "mohini_group",1610 key: "mohini_group"1611 },1612 {1613 label: "group32",1614 key: "group32"1615 },1616 {1617 label: "TTTT",1618 key: "TTTT"1619 },1620 {1621 label: "qq",1622 key: "qq"1623 },1624 {1625 label: "asdff",1626 key: "asdff"1627 },1628 {1629 label: "6565",1630 key: "6565"1631 }1632 ]1633 }1634];1635export const systemComponents = {1636 Dashboard: [1637 {1638 SystemComponent: {1639 system_component_id: "16",1640 system_component_group_id: "5",1641 name: "Dashboard",1642 order: "1",1643 _create: false,1644 _read: true,1645 _update: false,1646 _delete: false1647 },1648 SystemComponentGroup: {1649 system_component_group_id: "5",1650 name: "Dashboard",1651 order: "1"1652 }1653 },1654 {1655 SystemComponent: {1656 system_component_id: "63",1657 system_component_group_id: "5",1658 name: "Campaign Summary",1659 order: "2",1660 _create: false,1661 _read: true,1662 _update: false,1663 _delete: false1664 },1665 SystemComponentGroup: {1666 system_component_group_id: "5",1667 name: "Dashboard",1668 order: "1"1669 }1670 }1671 ],1672 Users: [1673 {1674 SystemComponent: {1675 system_component_id: "14",1676 system_component_group_id: "4",1677 name: "User",1678 order: "1",1679 _create: true,1680 _read: true,1681 _update: true,1682 _delete: true1683 },1684 SystemComponentGroup: {1685 system_component_group_id: "4",1686 name: "Users",1687 order: "5"1688 }1689 },1690 {1691 SystemComponent: {1692 system_component_id: "15",1693 system_component_group_id: "4",1694 name: "User Group",1695 order: "2",1696 _create: true,1697 _read: true,1698 _update: true,1699 _delete: true1700 },1701 SystemComponentGroup: {1702 system_component_group_id: "4",1703 name: "Users",1704 order: "5"1705 }1706 }1707 ],1708 Campaigns: [1709 {1710 SystemComponent: {1711 system_component_id: "7",1712 system_component_group_id: "3",1713 name: "Campaign",1714 order: "1",1715 _create: true,1716 _read: true,1717 _update: true,1718 _delete: true1719 },1720 SystemComponentGroup: {1721 system_component_group_id: "3",1722 name: "Campaigns",1723 order: "10"1724 }1725 },1726 {1727 SystemComponent: {1728 system_component_id: "8",1729 system_component_group_id: "3",1730 name: "Campaign Statuses",1731 order: "2",1732 _create: true,1733 _read: true,1734 _update: true,1735 _delete: true1736 },1737 SystemComponentGroup: {1738 system_component_group_id: "3",1739 name: "Campaigns",1740 order: "10"1741 }1742 },1743 {1744 SystemComponent: {1745 system_component_id: "9",1746 system_component_group_id: "3",1747 name: "Campaign List Mix",1748 order: "3",1749 _create: true,1750 _read: true,1751 _update: true,1752 _delete: true1753 },1754 SystemComponentGroup: {1755 system_component_group_id: "3",1756 name: "Campaigns",1757 order: "10"1758 }1759 },1760 {1761 SystemComponent: {1762 system_component_id: "10",1763 system_component_group_id: "3",1764 name: "Lead Recycle",1765 order: "4",1766 _create: true,1767 _read: true,1768 _update: true,1769 _delete: false1770 },1771 SystemComponentGroup: {1772 system_component_group_id: "3",1773 name: "Campaigns",1774 order: "10"1775 }1776 },1777 {1778 SystemComponent: {1779 system_component_id: "11",1780 system_component_group_id: "3",1781 name: "Pause Codes",1782 order: "5",1783 _create: true,1784 _read: true,1785 _update: true,1786 _delete: true1787 },1788 SystemComponentGroup: {1789 system_component_group_id: "3",1790 name: "Campaigns",1791 order: "10"1792 }1793 },1794 {1795 SystemComponent: {1796 system_component_id: "12",1797 system_component_group_id: "3",1798 name: "AC-CID",1799 order: "6",1800 _create: true,1801 _read: true,1802 _update: true,1803 _delete: false1804 },1805 SystemComponentGroup: {1806 system_component_group_id: "3",1807 name: "Campaigns",1808 order: "10"1809 }1810 },1811 {1812 SystemComponent: {1813 system_component_id: "13",1814 system_component_group_id: "3",1815 name: "Call Transfer Presents",1816 order: "7",1817 _create: true,1818 _read: true,1819 _update: true,1820 _delete: false1821 },1822 SystemComponentGroup: {1823 system_component_group_id: "3",1824 name: "Campaigns",1825 order: "10"1826 }1827 }1828 ],1829 "Data Management": [1830 {1831 SystemComponent: {1832 system_component_id: "17",1833 system_component_group_id: "6",1834 name: "Data List",1835 order: "1",1836 _create: true,1837 _read: true,1838 _update: true,1839 _delete: true1840 },1841 SystemComponentGroup: {1842 system_component_group_id: "6",1843 name: "Data Management",1844 order: "30"1845 }1846 },1847 {1848 SystemComponent: {1849 system_component_id: "67",1850 system_component_group_id: "6",1851 name: "Data List - Download",1852 order: "2",1853 _create: false,1854 _read: true,1855 _update: false,1856 _delete: false1857 },1858 SystemComponentGroup: {1859 system_component_group_id: "6",1860 name: "Data Management",1861 order: "30"1862 }1863 },1864 {1865 SystemComponent: {1866 system_component_id: "18",1867 system_component_group_id: "6",1868 name: "Advanced List Rule",1869 order: "3",1870 _create: true,1871 _read: true,1872 _update: true,1873 _delete: true1874 },1875 SystemComponentGroup: {1876 system_component_group_id: "6",1877 name: "Data Management",1878 order: "30"1879 }1880 },1881 {1882 SystemComponent: {1883 system_component_id: "19",1884 system_component_group_id: "6",1885 name: "Data Search",1886 order: "4",1887 _create: false,1888 _read: true,1889 _update: false,1890 _delete: false1891 },1892 SystemComponentGroup: {1893 system_component_group_id: "6",1894 name: "Data Management",1895 order: "30"1896 }1897 },1898 {1899 SystemComponent: {1900 system_component_id: "20",1901 system_component_group_id: "6",1902 name: "Custom Fields",1903 order: "5",1904 _create: false,1905 _read: true,1906 _update: false,1907 _delete: false1908 },1909 SystemComponentGroup: {1910 system_component_group_id: "6",1911 name: "Data Management",1912 order: "30"1913 }1914 },1915 {1916 SystemComponent: {1917 system_component_id: "21",1918 system_component_group_id: "6",1919 name: "Lead Management",1920 order: "6",1921 _create: false,1922 _read: true,1923 _update: true,1924 _delete: true1925 },1926 SystemComponentGroup: {1927 system_component_group_id: "6",1928 name: "Data Management",1929 order: "30"1930 }1931 }1932 ],1933 "Data Loader": [1934 {1935 SystemComponent: {1936 system_component_id: "5",1937 system_component_group_id: "1",1938 name: "Main Access",1939 order: "1",1940 _create: false,1941 _read: true,1942 _update: false,1943 _delete: false1944 },1945 SystemComponentGroup: {1946 system_component_group_id: "1",1947 name: "Data Loader",1948 order: "40"1949 }1950 },1951 {1952 SystemComponent: {1953 system_component_id: "1",1954 system_component_group_id: "1",1955 name: "Data File",1956 order: "2",1957 _create: true,1958 _read: true,1959 _update: false,1960 _delete: true1961 },1962 SystemComponentGroup: {1963 system_component_group_id: "1",1964 name: "Data Loader",1965 order: "40"1966 }1967 },1968 {1969 SystemComponent: {1970 system_component_id: "2",1971 system_component_group_id: "1",1972 name: "Process File",1973 order: "3",1974 _create: true,1975 _read: true,1976 _update: false,1977 _delete: true1978 },1979 SystemComponentGroup: {1980 system_component_group_id: "1",1981 name: "Data Loader",1982 order: "40"1983 }1984 },1985 {1986 SystemComponent: {1987 system_component_id: "4",1988 system_component_group_id: "1",1989 name: "Queue",1990 order: "4",1991 _create: false,1992 _read: true,1993 _update: false,1994 _delete: false1995 },1996 SystemComponentGroup: {1997 system_component_group_id: "1",1998 name: "Data Loader",1999 order: "40"2000 }2001 },2002 {2003 SystemComponent: {2004 system_component_id: "3",2005 system_component_group_id: "1",2006 name: "Error File",2007 order: "5",2008 _create: false,2009 _read: true,2010 _update: false,2011 _delete: false2012 },2013 SystemComponentGroup: {2014 system_component_group_id: "1",2015 name: "Data Loader",2016 order: "40"2017 }2018 }2019 ],2020 Inbound: [2021 {2022 SystemComponent: {2023 system_component_id: "22",2024 system_component_group_id: "7",2025 name: "Inbound Queues",2026 order: "1",2027 _create: true,2028 _read: true,2029 _update: true,2030 _delete: true2031 },2032 SystemComponentGroup: {2033 system_component_group_id: "7",2034 name: "Inbound",2035 order: "50"2036 }2037 },2038 {2039 SystemComponent: {2040 system_component_id: "23",2041 system_component_group_id: "7",2042 name: "Numbers",2043 order: "1",2044 _create: true,2045 _read: true,2046 _update: true,2047 _delete: true2048 },2049 SystemComponentGroup: {2050 system_component_group_id: "7",2051 name: "Inbound",2052 order: "50"2053 }2054 },2055 {2056 SystemComponent: {2057 system_component_id: "24",2058 system_component_group_id: "7",2059 name: "Call Menu",2060 order: "2",2061 _create: true,2062 _read: true,2063 _update: true,2064 _delete: true2065 },2066 SystemComponentGroup: {2067 system_component_group_id: "7",2068 name: "Inbound",2069 order: "50"2070 }2071 },2072 {2073 SystemComponent: {2074 system_component_id: "25",2075 system_component_group_id: "7",2076 name: "Filter Phone Group",2077 order: "3",2078 _create: true,2079 _read: true,2080 _update: true,2081 _delete: true2082 },2083 SystemComponentGroup: {2084 system_component_group_id: "7",2085 name: "Inbound",2086 order: "50"2087 }2088 },2089 {2090 SystemComponent: {2091 system_component_id: "71",2092 system_component_group_id: "7",2093 name: "Agent",2094 order: "5",2095 _create: false,2096 _read: true,2097 _update: true,2098 _delete: false2099 },2100 SystemComponentGroup: {2101 system_component_group_id: "7",2102 name: "Inbound",2103 order: "50"2104 }2105 }2106 ],2107 "Admin Utility": [2108 {2109 SystemComponent: {2110 system_component_id: "26",2111 system_component_group_id: "8",2112 name: "Scripts",2113 order: "1",2114 _create: true,2115 _read: true,2116 _update: true,2117 _delete: true2118 },2119 SystemComponentGroup: {2120 system_component_group_id: "8",2121 name: "Admin Utility",2122 order: "60"2123 }2124 },2125 {2126 SystemComponent: {2127 system_component_id: "27",2128 system_component_group_id: "8",2129 name: "Audio",2130 order: "2",2131 _create: true,2132 _read: true,2133 _update: false,2134 _delete: true2135 },2136 SystemComponentGroup: {2137 system_component_group_id: "8",2138 name: "Admin Utility",2139 order: "60"2140 }2141 },2142 {2143 SystemComponent: {2144 system_component_id: "28",2145 system_component_group_id: "8",2146 name: "Voicemail",2147 order: "3",2148 _create: true,2149 _read: true,2150 _update: true,2151 _delete: true2152 },2153 SystemComponentGroup: {2154 system_component_group_id: "8",2155 name: "Admin Utility",2156 order: "60"2157 }2158 },2159 {2160 SystemComponent: {2161 system_component_id: "29",2162 system_component_group_id: "8",2163 name: "DNC Management",2164 order: "4",2165 _create: true,2166 _read: true,2167 _update: false,2168 _delete: true2169 },2170 SystemComponentGroup: {2171 system_component_group_id: "8",2172 name: "Admin Utility",2173 order: "60"2174 }2175 },2176 {2177 SystemComponent: {2178 system_component_id: "30",2179 system_component_group_id: "8",2180 name: "Lead Filter List",2181 order: "5",2182 _create: true,2183 _read: true,2184 _update: true,2185 _delete: true2186 },2187 SystemComponentGroup: {2188 system_component_group_id: "8",2189 name: "Admin Utility",2190 order: "60"2191 }2192 },2193 {2194 SystemComponent: {2195 system_component_id: "31",2196 system_component_group_id: "8",2197 name: "Call Time",2198 order: "6",2199 _create: true,2200 _read: true,2201 _update: true,2202 _delete: true2203 },2204 SystemComponentGroup: {2205 system_component_group_id: "8",2206 name: "Admin Utility",2207 order: "60"2208 }2209 },2210 {2211 SystemComponent: {2212 system_component_id: "32",2213 system_component_group_id: "8",2214 name: "Shifts",2215 order: "7",2216 _create: true,2217 _read: true,2218 _update: true,2219 _delete: true2220 },2221 SystemComponentGroup: {2222 system_component_group_id: "8",2223 name: "Admin Utility",2224 order: "60"2225 }2226 },2227 {2228 SystemComponent: {2229 system_component_id: "33",2230 system_component_group_id: "8",2231 name: "System Audit",2232 order: "8",2233 _create: false,2234 _read: true,2235 _update: false,2236 _delete: false2237 },2238 SystemComponentGroup: {2239 system_component_group_id: "8",2240 name: "Admin Utility",2241 order: "60"2242 }2243 },2244 {2245 SystemComponent: {2246 system_component_id: "64",2247 system_component_group_id: "8",2248 name: "System Status",2249 order: "9",2250 _create: true,2251 _read: true,2252 _update: true,2253 _delete: false2254 },2255 SystemComponentGroup: {2256 system_component_group_id: "8",2257 name: "Admin Utility",2258 order: "60"2259 }2260 },2261 {2262 SystemComponent: {2263 system_component_id: "69",2264 system_component_group_id: "8",2265 name: "Recordings",2266 order: "9",2267 _create: false,2268 _read: true,2269 _update: false,2270 _delete: false2271 },2272 SystemComponentGroup: {2273 system_component_group_id: "8",2274 name: "Admin Utility",2275 order: "60"2276 }2277 },2278 {2279 SystemComponent: {2280 system_component_id: "65",2281 system_component_group_id: "8",2282 name: "Music On Hold",2283 order: "10",2284 _create: true,2285 _read: true,2286 _update: true,2287 _delete: true2288 },2289 SystemComponentGroup: {2290 system_component_group_id: "8",2291 name: "Admin Utility",2292 order: "60"2293 }2294 }2295 ],2296 Report: [2297 {2298 SystemComponent: {2299 system_component_id: "34",2300 system_component_group_id: "9",2301 name: "Export Call Report",2302 order: "1",2303 _create: false,2304 _read: true,2305 _update: false,2306 _delete: false2307 },2308 SystemComponentGroup: {2309 system_component_group_id: "9",2310 name: "Report",2311 order: "70"2312 }2313 },2314 {2315 SystemComponent: {2316 system_component_id: "35",2317 system_component_group_id: "9",2318 name: "Export Lead Report",2319 order: "2",2320 _create: false,2321 _read: true,2322 _update: false,2323 _delete: false2324 },2325 SystemComponentGroup: {2326 system_component_group_id: "9",2327 name: "Report",2328 order: "70"2329 }2330 },2331 {2332 SystemComponent: {2333 system_component_id: "36",2334 system_component_group_id: "9",2335 name: "Inbound Report",2336 order: "3",2337 _create: false,2338 _read: true,2339 _update: false,2340 _delete: false2341 },2342 SystemComponentGroup: {2343 system_component_group_id: "9",2344 name: "Report",2345 order: "70"2346 }2347 },2348 {2349 SystemComponent: {2350 system_component_id: "37",2351 system_component_group_id: "9",2352 name: "Inbound Report By DID",2353 order: "4",2354 _create: false,2355 _read: true,2356 _update: false,2357 _delete: false2358 },2359 SystemComponentGroup: {2360 system_component_group_id: "9",2361 name: "Report",2362 order: "70"2363 }2364 },2365 {2366 SystemComponent: {2367 system_component_id: "38",2368 system_component_group_id: "9",2369 name: "Inbound Service Level Report",2370 order: "5",2371 _create: false,2372 _read: true,2373 _update: false,2374 _delete: false2375 },2376 SystemComponentGroup: {2377 system_component_group_id: "9",2378 name: "Report",2379 order: "70"2380 }2381 },2382 {2383 SystemComponent: {2384 system_component_id: "39",2385 system_component_group_id: "9",2386 name: "Inbound Summary Hourly Report",2387 order: "6",2388 _create: false,2389 _read: true,2390 _update: false,2391 _delete: false2392 },2393 SystemComponentGroup: {2394 system_component_group_id: "9",2395 name: "Report",2396 order: "70"2397 }2398 },2399 {2400 SystemComponent: {2401 system_component_id: "40",2402 system_component_group_id: "9",2403 name: "Inbound Daily Report",2404 order: "7",2405 _create: false,2406 _read: true,2407 _update: false,2408 _delete: false2409 },2410 SystemComponentGroup: {2411 system_component_group_id: "9",2412 name: "Report",2413 order: "70"2414 }2415 },2416 {2417 SystemComponent: {2418 system_component_id: "41",2419 system_component_group_id: "9",2420 name: "Inbound DID Report",2421 order: "8",2422 _create: false,2423 _read: true,2424 _update: false,2425 _delete: false2426 },2427 SystemComponentGroup: {2428 system_component_group_id: "9",2429 name: "Report",2430 order: "70"2431 }2432 },2433 {2434 SystemComponent: {2435 system_component_id: "42",2436 system_component_group_id: "9",2437 name: "Inbound IVR Report",2438 order: "9",2439 _create: false,2440 _read: true,2441 _update: false,2442 _delete: false2443 },2444 SystemComponentGroup: {2445 system_component_group_id: "9",2446 name: "Report",2447 order: "70"2448 }2449 },2450 {2451 SystemComponent: {2452 system_component_id: "43",2453 system_component_group_id: "9",2454 name: "Outbound Calling Report",2455 order: "10",2456 _create: false,2457 _read: true,2458 _update: false,2459 _delete: false2460 },2461 SystemComponentGroup: {2462 system_component_group_id: "9",2463 name: "Report",2464 order: "70"2465 }2466 },2467 {2468 SystemComponent: {2469 system_component_id: "44",2470 system_component_group_id: "9",2471 name: "Outbound Summary Interval Report",2472 order: "11",2473 _create: false,2474 _read: true,2475 _update: false,2476 _delete: false2477 },2478 SystemComponentGroup: {2479 system_component_group_id: "9",2480 name: "Report",2481 order: "70"2482 }2483 },2484 {2485 SystemComponent: {2486 system_component_id: "45",2487 system_component_group_id: "9",2488 name: "Outbound IVR Report",2489 order: "12",2490 _create: false,2491 _read: true,2492 _update: false,2493 _delete: false2494 },2495 SystemComponentGroup: {2496 system_component_group_id: "9",2497 name: "Report",2498 order: "70"2499 }2500 },2501 {2502 SystemComponent: {2503 system_component_id: "46",2504 system_component_group_id: "9",2505 name: "Fronter Closer Report",2506 order: "13",2507 _create: false,2508 _read: true,2509 _update: false,2510 _delete: false2511 },2512 SystemComponentGroup: {2513 system_component_group_id: "9",2514 name: "Report",2515 order: "70"2516 }2517 },2518 {2519 SystemComponent: {2520 system_component_id: "47",2521 system_component_group_id: "9",2522 name: "Lists Campaign Statuses Report",2523 order: "14",2524 _create: false,2525 _read: true,2526 _update: false,2527 _delete: false2528 },2529 SystemComponentGroup: {2530 system_component_group_id: "9",2531 name: "Report",2532 order: "70"2533 }2534 },2535 {2536 SystemComponent: {2537 system_component_id: "48",2538 system_component_group_id: "9",2539 name: "Campaign Status List Report",2540 order: "15",2541 _create: false,2542 _read: true,2543 _update: false,2544 _delete: false2545 },2546 SystemComponentGroup: {2547 system_component_group_id: "9",2548 name: "Report",2549 order: "70"2550 }2551 },2552 {2553 SystemComponent: {2554 system_component_id: "49",2555 system_component_group_id: "9",2556 name: "Agent Time Report",2557 order: "16",2558 _create: false,2559 _read: true,2560 _update: false,2561 _delete: false2562 },2563 SystemComponentGroup: {2564 system_component_group_id: "9",2565 name: "Report",2566 order: "70"2567 }2568 },2569 {2570 SystemComponent: {2571 system_component_id: "50",2572 system_component_group_id: "9",2573 name: "Agent Status Report",2574 order: "17",2575 _create: false,2576 _read: true,2577 _update: false,2578 _delete: false2579 },2580 SystemComponentGroup: {2581 system_component_group_id: "9",2582 name: "Report",2583 order: "70"2584 }2585 },2586 {2587 SystemComponent: {2588 system_component_id: "51",2589 system_component_group_id: "9",2590 name: "Agent Performance Report",2591 order: "18",2592 _create: false,2593 _read: true,2594 _update: false,2595 _delete: false2596 },2597 SystemComponentGroup: {2598 system_component_group_id: "9",2599 name: "Report",2600 order: "70"2601 }2602 },2603 {2604 SystemComponent: {2605 system_component_id: "52",2606 system_component_group_id: "9",2607 name: "Team Performance Report",2608 order: "19",2609 _create: false,2610 _read: true,2611 _update: false,2612 _delete: false2613 },2614 SystemComponentGroup: {2615 system_component_group_id: "9",2616 name: "Report",2617 order: "70"2618 }2619 },2620 {2621 SystemComponent: {2622 system_component_id: "53",2623 system_component_group_id: "9",2624 name: "Single Agent Report",2625 order: "20",2626 _create: false,2627 _read: true,2628 _update: false,2629 _delete: false2630 },2631 SystemComponentGroup: {2632 system_component_group_id: "9",2633 name: "Report",2634 order: "70"2635 }2636 },2637 {2638 SystemComponent: {2639 system_component_id: "54",2640 system_component_group_id: "9",2641 name: "User Group Login Report",2642 order: "21",2643 _create: false,2644 _read: true,2645 _update: false,2646 _delete: false2647 },2648 SystemComponentGroup: {2649 system_component_group_id: "9",2650 name: "Report",2651 order: "70"2652 }2653 },2654 {2655 SystemComponent: {2656 system_component_id: "55",2657 system_component_group_id: "9",2658 name: "User Stats Report",2659 order: "22",2660 _create: false,2661 _read: true,2662 _update: false,2663 _delete: false2664 },2665 SystemComponentGroup: {2666 system_component_group_id: "9",2667 name: "Report",2668 order: "70"2669 }2670 },2671 {2672 SystemComponent: {2673 system_component_id: "56",2674 system_component_group_id: "9",2675 name: "User Time Sheet Report",2676 order: "23",2677 _create: false,2678 _read: true,2679 _update: false,2680 _delete: false2681 },2682 SystemComponentGroup: {2683 system_component_group_id: "9",2684 name: "Report",2685 order: "70"2686 }2687 },2688 {2689 SystemComponent: {2690 system_component_id: "57",2691 system_component_group_id: "9",2692 name: "Agent Login Report",2693 order: "24",2694 _create: false,2695 _read: true,2696 _update: false,2697 _delete: false2698 },2699 SystemComponentGroup: {2700 system_component_group_id: "9",2701 name: "Report",2702 order: "70"2703 }2704 },2705 {2706 SystemComponent: {2707 system_component_id: "58",2708 system_component_group_id: "9",2709 name: "User Timeclock Report",2710 order: "25",2711 _create: false,2712 _read: true,2713 _update: false,2714 _delete: false2715 },2716 SystemComponentGroup: {2717 system_component_group_id: "9",2718 name: "Report",2719 order: "70"2720 }2721 },2722 {2723 SystemComponent: {2724 system_component_id: "59",2725 system_component_group_id: "9",2726 name: "User Group Timeclock Status Report",2727 order: "26",2728 _create: false,2729 _read: true,2730 _update: false,2731 _delete: false2732 },2733 SystemComponentGroup: {2734 system_component_group_id: "9",2735 name: "Report",2736 order: "70"2737 }2738 },2739 {2740 SystemComponent: {2741 system_component_id: "60",2742 system_component_group_id: "9",2743 name: "User Timeclock Detail Report",2744 order: "27",2745 _create: false,2746 _read: true,2747 _update: false,2748 _delete: false2749 },2750 SystemComponentGroup: {2751 system_component_group_id: "9",2752 name: "Report",2753 order: "70"2754 }2755 },2756 {2757 SystemComponent: {2758 system_component_id: "61",2759 system_component_group_id: "9",2760 name: "Outbound IVR Report Export",2761 order: "28",2762 _create: false,2763 _read: true,2764 _update: false,2765 _delete: false2766 },2767 SystemComponentGroup: {2768 system_component_group_id: "9",2769 name: "Report",2770 order: "70"2771 }2772 },2773 {2774 SystemComponent: {2775 system_component_id: "62",2776 system_component_group_id: "9",2777 name: "Performance Comparison Report",2778 order: "29",2779 _create: false,2780 _read: true,2781 _update: false,2782 _delete: false2783 },2784 SystemComponentGroup: {2785 system_component_group_id: "9",2786 name: "Report",2787 order: "70"2788 }2789 },2790 {2791 SystemComponent: {2792 system_component_id: "68",2793 system_component_group_id: "9",2794 name: "Campaign List Detail Report",2795 order: "30",2796 _create: false,2797 _read: true,2798 _update: false,2799 _delete: false2800 },2801 SystemComponentGroup: {2802 system_component_group_id: "9",2803 name: "Report",2804 order: "70"2805 }2806 }2807 ],2808 App: [2809 {2810 SystemComponent: {2811 system_component_id: "66",2812 system_component_group_id: "10",2813 name: "Leadbeam",2814 order: "1",2815 _create: false,2816 _read: true,2817 _update: false,2818 _delete: false2819 },2820 SystemComponentGroup: {2821 system_component_group_id: "10",2822 name: "App",2823 order: "200"2824 }2825 },2826 {2827 SystemComponent: {2828 system_component_id: "72",2829 system_component_group_id: "10",2830 name: "AMD",2831 order: "1",2832 _create: false,2833 _read: true,2834 _update: false,2835 _delete: false2836 },2837 SystemComponentGroup: {2838 system_component_group_id: "10",2839 name: "App",2840 order: "200"2841 }2842 },2843 {2844 SystemComponent: {2845 system_component_id: "74",2846 system_component_group_id: "10",2847 name: "Score Cards",2848 order: "1",2849 _create: false,2850 _read: true,2851 _update: false,2852 _delete: false2853 },2854 SystemComponentGroup: {2855 system_component_group_id: "10",2856 name: "App",2857 order: "200"2858 }2859 },2860 {2861 SystemComponent: {2862 system_component_id: "73",2863 system_component_group_id: "10",2864 name: "Voice Messaging",2865 order: "1",2866 _create: false,2867 _read: true,2868 _update: false,2869 _delete: false2870 },2871 SystemComponentGroup: {2872 system_component_group_id: "10",2873 name: "App",2874 order: "200"2875 }2876 },2877 {2878 SystemComponent: {2879 system_component_id: "75",2880 system_component_group_id: "10",2881 name: "Mobile_App",2882 order: "1",2883 _create: false,2884 _read: true,2885 _update: false,2886 _delete: false2887 },2888 SystemComponentGroup: {2889 system_component_group_id: "10",2890 name: "App",2891 order: "200"2892 }2893 },2894 {2895 SystemComponent: {2896 system_component_id: "70",2897 system_component_group_id: "10",2898 name: "Leadbeam 2",2899 order: "2",2900 _create: false,2901 _read: true,2902 _update: false,2903 _delete: false2904 },2905 SystemComponentGroup: {2906 system_component_group_id: "10",2907 name: "App",2908 order: "200"2909 }2910 }2911 ]...
_z_methods.js
Source:_z_methods.js
...438 return s439 ? document.createElementNS('http://www.w3.org/2000/svg', t)440 : document.createElement(t);441 },442 _create(s, t, n) {443 let r;444 if (n === undefined) {445 r = this._createElm(s, t);446 }447 else {448 r = [];449 for (let j = 0; j < n; j++) {450 r.push(this._createElm(s, t)); 451 }452 }453 return r;454 },455 _getAttr(e, q) { return e.getAttribute(q) },456 _getProp(e, q) { return e[q] },457 _getStyle(e, q) { return window.getComputedStyle(e).getPropertyValue(q) },458 _apsGet(f, e, a) {459 let r;460 if (typeof e === 'string') e = document.querySelectorAll(e);461 if (e && e[Symbol.iterator]) {462 r = [];463 for (let y of e) {464 r.push(f(y, a));465 }466 }467 else {468 r = f(e, a);469 }470 return r;471 },472 _setAttr(e, q, v) { e.setAttribute(q, v) },473 _setProp(e, q, v) { e[q] = v },474 _setStyle(e, q, v) { e.style.setProperty(q, v) },475 _apsSet(f, e, a, v) {476 let j = 0;477 e = this._autoSelect(e);478 for (let q of (e && e[Symbol.iterator] ? e : [e])) {479 f(q, a, (typeof v === "function" ? v.call(q, q.__data__, j++) : v));480 };481 return e;482 },483 _addRemoveClass(a, e, c) {484 a = a ? 'add' : 'remove';485 c = c.trim().split(/^|\s+/);486 e = this._autoSelect(e);487 if (e && e[Symbol.iterator]) {488 for (let q of e) {489 q.classList[a](...c);490 }491 }492 else {493 e.classList[a](...c);494 }495 return e;496 },497 _eachElement(f, e, v) {498 e = this._autoSelect(e);499 if (e && e[Symbol.iterator]) {500 for (let q of e) {501 f(q, v);502 }503 }504 else {505 f(e, v);506 }507 return e;508 },509 // ----- call directly as _z_ methods in generated code -----510 *to(s, e, j = 1) {511 j = +j, s = +s, e = +e;512 e += (e - s) * 1e-14;513 while (j > 0 ? s < e : s > e) {514 yield s;515 s += j;516 }517 },518 *linSpace(s, e, n) {519 if ((n = +n) === 1) yield (+s + +e) / 2;520 else {521 const j = (+e - +s) / (n - 1);522 s = +s - j;523 for (let i = 0; i < n; i++) yield s += j;524 }525 },526 array(...q) {527 const r = [];528 for (let x of q) {529 if (typeof x !== 'string' && x && x[Symbol.iterator]) {530 for (let y of x) {531 r.push(y);532 }533 }534 else {535 r.push(x);536 }537 }538 return r; 539 },540 print(v) {541 console.log(v);542 return v;543 },544 chg(o, p, v) {545 o[p] = v;546 return o;547 },548 getter(o, p, f) {549 return Object.defineProperty(o, p, {550 get: f,551 configurable: true,552 enumerable: true553 });554 },555 setter(o, p, f) {556 return Object.defineProperty(o, p, {557 set: f,558 configurable: true,559 enumerable: true560 });561 },562 reduce(i, f, q) {563 let j = 0;564 for (let v of i) {565 q = f(q, v, j++, i);566 }567 return q;568 },569 pick(x, p) {570 let r = [];571 for (let v of x) {572 r.push(v[p]);573 }574 return r;575 },576 mapAt(x, p, a) {577 let r = [];578 for (let v of x) {579 r.push(this._at(v, p, a));580 }581 return r;582 },583 mapAtUse: ['_at'],584 interpolate(s, e, t) {585 return +s * (1 - t) + +e * t;586 },587 group(i, f, g) { return this._group(false, i, this._callback(f), g) },588 groupUse: ['_callback', '_group'],589 groupCount(i, f, g) { return this._group(true, i, this._callback(f), g) },590 groupCountUse: ['_callback', '_group'],591 bin(i, z, f, g) { return this._bin(false, i, z, f, g) },592 binUse: ['_bin'],593 binCount(i, z, f, g) { return this._bin(true, i, z, f, g) },594 binCountUse: ['_bin'],595 sumCumu(i, f) {596 f = this._callback(f);597 let s = 0,598 r = [],599 j = 0;600 for (let v of i) {601 r.push(s += +f(v, j++, i));602 }603 return r;604 },605 sumCumuUse: ['_callback'],606 sum(i, f) { return this._sum(false, i, this._callback(f)) },607 sumUse: ['_callback', '_sum'],608 mean(i, f) { return this._sum(true, i, this._callback(f)) },609 meanUse: ['_callback', '_sum'],610 minIndex(i, f) { return this._minMaxIndex(false, i, this._callback(f)) },611 minIndexUse: ['_callback', '_minMaxIndex'],612 maxIndex(i, f) { return this._minMaxIndex(true, i, this._callback(f)) },613 maxIndexUse: ['_callback', '_minMaxIndex'],614 min(i, f) { return this._minMax(false, i, this._callback(f)) },615 minUse: ['_callback', '_minMax'],616 max(i, f) { return this._minMax(true, i, this._callback(f)) },617 maxUse: ['_callback', '_minMax'],618 variance(i, f) { return this._varDev(false, false, i, this._callback(f)) },619 varianceUse: ['_callback', '_varDev'],620 variancePop(i, f) { return this._varDev(false, true, i, this._callback(f)) },621 variancePopUse: ['_callback', '_varDev'],622 deviation(i, f) { return this._varDev(true, false, i, this._callback(f)) },623 deviationUse: ['_callback', '_varDev'],624 deviationPop(i, f) { return this._varDev(true, true, i, this._callback(f)) },625 deviationPopUse: ['_callback', '_varDev'],626 627 covariance(i, f, g) {628 return this._covCorr(false, false, i, this._callback(f), this._callback(g));629 },630 covarianceUse: ['_callback', '_covCorr'],631 covariancePop(i, f, g) {632 return this._covCorr(false, true, i, this._callback(f), this._callback(g));633 },634 covariancePopUse: ['_callback', '_covCorr'],635 636 correlation(i, f, g) {637 return this._covCorr(true, false, i, this._callback(f), this._callback(g));638 },639 correlationUse: ['_callback', '_covCorr'],640 median(i, f, o) { return this._quantile(i, 0.5, this._callback(f), o) },641 medianUse: ['_callback', '_quantile'],642 quantile(i, q, f, o) { return this._quantile(i, q, this._callback(f), o) },643 quantileUse: ['_callback', '_quantile'],644 orderIndex(i, f, p) {645 return this._orderIndex(i, this._compare(f, p));646 },647 orderIndexUse: ['_compare', '_orderIndex'],648 order(i, f, p) {649 return [...i].sort(this._compare(f, p));650 },651 orderUse: ['_compare'],652 rank(i, f, p) {653 i = Array.isArray(i) ? i : [...i];654 f = this._compare(f, p);655 const o = this._orderIndex(i, f);656 const n = i.length;657 const r = new Array(n);658 let c, y;659 for (let j = 0; j < n; j++) {660 let k = o[j];661 if (j === 0 || f(i[k], y) !== 0) {662 c = j;663 y = i[k];664 }665 r[k] = c;666 }667 return r;668 },669 rankUse: ['_compare', '_orderIndex'],670 some(i, f) {671 f = this._callback(f);672 let j = 0;673 for (let v of i) {674 if (f(v, j++, i)) return true;675 }676 return false;677 },678 someUse: ['_callback'],679 every(i, f) { 680 f = this._callback(f);681 let j = 0;682 for (let v of i) {683 if (!f(v, j++, i)) return false;684 }685 return true;686 },687 everyUse: ['_callback'],688 filter(i, f) {689 f = this._callback(f);690 let r = [],691 j = 0;692 for (let v of i) {693 if (f(v, j++, i)) r.push(v);694 }695 return r;696 },697 filterUse: ['_callback'],698 filterIndex(i, f) {699 f = this._callback(f);700 let r = [],701 j = 0;702 for (let v of i) {703 if (f(v, j, i)) r.push(j);704 j++;705 }706 return r;707 },708 filterIndexUse: ['_callback'],709 count(i, f) {710 f = this._callback(f);711 let c = 0,712 j = 0;713 for (let v of i) {714 if (f(v, j++, i)) c++;715 }716 return c;717 },718 countUse: ['_callback'],719 findIndex(i, f) {720 f = this._callback(f);721 let j = 0;722 for (let v of i) {723 if (f(v, j, i)) return j;724 j++;725 }726 return -1;727 },728 findIndexUse: ['_callback'],729 find(i, f) {730 f = this._callback(f);731 let j = 0;732 for (let v of i) {733 if (f(v, j++, i)) return v;734 }735 },736 findUse: ['_callback'],737 innerJoin(...q) { return this._join('i', ...q) },738 innerJoinUse: ['_join'],739 outerJoin(...q) { return this._join('o', ...q) },740 outerJoinUse: ['_join'],741 leftJoin(...q) { return this._join('l', ...q) },742 leftJoinUse: ['_join'],743 rightJoin(...q) { return this._join('r', ...q) },744 rightJoinUse: ['_join'],745 crossJoin(x, y, z) { return this._join('i', x, y, () => 1, z) },746 crossJoinUse: ['_join'],747 748 semiJoin(...q) { return this._semiJoin(false, ...q) },749 semiJoinUse: ['_semiJoin'],750 antiJoin(...q) { return this._semiJoin(true, ...q) },751 antiJoinUse: ['_semiJoin'],752 crush(j, ...o) {753 let r = [];754 const p = [];755 const c = [];756 for (let q of o) {757 if (q) {758 let w = q.prefix;759 p.push(w === undefined || w === null ? '' : String(w));760 w = q.keep;761 c.push(w ? (Array.isArray(w) ? w : [...w]) : null)762 }763 else {764 p.push('');765 c.push(null);766 }767 }768 for (let u of j) {769 let z = {};770 let i = 0;771 for (let v of u) {772 if (typeof v === 'object' && v !== null) {773 let s = p[i] || '';774 if (c[i]) {775 for (let k of c[i]) {776 if (v.hasOwnProperty(k)) {777 z[s + k] = v[k];778 }779 }780 }781 else {782 for (let k in v) {783 if (v.hasOwnProperty(k)) {784 z[s + k] = v[k];785 }786 }787 }788 }789 i++;790 }791 r.push(z);792 }793 return r;794 },795 796 arrObj(o, c) {797 let r = [];798 for (let k of c || Object.keys(o)) {799 let j = 0;800 for (let v of o[k]) {801 (r[j] || (r[j] = {}))[k] = v;802 j++;803 }804 }805 return r;806 },807 808 objArr(a, c) {809 let r = {},810 j = 0;811 for (let o of a) {812 for (let k of c || Object.keys(o)) {813 (r[k] || (r[k] = []))[j] = o[k];814 }815 j++;816 }817 return r;818 },819 transpose(x) {820 let r = [],821 j = 0;822 for (let y of x) {823 let k = 0;824 for (let v of y) {825 (r[k] || (r[k] = []))[j] = v;826 k++;827 }828 j++;829 }830 return r;831 },832 random(j = 0, k = 1, n) {833 return this._sample(this._random, n, +j, +k);834 },835 randomUse: ['_sample', '_random'],836 randomInt(j = 0, k = 2, n) {837 return this._sample(this._randomInt, n, +j, +k);838 },839 randomIntUse: ['_sample', '_randomInt'],840 categorical(m, n) {841 let q = [],842 c = 0;843 for (let w of m) {844 q.push(c += +w);845 }846 return this._sample(this._categorical, n, q, c);847 },848 categoricalUse: ['_sample', '_categorical'],849 850 normal(m = 0, d = 1, n) {851 return this._sample(this._normal(+m, +d), n);852 },853 normalUse: ['_sample', '_normal'],854 logNormal(m = 0, d = 1, n) {855 return this._sample(this._normal(+m, +d, true), n);856 },857 logNormalUse: ['_sample', '_normal'],858 binomial(m, p = 0.5, n) {859 return this._sample(this._binomial, n, +m, +p);860 },861 binomialUse: ['_sample', '_binomial'],862 exponential(r, n) {863 return this._sample(this._exponential, n, +r);864 },865 exponentialUse: ['_sample', '_exponential'],866 geometric(p = 0.5, n) {867 return this._sample(this._geometric, n, +p);868 },869 geometricUse: ['_sample', '_geometric'],870 shuffle(x) { // FisherâYates871 x = [...x];872 for (let i = x.length - 1; i > 0; i--) {873 const j = Math.floor(Math.random() * (i + 1));874 if (i !== j) {875 const t = x[i];876 x[i] = x[j];877 x[j] = t;878 } 879 }880 return x;881 },882 period(m, x) {883 return new Promise(r => setTimeout(() => r(x), m));884 },885 at(...q) { return this._at(...q) },886 atUse: ['_at'],887 ones(...d) { return this._mdArray(d, 1) },888 onesUse: ['_mdArray'],889 zeros(...d) { return this._mdArray(d, 0) },890 zerosUse: ['_mdArray'],891 empties(...d) { return this._mdArray(d) },892 emptiesUse: ['_mdArray'],893 // set thoery functions from: https://github.com/d3/d3-array894 difference(s, ...t) {895 s = new Set(s);896 for (let q of t) {897 for (let v of q) {898 s.delete(v);899 }900 }901 return s;902 },903 intersection(s, ...t) {904 s = new Set(s);905 t = t.map(w => w instanceof Set ? w : new Set(w));906 z: for (let v of s) {907 for (let q of t) {908 if (!q.has(v)) {909 s.delete(v);910 continue z;911 }912 }913 }914 return s;915 },916 union(...t) {917 const s = new Set();918 for (let q of t) {919 for (let v of q) {920 s.add(v);921 }922 }923 return s;924 },925 select(...a) {926 return (a.length === 1)927 ? document.querySelector(a[0])928 : this._first(a[0]).querySelector(a[1]);929 },930 selectUse: ['_first'],931 selectAll(...a) {932 return (a.length === 1)933 ? [...document.querySelectorAll(a[0])]934 : [...this._first(a[0]).querySelectorAll(a[1])];935 },936 selectAllUse: ['_first'],937 insert(t, e, p = () => null) {938 t = this._first(t);939 if (typeof e === 'function') e = e.call(t, t.__data__);940 else e = this._autoSelect(e);941 p = this._first(p.call(t, t.__data__));942 for (let w of (e && e[Symbol.iterator] ? e : [e])) {943 t.insertBefore(w, p);944 }945 return e;946 },947 insertUse: ['_first', '_autoSelect'],948 insertEach(t, f, p = () => null) {949 let r = [],950 j = 0;951 if (typeof t === 'string') t = document.querySelectorAll(t);952 else if (!(t && t[Symbol.iterator])) t = [t];953 for (let q of t) {954 let v = f.call(q, q.__data__, j);955 let m = this._first(p.call(q, q.__data__, j++));956 r.push(v);957 for (let w of (v && v[Symbol.iterator] ? v : [v])) {958 q.insertBefore(w, m);959 }960 }961 return r;962 },963 insertEachUse: ['_first'],964 965 into(e, t, p = () => null) {966 t = this._first(t);967 if (typeof e === 'function') e = e.call(t, t.__data__);968 else if (typeof e === 'string') e = document.querySelectorAll(e);969 p = this._first(p.call(t, t.__data__));970 for (let q of (e && e[Symbol.iterator] ? e : [e])) {971 t.insertBefore(q, p);972 }973 return t;974 },975 intoUse: ['_first'],976 977 encode(x, t, a) { return this._encode(false, x, t, a) },978 encodeUse: ['_encode'],979 encodeSVG(x, t, a) { return this._encode(true, x, t, a) },980 encodeSVGUse: ['_encode'],981 create(t, n) { return this._create(false, t, n) },982 createUse: createArray,983 createSVG(t, n) { return this._create(true, t, n) },984 createSVGUse: createArray,985 attr(...x) {986 return (x.length === 2)987 ? this._apsGet(this._getAttr, ...x)988 : this._apsSet(this._setAttr, ...x);989 },990 attrUse: ['_apsGet', '_apsSet', '_getAttr', '_setAttr', '_autoSelect'],991 prop(...x) {992 return (x.length === 2)993 ? this._apsGet(this._getProp, ...x)994 : this._apsSet(this._setProp, ...x);995 },996 propUse: ['_apsGet', '_apsSet', '_getProp', '_setProp', '_autoSelect'],997 style(...x) {998 return (x.length === 2)999 ? this._apsGet(this._getStyle, ...x)1000 : this._apsSet(this._setStyle, ...x);1001 },1002 styleUse: ['_apsGet', '_apsSet', '_getStyle', '_setStyle', '_autoSelect'],1003 text(...x) {1004 return (x.length === 1)1005 ? this._apsGet(this._getProp, x[0], 'textContent')1006 : this._apsSet(this._setProp, x[0], 'textContent', x[1]);1007 },1008 textUse: ['_apsGet', '_apsSet', '_getProp', '_setProp', '_autoSelect'],1009 html(...x) {1010 return (x.length === 1)1011 ? this._apsGet(this._getProp, x[0], 'innerHTML')1012 : this._apsSet(this._setProp, x[0], 'innerHTML', x[1]);1013 },1014 htmlUse: ['_apsGet', '_apsSet', '_getProp', '_setProp', '_autoSelect'],1015 remove(e) {1016 e = this._autoSelect(e);1017 if (e && e[Symbol.iterator]) {1018 for (let q of e) {1019 q.parentNode.removeChild(q);1020 }1021 }1022 else {1023 e.parentNode.removeChild(e);1024 }1025 return e;1026 },1027 removeUse: ['_autoSelect'],1028 lower(e) {1029 e = this._autoSelect(e);1030 if (e && e[Symbol.iterator]) {1031 for (let q of e) {1032 let p = q.parentNode;1033 p.insertBefore(q, p.firstChild);1034 }1035 }1036 else {1037 let p = e.parentNode;1038 p.insertBefore(e, p.firstChild);1039 }1040 return e;1041 },1042 lowerUse: ['_autoSelect'],1043 raise(e) {1044 e = this._autoSelect(e);1045 if (e && e[Symbol.iterator]) {1046 for (let q of e) {1047 q.parentNode.insertBefore(q, null);1048 }1049 }1050 else {1051 e.parentNode.insertBefore(e, null);1052 }1053 return e;1054 },1055 raiseUse: ['_autoSelect'],1056 addClass(e, c) { return this._addRemoveClass(true, e, c) },1057 addClassUse: ['_autoSelect', '_addRemoveClass'],1058 1059 removeClass(e, c) { return this._addRemoveClass(false, e, c) },1060 removeClassUse: ['_autoSelect', '_addRemoveClass'],1061 toggleClass(e, v) {1062 return this._eachElement((x, y) => x.classList.toggle(y), e, v);1063 },1064 toggleClassUse: ['_autoSelect', '_eachElement'],1065 removeAttr(e, v) {1066 return this._eachElement((x, y) => x.removeAttribute(y), e, v);1067 },1068 removeAttrUse: ['_autoSelect', '_eachElement'],1069 removeStyle(e, v) {1070 return this._eachElement((x, y) => x.style.removeProperty(y), e, v);1071 },1072 removeStyleUse: ['_autoSelect', '_eachElement'],1073 hasClass(e, c) {1074 let r;1075 if (typeof e === 'string') e = document.querySelectorAll(e);1076 if (e && e[Symbol.iterator]) {1077 r = [];1078 for (let q of e) {1079 r.push(q.classList.contains(c));1080 }1081 }1082 else {1083 r = e.classList.contains(c);1084 }1085 return r;1086 },1087 hasAttr(e, a) {1088 let r;1089 if (typeof e === 'string') e = document.querySelectorAll(e);1090 if (e && e[Symbol.iterator]) {1091 r = [];1092 for (let q of e) {1093 r.push(q.hasAttribute(a));1094 }1095 }1096 else {1097 r = e.hasAttribute(a);1098 }1099 return r;1100 },1101 on(e, t, f, c = false) {1102 e = this._autoSelect(e);1103 t = t.trim().split(/^|\s+/);1104 for (let q of (e && e[Symbol.iterator] ? e : [e])) {1105 let g = k => f.call(q, q.__data__, k);1106 if (!q.__on__) q.__on__ = {};1107 for (let w of t) {1108 if (!q.__on__[w]) q.__on__[w] = new Map();1109 else if (q.__on__[w].has(f)) continue;1110 q.addEventListener(w, g, c);1111 q.__on__[w].set(f, g);1112 }1113 }1114 return e;1115 },1116 onUse: ['_autoSelect'],1117 off(e, t, f, c = false) {1118 e = this._autoSelect(e);1119 t = t.trim().split(/^|\s+/);1120 for (let q of (e && e[Symbol.iterator] ? e : [e])) {1121 if (!q.__on__) continue;1122 for (let w of t) {1123 let g = q.__on__[w] ? q.__on__[w].get(f) : undefined;1124 if (g) {1125 q.removeEventListener(w, g, c);1126 q.__on__[w].delete(f);1127 }1128 }1129 }1130 return e;1131 },1132 offUse: ['_autoSelect'],1133 sketch({1134 width: w = 300,1135 height: h = 300,1136 context: d = "2d",1137 scale: s = true,1138 ...o} = {}) {1139 let r = window.devicePixelRatio;1140 let c = document.createElement("canvas");1141 let x = c.getContext(d, o);1142 if (s && d === "2d") {1143 c.style.width = w + "px";1144 c.style.height = h + "px";1145 c.width = w * r;1146 c.height = h * r;1147 x.scale(r, r);1148 }1149 else {1150 c.width = w;1151 c.height = h;1152 }1153 return [c, x];1154 },1155 // HTML convenience1156 $a(n) {return this._create(false, 'a', n)}, $aUse: createArray,1157 $abbr(n) {return this._create(false, 'abbr', n)}, $abbrUse: createArray,1158 $address(n) {return this._create(false, 'address', n)}, $addressUse: createArray,1159 $area(n) {return this._create(false, 'area', n)}, $areaUse: createArray,1160 $article(n) {return this._create(false, 'article', n)}, $articleUse: createArray,1161 $aside(n) {return this._create(false, 'aside', n)}, $asideUse: createArray,1162 $audio(n) {return this._create(false, 'audio', n)}, $audioUse: createArray,1163 $b(n) {return this._create(false, 'b', n)}, $bUse: createArray,1164 $base(n) {return this._create(false, 'base', n)}, $baseUse: createArray,1165 $bdi(n) {return this._create(false, 'bdi', n)}, $bdiUse: createArray,1166 $bdo(n) {return this._create(false, 'bdo', n)}, $bdoUse: createArray,1167 $blockquote(n) {return this._create(false, 'blockquote', n)}, $blockquoteUse: createArray,1168 $body(n) {return this._create(false, 'body', n)}, $bodyUse: createArray,1169 $br(n) {return this._create(false, 'br', n)}, $brUse: createArray,1170 $button(n) {return this._create(false, 'button', n)}, $buttonUse: createArray,1171 $canvas(n) {return this._create(false, 'canvas', n)}, $canvasUse: createArray,1172 $caption(n) {return this._create(false, 'caption', n)}, $captionUse: createArray,1173 $cite(n) {return this._create(false, 'cite', n)}, $citeUse: createArray,1174 $code(n) {return this._create(false, 'code', n)}, $codeUse: createArray,1175 $col(n) {return this._create(false, 'col', n)}, $colUse: createArray,1176 $colgroup(n) {return this._create(false, 'colgroup', n)}, $colgroupUse: createArray,1177 $data(n) {return this._create(false, 'data', n)}, $dataUse: createArray,1178 $datalist(n) {return this._create(false, 'datalist', n)}, $datalistUse: createArray,1179 $dd(n) {return this._create(false, 'dd', n)}, $ddUse: createArray,1180 $del(n) {return this._create(false, 'del', n)}, $delUse: createArray,1181 $details(n) {return this._create(false, 'details', n)}, $detailsUse: createArray,1182 $dfn(n) {return this._create(false, 'dfn', n)}, $dfnUse: createArray,1183 $dialog(n) {return this._create(false, 'dialog', n)}, $dialogUse: createArray,1184 $div(n) {return this._create(false, 'div', n)}, $divUse: createArray,1185 $dl(n) {return this._create(false, 'dl', n)}, $dlUse: createArray,1186 $dt(n) {return this._create(false, 'dt', n)}, $dtUse: createArray,1187 $em(n) {return this._create(false, 'em', n)}, $emUse: createArray,1188 $embed(n) {return this._create(false, 'embed', n)}, $embedUse: createArray,1189 $fieldset(n) {return this._create(false, 'fieldset', n)}, $fieldsetUse: createArray,1190 $figcaption(n) {return this._create(false, 'figcaption', n)}, $figcaptionUse: createArray,1191 $figure(n) {return this._create(false, 'figure', n)}, $figureUse: createArray,1192 $footer(n) {return this._create(false, 'footer', n)}, $footerUse: createArray,1193 $form(n) {return this._create(false, 'form', n)}, $formUse: createArray,1194 $h1(n) {return this._create(false, 'h1', n)}, $h1Use: createArray,1195 $h2(n) {return this._create(false, 'h2', n)}, $h2Use: createArray,1196 $h3(n) {return this._create(false, 'h3', n)}, $h3Use: createArray,1197 $h4(n) {return this._create(false, 'h4', n)}, $h4Use: createArray,1198 $h5(n) {return this._create(false, 'h5', n)}, $h5Use: createArray,1199 $h6(n) {return this._create(false, 'h6', n)}, $h6Use: createArray,1200 $head(n) {return this._create(false, 'head', n)}, $headUse: createArray,1201 $header(n) {return this._create(false, 'header', n)}, $headerUse: createArray,1202 $hgroup(n) {return this._create(false, 'hgroup', n)}, $hgroupUse: createArray,1203 $hr(n) {return this._create(false, 'hr', n)}, $hrUse: createArray,1204 $i(n) {return this._create(false, 'i', n)}, $iUse: createArray,1205 $iframe(n) {return this._create(false, 'iframe', n)}, $iframeUse: createArray,1206 $img(n) {return this._create(false, 'img', n)}, $imgUse: createArray,1207 $input(n) {return this._create(false, 'input', n)}, $inputUse: createArray,1208 $ins(n) {return this._create(false, 'ins', n)}, $insUse: createArray,1209 $kbd(n) {return this._create(false, 'kbd', n)}, $kbdUse: createArray,1210 $label(n) {return this._create(false, 'label', n)}, $labelUse: createArray,1211 $legend(n) {return this._create(false, 'legend', n)}, $legendUse: createArray,1212 $li(n) {return this._create(false, 'li', n)}, $liUse: createArray,1213 $link(n) {return this._create(false, 'link', n)}, $linkUse: createArray,1214 $main(n) {return this._create(false, 'main', n)}, $mainUse: createArray,1215 $map(n) {return this._create(false, 'map', n)}, $mapUse: createArray,1216 $mark(n) {return this._create(false, 'mark', n)}, $markUse: createArray,1217 $menu(n) {return this._create(false, 'menu', n)}, $menuUse: createArray,1218 $meta(n) {return this._create(false, 'meta', n)}, $metaUse: createArray,1219 $meter(n) {return this._create(false, 'meter', n)}, $meterUse: createArray,1220 $nav(n) {return this._create(false, 'nav', n)}, $navUse: createArray,1221 $noscript(n) {return this._create(false, 'noscript', n)}, $noscriptUse: createArray,1222 $object(n) {return this._create(false, 'object', n)}, $objectUse: createArray,1223 $ol(n) {return this._create(false, 'ol', n)}, $olUse: createArray,1224 $optgroup(n) {return this._create(false, 'optgroup', n)}, $optgroupUse: createArray,1225 $option(n) {return this._create(false, 'option', n)}, $optionUse: createArray,1226 $output(n) {return this._create(false, 'output', n)}, $outputUse: createArray,1227 $p(n) {return this._create(false, 'p', n)}, $pUse: createArray,1228 $param(n) {return this._create(false, 'param', n)}, $paramUse: createArray,1229 $picture(n) {return this._create(false, 'picture', n)}, $pictureUse: createArray,1230 $pre(n) {return this._create(false, 'pre', n)}, $preUse: createArray,1231 $progress(n) {return this._create(false, 'progress', n)}, $progressUse: createArray,1232 $q(n) {return this._create(false, 'q', n)}, $qUse: createArray,1233 $rb(n) {return this._create(false, 'rb', n)}, $rbUse: createArray,1234 $rp(n) {return this._create(false, 'rp', n)}, $rpUse: createArray,1235 $rt(n) {return this._create(false, 'rt', n)}, $rtUse: createArray,1236 $rtc(n) {return this._create(false, 'rtc', n)}, $rtcUse: createArray,1237 $ruby(n) {return this._create(false, 'ruby', n)}, $rubyUse: createArray,1238 $s(n) {return this._create(false, 's', n)}, $sUse: createArray,1239 $samp(n) {return this._create(false, 'samp', n)}, $sampUse: createArray,1240 $script(n) {return this._create(false, 'script', n)}, $scriptUse: createArray,1241 $section(n) {return this._create(false, 'section', n)}, $sectionUse: createArray,1242 $select(n) {return this._create(false, 'select', n)}, $selectUse: createArray,1243 $slot(n) {return this._create(false, 'slot', n)}, $slotUse: createArray,1244 $small(n) {return this._create(false, 'small', n)}, $smallUse: createArray,1245 $source(n) {return this._create(false, 'source', n)}, $sourceUse: createArray,1246 $span(n) {return this._create(false, 'span', n)}, $spanUse: createArray,1247 $strong(n) {return this._create(false, 'strong', n)}, $strongUse: createArray,1248 $style(n) {return this._create(false, 'style', n)}, $styleUse: createArray,1249 $sub(n) {return this._create(false, 'sub', n)}, $subUse: createArray,1250 $summary(n) {return this._create(false, 'summary', n)}, $summaryUse: createArray,1251 $sup(n) {return this._create(false, 'sup', n)}, $supUse: createArray,1252 $table(n) {return this._create(false, 'table', n)}, $tableUse: createArray,1253 $tbody(n) {return this._create(false, 'tbody', n)}, $tbodyUse: createArray,1254 $td(n) {return this._create(false, 'td', n)}, $tdUse: createArray,1255 $template(n) {return this._create(false, 'template', n)}, $templateUse: createArray,1256 $textarea(n) {return this._create(false, 'textarea', n)}, $textareaUse: createArray,1257 $tfoot(n) {return this._create(false, 'tfoot', n)}, $tfootUse: createArray,1258 $th(n) {return this._create(false, 'th', n)}, $thUse: createArray,1259 $thead(n) {return this._create(false, 'thead', n)}, $theadUse: createArray,1260 $time(n) {return this._create(false, 'time', n)}, $timeUse: createArray,1261 $title(n) {return this._create(false, 'title', n)}, $titleUse: createArray,1262 $tr(n) {return this._create(false, 'tr', n)}, $trUse: createArray,1263 $track(n) {return this._create(false, 'track', n)}, $trackUse: createArray,1264 $u(n) {return this._create(false, 'u', n)}, $uUse: createArray,1265 $ul(n) {return this._create(false, 'ul', n)}, $ulUse: createArray,1266 $var(n) {return this._create(false, 'var', n)}, $varUse: createArray,1267 $video(n) {return this._create(false, 'video', n)}, $videoUse: createArray,1268 $wbr(n) {return this._create(false, 'wbr', n)}, $wbrUse: createArray,1269 // SVG convenience1270 $animate(n) {return this._create(true, 'animate', n)}, $animateUse: createArray,1271 $animateMotion(n) {return this._create(true, 'animateMotion', n)}, $animateMotionUse: createArray,1272 $animateTransform(n) {return this._create(true, 'animateTransform', n)}, $animateTransformUse: createArray,1273 $circle(n) {return this._create(true, 'circle', n)}, $circleUse: createArray,1274 $clipPath(n) {return this._create(true, 'clipPath', n)}, $clipPathUse: createArray,1275 $defs(n) {return this._create(true, 'defs', n)}, $defsUse: createArray,1276 $desc(n) {return this._create(true, 'desc', n)}, $descUse: createArray,1277 $discard(n) {return this._create(true, 'discard', n)}, $discardUse: createArray,1278 $ellipse(n) {return this._create(true, 'ellipse', n)}, $ellipseUse: createArray,1279 $feBlend(n) {return this._create(true, 'feBlend', n)}, $feBlendUse: createArray,1280 $feColorMatrix(n) {return this._create(true, 'feColorMatrix', n)}, $feColorMatrixUse: createArray,1281 $feComponentTransfer(n) {return this._create(true, 'feComponentTransfer', n)}, $feComponentTransferUse: createArray,1282 $feComposite(n) {return this._create(true, 'feComposite', n)}, $feCompositeUse: createArray,1283 $feConvolveMatrix(n) {return this._create(true, 'feConvolveMatrix', n)}, $feConvolveMatrixUse: createArray,1284 $feDiffuseLighting(n) {return this._create(true, 'feDiffuseLighting', n)}, $feDiffuseLightingUse: createArray,1285 $feDisplacementMap(n) {return this._create(true, 'feDisplacementMap', n)}, $feDisplacementMapUse: createArray,1286 $feDistantLight(n) {return this._create(true, 'feDistantLight', n)}, $feDistantLightUse: createArray,1287 $feDropShadow(n) {return this._create(true, 'feDropShadow', n)}, $feDropShadowUse: createArray,1288 $feFlood(n) {return this._create(true, 'feFlood', n)}, $feFloodUse: createArray,1289 $feFuncA(n) {return this._create(true, 'feFuncA', n)}, $feFuncAUse: createArray,1290 $feFuncB(n) {return this._create(true, 'feFuncB', n)}, $feFuncBUse: createArray,1291 $feFuncG(n) {return this._create(true, 'feFuncG', n)}, $feFuncGUse: createArray,1292 $feFuncR(n) {return this._create(true, 'feFuncR', n)}, $feFuncRUse: createArray,1293 $feGaussianBlur(n) {return this._create(true, 'feGaussianBlur', n)}, $feGaussianBlurUse: createArray,1294 $feImage(n) {return this._create(true, 'feImage', n)}, $feImageUse: createArray,1295 $feMerge(n) {return this._create(true, 'feMerge', n)}, $feMergeUse: createArray,1296 $feMergeNode(n) {return this._create(true, 'feMergeNode', n)}, $feMergeNodeUse: createArray,1297 $feMorphology(n) {return this._create(true, 'feMorphology', n)}, $feMorphologyUse: createArray,1298 $feOffset(n) {return this._create(true, 'feOffset', n)}, $feOffsetUse: createArray,1299 $fePointLight(n) {return this._create(true, 'fePointLight', n)}, $fePointLightUse: createArray,1300 $feSpecularLighting(n) {return this._create(true, 'feSpecularLighting', n)}, $feSpecularLightingUse: createArray,1301 $feSpotLight(n) {return this._create(true, 'feSpotLight', n)}, $feSpotLightUse: createArray,1302 $feTile(n) {return this._create(true, 'feTile', n)}, $feTileUse: createArray,1303 $feTurbulence(n) {return this._create(true, 'feTurbulence', n)}, $feTurbulenceUse: createArray,1304 $filter(n) {return this._create(true, 'filter', n)}, $filterUse: createArray,1305 $foreignObject(n) {return this._create(true, 'foreignObject', n)}, $foreignObjectUse: createArray,1306 $g(n) {return this._create(true, 'g', n)}, $gUse: createArray,1307 $hatch(n) {return this._create(true, 'hatch', n)}, $hatchUse: createArray,1308 $hatchpath(n) {return this._create(true, 'hatchpath', n)}, $hatchpathUse: createArray,1309 $image(n) {return this._create(true, 'image', n)}, $imageUse: createArray,1310 $line(n) {return this._create(true, 'line', n)}, $lineUse: createArray,1311 $linearGradient(n) {return this._create(true, 'linearGradient', n)}, $linearGradientUse: createArray,1312 $marker(n) {return this._create(true, 'marker', n)}, $markerUse: createArray,1313 $mask(n) {return this._create(true, 'mask', n)}, $maskUse: createArray,1314 $metadata(n) {return this._create(true, 'metadata', n)}, $metadataUse: createArray,1315 $mpath(n) {return this._create(true, 'mpath', n)}, $mpathUse: createArray,1316 $path(n) {return this._create(true, 'path', n)}, $pathUse: createArray,1317 $pattern(n) {return this._create(true, 'pattern', n)}, $patternUse: createArray,1318 $polygon(n) {return this._create(true, 'polygon', n)}, $polygonUse: createArray,1319 $polyline(n) {return this._create(true, 'polyline', n)}, $polylineUse: createArray,1320 $radialGradient(n) {return this._create(true, 'radialGradient', n)}, $radialGradientUse: createArray,1321 $rect(n) {return this._create(true, 'rect', n)}, $rectUse: createArray, 1322 $set(n) {return this._create(true, 'set', n)}, $setUse: createArray,1323 $solidcolor(n) {return this._create(true, 'solidcolor', n)}, $solidcolorUse: createArray,1324 $stop(n) {return this._create(true, 'stop', n)}, $stopUse: createArray,1325 $svg(n) {return this._create(true, 'svg', n)}, $svgUse: createArray,1326 $switch(n) {return this._create(true, 'switch', n)}, $switchUse: createArray,1327 $symbol(n) {return this._create(true, 'symbol', n)}, $symbolUse: createArray,1328 $text(n) {return this._create(true, 'text', n)}, $textUse: createArray,1329 $textPath(n) {return this._create(true, 'textPath', n)}, $textPathUse: createArray,1330 $tspan(n) {return this._create(true, 'tspan', n)}, $tspanUse: createArray,1331 $use(n) {return this._create(true, 'use', n)}, $useUse: createArray,1332 $view(n) {return this._create(true, 'view', n)}, $viewUse: createArray,1333 // entrywise1334 abs(x) {return this._ew(x, Math.abs)}, absUse: ['_ew'],1335 acos(x) {return this._ew(x, Math.acos)}, acosUse: ['_ew'],1336 acosh(x) {return this._ew(x, Math.acosh)}, acoshUse: ['_ew'],1337 asin(x) {return this._ew(x, Math.asin)}, asinUse: ['_ew'],1338 asinh(x) {return this._ew(x, Math.asinh)}, asinhUse: ['_ew'],1339 atan(x) {return this._ew(x, Math.atan)}, atanUse: ['_ew'],1340 atanh(x) {return this._ew(x, Math.atanh)}, atanhUse: ['_ew'],1341 cbrt(x) {return this._ew(x, Math.cbrt)}, cbrtUse: ['_ew'],1342 ceil(x) {return this._ew(x, Math.ceil)}, ceilUse: ['_ew'],1343 clz32(x) {return this._ew(x, Math.clz32)}, clz32Use: ['_ew'],1344 cos(x) {return this._ew(x, Math.cos)}, cosUse: ['_ew'],1345 cosh(x) {return this._ew(x, Math.cosh)}, coshUse: ['_ew'],1346 exp(x) {return this._ew(x, Math.exp)}, expUse: ['_ew'],...
form.js
Source:form.js
1(function(){2 const _helpimage = chrome.runtime.getURL( '/img/help.png' );3 function _create( type, id, cls, parent ) {4 const el = document.createElement( type );5 if ( id ) {6 el.id = id;7 }8 if ( cls ) {9 el.className = cls;10 }11 if ( parent ) {12 parent.appendChild( el );13 }14 return el;15 }16 function _input( type, name, value, id ) {17 if ( !id ) {18 id = name;19 }20 const input = _create( 'input', id );21 input.type = type;22 input.name = name;23 input.value = value || '';24 return input;25 }26 function FNF_Form( container ) {27 this.container = container || document.body;28 }29 FNF_Form.prototype = {30 container: null,31 ui: {},32 tabs: {},33 fields: {},34 config: {},35 render: function( config, values ) {36 this.config = config;37 if ( values ) {38 this.values = values;39 }40 this.createPanel();41 this.createForm();42 this.createButtons();43 this.createTabs( config.tabs );44 this.createFields( config.fields );45 },46 createPanel: function() {47 this.ui.panel = _create( 'div', 'FakeNewsForm', '', this.container );48 },49 createForm: function() {50 this.ui.form = _create( 'form', '', '', this.ui.panel );51 this.ui.form.addEventListener( 'submit', e => e.preventDefault() );52 // Disable auto-submission by pressing enter.53 //https://stackoverflow.com/questions/895171/prevent-users-from-submitting-a-form-by-hitting-enter54 var b = _create( 'button', 'doNothingButton', '', this.ui.form );55 b.style.display = 'none';56 b.type = 'submit';57 b.setAttribute( 'aria-hidden', true );58 },59 createButtons: function() {60 this.ui.buttons = _create( 'div', 'button-container', '', this.ui.form );61 var b;62 if ( ! this.config.disable_google_drive ) {63 b = _create( 'button', 'saveReport', '', this.ui.buttons );64 b.textContent = 'Save to Google Drive';65 this.bindGoogleDrive( b );66 }67 b = _create( 'button', 'copyReport', '', this.ui.buttons );68 b.textContent = 'Copy/Paste';69 this.bindCopyPaste( b );70 b = _create( 'button', 'cancelButton', '', this.ui.buttons );71 b.textContent = 'Exit';72 b.addEventListener( 'click', e => {73 e.preventDefault();74 chrome.runtime.sendMessage( { text: 'close_frame' } );75 });76 },77 bindGoogleDrive: function( button ) {78 button.addEventListener( 'click', e => {79 e.preventDefault();80 const data = this.gatherFormValues();81 const report = new FNF_Report( data );82 report.createDriveFile();83 });84 },85 bindCopyPaste: function( button ) {86 button.addEventListener( 'click', e => {87 e.preventDefault();88 const data = this.gatherFormValues();89 const report = new FNF_Report( data );90 var el = report.createCopyPopup();91 if ( ! el.parentNode ) {92 this.ui.panel.appendChild( el );93 }94 });95 },96 createTabs: function( tabs ) {97 if ( ! this.ui.tabSections ) {98 this.createTabSection();99 }100 tabs.forEach( this.createTab, this );101 this.setActiveTab(); // Set first tab active.102 },103 createTabSection: function() {104 this.ui.tabNav = _create( 'nav', 'tab-nav', '', this.ui.form );105 this.ui.tabSections = _create( 'div', 'tab-sections', '', this.ui.form );106 },107 createTab: function( tabdata ) {108 var link = _create( 'a', '', 'tab-link', this.ui.tabNav );109 link.href = '#';110 link.textContent = tabdata.label;111 var tab = _create( 'div', tabdata.id, 'fnf-tab', this.ui.tabSections );112 link.addEventListener( 'click', e => {113 e.preventDefault();114 this.setActiveTab( tabdata.id );115 });116 var content = _create( 'div', '', 'fnf-tab-content', tab );117 this.tabs[tabdata.id] = { link, tab, content };118 this.createTabFooter( tabdata );119 return tab;120 },121 createTabFooter: function( tabdata ) {122 if ( !tabdata.footer_actions ) {123 return;124 }125 var ui = this.tabs[tabdata.id];126 var footer = ui.footer = _create( 'div', '', 'fnf-tab-footer', ui.tab );127 tabdata.footer_actions.forEach( data => {128 switch( data.type ) {129 case 'changetab':130 var b = _create( 'button', '', '', ui.footer );131 b.textContent = data.label;132 b.addEventListener( 'click', e => {133 e.preventDefault();134 this.setActiveTab.apply( this, data.args );135 window.scrollTo( 0, 0 );136 });137 break;138 case 'save_google':139 // Global drive setting overrides footer action.140 if ( this.config.disable_google_drive ) {141 break;142 }143 /* falls through */144 case 'save_copypaste':145 var b = _create( 'button', '', '', ui.footer );146 b.textContent = data.label;147 this.bindClickAction( data.type, b );148 break;149 }150 });151 },152 bindClickAction: function( action, el ) {153 switch( action ) {154 case 'save_google':155 if ( this.config.disable_google_drive ) {156 break;157 }158 this.bindGoogleDrive( el );159 break;160 case 'save_copypaste':161 this.bindCopyPaste( el );162 break;163 }164 return el;165 },166 setActiveTab: function( tabid ) {167 const tabs = this.tabs;168 const ids = Object.keys( tabs );169 if ( !ids.length ) {170 return;171 }172 // Deactivate all173 ids.forEach( id => {174 tabs[id].link.removeAttribute( 'data-tab-active' );175 tabs[id].tab.removeAttribute( 'data-tab-active' );176 });177 // selected tab ID, or first if none specified.178 const active = tabid ? tabs[tabid] : tabs[ids[0]];179 active.tab.setAttribute( 'data-tab-active', 1 );180 active.link.setAttribute( 'data-tab-active', 1 );181 return active;182 },183 createFields: function( fields ) {184 fields.forEach( this.createField, this );185 },186 createField: function( data ) {187 if ( this.values && typeof this.values[data.id] !== 'undefined' ) {188 data.value = this.values[data.id];189 }190 var input = this.createInput( data, el );191 if ( !input ) {192 return;193 }194 var tabui = this.tabs[data.tabid] || null;195 if ( !tabui ) {196 console.warn( 'Unable to find tab ', data.tabid, ' for field ', data.id );197 return false;198 }199 var el = _create( 'div', '', 'form-group', tabui.content );200 el.setAttribute( 'for', data.id );201 // Label is optional now, for HTML type mainly.202 var label = false;203 if ( data.label ) {204 label = _create( 'label', data.id + '_label', 'field-label', el );205 label.textContent = data.label;206 el.setAttribute( 'role', 'group' );207 el.setAttribute( 'aria-labelledby', data.id + '_label' );208 }209 if ( data.contextual_help ) {210 var hlp = data.contextual_help;211 var helplink = _create( 'a', '', 'help-link', label || el );212 helplink.target = '_blank';213 if ( hlp.url ) {214 helplink.href = hlp.url;215 }216 var img = _create( 'img', '', '', helplink );217 img.src = _helpimage;218 img.alt = 'Help';219 }220 el.appendChild( input );221 this.fields[data.id] = { input, label, container: el, config: data, tab: tabui };222 return el;223 },224 createInput: function( data, field ) {225 if ( this.inputBuilders[ data.type ] ) {226 var method = this.inputBuilders[ data.type ];227 return this[method].call( this, data, field );228 }229 console.warn( 'Unhandled input type:', data.type, data );230 return false;231 },232 createTextInput: function( data ) {233 return _input( 'text', data.id, data.value || '' );234 },235 createTextareaInput: function( data ) {236 const el = _create( 'textarea', data.id );237 el.name = data.id;238 el.value = data.value || '';239 return el;240 },241 createListInput: function( data ) {242 const el = _create( 'div', data.id, 'list-input-container' );243 const list = _create( 'ul', '', 'list-items', el );244 const addblock = _create( 'div', '', 'add-list-items', el );245 if ( !data.noAdd ) {246 const input = _input( 'text', 'add_' + data.id, '' );247 input.addEventListener( 'keyup', e => {248 if ( e.code === 'Enter' ) {249 addItem.call( this, e);250 }251 });252 addblock.appendChild( input );253 const addbutton = _create( 'button', '', '', addblock );254 addbutton.textContent = 'Add';255 addbutton.addEventListener( 'click', addItem.bind(this) );256 function addItem(e) {257 e.preventDefault();258 var value = input.value;259 if ( value !== '' ) {260 this.addListItem( list, value, data );261 input.value = '';262 }263 }264 }265 if ( data.value ) {266 var val = Array.isArray( data.value ) ? data.value : [ data.value ];267 val.forEach( v => this.addListItem( list, v, data ) );268 }269 return el;270 },271 addListItem: function( list, value, field ) {272 var item = _create( 'li', '', '', list );273 var span = _create( 'span', '', 'list-value', item );274 span.textContent = value;275 if ( !field.noRemove ) {276 var del = _create( 'button', '', '', item );277 del.innerHTML = '×';278 del.addEventListener( 'click', function(e) {279 e.preventDefault();280 list.removeChild( item );281 });282 }283 list.appendChild( item );284 return item;285 },286 createLinkListInput: function( data ) {287 const el = _create( 'div', data.id, 'list-input-container link-list-input-container' );288 const list = _create( 'ul', '', 'list-items link-list-items', el );289 const addblock = _create( 'div', '', 'add-list-items add-link-list-items', el );290 if ( !data.noAdd ) {291 const input = _input( 'text', 'add_' + data.id, '' );292 input.placeholder = 'https://';293 input.addEventListener( 'keyup', e => {294 if ( e.code === 'Enter' ) {295 addItem.call( this, e);296 }297 });298 addblock.appendChild( input );299 const addbutton = _create( 'button', '', '', addblock );300 addbutton.textContent = 'Add';301 addbutton.addEventListener( 'click', addItem.bind(this) );302 function addItem(e) {303 e.preventDefault();304 var value = input.value;305 if ( value !== '' ) {306 this.addLinkListItem( list, value, data );307 input.value = '';308 }309 }310 }311 if ( data.value ) {312 var val = Array.isArray( data.value ) ? data.value : [ data.value ];313 val.forEach( v => this.addLinkListItem( list, v, data ) );314 }315 return el;316 },317 addLinkListItem: function( list, value, field ) {318 var item = _create( 'li', '', '', list );319 var span = _create( 'a', '', 'list-value tooltip-title', item );320 span.textContent = value;321 span.href = value;322 span.target = '_blank';323 span.title = value;324 if ( !field.noRemove ) {325 var del = _create( 'button', '', '', item );326 del.innerHTML = '×';327 del.addEventListener( 'click', function(e) {328 e.preventDefault();329 list.removeChild( item );330 });331 }332 list.appendChild( item );333 return item;334 },335 createBooleanInput: function( data ) {336 data.options = [ [ 'Yes' ] ];337 return this.createCheckboxInput( data );338 //return _input( 'checkbox', data.id, 'Yes');339 },340 createCheckboxInput: function( data ) {341 var el = _create( 'div', '', 'checkbox-group' );342 data.options.forEach( opt => {343 // Option is a value or array of [value, label]344 // If label is ommitted, the value will be shown.345 if ( ! Array.isArray( opt ) ) {346 opt = [ opt ];347 }348 if ( opt.length < 2 ) {349 opt.push( opt[0] );350 }351 var id = data.id + '_' + opt[0];352 var chk = _input( 'checkbox', data.id, opt[0], id );353 var label = _create( 'label' );354 label.setAttribute( 'for', id );355 label.textContent = opt[1];356 el.appendChild( chk );357 el.appendChild( label );358 });359 return el;360 },361 createLikertInput: function( data ) {362 var options = data.options;363 var nopt = options.length;364 var list = _create( 'ul', data.id + '_container', 'likert likert-q' + nopt );365 for ( var i=0; i<nopt; i++ ) {366 var li = _create( 'li', '', '', list );367 var value = options[i];368 if ( value.length == 1 ) {369 value.push( value[0] );370 }371 var item_id = data.id + '_' + value[0];372 var input = _input( 'radio', data.id, value[0], item_id );373 var label = _create( 'label' );374 label.textContent = value[1];375 label.setAttribute( 'for', item_id );376 li.appendChild( input );377 li.appendChild( label );378 }379 return list;380 },381 createLinkInput: function( data ) {382 var el = _create( 'div' );383 var link = _input( 'text', data.id, data.value );384 link.placeholder = 'https://';385 link.className = 'link-input';386 el.appendChild( link );387 var go = _create( 'button', '', 'link-go-button', el );388 go.textContent = 'Go';389 go.addEventListener( 'click', function(e){390 e.preventDefault();391 window.open( link.value, '_blank' );392 });393 return el;394 },395 createLink: function( data ) {396 var el;397 if ( data.value ) {398 el = _create( 'a', data.id, 'link-field' );399 el.target = '_blank';400 el.href = data.value;401 el.textContent = data.value;402 } else {403 el = _create( 'span', data.id, 'no-link-field' );404 el.textContent = 'n/a';405 }406 return el;407 },408 createHtmlRegion: function( data ) {409 var el = _create( 'div' );410 if ( data.content ) {411 el.innerHTML = data.content;412 }413 return el;414 },415 createActionButton: function( data ) {416 var el = _create( 'button' );417 if ( data.buttonlabel ) {418 el.innerHTML = data.buttonlabel;419 }420 this.bindClickAction( data.action, el );421 return el;422 },423 createConfigSelector: function( data ) {424 var el = _create( 'div' );425 var sel = _create( 'select', '', 'config-selector', el );426 var button = _create( 'button', '', '', el );427 button.textContent = 'Save/Reload';428 button.addEventListener( 'click', e => {429 chrome.runtime.sendMessage( { text: 'set_config', url: sel.value }, () => {430 chrome.runtime.sendMessage( { text: 'close_frame', noprompt: 1, reopen: 1 } );431 });432 });433 var optDefault = _create( 'option' );434 optDefault.value = '';435 optDefault.text = 'Default';436 sel.options.add( optDefault );437 if ( data.options.length ) {438 for( var i=0,n=data.options.length; i<n; i++ ) {439 var item = data.options[i];440 if ( ! item.url ) {441 continue;442 }443 var opt = _create( 'option' );444 opt.value = item.url;445 opt.text = item.label || item.url;446 sel.options.add( opt );447 }448 }449 return el;450 },451 inputBuilders: {452 text: 'createTextInput',453 textarea: 'createTextareaInput',454 boolean: 'createBooleanInput',455 checkbox: 'createCheckboxInput',456 likert: 'createLikertInput',457 list: 'createListInput',...
measurer.js
Source:measurer.js
1import { CoordinateType } from "./geometry/geometry";2import { GraphicLayer } from "./layer/graphic-layer";3import { Graphic } from "./element/graphic";4import { Point } from "./geometry/point";5import { SimpleFillSymbol, SimpleLineSymbol, SimplePointSymbol, SimpleTextSymbol } from "./symbol/symbol";6import { Subject } from "./util/subject";7import { Polyline } from "./geometry/polyline";8import { Polygon } from "./geometry/polygon";9export var MeasureActionType;10(function (MeasureActionType) {11 MeasureActionType[MeasureActionType["Default"] = 0] = "Default";12 MeasureActionType[MeasureActionType["Polyline"] = 1] = "Polyline";13 MeasureActionType[MeasureActionType["Polygon"] = 2] = "Polygon";14})(MeasureActionType || (MeasureActionType = {}));15/**16 * Measurer17 */18export class Measurer extends Subject {19 /**20 * å建Editor21 * ä¸åºèªä¸»å建ï¼mapå
é¨å建22 * @param {Map} map - å°å¾å®¹å¨23 */24 constructor(map) {25 super(["mouseover", "mouseout", "startedit", "stopedit", "click", "update", "commit", "create", "delete"]); //when mouseover feature or vertex26 this._create = {27 click: 0,28 graphic: null,29 lnglats: []30 };31 this._action = MeasureActionType.Default;32 this._defaultPointSymbol = new SimplePointSymbol();33 this._defaultLineSymbol = new SimpleLineSymbol();34 this._defaultPolygonSymbol = new SimpleFillSymbol();35 this._map = map;36 const container = map.container;37 //create canvas38 this._canvas = document.createElement("canvas");39 this._canvas.style.cssText = "position: absolute; height: 100%; width: 100%; z-index: 90";40 this._canvas.width = container.clientWidth;41 this._canvas.height = container.clientHeight;42 container.appendChild(this._canvas);43 this._ctx = this._canvas.getContext("2d");44 this._onResize = this._onResize.bind(this);45 this._extentChange = this._extentChange.bind(this);46 this._map.on("resize", this._onResize);47 this._map.on("extent", this._extentChange);48 this._measureLayer = new GraphicLayer();49 }50 get measuring() {51 return this._measuring;52 }53 get action() {54 return this._action;55 }56 set action(value) {57 this._action = value;58 }59 get defaultPointSymbol() {60 return this._defaultPointSymbol;61 }62 set defaultPointSymbol(value) {63 this._defaultPointSymbol = value;64 }65 get defaultLineSymbol() {66 return this._defaultLineSymbol;67 }68 set defaultLineSymbol(value) {69 this._defaultLineSymbol = value;70 }71 get defaultPolygonSymbol() {72 return this._defaultPolygonSymbol;73 }74 set defaultPolygonSymbol(value) {75 this._defaultPolygonSymbol = value;76 }77 measurePolyLine() {78 this._measuring = true;79 this._action = MeasureActionType.Polyline;80 this._createLayer = new GraphicLayer();81 }82 measurePolygon() {83 this._measuring = true;84 this._action = MeasureActionType.Polygon;85 this._createLayer = new GraphicLayer();86 }87 clear() {88 this._measuring = false;89 this._action = MeasureActionType.Default;90 this._create = {91 click: 0,92 graphic: null,93 lnglats: []94 };95 this._measureLayer.clear();96 this._ctx.save();97 this._ctx.setTransform(1, 0, 0, 1, 0, 0);98 this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);99 this._ctx.restore();100 }101 addGraphic(g) {102 this._measureLayer.add(g);103 this.redraw();104 }105 removeGraphic(g) {106 this._measureLayer.remove(g);107 this.redraw();108 }109 _onResize(event) {110 this._canvas.width = this._map.container.clientWidth;111 this._canvas.height = this._map.container.clientHeight;112 }113 _extentChange(event) {114 this._ctx.setTransform(event.matrix.a, 0, 0, event.matrix.d, event.matrix.e, event.matrix.f);115 this.redraw();116 }117 redraw() {118 this._ctx.save();119 this._ctx.setTransform(1, 0, 0, 1, 0, 0);120 this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);121 this._ctx.restore();122 this._createLayer && this._createLayer.draw(this._ctx, this._map.projection, this._map.extent, this._map.zoom);123 this._measureLayer && this._measureLayer.draw(this._ctx, this._map.projection, this._map.extent, this._map.zoom);124 this._measureLayer.graphics.forEach(graphic => this._label(graphic.geometry));125 }126 _onClick(event) {127 if (!this._measuring)128 return;129 if (event.detail > 1)130 return;131 if (this._action === MeasureActionType.Polygon) {132 if (this._create.click == 0) {133 this._createLayer.clear();134 const point = new Point(event.originalLng, event.originalLat);135 const graphic = new Graphic(point, this._defaultPointSymbol);136 this._createLayer.add(graphic);137 this._create.click += 1;138 this._create.lnglats.push([event.originalLng, event.originalLat]);139 }140 else if (this._create.click == 1) {141 const second = new Point(event.originalLng, event.originalLat);142 const graphic1 = new Graphic(second, this._defaultPointSymbol);143 this._createLayer.add(graphic1);144 if (this._create.graphic)145 this._createLayer.remove(this._create.graphic);146 this._create.lnglats.push([event.originalLng, event.originalLat]);147 const line = new Polyline(this._create.lnglats);148 this._create.graphic = new Graphic(line, this._defaultLineSymbol);149 this._createLayer.add(this._create.graphic);150 this._create.click += 1;151 }152 else {153 const second = new Point(event.originalLng, event.originalLat);154 const graphic1 = new Graphic(second, this._defaultPointSymbol);155 this._createLayer.add(graphic1);156 if (this._create.graphic)157 this._createLayer.remove(this._create.graphic);158 this._create.lnglats.push([event.originalLng, event.originalLat]);159 const polygon = new Polygon([this._create.lnglats]);160 this._create.graphic = new Graphic(polygon, this._defaultPolygonSymbol);161 this._createLayer.add(this._create.graphic);162 this._create.click += 1;163 }164 }165 else if (this._action === MeasureActionType.Polyline) {166 if (this._create.click == 0) {167 this._createLayer.clear();168 const point = new Point(event.originalLng, event.originalLat);169 const graphic = new Graphic(point, this._defaultPointSymbol);170 this._createLayer.add(graphic);171 this._create.click += 1;172 this._create.lnglats.push([event.originalLng, event.originalLat]);173 }174 else {175 const second = new Point(event.originalLng, event.originalLat);176 const graphic1 = new Graphic(second, this._defaultPointSymbol);177 this._createLayer.add(graphic1);178 if (this._create.graphic)179 this._createLayer.remove(this._create.graphic);180 this._create.lnglats.push([event.originalLng, event.originalLat]);181 const line = new Polyline(this._create.lnglats);182 this._create.graphic = new Graphic(line, this._defaultLineSymbol);183 this._createLayer.add(this._create.graphic);184 this._create.click += 1;185 }186 }187 }188 _onDoubleClick(event) {189 if (!this._measuring)190 return;191 if (this._action === MeasureActionType.Polygon) {192 if (this._create.click > 1) {193 if (this._create.graphic)194 this._createLayer.remove(this._create.graphic);195 const polygon = new Polygon([this._create.lnglats]);196 const graphic = new Graphic(polygon, this._defaultPolygonSymbol);197 this._create = {198 click: 0,199 graphic: null,200 lnglats: []201 };202 this._createLayer.clear();203 this.addGraphic(graphic);204 //this._label(polygon);205 }206 }207 else if (this._action === MeasureActionType.Polyline) {208 if (this._create.click > 0) {209 if (this._create.graphic)210 this._createLayer.remove(this._create.graphic);211 const polyline = new Polyline(this._create.lnglats);212 const graphic = new Graphic(polyline, this._defaultLineSymbol);213 this._create = {214 click: 0,215 graphic: null,216 lnglats: []217 };218 this._createLayer.clear();219 this.addGraphic(graphic);220 //this._label(polyline);221 }222 }223 }224 _label(geometry) {225 let projection = this._map.projection;226 geometry.project(projection);227 let ctx = this._canvas.getContext("2d");228 ctx.save();229 let symbol = new SimpleTextSymbol();230 ctx.strokeStyle = symbol.strokeStyle;231 ctx.fillStyle = symbol.fillStyle;232 ctx.lineWidth = symbol.lineWidth;233 ctx.lineJoin = "round";234 ctx.font = symbol.fontSize + "px/1 " + symbol.fontFamily + " " + symbol.fontWeight;235 const matrix = ctx.getTransform();236 //keep pixel237 ctx.setTransform(1, 0, 0, 1, 0, 0);238 let text = "";239 let center = geometry.getCenter(CoordinateType.Projection, projection);240 if (geometry instanceof Polyline) {241 const length = geometry.getLength(projection);242 text = length > 1000 ? Math.round(length / 1000 * 10) / 10 + "å
¬é" : Math.round(length) + "ç±³";243 center = geometry.coordinates[geometry.coordinates.length - 1];244 }245 else if (geometry instanceof Polygon) {246 const area = geometry.getArea(projection);247 text = area > 1000 ? Math.round(area / 10000 * 10) / 10 + "å
¬é¡·" : Math.round(area) + "å¹³æ¹ç±³";248 }249 else {250 return;251 }252 let width = ctx.measureText(text).width + symbol.padding * 2;253 let height = symbol.fontSize + symbol.padding * 2;254 const screenX = (matrix.a * center[0] + matrix.e);255 const screenY = (matrix.d * center[1] + matrix.f);256 let totalX, totalY;257 totalX = -width / 2;258 totalY = symbol.pointSymbolHeight / 2;259 ctx.strokeRect(screenX + totalX, screenY + totalY, width, height);260 ctx.fillRect(screenX + totalX, screenY + totalY, width, height);261 ctx.textBaseline = "top";262 ctx.fillStyle = symbol.fontColor;263 ctx.fillText(text, screenX + totalX + symbol.padding, screenY + totalY + symbol.padding);264 ctx.restore();265 }266 ;267 _onMouseDown(event) {268 }269 _onMouseMove(event) {270 if (!this._measuring)271 return;272 if (this._action === MeasureActionType.Polygon) {273 if (this._create.click == 1) {274 if (this._create.graphic)275 this._createLayer.remove(this._create.graphic);276 const lnglats = [...this._create.lnglats];277 lnglats.push([event.originalLng, event.originalLat]);278 const line = new Polyline(lnglats);279 this._create.graphic = new Graphic(line, this._defaultLineSymbol);280 this._createLayer.add(this._create.graphic);281 }282 else if (this._create.click > 1) {283 if (this._create.graphic)284 this._createLayer.remove(this._create.graphic);285 const lnglats = [...this._create.lnglats];286 lnglats.push([event.originalLng, event.originalLat]);287 const polygon = new Polygon([lnglats]);288 this._create.graphic = new Graphic(polygon, this._defaultPolygonSymbol);289 this._createLayer.add(this._create.graphic);290 }291 }292 else if (this._action === MeasureActionType.Polyline) {293 if (this._create.click > 0) {294 if (this._create.graphic)295 this._createLayer.remove(this._create.graphic);296 const lnglats = [...this._create.lnglats];297 lnglats.push([event.originalLng, event.originalLat]);298 const line = new Polyline(lnglats);299 this._create.graphic = new Graphic(line, this._defaultLineSymbol);300 this._createLayer.add(this._create.graphic);301 }302 }303 this.redraw();304 }305 _onMouseUp(event) {306 }307 destroy() {308 this._measureLayer = null;309 this._map.off("resize", this._onResize);310 this._map.off("extent", this._extentChange);311 }...
widget_core.js
Source:widget_core.js
1/*2 * widget unit tests3 */4(function( $ ) {5module( "widget factory", {6 teardown: function() {7 delete $.ui.testWidget;8 }9});10test( "widget creation", function() {11 var myPrototype = {12 _create: function() {},13 creationTest: function() {}14 };15 $.widget( "ui.testWidget", myPrototype );16 ok( $.isFunction( $.ui.testWidget ), "constructor was created" );17 equals( "object", typeof $.ui.testWidget.prototype, "prototype was created" );18 equals( $.ui.testWidget.prototype._create, myPrototype._create,19 "create function is copied over" );20 equals( $.ui.testWidget.prototype.creationTest, myPrototype.creationTest,21 "random function is copied over" );22 equals( $.ui.testWidget.prototype.option, $.Widget.prototype.option,23 "option method copied over from base widget" );24});25test( "jQuery usage", function() {26 expect( 11 );27 var shouldCreate = false;28 $.widget( "ui.testWidget", {29 getterSetterVal: 5,30 _create: function() {31 ok( shouldCreate, "create called on instantiation" );32 },33 methodWithParams: function( param1, param2 ) {34 ok( true, "method called via .pluginName(methodName)" );35 equals( param1, "value1",36 "parameter passed via .pluginName(methodName, param)" );37 equals( param2, "value2",38 "multiple parameters passed via .pluginName(methodName, param, param)" );39 40 return this;41 },42 getterSetterMethod: function( val ) {43 if ( val ) {44 this.getterSetterVal = val;45 } else {46 return this.getterSetterVal;47 }48 }49 });50 shouldCreate = true;51 var elem = $( "<div></div>" )52 .bind( "testwidgetcreate", function() {53 ok( shouldCreate, "create event triggered on instantiation" );54 })55 .testWidget();56 shouldCreate = false;57 var instance = elem.data( "testWidget" );58 equals( typeof instance, "object", "instance stored in .data(pluginName)" );59 equals( instance.element[0], elem[0], "element stored on widget" );60 var ret = elem.testWidget( "methodWithParams", "value1", "value2" );61 equals( ret, elem, "jQuery object returned from method call" );62 ret = elem.testWidget( "getterSetterMethod" );63 equals( ret, 5, "getter/setter can act as getter" );64 ret = elem.testWidget( "getterSetterMethod", 30 );65 equals( ret, elem, "getter/setter method can be chainable" );66 equals( instance.getterSetterVal, 30, "getter/setter can act as setter" );67});68test( "direct usage", function() {69 expect( 9 );70 var shouldCreate = false;71 $.widget( "ui.testWidget", {72 getterSetterVal: 5,73 _create: function() {74 ok( shouldCreate, "create called on instantiation" );75 },76 methodWithParams: function( param1, param2 ) {77 ok( true, "method called dirctly" );78 equals( param1, "value1", "parameter passed via direct call" );79 equals( param2, "value2", "multiple parameters passed via direct call" );80 return this;81 },82 getterSetterMethod: function( val ) {83 if ( val ) {84 this.getterSetterVal = val;85 } else {86 return this.getterSetterVal;87 }88 }89 });90 91 var elem = $( "<div></div>" )[ 0 ];92 93 shouldCreate = true;94 var instance = new $.ui.testWidget( {}, elem );95 shouldCreate = false;96 equals( $( elem ).data( "testWidget" ), instance,97 "instance stored in .data(pluginName)" );98 equals( instance.element[ 0 ], elem, "element stored on widget" );99 100 var ret = instance.methodWithParams( "value1", "value2" );101 equals( ret, instance, "plugin returned from method call" );102 ret = instance.getterSetterMethod();103 equals( ret, 5, "getter/setter can act as getter" );104 instance.getterSetterMethod( 30 );105 equals( instance.getterSetterVal, 30, "getter/setter can act as setter" );106});107test("merge multiple option arguments", function() {108 expect( 1 );109 $.widget( "ui.testWidget", {110 _create: function() {111 same( this.options, {112 disabled: false,113 option1: "value1",114 option2: "value2",115 option3: "value3",116 option4: {117 option4a: "valuea",118 option4b: "valueb"119 }120 });121 }122 });123 $( "<div></div>" ).testWidget({124 option1: "valuex",125 option2: "valuex",126 option3: "value3",127 option4: {128 option4a: "valuex"129 }130 }, {131 option1: "value1",132 option2: "value2",133 option4: {134 option4b: "valueb"135 }136 }, {137 option4: {138 option4a: "valuea"139 }140 });141});142test( "_getCreateOptions()", function() {143 expect( 1 );144 $.widget( "ui.testWidget", {145 options: {146 option1: "valuex",147 option2: "valuex",148 option3: "value3",149 },150 _getCreateOptions: function() {151 return {152 option1: "override1",153 option2: "overideX",154 };155 },156 _create: function() {157 same( this.options, {158 disabled: false,159 option1: "override1",160 option2: "value2",161 option3: "value3"162 });163 }164 });165 $( "<div>" ).testWidget({ option2: "value2" });166});167test( "re-init", function() {168 var div = $( "<div></div>" ),169 actions = [];170 $.widget( "ui.testWidget", {171 _create: function() {172 actions.push( "create" );173 },174 _init: function() {175 actions.push( "init" );176 },177 _setOption: function( key, value ) {178 actions.push( "option" + key );179 }180 });181 actions = [];182 div.testWidget({ foo: "bar" });183 same( actions, [ "create", "init" ], "correct methods called on init" );184 actions = [];185 div.testWidget();186 same( actions, [ "init" ], "correct methods call on re-init" );187 actions = [];188 div.testWidget({ foo: "bar" });189 same( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" );190});191test( ".option() - getter", function() {192 $.widget( "ui.testWidget", {193 _create: function() {}194 });195 var div = $( "<div></div>" ).testWidget({196 foo: "bar",197 baz: 5,198 qux: [ "quux", "quuux" ]199 });200 same( div.testWidget( "option", "foo"), "bar", "single option - string" );201 same( div.testWidget( "option", "baz"), 5, "single option - number" );202 same( div.testWidget( "option", "qux"), [ "quux", "quuux" ],203 "single option - array" );204 var options = div.testWidget( "option" );205 same( options, {206 disabled: false,207 foo: "bar",208 baz: 5,209 qux: [ "quux", "quuux" ]210 }, "full options hash returned" );211 options.foo = "notbar";212 same( div.testWidget( "option", "foo"), "bar",213 "modifying returned options hash does not modify plugin instance" );214});215test( ".option() - delegate to ._setOptions()", function() {216 var calls = [];217 $.widget( "ui.testWidget", {218 _create: function() {},219 _setOptions: function( options ) {220 calls.push( options );221 }222 });223 var div = $( "<div></div>" ).testWidget();224 calls = [];225 div.testWidget( "option", "foo", "bar" );226 same( calls, [{ foo: "bar" }], "_setOptions called for single option" );227 228 calls = [];229 div.testWidget( "option", {230 bar: "qux",231 quux: "quuux"232 });233 same( calls, [{ bar: "qux", quux: "quuux" }],234 "_setOptions called with multiple options" );235});236test( ".option() - delegate to ._setOption()", function() {237 var calls = [];238 $.widget( "ui.testWidget", {239 _create: function() {},240 _setOption: function( key, val ) {241 calls.push({242 key: key,243 val: val244 });245 }246 });247 var div = $( "<div></div>" ).testWidget();248 calls = [];249 div.testWidget( "option", "foo", "bar" );250 same( calls, [{ key: "foo", val: "bar" }],251 "_setOption called for single option" );252 253 calls = [];254 div.testWidget( "option", {255 bar: "qux",256 quux: "quuux"257 });258 same( calls, [259 { key: "bar", val: "qux" },260 { key: "quux", val: "quuux" }261 ], "_setOption called with multiple options" );262});263test( ".enable()", function() {264 expect( 2 );265 $.widget( "ui.testWidget", {266 _create: function() {},267 _setOption: function( key, val ) {268 same( key, "disabled", "_setOption called with disabled option" );269 same( val, false, "disabled set to false" );270 }271 });272 $( "<div></div>" ).testWidget().testWidget( "enable" );273});274test( ".disable()", function() {275 expect( 2 );276 $.widget( "ui.testWidget", {277 _create: function() {},278 _setOption: function( key, val ) {279 same( key, "disabled", "_setOption called with disabled option" );280 same( val, true, "disabled set to true" );281 }282 });283 $( "<div></div>" ).testWidget().testWidget( "disable" );284});285test( ".widget() - base", function() {286 $.widget( "ui.testWidget", {287 _create: function() {}288 });289 var div = $( "<div></div>" ).testWidget();290 same( div[0], div.testWidget( "widget" )[0]);291});292test( ".widget() - overriden", function() {293 var wrapper = $( "<div></div>" );294 $.widget( "ui.testWidget", {295 _create: function() {},296 widget: function() {297 return wrapper;298 }299 });300 same( wrapper[0], $( "<div></div>" ).testWidget().testWidget( "widget" )[0] );301});302test( "._trigger() - no event, no ui", function() {303 expect( 7 );304 var handlers = [];305 $.widget( "ui.testWidget", {306 _create: function() {}307 });308 $( "#widget" ).testWidget({309 foo: function( event, ui ) {310 same( event.type, "testwidgetfoo", "correct event type in callback" );311 same( ui, {}, "empty ui hash passed" );312 handlers.push( "callback" );313 }314 });315 $( document ).add( "#widget-wrapper" ).add( "#widget" )316 .bind( "testwidgetfoo", function( event, ui ) {317 same( ui, {}, "empty ui hash passed" );318 handlers.push( this );319 });320 same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), true,321 "_trigger returns true when event is not cancelled" );322 same( handlers, [323 $( "#widget" )[ 0 ],324 $( "#widget-wrapper" )[ 0 ],325 document,326 "callback"327 ], "event bubbles and then invokes callback" );328 $( document ).unbind( "testwidgetfoo" );329});330test( "._trigger() - cancelled event", function() {331 expect( 3 );332 $.widget( "ui.testWidget", {333 _create: function() {}334 });335 $( "#widget" ).testWidget({336 foo: function( event, ui ) {337 ok( true, "callback invoked even if event is cancelled" );338 }339 })340 .bind( "testwidgetfoo", function( event, ui ) {341 ok( true, "event was triggered" );342 return false;343 });344 same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false,345 "_trigger returns false when event is cancelled" );346});347test( "._trigger() - cancelled callback", function() {348 $.widget( "ui.testWidget", {349 _create: function() {}350 });351 $( "#widget" ).testWidget({352 foo: function( event, ui ) {353 return false;354 }355 });356 same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false,357 "_trigger returns false when callback returns false" );358});359test( "._trigger() - provide event and ui", function() {360 expect( 7 );361 var originalEvent = $.Event( "originalTest" );362 $.widget( "ui.testWidget", {363 _create: function() {},364 testEvent: function() {365 var ui = {366 foo: "bar",367 baz: {368 qux: 5,369 quux: 20370 }371 };372 this._trigger( "foo", originalEvent, ui );373 same( ui, {374 foo: "notbar",375 baz: {376 qux: 10,377 quux: "jQuery"378 }379 }, "ui object modified" );380 }381 });382 $( "#widget" ).bind( "testwidgetfoo", function( event, ui ) {383 equal( event.originalEvent, originalEvent, "original event object passed" );384 same( ui, {385 foo: "bar",386 baz: {387 qux: 5,388 quux: 20389 }390 }, "ui hash passed" );391 ui.foo = "notbar";392 });393 $( "#widget-wrapper" ).bind( "testwidgetfoo", function( event, ui ) {394 equal( event.originalEvent, originalEvent, "original event object passed" );395 same( ui, {396 foo: "notbar",397 baz: {398 qux: 5,399 quux: 20400 }401 }, "modified ui hash passed" );402 ui.baz.qux = 10;403 });404 $( "#widget" ).testWidget({405 foo: function( event, ui ) {406 equal( event.originalEvent, originalEvent, "original event object passed" );407 same( ui, {408 foo: "notbar",409 baz: {410 qux: 10,411 quux: 20412 }413 }, "modified ui hash passed" );414 ui.baz.quux = "jQuery";415 }416 })417 .testWidget( "testEvent" );418});419test( "auto-destroy - .remove()", function() {420 expect( 1 );421 $.widget( "ui.testWidget", {422 _create: function() {},423 destroy: function() {424 ok( true, "destroyed from .remove()" );425 }426 });427 $( "#widget" ).testWidget().remove();428});429test( "auto-destroy - .remove() on parent", function() {430 expect( 1 );431 $.widget( "ui.testWidget", {432 _create: function() {},433 destroy: function() {434 ok( true, "destroyed from .remove() on parent" );435 }436 });437 $( "#widget" ).testWidget().parent().remove();438});439test( "auto-destroy - .remove() on child", function() {440 $.widget( "ui.testWidget", {441 _create: function() {},442 destroy: function() {443 ok( false, "destroyed from .remove() on child" );444 }445 });446 $( "#widget" ).testWidget().children().remove();447 // http://github.com/jquery/qunit/pull/34448 $.ui.testWidget.prototype.destroy = $.noop;449});450test( "auto-destroy - .empty()", function() {451 $.widget( "ui.testWidget", {452 _create: function() {},453 destroy: function() {454 ok( false, "destroyed from .empty()" );455 }456 });457 $( "#widget" ).testWidget().empty();458 // http://github.com/jquery/qunit/pull/34459 $.ui.testWidget.prototype.destroy = $.noop;460});461test( "auto-destroy - .empty() on parent", function() {462 expect( 1 );463 $.widget( "ui.testWidget", {464 _create: function() {},465 destroy: function() {466 ok( true, "destroyed from .empty() on parent" );467 }468 });469 $( "#widget" ).testWidget().parent().empty();470});471test( "auto-destroy - .detach()", function() {472 $.widget( "ui.testWidget", {473 _create: function() {},474 destroy: function() {475 ok( false, "destroyed from .detach()" );476 }477 });478 $( "#widget" ).testWidget().detach();479});...
create.js
Source:create.js
1const fs = require('fs')2let _create = JSON.parse(fs.readFileSync('./database/create.json'))3/*4 * Common / Legendary / Mythic5 * Create by Ryuuka Botz6 * Recode Dari Febza7 */8 const addCommon = (sender, amount) => {9 let position = false10 Object.keys(_create).forEach((i) => {11 if (_create[i].id === sender) {12 position = i13 }14 })15 if (position !== false) {16 _create[position].common += amount17 fs.writeFileSync('./database/create.json', JSON.stringify(_create))18 }19 }20 21 const bukaCommon = (sender, amount) => {22 let position = false23 Object.keys(_create).forEach((i) => {24 if (_create[i].id === sender) {25 position = i26 }27 })28 if (position !== false) {29 _create[position].common -= amount30 fs.writeFileSync('./database/create.json', JSON.stringify(_create))31 }32 } 33 34 const getCommon = (sender) => {35 let position = false36 Object.keys(_create).forEach((i) => {37 if (_create[i].id === sender) {38 position = i39 }40 })41 if (position !== false) {42 return _create[position].common43 }44 }45 const addLegendary = (sender, amount) => {46 let position = false47 Object.keys(_create).forEach((i) => {48 if (_create[i].id === sender) {49 position = i50 }51 })52 if (position !== false) {53 _create[position].legendary += amount54 fs.writeFileSync('./database/create.json', JSON.stringify(_create))55 }56 }57 58 const bukaLegendary = (sender, amount) => {59 let position = false60 Object.keys(_create).forEach((i) => {61 if (_create[i].id === sender) {62 position = i63 }64 })65 if (position !== false) {66 _create[position].legendary -= amount67 fs.writeFileSync('./database/create.json', JSON.stringify(_create))68 }69 } 70 71 const getLegendary = (sender) => {72 let position = false73 Object.keys(_create).forEach((i) => {74 if (_create[i].id === sender) {75 position = i76 }77 })78 if (position !== false) {79 return _create[position].legendary80 }81 }82 83 const addMythic = (sender, amount) => {84 let position = false85 Object.keys(_create).forEach((i) => {86 if (_create[i].id === sender) {87 position = i88 }89 })90 if (position !== false) {91 _create[position].mythic += amount92 fs.writeFileSync('./database/create.json', JSON.stringify(_create))93 }94 }95 96 const bukaMythic = (sender, amount) => {97 let position = false98 Object.keys(_create).forEach((i) => {99 if (_create[i].id === sender) {100 position = i101 }102 })103 if (position !== false) {104 _create[position].mythic -= amount105 fs.writeFileSync('./database/create.json', JSON.stringify(_create))106 }107 } 108 109 const getMythic = (sender) => {110 let position = false111 Object.keys(_create).forEach((i) => {112 if (_create[i].id === sender) {113 position = i114 }115 })116 if (position !== false) {117 return _create[position].mythic118 }119 }120 const addCreate = (sender) => {121 const obj = {id: sender, common: 0, legendary: 0, mythic: 0}122 _create.push(obj)123 fs.writeFileSync('./database/create.json', JSON.stringify(_create))124 }125 const checkCreate = (sender) => {126 let status = false127 Object.keys(_create).forEach((i) => {128 if (_create[i].id === sender) {129 status = true130 }131 })132 return status133 }134 ...
base.js
Source:base.js
1require('should');2const Endpoint = require('../../endpoints/base.js');3describe('endpoints/base', () => {4 describe('constructRegexForPath', () => {5 const testCases = [6 {path: '/{index}/{type}/{id}/_create', capture: null, expect: `/^\\/[^\\/]+\\/[^\\/]+\\/[^\\/]+\\/_create$/`},7 {path: '/{index}/{type}/{id}/_create', capture: 'type', expect: `/^\\/[^\\/]+\\/([^\\/]+)\\/[^\\/]+\\/_create$/`}8 ];9 testCases.forEach(test => {10 it(`returns '${test.expect}' when path is '${test.path}' and capture is '${test.capture}'`, () => {11 const endpoint = new Endpoint({12 url: {13 paths: ["/{index}/{type}/{id}/_create"]14 }15 }, {16 path: "/my-index/my-type/some-id/_create"17 });18 endpoint.constructRegexForPath(test.path, test.capture).toString().should.equal(test.expect);19 });20 });21 });22 describe('getMatchingPaths', () => {23 it('extracts paths correctly', () => {24 const endpoint = new Endpoint({25 url: {26 paths: ["/{index}/{type}/{id}/_create","/{index}/some-type/{id}/_create","/{index}/_create"]27 }28 }, {29 path: "/my-index/some-type/some-id/_create"30 });31 endpoint.getMatchingPaths().should.deepEqual(["/{index}/{type}/{id}/_create","/{index}/some-type/{id}/_create"]);32 });33 it('returns empty array when none matches', () => {34 const endpoint = new Endpoint({35 url: {36 paths: ["/{index}/{type}/{id}/_create","/{index}/some-type/{id}/_create","/{index}/_create"]37 }38 }, {39 path: "/non-existing-path"40 });41 endpoint.getMatchingPaths().should.deepEqual([]);42 });43 });44 describe('getPathPart', () => {45 it('return null when part does not exist', () => {46 const endpoint = new Endpoint({47 url: {48 paths: ["/{index}/{type}/{id}/_create","/{index}/some-type/{id}/_create","/{index}/_create"]49 }50 }, {51 path: "/my-index/some-type/some-id/_create"52 });53 should.equal(endpoint.getPathPart('template'), null);54 });55 it('return matching part value (#1)', () => {56 const endpoint = new Endpoint({57 url: {58 paths: ["/{index}/{type}/{id}/_create","/{index}/some-type/{id}/_create","/{index}/_create"]59 }60 }, {61 path: "/my-index/some-type/some-id/_create"62 });63 endpoint.getPathPart('index').should.equal('my-index');64 });65 it('return matching part value (#2)', () => {66 const endpoint = new Endpoint({67 url: {68 paths: ["/{index}/{type}/{id}/_create","/{index}/some-type/{id}/_create","/{index}/_create"]69 }70 }, {71 path: "/my-index/some-type/some-id/_create"72 });73 endpoint.getPathPart('id').should.equal('some-id');74 });75 it('return matching part value (#3)', () => {76 const endpoint = new Endpoint({77 url: {78 paths: ["/{index}/{type}/{id}/_create","/{index}/some-type/{id}/_create","/{index}/_create"]79 }80 }, {81 path: "/my-index/some-type/some-id/_create"82 });83 endpoint.getPathPart('type').should.equal('some-type');84 });85 });...
SpecialObject.js
Source:SpecialObject.js
...8 Util.extend(ret, params);9 return ret;10 },11 CreateDescription: function (description) {12 return this._create('recorded_description', { description: description });13 },14 CreateDotObj: function (id) {15 return this._create('object', { id: id });16 },17 CreateElementRequest: function (uid, asyncId) {18 return this._create('DotObjMarkerElementRequest', { objUID: uid, dotUtilObjAsyncID: asyncId });19 },20 CreateDocumentRequest: function (asyncId) {21 return this._create('DotObjMarkerDocumentRequest', { dotUtilObjAsyncID: asyncId });22 },23 CreateReferenceRequest: function (ref) {24 return this._create('DotObjMarkerReferenceRequest', { objRef: ref });25 },26 CreateDotObjInHTML: function (cookie, asyncId) {27 return this._create('DotObjInHTML', { cookie: cookie, dotUtilObjAsyncID: asyncId });28 },29 CreateMMFile: function (html) {30 return this._create('writeMMFile', { html: html });31 },32 CreateFrameSource: function (path, source) {33 return this._create('saveFrameSource', { fullPath: path, frameSource: source });34 },35 CreateTime: function (time) {36 return this._create('UTCTime', {37 year: time.getUTCFullYear(),38 month: time.getUTCMonth() + 1,39 day: time.getUTCDate(),40 hour: time.getUTCHours(),41 minute: time.getUTCMinutes(),42 second: time.getUTCSeconds(),43 milliseconds: time.getUTCMilliseconds()44 });45 },46 CreateAsyncRequest: function (cookie) {47 return this._create('AsyncRequest', { cookie: cookie, onTimeout: null });48 },49 CreateProcessId: function () {50 return this._create('processId');51 },52 CreateEventId: function (event, id) {53 return this._create('event id', {54 point: {55 x: event.clientX, y: event.clientY56 },57 name: event.type,58 sourceId: id59 });60 },61 CreateBase64: function (value) {62 return this._create('Base64', { data: value });63 }...
Using AI Code Generation
1var gherkin = require('cucumber-gherkin');2var fs = require('fs');3var gherkinSource = fs.readFileSync('test.feature', 'utf-8');4var parser = new gherkin.Parser();5var ast = parser.parse(gherkinSource);6var feature = ast.feature;7var featureJson = gherkin.GherkinDocument.create(feature);8console.log(featureJson);9{10 "feature": {11 "location": {12 },13 {14 "scenario": {15 "location": {16 },17 {18 "location": {19 },20 }21 }22 }23 }24}25{}
Using AI Code Generation
1var gherkin = require('cucumber-gherkin');2var parser = new gherkin.Parser();3var lexer = new gherkin.Lexer();4var feature = parser.parse(lexer.lex("Feature: test5Given I am a test"));6console.log(feature);7var gherkin = require('cucumber-gherkin');8var parser = new gherkin.Parser();9var lexer = new gherkin.Lexer();10var feature = parser.parse(lexer.lex("Feature: test11Given I am a test"));12console.log(feature);13var gherkin = require('cucumber-gherkin');14var parser = new gherkin.Parser();15var lexer = new gherkin.Lexer();16var feature = parser.parse(lexer.lex("Feature: test17Given I am a test"));18console.log(feature);19var gherkin = require('cucumber-gherkin');20var parser = new gherkin.Parser();21var lexer = new gherkin.Lexer();22var feature = parser.parse(lexer.lex("Feature: test23Given I am a test"));24console.log(feature);25var gherkin = require('cucumber-gherkin');26var parser = new gherkin.Parser();27var lexer = new gherkin.Lexer();28var feature = parser.parse(lexer.lex("Feature: test29Given I am a test"));30console.log(feature);31var gherkin = require('cucumber-gherkin');32var parser = new gherkin.Parser();33var lexer = new gherkin.Lexer();34var feature = parser.parse(lexer.lex("Feature: test35Given I am a test"));36console.log(feature);37var gherkin = require('cucumber-gherkin');38var parser = new gherkin.Parser();39var lexer = new gherkin.Lexer();40var feature = parser.parse(lexer.lex
Using AI Code Generation
1var gherkin = require('cucumber-gherkin');2var parser = new gherkin.Parser();3var feature = parser.parse('Feature: test');4console.log(feature);5var gherkin = require('cucumber-gherkin');6var parser = new gherkin.Parser();7var feature = parser.parse('Feature: test');8console.log(feature);9var gherkin = require('cucumber-gherkin');10var parser = new gherkin.Parser();11var feature = parser.parse('Feature: test');12console.log(feature);13var gherkin = require('cucumber-gherkin');14var parser = new gherkin.Parser();15var feature = parser.parse('Feature: test');16console.log(feature);17var gherkin = require('cucumber-gherkin');18var parser = new gherkin.Parser();19var feature = parser.parse('Feature: test');20console.log(feature);21var gherkin = require('cucumber-gherkin');22var parser = new gherkin.Parser();23var feature = parser.parse('Feature: test');24console.log(feature);25var gherkin = require('cucumber-gherkin');26var parser = new gherkin.Parser();27var feature = parser.parse('Feature: test');28console.log(feature);29var gherkin = require('cucumber-gherkin');30var parser = new gherkin.Parser();31var feature = parser.parse('Feature: test');32console.log(feature);33var gherkin = require('cucumber-gherkin');34var parser = new gherkin.Parser();
Using AI Code Generation
1var Cucumber = require('cucumber');2var gherkin = new Cucumber.Gherkin();3var gherkinDoc = gherkin._create('Feature: foo4Given a step');5console.log(gherkinDoc);6var Cucumber = require('cucumber');7var gherkin = new Cucumber.Gherkin();8var gherkinDoc = gherkin._create('Feature: foo9Given a step');10console.log(gherkinDoc);11var Cucumber = require('cucumber');12var gherkin = new Cucumber.Gherkin();13var gherkinDoc = gherkin._create('Feature: foo14Given a step');15console.log(gherkinDoc);16var Cucumber = require('cucumber');17var gherkin = new Cucumber.Gherkin();18var gherkinDoc = gherkin._create('Feature: foo19Given a step');20console.log(gherkinDoc);21var Cucumber = require('cucumber');22var gherkin = new Cucumber.Gherkin();23var gherkinDoc = gherkin._create('Feature: foo24Given a step');25console.log(gherkinDoc);26var Cucumber = require('cucumber');27var gherkin = new Cucumber.Gherkin();28var gherkinDoc = gherkin._create('Feature: foo29Given a step');30console.log(gherkinDoc);31var Cucumber = require('cucumber');32var gherkin = new Cucumber.Gherkin();33var gherkinDoc = gherkin._create('Feature: foo34Given a step');35console.log(
Using AI Code Generation
1var gherkin = require('cucumber-gherkin');2var feature = gherkin._create('Feature', 'Hello world');3console.log(feature);4{ type: 'Feature',5 elements: [] }6var gherkin = require('cucumber-gherkin');7var feature = gherkin._create('Feature', 'Hello world');8var fs = require('fs');9fs.writeFileSync('test.feature', gherkin.generate(feature));10var gherkin = require('cucumber-gherkin');11var feature = gherkin._create('Feature', 'Hello world');12feature.tags.push(gherkin._create('Tag', '@tag1'));13var fs = require('fs');14fs.writeFileSync('test.feature', gherkin.generate(feature));15var gherkin = require('cucumber-gherkin');16var feature = gherkin._create('Feature', 'Hello world');17feature.tags.push(gherkin._create('Tag', '@tag1'));18var scenario = gherkin._create('Scenario', 'Simple scenario');19feature.elements.push(scenario);20var fs = require('fs');21fs.writeFileSync('test.feature', gherkin.generate(feature));22var gherkin = require('cucumber-gherkin');23var feature = gherkin._create('Feature', 'Hello world');24feature.tags.push(gherkin._create('Tag', '@tag1'));25var scenario = gherkin._create('Scenario', 'Simple scenario');26scenario.steps.push(gherkin._create('Step', 'Given I am on the page'));27scenario.steps.push(gherkin._create('Step', 'When I click on the button'));
Using AI Code Generation
1var Cucumber = require('cucumber');2var gherkin = Cucumber.Gherkin;3var feature = gherkin.Feature('feature name', 'feature description', 'feature keyword', 'feature uri', 1);4var scenario = gherkin.Scenario('scenario name', 'scenario description', 'scenario keyword', 'scenario uri', 1);5var step = gherkin.Step('step name', 'step keyword', 'step uri', 1);6feature.addChild(scenario);7scenario.addChild(step);8console.log(feature);9Given(/^I am on the new user page$/, function () {10 return 'pending';11});12When(/^I fill in the user details$/, function () {13 return 'pending';14});15And(/^I click on the create button$/, function () {16 return 'pending';17});18Then(/^I should be on the user list page$/, function () {19 return 'pending';20});21And(/^I should see the new user$/, function () {22 return 'pending';23});24Given(/^I am on the new user page$/, function () {
Using AI Code Generation
1var gherkin = require('cucumber-gherkin');2var gherkinDocument = gherkin._create('Feature: My Feature');3var gherkin = require('cucumber-gherkin');4var gherkinDocument = gherkin._create('Feature: My Feature');5var gherkin = require('cucumber-gherkin');6var gherkinDocument = gherkin._create('Feature: My Feature');7var gherkin = require('cucumber-gherkin');8var gherkinDocument = gherkin._create('Feature: My Feature');9var gherkin = require('cucumber-gherkin');10var gherkinDocument = gherkin._create('Feature: My Feature');11var gherkin = require('cucumber-gherkin');12var gherkinDocument = gherkin._create('Feature: My Feature');13var gherkin = require('cucumber-gherkin');14var gherkinDocument = gherkin._create('Feature: My Feature');15var gherkin = require('cucumber-gherkin');16var gherkinDocument = gherkin._create('Feature: My Feature');
LambdaTest offers a detailed Cucumber testing tutorial, explaining its features, importance, best practices, and more to help you get started with running your automation testing scripts.
Here are the detailed Cucumber testing chapters to help you get started:
Get 100 minutes of automation test minutes FREE!!