How to use read_value method in wpt

Best JavaScript code snippet using wpt

ctrlParams.js

Source:ctrlParams.js Github

copy

Full Screen

1function init() {2 return {3 6011: [4 {5 title: "额定电压",6 title_en: "Rated Voltage",7 category: "Battery",8 range: [36, 43, 48],9 read_value: "",10 standard_value: "",11 set_value: "",12 description: "36,43,48",13 unit: "DCV",14 split: 0,15 data: "0",16 length: 1,17 },18 {19 title: "电量满时最大限流值",20 title_en: "Max Limited Current",21 category: "Battery",22 range: 0,23 read_value: "",24 standard_value: "",25 set_value: "",26 description: "最大限流, 0-100A",27 unit: "A",28 split: 0,29 data: "1",30 length: 1,31 },32 {33 title: "过电压",34 title_en: "Over-voltage",35 category: "Battery",36 range: 0,37 read_value: "",38 standard_value: "",39 set_value: "",40 description: "",41 unit: "DCV",42 split: 0,43 data: "2",44 length: 1,45 },46 {47 title: "欠压",48 title_en: "Under-voltage",49 category: "Battery",50 range: 0,51 read_value: "",52 standard_value: "",53 set_value: "",54 description: "电机不工作或空转时欠压值,0-100V",55 unit: "DCV",56 split: 0,57 data: "3",58 length: 1,59 },60 {61 title: "骑行动态欠压",62 title_en: "Riding under-voltage",63 category: "Battery",64 range: 0,65 read_value: "",66 standard_value: "",67 set_value: "",68 description: "",69 unit: "DCV",70 split: 0,71 data: "4",72 length: 1,73 },74 {75 title: "欠压恢复电压",76 title_en: "Recovery voltage",77 category: "Battery",78 range: 0,79 read_value: "",80 standard_value: "",81 set_value: "",82 description: "",83 unit: "DCV",84 split: 0,85 data: "5",86 length: 1,87 },88 {89 title: "电池容量",90 title_en: "Battery capacity",91 category: "Battery",92 range: 0,93 read_value: "",94 standard_value: "",95 set_value: "",96 description: "",97 unit: "mAh",98 split: 0,99 data: "7-8",100 length: 2,101 },102 {103 title: "电量不足时最大限流",104 title_en: "Ordinary Limited Current",105 category: "Battery",106 range: 0,107 read_value: "",108 standard_value: "",109 set_value: "",110 description: "",111 unit: "A",112 split: 0,113 data: "9",114 length: 1,115 },116 {117 title: "电流开始衰减时电量值阈值",118 title_en: "Capacity percentage for current begins to decay",119 category: "Battery",120 range: 0,121 read_value: "",122 standard_value: "",123 set_value: "",124 description: "",125 unit: "%",126 split: 0,127 data: "10",128 length: 1,129 },130 {131 title: "电流开始衰减时电量百分比系数",132 title_en: "Capacity percentage for current begins to decay coefficient",133 category: "Battery",134 range: 0,135 read_value: "",136 standard_value: "",137 set_value: "",138 description: "",139 unit: "%",140 split: 0,141 data: "11",142 length: 1,143 },144 {145 title: "满电里程数显示",146 title_en: "Full capacity mileage display",147 category: "Battery",148 range: 0,149 read_value: "",150 standard_value: "",151 set_value: "",152 description: "",153 unit: "Km",154 split: 0,155 data: "12",156 length: 1,157 },158 {159 title: "传感器类型",160 title_en: "Sensor Type",161 category: "Pedal_sensor",162 range: [0, 1, 2],163 read_value: "",164 standard_value: "",165 set_value: "",166 description: "0-力矩传感器,1-速度传感器,2-仅转把",167 unit: "",168 split: 0,169 data: "13",170 length: 1,171 },172 {173 title: "倒刹功能",174 title_en: "Coaster brake function",175 category: "Pedal_sensor",176 range: [0, 1],177 read_value: "",178 standard_value: "",179 set_value: "",180 description: "0-不支持倒刹,1-支持倒刹",181 unit: "",182 split: 0,183 data: "14",184 length: 1,185 },186 {187 title: "速度码盘齿数",188 title_en: "Speed signal channel number",189 category: "Pedal_sensor",190 range: [1, 2],191 read_value: "",192 standard_value: "",193 set_value: "",194 description: "",195 unit: "",196 split: 0,197 data: "15",198 length: 1,199 },200 {201 title: "速度信号通道数",202 title_en: "Speed signal channel number",203 category: "Pedal_sensor",204 range: [1, 2],205 read_value: "",206 standard_value: "",207 set_value: "",208 description: "1-单通道,2-正交双通道",209 unit: "",210 split: 0,211 data: "16",212 length: 1,213 },214 {215 title: "防跟转力矩检查齿数",216 title_en: "Check teeth for heel torque",217 category: "Pedal_sensor",218 range: 0,219 read_value: "",220 standard_value: "",221 set_value: "",222 description: "",223 unit: "",224 split: 0,225 data: "17",226 length: 1,227 },228 {229 title: "电机类型",230 title_en: "Motor type",231 category: "Motor",232 range: [0, 1, 2],233 read_value: "",234 standard_value: "",235 set_value: "",236 description: "0-轮毂电机,1-中置电机,2-直驱电机(踏板车)",237 unit: "",238 split: 0,239 data: "18",240 length: 1,241 },242 {243 title: "电机极对数",244 title_en: "Motor pole logarithm",245 category: "Motor",246 range: 0,247 read_value: "",248 standard_value: "",249 set_value: "",250 description: "",251 unit: "",252 split: 0,253 data: "19",254 length: 1,255 },256 {257 title: "测速磁钢数",258 title_en: "Magnetic steel number for velocity measurement",259 category: "Motor",260 range: 0,261 read_value: "",262 standard_value: "",263 set_value: "",264 description: "",265 unit: "",266 split: 0,267 data: "20",268 length: 1,269 },270 {271 title: "温度传感器信号",272 title_en: "Temperature sensor",273 category: "Motor",274 range: [0, 1, 2],275 read_value: "",276 standard_value: "",277 set_value: "",278 description: "0-无,1-10K,2-PT1000",279 unit: "",280 split: 0,281 data: "21",282 length: 1,283 },284 {285 title: "减速比",286 title_en: "Deceleration ratio (multiplied by 0.01)",287 category: "Motor",288 range: 0,289 read_value: "",290 standard_value: "",291 set_value: "",292 description: "乘以0.01",293 unit: "",294 split: 0,295 data: "22-23",296 length: 2,297 },298 {299 title: "电机机芯最高转速",300 title_en: "Max. speed of rotor",301 category: "Motor",302 range: 0,303 read_value: "",304 standard_value: "",305 set_value: "",306 description: "不明确或不需要填0",307 unit: "RPM",308 split: 0,309 data: "24-25",310 length: 2,311 },312 {313 title: "D轴电感",314 title_en: "D-axis inductance",315 category: "Motor",316 range: 0,317 read_value: "",318 standard_value: "",319 set_value: "",320 description: "不明确或不需要填0",321 unit: "uH",322 split: 0,323 data: "26-27",324 length: 2,325 },326 {327 title: "Q轴电感",328 title_en: "Q-axis inductance",329 category: "Motor",330 range: 0,331 read_value: "",332 standard_value: "",333 set_value: "",334 description: "不明确或不需要填0",335 unit: "uH",336 split: 0,337 data: "28-29",338 length: 2,339 },340 {341 title: "相限电阻",342 title_en: "Phase resistance",343 category: "Motor",344 range: 0,345 read_value: "",346 standard_value: "",347 set_value: "",348 description: "不明确或不需要填0",349 unit: "mΩ",350 split: 0,351 data: "30-31",352 length: 2,353 },354 {355 title: "反电势系数",356 title_en: "Reverse potential coefficient",357 category: "Motor",358 range: 0,359 read_value: "",360 standard_value: "",361 set_value: "",362 description: "不明确或不需要填0",363 unit: "0.001V/RPM",364 split: 0,365 data: "32-33",366 length: 2,367 },368 {369 title: "转把启动电压",370 title_en: "Throttle start voltage",371 category: "Throttle",372 range: 0,373 read_value: "",374 standard_value: "",375 set_value: "",376 description: "",377 unit: "0.1DCV",378 split: 0,379 data: "34",380 length: 1,381 },382 {383 title: "转把满度电压",384 title_en: "Throttle max. output voltage",385 category: "Throttle",386 range: 0,387 read_value: "",388 standard_value: "",389 set_value: "",390 description: "",391 unit: "0.1DCV",392 split: 0,393 data: "35",394 length: 1,395 },396 {397 title: "转把限速功能",398 title_en: "Speed limit switch function",399 category: "Throttle",400 range: [0, 1],401 read_value: "",402 standard_value: "",403 set_value: "",404 description: "0-不限速,1-限速",405 unit: "",406 split: 0,407 data: "36",408 length: 1,409 },410 {411 title: "启动电流",412 title_en: "Starting current",413 category: "Speed_Sensor",414 range: 0,415 read_value: "",416 standard_value: "",417 set_value: "",418 description: "",419 unit: "%",420 split: 0,421 data: "37",422 length: 1,423 },424 {425 title: "电流加载时间",426 title_en: "Current loading time",427 category: "Speed_Sensor",428 range: 0,429 read_value: "",430 standard_value: "",431 set_value: "",432 description: "",433 unit: "100ms",434 split: 0,435 data: "38",436 length: 1,437 },438 {439 title: "电流减载时间",440 title_en: "Current load shedding time",441 category: "Speed_Sensor",442 range: 0,443 read_value: "",444 standard_value: "",445 set_value: "",446 description: "",447 unit: "100ms",448 split: 0,449 data: "39",450 length: 1,451 },452 {453 title: "档位1-限流百分比",454 title_en: "Current limit percentage for level 1",455 category: "Level",456 range: 0,457 read_value: "",458 standard_value: "",459 set_value: "",460 description: "",461 unit: "%",462 split: 0,463 data: "40",464 length: 1,465 },466 {467 title: "档位2-限流百分比",468 title_en: "Current limit percentage for level 2",469 category: "Level",470 range: 0,471 read_value: "",472 standard_value: "",473 set_value: "",474 description: "",475 unit: "%",476 split: 0,477 data: "41",478 length: 1,479 },480 {481 title: "档位3-限流百分比",482 title_en: "Current limit percentage for level 3",483 category: "Level",484 range: 0,485 read_value: "",486 standard_value: "",487 set_value: "",488 description: "",489 unit: "%",490 split: 0,491 data: "42",492 length: 1,493 },494 {495 title: "档位4-限流百分比",496 title_en: "Current limit percentage for level 4",497 category: "Level",498 range: 0,499 read_value: "",500 standard_value: "",501 set_value: "",502 description: "",503 unit: "%",504 split: 0,505 data: "43",506 length: 1,507 },508 {509 title: "档位5-限流百分比",510 title_en: "Current limit percentage for level 5",511 category: "Level",512 range: 0,513 read_value: "",514 standard_value: "",515 set_value: "",516 description: "",517 unit: "%",518 split: 0,519 data: "44",520 length: 1,521 },522 {523 title: "档位6-限流百分比",524 title_en: "Current limit percentage for level 6",525 category: "Level",526 range: 0,527 read_value: "",528 standard_value: "",529 set_value: "",530 description: "",531 unit: "%",532 split: 0,533 data: "45",534 length: 1,535 },536 {537 title: "档位7-限流百分比",538 title_en: "Current limit percentage for level 7",539 category: "Level",540 range: 0,541 read_value: "",542 standard_value: "",543 set_value: "",544 description: "",545 unit: "%",546 split: 0,547 data: "46",548 length: 1,549 },550 {551 title: "档位8-限流百分比",552 title_en: "Current limit percentage for level 8",553 category: "Level",554 range: 0,555 read_value: "",556 standard_value: "",557 set_value: "",558 description: "",559 unit: "%",560 split: 0,561 data: "47",562 length: 1,563 },564 {565 title: "档位9-限流百分比",566 title_en: "Current limit percentage for level 9",567 category: "Level",568 range: 0,569 read_value: "",570 standard_value: "",571 set_value: "",572 description: "",573 unit: "%",574 split: 0,575 data: "48",576 length: 1,577 },578 {579 title: "档位1-限速百分比",580 title_en: "Speed limit percentage for level 1",581 category: "Level",582 range: 0,583 read_value: "",584 standard_value: "",585 set_value: "",586 description: "",587 unit: "%",588 split: 0,589 data: "49",590 length: 1,591 },592 {593 title: "档位2-限速百分比",594 title_en: "Speed limit percentage for level 2",595 category: "Level",596 range: 0,597 read_value: "",598 standard_value: "",599 set_value: "",600 description: "",601 unit: "%",602 split: 0,603 data: "50",604 length: 1,605 },606 {607 title: "档位3-限速百分比",608 title_en: "Speed limit percentage for level 3",609 category: "Level",610 range: 0,611 read_value: "",612 standard_value: "",613 set_value: "",614 description: "",615 unit: "%",616 split: 0,617 data: "51",618 length: 1,619 },620 {621 title: "档位4-限速百分比",622 title_en: "Speed limit percentage for level 4",623 category: "Level",624 range: 0,625 read_value: "",626 standard_value: "",627 set_value: "",628 description: "",629 unit: "%",630 split: 0,631 data: "52",632 length: 1,633 },634 {635 title: "档位5-限速百分比",636 title_en: "Speed limit percentage for level 5",637 category: "Level",638 range: 0,639 read_value: "",640 standard_value: "",641 set_value: "",642 description: "",643 unit: "%",644 split: 0,645 data: "53",646 length: 1,647 },648 {649 title: "档位6-限速百分比",650 title_en: "Speed limit percentage for level 6",651 category: "Level",652 range: 0,653 read_value: "",654 standard_value: "",655 set_value: "",656 description: "",657 unit: "%",658 split: 0,659 data: "54",660 length: 1,661 },662 {663 title: "档位7-限速百分比",664 title_en: "Speed limit percentage for level 7",665 category: "Level",666 range: 0,667 read_value: "",668 standard_value: "",669 set_value: "",670 description: "",671 unit: "%",672 split: 0,673 data: "55",674 length: 1,675 },676 {677 title: "档位8-限速百分比",678 title_en: "Speed limit percentage for level 8",679 category: "Level",680 range: 0,681 read_value: "",682 standard_value: "",683 set_value: "",684 description: "",685 unit: "%",686 split: 0,687 data: "56",688 length: 1,689 },690 {691 title: "档位9-限速百分比",692 title_en: "Speed limit percentage for level 9",693 category: "Level",694 range: 0,695 read_value: "",696 standard_value: "",697 set_value: "",698 description: "",699 unit: "%",700 split: 0,701 data: "57",702 length: 1,703 },704 {705 title: "有无仪表",706 title_en: "Have or not display",707 category: "System",708 range: [0, 1],709 read_value: "",710 standard_value: "",711 set_value: "",712 description: "0 有仪表, 1 无仪表",713 unit: "",714 split: 0,715 data: "58",716 length: 1,717 },718 {719 title: "大灯常亮",720 title_en: "Lamps are normally on",721 category: "System",722 range: [0, 1],723 read_value: "",724 standard_value: "",725 set_value: "",726 description: "0-随仪表,1-上电常亮",727 unit: "",728 split: 0,729 data: "59",730 length: 1,731 },732 {733 title: "助推速度",734 title_en: "Assist speed",735 category: "System",736 range: 0,737 read_value: "",738 standard_value: "",739 set_value: "",740 description: "0 无助推功能",741 unit: "",742 split: 0,743 data: "60-61",744 length: 2,745 },746 ],747 6012: [748 {749 title: "启动力矩值-0",750 title_en: "Starting torque value-0",751 category: "Torque",752 range: 0,753 read_value: "",754 standard_value: "",755 set_value: "",756 description: "",757 unit: "Kg",758 split: 0,759 data: "0",760 length: 1,761 },762 {763 title: "启动力矩值-1",764 title_en: "Starting torque value-1",765 category: "Torque",766 range: 0,767 read_value: "",768 standard_value: "",769 set_value: "",770 description: "",771 unit: "Kg",772 split: 0,773 data: "1",774 length: 1,775 },776 {777 title: "启动力矩值-2",778 title_en: "Starting torque value-2",779 category: "Torque",780 range: 0,781 read_value: "",782 standard_value: "",783 set_value: "",784 description: "",785 unit: "Kg",786 split: 0,787 data: "2",788 length: 1,789 },790 {791 title: "启动力矩值-3",792 title_en: "Starting torque value-3",793 category: "Torque",794 range: 0,795 read_value: "",796 standard_value: "",797 set_value: "",798 description: "",799 unit: "Kg",800 split: 0,801 data: "3",802 length: 1,803 },804 {805 title: "启动力矩值-4",806 title_en: "Starting torque value-4",807 category: "Torque",808 range: 0,809 read_value: "",810 standard_value: "",811 set_value: "",812 description: "",813 unit: "Kg",814 split: 0,815 data: "4",816 length: 1,817 },818 {819 title: "启动力矩值-5",820 title_en: "Starting torque value-5",821 category: "Torque",822 range: 0,823 read_value: "",824 standard_value: "",825 set_value: "",826 description: "",827 unit: "Kg",828 split: 0,829 data: "5",830 length: 1,831 },832 {833 title: "满载力矩值-0",834 title_en: "Full load torque value-0",835 category: "Torque",836 range: 0,837 read_value: "",838 standard_value: "",839 set_value: "",840 description: "",841 unit: "Kg",842 split: 0,843 data: "6",844 length: 1,845 },846 {847 title: "满载力矩值-1",848 title_en: "Full load torque value-1",849 category: "Torque",850 range: 0,851 read_value: "",852 standard_value: "",853 set_value: "",854 description: "",855 unit: "Kg",856 split: 0,857 data: "7",858 length: 1,859 },860 {861 title: "满载力矩值-2",862 title_en: "Full load torque value-2",863 category: "Torque",864 range: 0,865 read_value: "",866 standard_value: "",867 set_value: "",868 description: "",869 unit: "Kg",870 split: 0,871 data: "8",872 length: 1,873 },874 {875 title: "满载力矩值-3",876 title_en: "Full load torque value-3",877 category: "Torque",878 range: 0,879 read_value: "",880 standard_value: "",881 set_value: "",882 description: "",883 unit: "Kg",884 split: 0,885 data: "9",886 length: 1,887 },888 {889 title: "满载力矩值-4",890 title_en: "Full load torque value-4",891 category: "Torque",892 range: 0,893 read_value: "",894 standard_value: "",895 set_value: "",896 description: "",897 unit: "Kg",898 split: 0,899 data: "10",900 length: 1,901 },902 {903 title: "满载力矩值-5",904 title_en: "Full load torque value-5",905 category: "Torque",906 range: 0,907 read_value: "",908 standard_value: "",909 set_value: "",910 description: "",911 unit: "Kg",912 split: 0,913 data: "11",914 length: 1,915 },916 {917 title: "返回力矩值-0",918 title_en: "Return torque value-0",919 category: "Torque",920 range: 0,921 read_value: "",922 standard_value: "",923 set_value: "",924 description: "",925 unit: "Kg",926 split: 0,927 data: "12",928 length: 1,929 },930 {931 title: "返回力矩值-1",932 title_en: "Return torque value-1",933 category: "Torque",934 range: 0,935 read_value: "",936 standard_value: "",937 set_value: "",938 description: "",939 unit: "Kg",940 split: 0,941 data: "13",942 length: 1,943 },944 {945 title: "返回力矩值-2",946 title_en: "Return torque value-2",947 category: "Torque",948 range: 0,949 read_value: "",950 standard_value: "",951 set_value: "",952 description: "",953 unit: "Kg",954 split: 0,955 data: "14",956 length: 1,957 },958 {959 title: "返回力矩值-3",960 title_en: "Return torque value-3",961 category: "Torque",962 range: 0,963 read_value: "",964 standard_value: "",965 set_value: "",966 description: "",967 unit: "Kg",968 split: 0,969 data: "15",970 length: 1,971 },972 {973 title: "返回力矩值-4",974 title_en: "Return torque value-4",975 category: "Torque",976 range: 0,977 read_value: "",978 standard_value: "",979 set_value: "",980 description: "",981 unit: "Kg",982 split: 0,983 data: "16",984 length: 1,985 },986 {987 title: "返回力矩值-5",988 title_en: "Return torque value-5",989 category: "Torque",990 range: 0,991 read_value: "",992 standard_value: "",993 set_value: "",994 description: "",995 unit: "Kg",996 split: 0,997 data: "17",998 length: 1,999 },1000 {1001 title: "最大电流-0",1002 title_en: "Maximum current-0",1003 category: "Torque",1004 range: 0,1005 read_value: "",1006 standard_value: "",1007 set_value: "",1008 description: "",1009 unit: "%",1010 split: 0,1011 data: "18",1012 length: 1,1013 },1014 {1015 title: "最大电流-1",1016 title_en: "Maximum current-1",1017 category: "Torque",1018 range: 0,1019 read_value: "",1020 standard_value: "",1021 set_value: "",1022 description: "",1023 unit: "%",1024 split: 0,1025 data: "19",1026 length: 1,1027 },1028 {1029 title: "最大电流-2",1030 title_en: "Maximum current-2",1031 category: "Torque",1032 range: 0,1033 read_value: "",1034 standard_value: "",1035 set_value: "",1036 description: "",1037 unit: "%",1038 split: 0,1039 data: "20",1040 length: 1,1041 },1042 {1043 title: "最大电流-3",1044 title_en: "Maximum current-3",1045 category: "Torque",1046 range: 0,1047 read_value: "",1048 standard_value: "",1049 set_value: "",1050 description: "",1051 unit: "%",1052 split: 0,1053 data: "21",1054 length: 1,1055 },1056 {1057 title: "最大电流-4",1058 title_en: "Maximum current-4",1059 category: "Torque",1060 range: 0,1061 read_value: "",1062 standard_value: "",1063 set_value: "",1064 description: "",1065 unit: "%",1066 split: 0,1067 data: "22",1068 length: 1,1069 },1070 {1071 title: "最大电流-5",1072 title_en: "Maximum current-5",1073 category: "Torque",1074 range: 0,1075 read_value: "",1076 standard_value: "",1077 set_value: "",1078 description: "",1079 unit: "%",1080 split: 0,1081 data: "23",1082 length: 1,1083 },1084 {1085 title: "最小电流-0",1086 title_en: "Minimum current-0",1087 category: "Torque",1088 range: 0,1089 read_value: "",1090 standard_value: "",1091 set_value: "",1092 description: "",1093 unit: "%",1094 split: 0,1095 data: "24",1096 length: 1,1097 },1098 {1099 title: "最小电流-1",1100 title_en: "Minimum current-1",1101 category: "Torque",1102 range: 0,1103 read_value: "",1104 standard_value: "",1105 set_value: "",1106 description: "",1107 unit: "%",1108 split: 0,1109 data: "25",1110 length: 1,1111 },1112 {1113 title: "最小电流-2",1114 title_en: "Minimum current-2",1115 category: "Torque",1116 range: 0,1117 read_value: "",1118 standard_value: "",1119 set_value: "",1120 description: "",1121 unit: "%",1122 split: 0,1123 data: "26",1124 length: 1,1125 },1126 {1127 title: "最小电流-3",1128 title_en: "Minimum current-3",1129 category: "Torque",1130 range: 0,1131 read_value: "",1132 standard_value: "",1133 set_value: "",1134 description: "",1135 unit: "%",1136 split: 0,1137 data: "27",1138 length: 1,1139 },1140 {1141 title: "最小电流-4",1142 title_en: "Minimum current-4",1143 category: "Torque",1144 range: 0,1145 read_value: "",1146 standard_value: "",1147 set_value: "",1148 description: "",1149 unit: "%",1150 split: 0,1151 data: "28",1152 length: 1,1153 },1154 {1155 title: "最小电流-5",1156 title_en: "Minimum current-5",1157 category: "Torque",1158 range: 0,1159 read_value: "",1160 standard_value: "",1161 set_value: "",1162 description: "",1163 unit: "%",1164 split: 0,1165 data: "29",1166 length: 1,1167 },1168 {1169 title: "力矩衰减时间-0",1170 title_en: "Torque attenuation-0",1171 category: "Torque",1172 range: 0,1173 read_value: "",1174 standard_value: "",1175 set_value: "",1176 description: "10ms",1177 unit: "10ms",1178 split: 0,1179 data: "30",1180 length: 1,1181 },1182 {1183 title: "力矩衰减时间-1",1184 title_en: "Torque attenuation-1",1185 category: "Torque",1186 range: 0,1187 read_value: "",1188 standard_value: "",1189 set_value: "",1190 description: "10ms",1191 unit: "10ms",1192 split: 0,1193 data: "31",1194 length: 1,1195 },1196 {1197 title: "力矩衰减时间-2",1198 title_en: "Torque attenuation-2",1199 category: "Torque",1200 range: 0,1201 read_value: "",1202 standard_value: "",1203 set_value: "",1204 description: "10ms",1205 unit: "10ms",1206 split: 0,1207 data: "32",1208 length: 1,1209 },1210 {1211 title: "力矩衰减时间-3",1212 title_en: "Torque attenuation-3",1213 category: "Torque",1214 range: 0,1215 read_value: "",1216 standard_value: "",1217 set_value: "",1218 description: "10ms",1219 unit: "10ms",1220 split: 0,1221 data: "33",1222 length: 1,1223 },1224 {1225 title: "力矩衰减时间-4",1226 title_en: "Torque attenuation-4",1227 category: "Torque",1228 range: 0,1229 read_value: "",1230 standard_value: "",1231 set_value: "",1232 description: "10ms",1233 unit: "10ms",1234 split: 0,1235 data: "34",1236 length: 1,1237 },1238 {1239 title: "力矩衰减时间-5",1240 title_en: "Torque attenuation-5",1241 category: "Torque",1242 range: 0,1243 read_value: "",1244 standard_value: "",1245 set_value: "",1246 description: "10ms",1247 unit: "10ms",1248 split: 0,1249 data: "35",1250 length: 1,1251 },1252 {1253 title: "启动脉冲数-0",1254 title_en: "Start pulse number 0",1255 category: "Torque",1256 range: 0,1257 read_value: "",1258 standard_value: "",1259 set_value: "",1260 description: "",1261 unit: "",1262 split: 0,1263 data: "36",1264 length: 1,1265 },1266 {1267 title: "启动脉冲数-1",1268 title_en: "Start pulse number 1",1269 category: "Torque",1270 range: 0,1271 read_value: "",1272 standard_value: "",1273 set_value: "",1274 description: "",1275 unit: "",1276 split: 0,1277 data: "37",1278 length: 1,1279 },1280 {1281 title: "启动脉冲数-2",1282 title_en: "Start pulse number 2",1283 category: "Torque",1284 range: 0,1285 read_value: "",1286 standard_value: "",1287 set_value: "",1288 description: "",1289 unit: "",1290 split: 0,1291 data: "38",1292 length: 1,1293 },1294 {1295 title: "启动脉冲数-3",1296 title_en: "Start pulse number 3",1297 category: "Torque",1298 range: 0,1299 read_value: "",1300 standard_value: "",1301 set_value: "",1302 description: "",1303 unit: "",1304 split: 0,1305 data: "39",1306 length: 1,1307 },1308 {1309 title: "启动脉冲数-4",1310 title_en: "Start pulse number 4",1311 category: "Torque",1312 range: 0,1313 read_value: "",1314 standard_value: "",1315 set_value: "",1316 description: "",1317 unit: "",1318 split: 0,1319 data: "40",1320 length: 1,1321 },1322 {1323 title: "启动脉冲数-5",1324 title_en: "Start pulse number 5",1325 category: "Torque",1326 range: 0,1327 read_value: "",1328 standard_value: "",1329 set_value: "",1330 description: "",1331 unit: "",1332 split: 0,1333 data: "41",1334 length: 1,1335 },1336 {1337 title: "电流衰减时间-0",1338 title_en: "Current decay time 0",1339 category: "Torque",1340 range: 0,1341 read_value: "",1342 standard_value: "",1343 set_value: "",1344 description: "5ms",1345 unit: "5ms",1346 split: 0,1347 data: "42",1348 length: 1,1349 },1350 {1351 title: "电流衰减时间-1",1352 title_en: "Current decay time 1",1353 category: "Torque",1354 range: 0,1355 read_value: "",1356 standard_value: "",1357 set_value: "",1358 description: "5ms",1359 unit: "5ms",1360 split: 0,1361 data: "43",1362 length: 1,1363 },1364 {1365 title: "电流衰减时间-2",1366 title_en: "Current decay time 2",1367 category: "Torque",1368 range: 0,1369 read_value: "",1370 standard_value: "",1371 set_value: "",1372 description: "5ms",1373 unit: "5ms",1374 split: 0,1375 data: "44",1376 length: 1,1377 },1378 {1379 title: "电流衰减时间-3",1380 title_en: "Current decay time 3",1381 category: "Torque",1382 range: 0,1383 read_value: "",1384 standard_value: "",1385 set_value: "",1386 description: "5ms",1387 unit: "5ms",1388 split: 0,1389 data: "45",1390 length: 1,1391 },1392 {1393 title: "电流衰减时间-4",1394 title_en: "Current decay time 4",1395 category: "Torque",1396 range: 0,1397 read_value: "",1398 standard_value: "",1399 set_value: "",1400 description: "5ms",1401 unit: "5ms",1402 split: 0,1403 data: "46",1404 length: 1,1405 },1406 {1407 title: "电流衰减时间-5",1408 title_en: "Current decay time 5",1409 category: "Torque",1410 range: 0,1411 read_value: "",1412 standard_value: "",1413 set_value: "",1414 description: "5ms",1415 unit: "5ms",1416 split: 0,1417 data: "47",1418 length: 1,1419 },1420 {1421 title: "踏板速度脉冲最大宽度-0",1422 title_en: "Pedal Speed ​​Pulse Max Width-0",1423 category: "Torque",1424 range: 0,1425 read_value: "",1426 standard_value: "",1427 set_value: "",1428 description: "2ms",1429 unit: "2ms",1430 split: 0,1431 data: "48",1432 length: 1,1433 },1434 {1435 title: "踏板速度脉冲最大宽度-1",1436 title_en: "Pedal Speed ​​Pulse Max Width-1",1437 category: "Torque",1438 range: 0,1439 read_value: "",1440 standard_value: "",1441 set_value: "",1442 description: "2ms",1443 unit: "2ms",1444 split: 0,1445 data: "49",1446 length: 1,1447 },1448 {1449 title: "踏板速度脉冲最大宽度-2",1450 title_en: "Pedal Speed ​​Pulse Max Width-2",1451 category: "Torque",1452 range: 0,1453 read_value: "",1454 standard_value: "",1455 set_value: "",1456 description: "2ms",1457 unit: "2ms",1458 split: 0,1459 data: "50",1460 length: 1,1461 },1462 {1463 title: "踏板速度脉冲最大宽度-3",1464 title_en: "Pedal Speed ​​Pulse Max Width-3",1465 category: "Torque",1466 range: 0,1467 read_value: "",1468 standard_value: "",1469 set_value: "",1470 description: "2ms",1471 unit: "2ms",1472 split: 0,1473 data: "51",1474 length: 1,1475 },1476 {1477 title: "踏板速度脉冲最大宽度-4",1478 title_en: "Pedal Speed ​​Pulse Max Width-4",1479 category: "Torque",1480 range: 0,1481 read_value: "",1482 standard_value: "",1483 set_value: "",1484 description: "2ms",1485 unit: "2ms",1486 split: 0,1487 data: "52",1488 length: 1,1489 },1490 {1491 title: "踏板速度脉冲最大宽度-5",1492 title_en: "Pedal Speed ​​Pulse Max Width-5",1493 category: "Torque",1494 range: 0,1495 read_value: "",1496 standard_value: "",1497 set_value: "",1498 description: "2ms",1499 unit: "2ms",1500 split: 0,1501 data: "53",1502 length: 1,1503 },1504 {1505 title: "电机降额温度",1506 title_en: "Motor temperature safety threshold",1507 category: "Motor",1508 range: 0,1509 read_value: "",1510 standard_value: "",1511 set_value: "",1512 description: "140",1513 unit: "℃",1514 split: 0,1515 data: "54",1516 length: 1,1517 },1518 {1519 title: "电机过热温度",1520 title_en: "Motor overheating temperature",1521 category: "Motor",1522 range: 0,1523 read_value: "",1524 standard_value: "",1525 set_value: "",1526 description: "",1527 unit: "℃",1528 split: 0,1529 data: "55",1530 length: 1,1531 },1532 ],1533 6017: [1534 {1535 title: "电流加载初值",1536 title_en: "Current loading initial value",1537 category: "Mountain",1538 range: 0,1539 read_value: "",1540 standard_value: "",1541 set_value: "",1542 description: "",1543 unit: "ms",1544 split: 0,1545 data: "48",1546 length: 1,1547 },1548 {1549 title: "电流加载与踏频关系K1",1550 title_en: "The relationship between current loading and cadence K1",1551 category: "Mountain",1552 range: 0,1553 read_value: "",1554 standard_value: "",1555 set_value: "",1556 description: "",1557 unit: "ms",1558 split: 0,1559 data: "49",1560 length: 1,1561 },1562 {1563 title: "电流衰减与踏频关系K2",1564 title_en: "The relationship between current attenuation and cadence K2",1565 category: "Mountain",1566 range: 0,1567 read_value: "",1568 standard_value: "",1569 set_value: "",1570 description: "",1571 unit: "ms",1572 split: 0,1573 data: "50",1574 length: 1,1575 },1576 {1577 title: "电流衰减与踏频关系K3",1578 title_en: "The relationship between current attenuation and cadence K3",1579 category: "Mountain",1580 range: 0,1581 read_value: "",1582 standard_value: "",1583 set_value: "",1584 description: "",1585 unit: "ms",1586 split: 0,1587 data: "51",1588 length: 1,1589 },1590 {1591 title: "电流衰减与踏频关系K4",1592 title_en: "The relationship between current attenuation and cadence K4",1593 category: "Mountain",1594 range: 0,1595 read_value: "",1596 standard_value: "",1597 set_value: "",1598 description: "",1599 unit: "ms",1600 split: 0,1601 data: "52",1602 length: 1,1603 },1604 {1605 title: "力矩启动值常数",1606 title_en: "Torque pickup value constant",1607 category: "Mountain",1608 range: 0,1609 read_value: "",1610 standard_value: "",1611 set_value: "",1612 description: "",1613 unit: "mV",1614 split: 0,1615 data: "53",1616 length: 1,1617 },1618 {1619 title: "力矩启动与踏频关系K5",1620 title_en: "The relationship between torque start and cadence K5",1621 category: "Mountain",1622 range: 0,1623 read_value: "",1624 standard_value: "",1625 set_value: "",1626 description: "",1627 unit: "mV",1628 split: 0,1629 data: "54-55",1630 length: 2,1631 },1632 {1633 title: "力矩最小值常数",1634 title_en: "Moment Min Constant",1635 category: "Mountain",1636 range: 0,1637 read_value: "",1638 standard_value: "",1639 set_value: "",1640 description: "",1641 unit: "mV",1642 split: 0,1643 data: "56-57",1644 length: 2,1645 },1646 {1647 title: "力矩最小值与踏频关系K6",1648 title_en: "The relationship between the minimum torque and cadence K6",1649 category: "Mountain",1650 range: 0,1651 read_value: "",1652 standard_value: "",1653 set_value: "",1654 description: "",1655 unit: "mV",1656 split: 0,1657 data: "58-59",1658 length: 2,1659 },1660 {1661 title: "力矩放大倍数",1662 title_en: "torque magnification",1663 category: "Mountain",1664 range: 0,1665 read_value: "",1666 standard_value: "",1667 set_value: "",1668 description: "",1669 unit: "",1670 split: 0,1671 data: "60-61",1672 length: 2,1673 },1674 ],1675 6018: [1676 {1677 title: "限速限流1电池总容量",1678 title_en: "Speed ​​limit current limit 1 total battery capacity",1679 category: "DIY",1680 range: 0,1681 read_value: "",1682 standard_value: "",1683 set_value: "",1684 description: "",1685 unit: "0.1Ah",1686 split: 0,1687 data: "0-1",1688 length: 2,1689 },1690 {1691 title: "限速限流2电池总容量",1692 title_en: "Speed ​​limit current limit 2 total battery capacity",1693 category: "DIY",1694 range: 0,1695 read_value: "",1696 standard_value: "",1697 set_value: "",1698 description: "",1699 unit: "0.1Ah",1700 split: 0,1701 data: "2-3",1702 length: 2,1703 },1704 {1705 title: "限速1",1706 title_en: "speed limit 1",1707 category: "DIY",1708 range: 0,1709 read_value: "",1710 standard_value: "",1711 set_value: "",1712 description: "",1713 unit: "0.1Km/H",1714 split: 0,1715 data: "4-5",1716 length: 2,1717 },1718 {1719 title: "限流1",1720 title_en: "Current limit 1",1721 category: "DIY",1722 range: 0,1723 read_value: "",1724 standard_value: "",1725 set_value: "",1726 description: "",1727 unit: "0.1Ah",1728 split: 0,1729 data: "6-7",1730 length: 2,1731 },1732 {1733 title: "限速2",1734 title_en: "speed limit 2",1735 category: "DIY",1736 range: 0,1737 read_value: "",1738 standard_value: "",1739 set_value: "",1740 description: "",1741 unit: "0.1Km/H",1742 split: 0,1743 data: "8-9",1744 length: 2,1745 },1746 {1747 title: "限流2",1748 title_en: "Limit 2",1749 category: "DIY",1750 range: 0,1751 read_value: "",1752 standard_value: "",1753 set_value: "",1754 description: "",1755 unit: "0.1Ah",1756 split: 0,1757 data: "10-11",1758 length: 2,1759 },1760 ],1761 };1762}1763export default init();1764//////////////////1765// WEBPACK FOOTER1766// ./core/ctrlParams.js1767// module id = 1110...

Full Screen

Full Screen

detail.js

Source:detail.js Github

copy

Full Screen

...6 7 function drawdtl(){8 var dataset = appstate.highlightedRows[0];9 var dtl = d3.select("#dtlPanel");10 dtl.selectAll("#name").html(data_utils.read_value(dataset, "Name"));11 dtl.selectAll("#platform").html(data_utils.read_value(dataset, "Platform"));12 dtl.selectAll("#year_of_release").html(parseInt(data_utils.read_value(dataset, "Year_of_Release")));13 dtl.selectAll("#mean_usercritic_score").html(data_utils.read_value(dataset, "Mean_UserCritic_Score"));14 dtl.selectAll("#global_sales").html(data_utils.read_value(dataset, "Global_Sales") + " M");15 dtl.selectAll("#rating").html(data_utils.read_value(dataset, "Rating"));16 dtl.selectAll("#genre").html(data_utils.read_value(dataset, "Genre"));17 dtl.selectAll("#publisher").html(data_utils.read_value(dataset, "Publisher"));18 dtl.selectAll("#developer").html(data_utils.read_value(dataset, "Developer"));19 drawSales();20 drawScores();21 };22 function axisOrigins(xdomain, ydomain, xrange, yrange, xscale, yscale){23 /*24 if we agree on the current axis, we can deprecate this.25 */26 27 var result = {28 x: null,29 y: null30 };31 result["x"] = xrange[0];32 result["y"] = yrange[1];33 return result;34 };35 function setSizesdtl(boundingRect){36 w = boundingRect.width;37 //h_sales = boundingRect.height;38 };39 function drawSales(){40 var padding_sales = 5;41 var xoffset_sales = 5;42 var yoffset_sales = 0;43 var xcutoff_sales = 0;44 var ycutoff_sales = 0;45 var total_var = "Global_Sales";46 var detail_vars = ["JP_Sales", "EU_Sales", "NA_Sales"];47 //var sales_colors = [ "#e41a1c", "#377eb8", "#4daf4a" ]; // these were taken from color brewer48 var sales_colors = [ "#cf171a", "#4e92ca", "#4daf4a" ]; // these were +- taken from color brewer [68%, 70%, 49%]49 var detail_vars_captions = ["Japan", "Europe", "N. America"];50 var isLogScale = false;51 var isCenteredData = false;52 var xscale = null;53 var row_number = appstate.highlightedRows[0];54 var svg = d3.select("#dtlPanel").selectAll("#salesViz");55 svg.attr("width",w)56 .attr("height",h_sales);57 58 var xdomain = [];59 xdomain[0] = 060 xdomain[1] = 1;61 var xrange = [];62 xrange[0] = padding_sales + xoffset_sales;63 xrange[1] = w - padding_sales - xcutoff_sales;64 var yrange = [];65 yrange[0] = padding_sales;66 yrange[1] = h_sales - padding_sales - yoffset_sales;67 if(isLogScale){68 xscale = d3.scaleLog();69 }70 else{71 xscale = d3.scaleLinear();72 }73 xscale.domain(xdomain)74 .range(xrange);75 var pixelvalues;76 var pixeloffsets;77 pixelvalues = detail_vars.map(function(d){ return xscale( data_utils.read_value(row_number, d) / data_utils.read_value(row_number, "Global_Sales") ) ; });78 var _rescale = d3.min([d3.sum(pixelvalues), xrange[1] - xrange[0]]) / d3.sum(pixelvalues);79 pixelvalues = pixelvalues.map(function(d){ return d * _rescale });80 pixeloffsets = pixelvalues.slice(1, pixelvalues.length)81 .map(function(d,i){ return d3.sum(pixelvalues.slice(0, i+1)); });82 pixeloffsets.unshift(0);83 svg.selectAll("rect")84 .data(detail_vars)85 .enter().append("rect");86 svg.selectAll("rect")87 .transition()88 .duration(500)89 .attr("x", function(d, i){ return pixeloffsets[i]; })90 .attr("y", yrange[0])91 .attr("width", function(d, i){ return pixelvalues[i] })92 .attr("height", yrange[1]-yrange[0])93 .attr("stroke", "#222")94 .attr("stroke-width", 2)95 .attr("fill", function(d,i){ return sales_colors[i]; });96 d3.select("#dtlPanel").selectAll("#salesLegend")97 .selectAll("div.col-xs-4")98 .data(detail_vars)99 .enter().append("div")100 .attr("class", "col-xs-4")101 .append("small")102 .style("border-left", function(d, i){ return "solid 3px " + sales_colors[i]; })103 .style("padding-left", "3px");104 d3.select("#dtlPanel").selectAll("#salesLegend")105 .selectAll("small")106 .style("font-size", "0.6em")107 .html(function(d, i){ 108 return detail_vars_captions[i] + " ("+ data_utils.read_value(row_number,detail_vars[i]) +")"; })109 };110 function drawScores(){111 var w_scores = $(".scoresVizParent").get(0).getClientRects()[0].width;112 var padding_scores = 5;113 var xoffset_scores = 30;114 var yoffset_scores = 30;115 var xcutoff_scores = 30;116 var ycutoff_scores = 30;117 var top_rows = 2;118 var user_var = "User_Score_Norm";119 var critic_var = "Critic_Score";120 var user_var_c = "User_Count";121 var critic_var_c = "Critic_Count";122 var detail_vars = ["JP_Sales", "EU_Sales", "NA_Sales"];123 var sales_colors = [ "#e41a1c", "#377eb8", "#4daf4a" ]; // these were taken from color brewer124 var detail_vars_captions = ["Japan", "Europe", "N. America"];125 var xscale = null;126 var row_number = appstate.highlightedRows[0];127 var score_counts = [data_utils.read_value(row_number, user_var_c), 128 data_utils.read_value(row_number, critic_var_c)]129 var svg = d3.select("#dtlPanel").selectAll("#scoresViz");130 svg131 .attr("width",w_scores)132 .attr("height",h_scores);133 var t0 = svg.transition().duration(100);134 var t1 = svg.transition().delay(100).duration(500);135 136 var xdomain = [];137 xdomain[0] = 0138 xdomain[1] = 2;139 var ydomain = [];140 ydomain[0] = 100;141 ydomain[1] = 0;142 var xrange = [];143 xrange[0] = padding_scores + xoffset_scores;144 xrange[1] = w_scores - padding_scores - xcutoff_scores;145 var yrange = [];146 yrange[0] = padding_scores;147 yrange[1] = h_scores - padding_scores - yoffset_scores;148 yscale = d3.scaleLinear();149 xscale = d3.scaleBand();150 yscale.domain(ydomain)151 .range(yrange);152 xscale.domain(d3.range.apply(null, xdomain))153 .range(xrange)154 .padding(0.1)155 // 5) Create X and Y axis156 //calculate the placement of the origins for both axis157 var axis_0 = axisOrigins(xdomain, ydomain, xrange, yrange, xscale, yscale);158 var yaxis = d3.axisLeft()159 .scale(yscale)160 .ticks(5);161 var xaxis = d3.axisBottom()162 .scale(xscale)163 .ticks(top_rows);164 // X) Append group for Axis and background grid165 // for data166 svg.selectAll("g.background")167 .data([0]).enter().append("g")168 .attr("class", "background");169 svg.selectAll("g.x.axis")170 .data([0]).enter().append("g")171 .attr("transform","translate(0," + axis_0["y"] + ")")172 .attr("class", "x axis")173 .call(xaxis);174 svg.selectAll("g.y.axis")175 .data([0]).enter().append("g")176 .attr("transform","translate("+ axis_0["x"] +",0)")177 .attr("class", "y axis");178 // X) Append group for data points grid179 svg.selectAll("g.datapoints")180 .data([0]).enter().append("g")181 .attr("class", "datapoints")182 // 5) Create X and Y axis183 var gY = svg.select("g.y.axis")184 .transition(t0)185 .call(yaxis);186 // draws the X axis with text label187 var gX = svg.select("g.x.axis")188 gX.selectAll("text")189 .attr("class", "x tick")190 .attr("class", "x tick")191 .style("text-anchor", "middle")192 .text(function(d, i){ 193 var result = [194 "User Score",195 "Critic Score"196 ];197 198 return result[i];199 })200 // 6) Create the background grid201 // Draw the Y grid202 svg.select("g.background").selectAll("line.y-grid")203 .data(yscale.ticks())204 .enter().append("line")205 .attr("class", "y-grid")206 .attr("x1", xrange[0])207 .attr("x2", xrange[1])208 .attr("stroke-width", 1)209 .attr("stroke", "rgba(120,120,120,0.2)");210 svg.select("g.background").selectAll("line.y-grid")211 .data(yscale.ticks())212 .exit().remove();213 svg.select("g.background").selectAll("line.y-grid")214 .transition(t1)215 .attr("y1", function(d){ return yscale(d); })216 .attr("y2", function(d){ return yscale(d); });217 // 7) Plot the data itself218 // draws the plot itself219 svg.select("g.datapoints").selectAll("rect.data-point")220 .data([0, 1])221 .enter().append("rect")222 .attr("class", "data-point")223 .attr("fill","rgb(255, 197, 0)")224 .attr("opacity", 1)225 svg.select("g.datapoints").selectAll("rect.data-point")226 .data([0, 1])227 .exit().remove();228 svg.select("g.datapoints").selectAll("rect.data-point")229 .transition().duration(750)230 .attr("x",function(d, i) {231 return xscale(i);232 })233 .attr("y", function(d, i) {234 var _var = [user_var, critic_var];235 var v = data_utils.read_value(row_number, _var[i]);236 return yscale(v);237 })238 .attr("width", xscale.bandwidth())239 .attr("height", function(d, i) {240 var _var = [user_var, critic_var];241 var v = data_utils.read_value(row_number, _var[i]);242 var result;243 if (v<0){244 // turns out we didn't have data for this245 result = 0;246 }247 else{248 result = yscale.range()[1] - yscale(v)249 }250 return result;251 });252 // 7) Plot the data itself253 // draws the inside-plot labels254 svg.select("g.datapoints").selectAll("text.data-point")255 .data([0, 1])256 .enter().append("text")257 .attr("class", "data-point")258 .attr("fill","rgb(0,0,0)")259 .style("font-size", 10)260 .style("text-anchor", "middle")261 svg.select("g.datapoints").selectAll("text.data-point")262 .data([0, 1])263 .exit().remove();264 svg.select("g.datapoints").selectAll("text.data-point")265 .transition().duration(750)266 .attr("x",function(d, i) {267 return xscale(i) + xscale.bandwidth() / 2;268 })269 .attr("y", function(d, i) {270 var _var = [user_var, critic_var];271 var v = data_utils.read_value(row_number, _var[i]);272 var result;273 if (v < 0 || score_counts[i] < 0){274 result = yscale(50);275 }276 else{277 result = yscale(v) - 4278 }279 return result;280 })281 .text(function(d, i){ 282 var _var = [user_var, critic_var];283 var v = data_utils.read_value(row_number, _var[i]);284 var result;285 if (v < 0 || score_counts[i] < 0){286 result = "Unknown";287 }288 else{289 result = d3.format(".1f")(v);290 }291 return result;292 })293 var dtl = d3.select("#dtlPanel");294 dtl.selectAll("#usercritic_diff").html(data_utils.read_value(row_number, "Critic_User_Diff"));295 dtl.selectAll("#user_count").html(Math.max(score_counts[0],0));296 dtl.selectAll("#critc_count").html(Math.max(score_counts[1],0));297 };298 window.drawdtl = drawdtl;299 window.setSizesdtl = setSizesdtl;...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1var fs = require("fs")2var readlinesync = require("readline-sync")3var candidate = readlinesync.question("enter the choise Login/SignUp--")4function checkPassword(password){5 if(password.includes("@") || password.includes("#")){6 var i = 0 ;7 while(i <10 ){8 if(password.includes(i)){9 return ("Password is strong");10 };11 i++;12 }13 return false;14 }else{15 return ("in password spacial charector should be there");16 };17}18function write_data(){19 console.log("congrats " + username +" you are Signed Up Successfully");20 var Descrition = readlinesync.question("Enter the Description--");21 var DOB = readlinesync.question("Enter the DOB--");22 var Hobbies = readlinesync.question("Enter the Hobbies--");23 var Gender = readlinesync.question("Enter the Gender--");24 var Profile ={"Descrition":Descrition, "DOB":DOB, "Hobbies": Hobbies, "Gender": Gender };25 var dic = {}26 dic["username"] = username;27 dic["password"] = password1;28 dic["Profile"] = Profile;29 convert_data.push(dic);30 // convert_data.push(dic);31 fs.writeFile("./sign_up.json",JSON.stringify(convert_data) ,err =>{32 if(err){33 console.log("error");34 }else{35 }36 }); 37}38var convert_data;39if(candidate === "sign up"){40 var username = readlinesync.question("enter the username--")41 var password1 = readlinesync.question("enter the password--")42 var password2 = readlinesync.question("enter the same password--")43 if(password1 === password2){44 console.log(checkPassword(password1));45 function readFile_data(){46 fs.readFile("./sign_up.json",'utf8', (err, jsonString) => {47 convert_data = JSON.parse(jsonString);48 function check_userIs(){49 var read_value = convert_data;50 var i = 0;51 while(i < read_value.length){52 if(read_value[i]["username"] === username && read_value[i]["password"] === password1){53 console.log(username, " are already Exists....."); 54 return ("Done this..."); 6 55 }else{56 57 };58 i++;59 };60 write_data()61 return ("Done this...");62 }63 console.log(check_userIs());64 65 });66 };67 readFile_data();68 69 }else{70 console.log("password is not same--")71 }72}else if(candidate === "login"){73 var username = readlinesync.question('Please enter your name--');74 var password1 = readlinesync.question('Please enter your password--');75 76 fs.readFile("./sign_up.json",'utf8', (err, jsonString) => {77 var convert_data = JSON.parse(jsonString);78 function Check_Login_User(){79 var read_value = convert_data;80 var i = 0;81 while(i < read_value.length){82 if(read_value[i]["username"] === username && read_value[i]["password"] === password1){83 console.log(username,"You are Logged In Successfully");84 return true;85 }86 else{87 88 };89 i++;90 };91 console.log("username or password is wrong");92 return false;93 }94 Check_Login_User()95 96 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org');3}, function(err, data) {4 if (err) return console.error(err);5 wpt.readValue(data.data.testId, 'firstView', 'loadTime', function(err, data) {6 if (err) return console.error(err);7 console.log('loadTime: ' + data);8 });9});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2wpt.read_value(url, function(err, data) {3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = function() {10 this.read_value = function(url, callback) {11 var request = require('request');12 if (!error && response.statusCode == 200) {13 var data = JSON.parse(body);14 callback(null, data);15 } else {16 callback(error, null);17 }18 });19 }20};21module.exports = new wpt();22var wpt = require('wpt.js');23var wpt = require('wpt');24var wpt = require('./wpt');25var wpt = require('wpt');26var wpt = require('wpt');27var wpt = require('wpt.js');28var wpt = require('wpt.js');29var wpt = require('wpt.js');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3var options = { location: 'Dulles_MotoG4', connectivity: '3G', firstViewOnly: true, runs: 1 };4wpt.runTest(url, options, function(err, data) {5 if (err) return console.error(err);6 wpt.getTestResults(data.data.testId, function(err, data) {7 if (err) return console.error(err);8 console.log(data.data.median.firstView.SpeedIndex);9 });10});11{12 "dependencies": {13 },14 "devDependencies": {},15 "scripts": {16 },17}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var options = {3};4var wpt = new WebPageTest('www.webpagetest.org', options);5wpt.getLocations(function(err, data) {6 if (err) return console.error(err);7 console.log('Locations: %j', data);8});9 if (err) return console.error(err);10 console.log('Test Results: %j', data);11 wpt.getTestResults(data.data.testId, function(err, data) {12 if (err) return console.error(err);13 console.log('Test Results: %j', data);14 });15});16var wpt = require('webpagetest');17var options = {18};19var wpt = new WebPageTest('www.webpagetest.org', options);20wpt.getLocations(function(err, data) {21 if (err) return console.error(err);22 console.log('Locations: %j', data);23});24 if (err) return console.error(err);25 console.log('Test Results: %j', data);26 wpt.getTestResults(data.data.testId, function(err, data) {27 if (err) return console.error(err);28 console.log('Test Results: %j', data);29 });30});31var wpt = require('webpagetest');32var options = {33};34var wpt = new WebPageTest('www.webpagetest.org', options);35wpt.getLocations(function(err, data) {36 if (err) return console.error(err);37 console.log('Locations: %j', data);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = require('wpt');10var wpt = new WebPageTest('www.webpagetest.org');11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17var wpt = require('wpt');18var wpt = new WebPageTest('www.webpagetest.org');19wpt.get_locations(function(err, data) {20 if (err) {21 console.log(err);22 } else {23 console.log(data);24 }25});26var wpt = require('wpt');27var wpt = new WebPageTest('www.webpagetest.org');28wpt.get_testers(function(err, data) {29 if (err) {30 console.log(err);31 } else {32 console.log(data);33 }34});35var wpt = require('wpt');36var wpt = new WebPageTest('www.webpagetest.org');37wpt.get_status(function(err, data) {38 if (err) {39 console.log(err);40 } else {41 console.log(data);42 }43});44var wpt = require('wpt');45var wpt = new WebPageTest('www.webpagetest.org');46wpt.get_testers(function(err, data) {47 if (err) {48 console.log(err);49 } else {50 console.log(data);51 }52});53var wpt = require('wpt');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new wpt('API_KEY');3wpt.read_value('test',function(err, data){4 if(err){5 console.log(err);6 }else{7 console.log(data);8 }9});10var wpt = require('wpt');11var wpt = new wpt('API_KEY');12wpt.write_value('test','test value',function(err, data){13 if(err){14 console.log(err);15 }else{16 console.log(data);17 }18});19var wpt = require('wpt');20var wpt = new wpt('API_KEY');21wpt.get_locations(function(err, data){22 if(err){23 console.log(err);24 }else{25 console.log(data);26 }27});28var wpt = require('wpt');29var wpt = new wpt('API_KEY');30wpt.get_location('Dulles_MotoG4',function(err, data){31 if(err){32 console.log(err);33 }else{34 console.log(data);35 }36});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new wpt('API_KEY');3wpt.read_value('test', 'test', function(err, data) {4 if (err) throw err;5 console.log(data);6});7Copyright (c) 2016 WebPagetest

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2var wpt = new wpt();3wpt.read_value('test', function(result){4 console.log(result);5});6var fs = require('fs');7var wpt = function(){8 this.read_value = function(key, callback){9 fs.readFile('config.json', 'utf-8', function(err, data){10 if(err){11 console.log(err);12 }13 else{14 var config = JSON.parse(data);15 callback(config[key]);16 }17 });18 }19}20module.exports = wpt;21{22}23var wpt = require('./wpt.js');24var wpt = new wpt();25fs.readFile('config.json', 'utf-8', function(err, data){26 if(err){27 console.log(err);28 }29 else{30 wpt.read_value(data, 'test', function(result){31 console.log(result);32 });33 }34});35var fs = require('fs');36var wpt = function(){37 this.read_value = function(data, key, callback){38 var config = JSON.parse(data);39 callback(config[key]);40 }41}42module.exports = wpt;43{44}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful