How to use ceiling method in Playwright Internal

Best JavaScript code snippet using playwright-internal

cryptanalysis.js

Source:cryptanalysis.js Github

copy

Full Screen

1/**2 * Скрипт для криптоанализа3 * частоты символов в тексте4 * только латиница5 */6// Находим холст для рисования и поля для ввода текста7var barChart=document.getElementById("barChart");8var textArea1=document.getElementById("textArea1");9var textArea2=document.getElementById("textArea2");10// Настройка гистограммы11var context=barChart.getContext("2d");12var width=1220; // Длинна гистограммы13var ceiling=420; // Потолок гистограммы14var factor=1; // Множитель высоты столбиков15var thickness=10; // Толщина столбиков16var distance=0; // Растояние между столбиками17var symbols=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","А","Б","В","Г","Д","Е","Ё","Ж","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ч","Ш","Щ","Ь","Ы","Ъ","Э","Ю","Я"," "];18var place=0;19// Подпись оси X20context.fillStyle="black";21context.font="bold 14px Arial";22for (symbol of symbols) {23 context.fillText(symbol,place*(thickness+distance)+5,ceiling+20);24 place+=2;25}26context.fillText("100%",1180,10);27context.fillText("90%",1190,52);28context.fillText("80%",1190,94);29context.fillText("70%",1190,136);30context.fillText("60%",1190,178);31context.fillText("50%",1190,220);32context.fillText("40%",1190,262);33context.fillText("30%",1190,304);34context.fillText("20%",1190,346);35context.fillText("10%",1190,388);36// Область графика с линиями37var lines=function(){38context.strokeRect(0,0,width,ceiling);39context.beginPath();40context.moveTo(0,42);41context.lineTo(width,42);42context.moveTo(width,84);43context.lineTo(0,84);44context.moveTo(0,126);45context.lineTo(width,126);46context.moveTo(width,168);47context.lineTo(0,168);48context.moveTo(0,210);49context.lineTo(width,210);50context.moveTo(width,252);51context.lineTo(0,252);52context.moveTo(0,294);53context.lineTo(width,294);54context.moveTo(width,336);55context.lineTo(0,336);56context.moveTo(0,378);57context.lineTo(width,378);58context.stroke();59}60lines();61// Функции обработки перехватчиков событий62var EventUtil={63 addHandler: function(element,type,handler){64 if (element,addEventListener){65 element.addEventListener(type,handler,false);66 } else if (element.attachEvent){67 element.attachEvent("on"+type,handler);68 } else element["on"+type]=handler;69 },70 getEvent: function(event){71 return event ? event : window.event;72 },73 getTarget: function(event){74 return event.target || event.srcElement;75 },76 preventDefault: function(event){77 if (event.preventDefault){78 event.preventDefault();79 } else event.returnValue=false;80 },81 removeHandler: function(element,type,handler){82 if (element,removeEventListener){83 element.removeEventListener(type,handler,false);84 } else if (element.detachEvent){85 element.detachEvent("on"+type,handler);86 } else element["on"+type]=null;87 },88 stopPropagation: function(event){89 if (event.stopPropagation){90 event.stopPropagation();91 } else event.cancelBubble=true;92 }93}94// Построение синей гистограммы95var blueRect = function(){96 var textArea1Length=textArea1.value.match(/[A-ZА-Я ]/gi) ? textArea1.value.match(/[A-ZА-Я ]/gi).length : 0;97 var A=textArea1.value.match(/A/gi) ? textArea1.value.match(/A/gi).length / textArea1Length * ceiling : 0;98 var B=textArea1.value.match(/B/gi) ? textArea1.value.match(/B/gi).length / textArea1Length * ceiling : 0;99 var C=textArea1.value.match(/C/gi) ? textArea1.value.match(/C/gi).length / textArea1Length * ceiling : 0;100 var D=textArea1.value.match(/D/gi) ? textArea1.value.match(/D/gi).length / textArea1Length * ceiling : 0;101 var E=textArea1.value.match(/E/gi) ? textArea1.value.match(/E/gi).length / textArea1Length * ceiling : 0;102 var F=textArea1.value.match(/F/gi) ? textArea1.value.match(/F/gi).length / textArea1Length * ceiling : 0;103 var G=textArea1.value.match(/G/gi) ? textArea1.value.match(/G/gi).length / textArea1Length * ceiling : 0;104 var H=textArea1.value.match(/H/gi) ? textArea1.value.match(/H/gi).length / textArea1Length * ceiling : 0;105 var I=textArea1.value.match(/I/gi) ? textArea1.value.match(/I/gi).length / textArea1Length * ceiling : 0;106 var J=textArea1.value.match(/J/gi) ? textArea1.value.match(/J/gi).length / textArea1Length * ceiling : 0;107 var K=textArea1.value.match(/K/gi) ? textArea1.value.match(/K/gi).length / textArea1Length * ceiling : 0;108 var L=textArea1.value.match(/L/gi) ? textArea1.value.match(/L/gi).length / textArea1Length * ceiling : 0;109 var M=textArea1.value.match(/M/gi) ? textArea1.value.match(/M/gi).length / textArea1Length * ceiling : 0;110 var N=textArea1.value.match(/N/gi) ? textArea1.value.match(/N/gi).length / textArea1Length * ceiling : 0;111 var O=textArea1.value.match(/O/gi) ? textArea1.value.match(/O/gi).length / textArea1Length * ceiling : 0;112 var P=textArea1.value.match(/P/gi) ? textArea1.value.match(/P/gi).length / textArea1Length * ceiling : 0;113 var Q=textArea1.value.match(/Q/gi) ? textArea1.value.match(/Q/gi).length / textArea1Length * ceiling : 0;114 var R=textArea1.value.match(/R/gi) ? textArea1.value.match(/R/gi).length / textArea1Length * ceiling : 0;115 var S=textArea1.value.match(/S/gi) ? textArea1.value.match(/S/gi).length / textArea1Length * ceiling : 0;116 var T=textArea1.value.match(/T/gi) ? textArea1.value.match(/T/gi).length / textArea1Length * ceiling : 0;117 var U=textArea1.value.match(/U/gi) ? textArea1.value.match(/U/gi).length / textArea1Length * ceiling : 0;118 var V=textArea1.value.match(/V/gi) ? textArea1.value.match(/V/gi).length / textArea1Length * ceiling : 0;119 var W=textArea1.value.match(/W/gi) ? textArea1.value.match(/W/gi).length / textArea1Length * ceiling : 0;120 var X=textArea1.value.match(/X/gi) ? textArea1.value.match(/X/gi).length / textArea1Length * ceiling : 0;121 var Y=textArea1.value.match(/Y/gi) ? textArea1.value.match(/Y/gi).length / textArea1Length * ceiling : 0;122 var Z=textArea1.value.match(/Z/gi) ? textArea1.value.match(/Z/gi).length / textArea1Length * ceiling : 0;123 var А=textArea1.value.match(/А/gi) ? textArea1.value.match(/А/gi).length / textArea1Length * ceiling : 0;124 var Б=textArea1.value.match(/Б/gi) ? textArea1.value.match(/Б/gi).length / textArea1Length * ceiling : 0;125 var В=textArea1.value.match(/В/gi) ? textArea1.value.match(/В/gi).length / textArea1Length * ceiling : 0;126 var Г=textArea1.value.match(/Г/gi) ? textArea1.value.match(/Г/gi).length / textArea1Length * ceiling : 0;127 var Д=textArea1.value.match(/Д/gi) ? textArea1.value.match(/Д/gi).length / textArea1Length * ceiling : 0;128 var Е=textArea1.value.match(/Е/gi) ? textArea1.value.match(/Е/gi).length / textArea1Length * ceiling : 0;129 var Ё=textArea1.value.match(/Ё/gi) ? textArea1.value.match(/Ё/gi).length / textArea1Length * ceiling : 0;130 var Ж=textArea1.value.match(/Ж/gi) ? textArea1.value.match(/Ж/gi).length / textArea1Length * ceiling : 0;131 var З=textArea1.value.match(/З/gi) ? textArea1.value.match(/З/gi).length / textArea1Length * ceiling : 0;132 var И=textArea1.value.match(/И/gi) ? textArea1.value.match(/И/gi).length / textArea1Length * ceiling : 0;133 var Й=textArea1.value.match(/Й/gi) ? textArea1.value.match(/Й/gi).length / textArea1Length * ceiling : 0;134 var К=textArea1.value.match(/К/gi) ? textArea1.value.match(/К/gi).length / textArea1Length * ceiling : 0;135 var Л=textArea1.value.match(/Л/gi) ? textArea1.value.match(/Л/gi).length / textArea1Length * ceiling : 0;136 var М=textArea1.value.match(/М/gi) ? textArea1.value.match(/М/gi).length / textArea1Length * ceiling : 0;137 var Н=textArea1.value.match(/Н/gi) ? textArea1.value.match(/Н/gi).length / textArea1Length * ceiling : 0;138 var О=textArea1.value.match(/О/gi) ? textArea1.value.match(/О/gi).length / textArea1Length * ceiling : 0;139 var П=textArea1.value.match(/П/gi) ? textArea1.value.match(/П/gi).length / textArea1Length * ceiling : 0;140 var Р=textArea1.value.match(/Р/gi) ? textArea1.value.match(/Р/gi).length / textArea1Length * ceiling : 0;141 var С=textArea1.value.match(/С/gi) ? textArea1.value.match(/С/gi).length / textArea1Length * ceiling : 0;142 var Т=textArea1.value.match(/Т/gi) ? textArea1.value.match(/Т/gi).length / textArea1Length * ceiling : 0;143 var У=textArea1.value.match(/У/gi) ? textArea1.value.match(/У/gi).length / textArea1Length * ceiling : 0;144 var Ф=textArea1.value.match(/Ф/gi) ? textArea1.value.match(/Ф/gi).length / textArea1Length * ceiling : 0;145 var Х=textArea1.value.match(/Х/gi) ? textArea1.value.match(/Х/gi).length / textArea1Length * ceiling : 0;146 var Ч=textArea1.value.match(/Ч/gi) ? textArea1.value.match(/Ч/gi).length / textArea1Length * ceiling : 0;147 var Ш=textArea1.value.match(/Ш/gi) ? textArea1.value.match(/Ш/gi).length / textArea1Length * ceiling : 0;148 var Щ=textArea1.value.match(/Щ/gi) ? textArea1.value.match(/Щ/gi).length / textArea1Length * ceiling : 0;149 var Ь=textArea1.value.match(/Ь/gi) ? textArea1.value.match(/Ь/gi).length / textArea1Length * ceiling : 0;150 var Ы=textArea1.value.match(/Ы/gi) ? textArea1.value.match(/Ы/gi).length / textArea1Length * ceiling : 0;151 var Ъ=textArea1.value.match(/Ъ/gi) ? textArea1.value.match(/Ъ/gi).length / textArea1Length * ceiling : 0;152 var Э=textArea1.value.match(/Э/gi) ? textArea1.value.match(/Э/gi).length / textArea1Length * ceiling : 0;153 var Ю=textArea1.value.match(/Ю/gi) ? textArea1.value.match(/Ю/gi).length / textArea1Length * ceiling : 0;154 var Я=textArea1.value.match(/Я/gi) ? textArea1.value.match(/Я/gi).length / textArea1Length * ceiling : 0;155 var SPACE=textArea1.value.match(/ /gi) ? textArea1.value.match(/ /gi).length / textArea1Length * ceiling : 0;156 for (i=0;i<=116;i+=2) {157 context.clearRect(i*(thickness+distance),0,thickness,ceiling);158 }159 lines();160 context.fillStyle="blue";161 context.fillRect(0,ceiling-A*factor,thickness,A*factor);162 context.fillRect(2*(thickness+distance),ceiling-B*factor,thickness,B*factor);163 context.fillRect(4*(thickness+distance),ceiling-C*factor,thickness,C*factor);164 context.fillRect(6*(thickness+distance),ceiling-D*factor,thickness,D*factor);165 context.fillRect(8*(thickness+distance),ceiling-E*factor,thickness,E*factor);166 context.fillRect(10*(thickness+distance),ceiling-F*factor,thickness,F*factor);167 context.fillRect(12*(thickness+distance),ceiling-G*factor,thickness,G*factor);168 context.fillRect(14*(thickness+distance),ceiling-H*factor,thickness,H*factor);169 context.fillRect(16*(thickness+distance),ceiling-I*factor,thickness,I*factor);170 context.fillRect(18*(thickness+distance),ceiling-J*factor,thickness,J*factor);171 context.fillRect(20*(thickness+distance),ceiling-K*factor,thickness,K*factor);172 context.fillRect(22*(thickness+distance),ceiling-L*factor,thickness,L*factor);173 context.fillRect(24*(thickness+distance),ceiling-M*factor,thickness,M*factor);174 context.fillRect(26*(thickness+distance),ceiling-N*factor,thickness,N*factor);175 context.fillRect(28*(thickness+distance),ceiling-O*factor,thickness,O*factor);176 context.fillRect(30*(thickness+distance),ceiling-P*factor,thickness,P*factor);177 context.fillRect(32*(thickness+distance),ceiling-Q*factor,thickness,Q*factor);178 context.fillRect(34*(thickness+distance),ceiling-R*factor,thickness,R*factor);179 context.fillRect(36*(thickness+distance),ceiling-S*factor,thickness,S*factor);180 context.fillRect(38*(thickness+distance),ceiling-T*factor,thickness,T*factor);181 context.fillRect(40*(thickness+distance),ceiling-U*factor,thickness,U*factor);182 context.fillRect(42*(thickness+distance),ceiling-V*factor,thickness,V*factor);183 context.fillRect(44*(thickness+distance),ceiling-W*factor,thickness,W*factor);184 context.fillRect(46*(thickness+distance),ceiling-X*factor,thickness,X*factor);185 context.fillRect(48*(thickness+distance),ceiling-Y*factor,thickness,Y*factor);186 context.fillRect(50*(thickness+distance),ceiling-Z*factor,thickness,Z*factor);187 context.fillRect(52*(thickness+distance),ceiling-А*factor,thickness,А*factor);188 context.fillRect(54*(thickness+distance),ceiling-Б*factor,thickness,Б*factor);189 context.fillRect(56*(thickness+distance),ceiling-В*factor,thickness,В*factor);190 context.fillRect(58*(thickness+distance),ceiling-Г*factor,thickness,Г*factor);191 context.fillRect(60*(thickness+distance),ceiling-Д*factor,thickness,Д*factor);192 context.fillRect(62*(thickness+distance),ceiling-Е*factor,thickness,Е*factor);193 context.fillRect(64*(thickness+distance),ceiling-Ё*factor,thickness,Ё*factor);194 context.fillRect(66*(thickness+distance),ceiling-Ж*factor,thickness,Ж*factor);195 context.fillRect(68*(thickness+distance),ceiling-З*factor,thickness,З*factor);196 context.fillRect(70*(thickness+distance),ceiling-И*factor,thickness,И*factor);197 context.fillRect(72*(thickness+distance),ceiling-Й*factor,thickness,Й*factor);198 context.fillRect(74*(thickness+distance),ceiling-К*factor,thickness,К*factor);199 context.fillRect(76*(thickness+distance),ceiling-Л*factor,thickness,Л*factor);200 context.fillRect(78*(thickness+distance),ceiling-М*factor,thickness,М*factor);201 context.fillRect(80*(thickness+distance),ceiling-Н*factor,thickness,Н*factor);202 context.fillRect(82*(thickness+distance),ceiling-О*factor,thickness,О*factor);203 context.fillRect(84*(thickness+distance),ceiling-П*factor,thickness,П*factor);204 context.fillRect(86*(thickness+distance),ceiling-Р*factor,thickness,Р*factor);205 context.fillRect(88*(thickness+distance),ceiling-С*factor,thickness,С*factor);206 context.fillRect(90*(thickness+distance),ceiling-Т*factor,thickness,Т*factor);207 context.fillRect(92*(thickness+distance),ceiling-У*factor,thickness,У*factor);208 context.fillRect(94*(thickness+distance),ceiling-Ф*factor,thickness,Ф*factor);209 context.fillRect(96*(thickness+distance),ceiling-Х*factor,thickness,Х*factor);210 context.fillRect(98*(thickness+distance),ceiling-Ч*factor,thickness,Ч*factor);211 context.fillRect(100*(thickness+distance),ceiling-Ш*factor,thickness,Ш*factor);212 context.fillRect(102*(thickness+distance),ceiling-Щ*factor,thickness,Щ*factor);213 context.fillRect(104*(thickness+distance),ceiling-Ь*factor,thickness,Ь*factor);214 context.fillRect(106*(thickness+distance),ceiling-Ы*factor,thickness,Ы*factor);215 context.fillRect(108*(thickness+distance),ceiling-Ъ*factor,thickness,Ъ*factor);216 context.fillRect(110*(thickness+distance),ceiling-Э*factor,thickness,Э*factor);217 context.fillRect(112*(thickness+distance),ceiling-Ю*factor,thickness,Ю*factor);218 context.fillRect(114*(thickness+distance),ceiling-Я*factor,thickness,Я*factor);219 context.fillRect(116*(thickness+distance),ceiling-SPACE*factor,thickness,SPACE*factor);220};221// Построение красной гистограммы222var redRect = function(){223 var textArea2Length=textArea2.value.match(/[A-ZА-Я ]/gi) ? textArea2.value.match(/[A-ZА-Я ]/gi).length : 0;224 var A0=textArea2.value.match(/A/gi) ? textArea2.value.match(/A/gi).length / textArea2Length * ceiling : 0;225 var B0=textArea2.value.match(/B/gi) ? textArea2.value.match(/B/gi).length / textArea2Length * ceiling : 0;226 var C0=textArea2.value.match(/C/gi) ? textArea2.value.match(/C/gi).length / textArea2Length * ceiling : 0;227 var D0=textArea2.value.match(/D/gi) ? textArea2.value.match(/D/gi).length / textArea2Length * ceiling : 0;228 var E0=textArea2.value.match(/E/gi) ? textArea2.value.match(/E/gi).length / textArea2Length * ceiling : 0;229 var F0=textArea2.value.match(/F/gi) ? textArea2.value.match(/F/gi).length / textArea2Length * ceiling : 0;230 var G0=textArea2.value.match(/G/gi) ? textArea2.value.match(/G/gi).length / textArea2Length * ceiling : 0;231 var H0=textArea2.value.match(/H/gi) ? textArea2.value.match(/H/gi).length / textArea2Length * ceiling : 0;232 var I0=textArea2.value.match(/I/gi) ? textArea2.value.match(/I/gi).length / textArea2Length * ceiling : 0;233 var J0=textArea2.value.match(/J/gi) ? textArea2.value.match(/J/gi).length / textArea2Length * ceiling : 0;234 var K0=textArea2.value.match(/K/gi) ? textArea2.value.match(/K/gi).length / textArea2Length * ceiling : 0;235 var L0=textArea2.value.match(/L/gi) ? textArea2.value.match(/L/gi).length / textArea2Length * ceiling : 0;236 var M0=textArea2.value.match(/M/gi) ? textArea2.value.match(/M/gi).length / textArea2Length * ceiling : 0;237 var N0=textArea2.value.match(/N/gi) ? textArea2.value.match(/N/gi).length / textArea2Length * ceiling : 0;238 var O0=textArea2.value.match(/O/gi) ? textArea2.value.match(/O/gi).length / textArea2Length * ceiling : 0;239 var P0=textArea2.value.match(/P/gi) ? textArea2.value.match(/P/gi).length / textArea2Length * ceiling : 0;240 var Q0=textArea2.value.match(/Q/gi) ? textArea2.value.match(/Q/gi).length / textArea2Length * ceiling : 0;241 var R0=textArea2.value.match(/R/gi) ? textArea2.value.match(/R/gi).length / textArea2Length * ceiling : 0;242 var S0=textArea2.value.match(/S/gi) ? textArea2.value.match(/S/gi).length / textArea2Length * ceiling : 0;243 var T0=textArea2.value.match(/T/gi) ? textArea2.value.match(/T/gi).length / textArea2Length * ceiling : 0;244 var U0=textArea2.value.match(/U/gi) ? textArea2.value.match(/U/gi).length / textArea2Length * ceiling : 0;245 var V0=textArea2.value.match(/V/gi) ? textArea2.value.match(/V/gi).length / textArea2Length * ceiling : 0;246 var W0=textArea2.value.match(/W/gi) ? textArea2.value.match(/W/gi).length / textArea2Length * ceiling : 0;247 var X0=textArea2.value.match(/X/gi) ? textArea2.value.match(/X/gi).length / textArea2Length * ceiling : 0;248 var Y0=textArea2.value.match(/Y/gi) ? textArea2.value.match(/Y/gi).length / textArea2Length * ceiling : 0;249 var Z0=textArea2.value.match(/Z/gi) ? textArea2.value.match(/Z/gi).length / textArea2Length * ceiling : 0;250 var А0=textArea2.value.match(/А/gi) ? textArea2.value.match(/А/gi).length / textArea2Length * ceiling : 0;251 var Б0=textArea2.value.match(/Б/gi) ? textArea2.value.match(/Б/gi).length / textArea2Length * ceiling : 0;252 var В0=textArea2.value.match(/В/gi) ? textArea2.value.match(/В/gi).length / textArea2Length * ceiling : 0;253 var Г0=textArea2.value.match(/Г/gi) ? textArea2.value.match(/Г/gi).length / textArea2Length * ceiling : 0;254 var Д0=textArea2.value.match(/Д/gi) ? textArea2.value.match(/Д/gi).length / textArea2Length * ceiling : 0;255 var Е0=textArea2.value.match(/Е/gi) ? textArea2.value.match(/Е/gi).length / textArea2Length * ceiling : 0;256 var Ё0=textArea2.value.match(/Ё/gi) ? textArea2.value.match(/Ё/gi).length / textArea2Length * ceiling : 0;257 var Ж0=textArea2.value.match(/Ж/gi) ? textArea2.value.match(/Ж/gi).length / textArea2Length * ceiling : 0;258 var З0=textArea2.value.match(/З/gi) ? textArea2.value.match(/З/gi).length / textArea2Length * ceiling : 0;259 var И0=textArea2.value.match(/И/gi) ? textArea2.value.match(/И/gi).length / textArea2Length * ceiling : 0;260 var Й0=textArea2.value.match(/Й/gi) ? textArea2.value.match(/Й/gi).length / textArea2Length * ceiling : 0;261 var К0=textArea2.value.match(/К/gi) ? textArea2.value.match(/К/gi).length / textArea2Length * ceiling : 0;262 var Л0=textArea2.value.match(/Л/gi) ? textArea2.value.match(/Л/gi).length / textArea2Length * ceiling : 0;263 var М0=textArea2.value.match(/М/gi) ? textArea2.value.match(/М/gi).length / textArea2Length * ceiling : 0;264 var Н0=textArea2.value.match(/Н/gi) ? textArea2.value.match(/Н/gi).length / textArea2Length * ceiling : 0;265 var О0=textArea2.value.match(/О/gi) ? textArea2.value.match(/О/gi).length / textArea2Length * ceiling : 0;266 var П0=textArea2.value.match(/П/gi) ? textArea2.value.match(/П/gi).length / textArea2Length * ceiling : 0;267 var Р0=textArea2.value.match(/Р/gi) ? textArea2.value.match(/Р/gi).length / textArea2Length * ceiling : 0;268 var С0=textArea2.value.match(/С/gi) ? textArea2.value.match(/С/gi).length / textArea2Length * ceiling : 0;269 var Т0=textArea2.value.match(/Т/gi) ? textArea2.value.match(/Т/gi).length / textArea2Length * ceiling : 0;270 var У0=textArea2.value.match(/У/gi) ? textArea2.value.match(/У/gi).length / textArea2Length * ceiling : 0;271 var Ф0=textArea2.value.match(/Ф/gi) ? textArea2.value.match(/Ф/gi).length / textArea2Length * ceiling : 0;272 var Х0=textArea2.value.match(/Х/gi) ? textArea2.value.match(/Х/gi).length / textArea2Length * ceiling : 0;273 var Ч0=textArea2.value.match(/Ч/gi) ? textArea2.value.match(/Ч/gi).length / textArea2Length * ceiling : 0;274 var Ш0=textArea2.value.match(/Ш/gi) ? textArea2.value.match(/Ш/gi).length / textArea2Length * ceiling : 0;275 var Щ0=textArea2.value.match(/Щ/gi) ? textArea2.value.match(/Щ/gi).length / textArea2Length * ceiling : 0;276 var Ь0=textArea2.value.match(/Ь/gi) ? textArea2.value.match(/Ь/gi).length / textArea2Length * ceiling : 0;277 var Ы0=textArea2.value.match(/Ы/gi) ? textArea2.value.match(/Ы/gi).length / textArea2Length * ceiling : 0;278 var Ъ0=textArea2.value.match(/Ъ/gi) ? textArea2.value.match(/Ъ/gi).length / textArea2Length * ceiling : 0;279 var Э0=textArea2.value.match(/Э/gi) ? textArea2.value.match(/Э/gi).length / textArea2Length * ceiling : 0;280 var Ю0=textArea2.value.match(/Ю/gi) ? textArea2.value.match(/Ю/gi).length / textArea2Length * ceiling : 0;281 var Я0=textArea2.value.match(/Я/gi) ? textArea2.value.match(/Я/gi).length / textArea2Length * ceiling : 0;282 var SPACE0=textArea2.value.match(/ /gi) ? textArea2.value.match(/ /gi).length / textArea2Length * ceiling : 0;283 for (i=1;i<=117;i+=2) {284 context.clearRect(i*(thickness+distance),0,thickness,ceiling);285 }286 lines();287 context.fillStyle="red";288 context.fillRect(1*(thickness+distance),ceiling-A0*factor,thickness,A0*factor);289 context.fillRect(3*(thickness+distance),ceiling-B0*factor,thickness,B0*factor);290 context.fillRect(5*(thickness+distance),ceiling-C0*factor,thickness,C0*factor);291 context.fillRect(7*(thickness+distance),ceiling-D0*factor,thickness,D0*factor);292 context.fillRect(9*(thickness+distance),ceiling-E0*factor,thickness,E0*factor);293 context.fillRect(11*(thickness+distance),ceiling-F0*factor,thickness,F0*factor);294 context.fillRect(13*(thickness+distance),ceiling-G0*factor,thickness,G0*factor);295 context.fillRect(15*(thickness+distance),ceiling-H0*factor,thickness,H0*factor);296 context.fillRect(17*(thickness+distance),ceiling-I0*factor,thickness,I0*factor);297 context.fillRect(19*(thickness+distance),ceiling-J0*factor,thickness,J0*factor);298 context.fillRect(21*(thickness+distance),ceiling-K0*factor,thickness,K0*factor);299 context.fillRect(23*(thickness+distance),ceiling-L0*factor,thickness,L0*factor);300 context.fillRect(25*(thickness+distance),ceiling-M0*factor,thickness,M0*factor);301 context.fillRect(27*(thickness+distance),ceiling-N0*factor,thickness,N0*factor);302 context.fillRect(29*(thickness+distance),ceiling-O0*factor,thickness,O0*factor);303 context.fillRect(31*(thickness+distance),ceiling-P0*factor,thickness,P0*factor);304 context.fillRect(33*(thickness+distance),ceiling-Q0*factor,thickness,Q0*factor);305 context.fillRect(35*(thickness+distance),ceiling-R0*factor,thickness,R0*factor);306 context.fillRect(37*(thickness+distance),ceiling-S0*factor,thickness,S0*factor);307 context.fillRect(39*(thickness+distance),ceiling-T0*factor,thickness,T0*factor);308 context.fillRect(41*(thickness+distance),ceiling-U0*factor,thickness,U0*factor);309 context.fillRect(43*(thickness+distance),ceiling-V0*factor,thickness,V0*factor);310 context.fillRect(45*(thickness+distance),ceiling-W0*factor,thickness,W0*factor);311 context.fillRect(47*(thickness+distance),ceiling-X0*factor,thickness,X0*factor);312 context.fillRect(49*(thickness+distance),ceiling-Y0*factor,thickness,Y0*factor);313 context.fillRect(51*(thickness+distance),ceiling-Z0*factor,thickness,Z0*factor);314 context.fillRect(53*(thickness+distance),ceiling-А0*factor,thickness,А0*factor);315 context.fillRect(55*(thickness+distance),ceiling-Б0*factor,thickness,Б0*factor);316 context.fillRect(57*(thickness+distance),ceiling-В0*factor,thickness,В0*factor);317 context.fillRect(59*(thickness+distance),ceiling-Г0*factor,thickness,Г0*factor);318 context.fillRect(61*(thickness+distance),ceiling-Д0*factor,thickness,Д0*factor);319 context.fillRect(63*(thickness+distance),ceiling-Е0*factor,thickness,Е0*factor);320 context.fillRect(65*(thickness+distance),ceiling-Ё0*factor,thickness,Ё0*factor);321 context.fillRect(67*(thickness+distance),ceiling-Ж0*factor,thickness,Ж0*factor);322 context.fillRect(69*(thickness+distance),ceiling-З0*factor,thickness,З0*factor);323 context.fillRect(71*(thickness+distance),ceiling-И0*factor,thickness,И0*factor);324 context.fillRect(73*(thickness+distance),ceiling-Й0*factor,thickness,Й0*factor);325 context.fillRect(75*(thickness+distance),ceiling-К0*factor,thickness,К0*factor);326 context.fillRect(77*(thickness+distance),ceiling-Л0*factor,thickness,Л0*factor);327 context.fillRect(79*(thickness+distance),ceiling-М0*factor,thickness,М0*factor);328 context.fillRect(81*(thickness+distance),ceiling-Н0*factor,thickness,Н0*factor);329 context.fillRect(83*(thickness+distance),ceiling-О0*factor,thickness,О0*factor);330 context.fillRect(85*(thickness+distance),ceiling-П0*factor,thickness,П0*factor);331 context.fillRect(87*(thickness+distance),ceiling-Р0*factor,thickness,Р0*factor);332 context.fillRect(89*(thickness+distance),ceiling-С0*factor,thickness,С0*factor);333 context.fillRect(91*(thickness+distance),ceiling-Т0*factor,thickness,Т0*factor);334 context.fillRect(93*(thickness+distance),ceiling-У0*factor,thickness,У0*factor);335 context.fillRect(95*(thickness+distance),ceiling-Ф0*factor,thickness,Ф0*factor);336 context.fillRect(97*(thickness+distance),ceiling-Х0*factor,thickness,Х0*factor);337 context.fillRect(99*(thickness+distance),ceiling-Ч0*factor,thickness,Ч0*factor);338 context.fillRect(101*(thickness+distance),ceiling-Ш0*factor,thickness,Ш0*factor);339 context.fillRect(103*(thickness+distance),ceiling-Щ0*factor,thickness,Щ0*factor);340 context.fillRect(105*(thickness+distance),ceiling-Ь0*factor,thickness,Ь0*factor);341 context.fillRect(107*(thickness+distance),ceiling-Ы0*factor,thickness,Ы0*factor);342 context.fillRect(109*(thickness+distance),ceiling-Ъ0*factor,thickness,Ъ0*factor);343 context.fillRect(111*(thickness+distance),ceiling-Э0*factor,thickness,Э0*factor);344 context.fillRect(113*(thickness+distance),ceiling-Ю0*factor,thickness,Ю0*factor);345 context.fillRect(115*(thickness+distance),ceiling-Я0*factor,thickness,Я0*factor);346 context.fillRect(117*(thickness+distance),ceiling-SPACE0*factor,thickness,SPACE0*factor);347};348// Перехватчики событий349EventUtil.addHandler(textArea1,"keyup",blueRect);...

Full Screen

Full Screen

file2.js

Source:file2.js Github

copy

Full Screen

1function csrfSafeMethod(method) {2 // these HTTP methods do not require CSRF protection3 return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));4}5function file2Create() {6 const token = $("input[name='csrfmiddlewaretoken']").val();7 let data;8 const memos = [];9 const author = $("input[name='author']").val();10 const reporting_date = $("input[name='reporting_date']").val();11 const floor_waterspout_1_floor1 = $("input[name='floor_waterspout_1_floor1']").prop('checked');12 const floor_waterspout_1_floor2 = $("input[name='floor_waterspout_1_floor2']").prop('checked');13 const floor_waterspout_1_floor3 = $("input[name='floor_waterspout_1_floor3']").prop('checked');14 const floor_waterspout_2_floor1 = $("input[name='floor_waterspout_2_floor1']").prop('checked');15 const floor_waterspout_2_floor2 = $("input[name='floor_waterspout_2_floor2']").prop('checked');16 const floor_waterspout_2_floor3 = $("input[name='floor_waterspout_2_floor3']").prop('checked');17 const floor_waterspout_3_floor1 = $("input[name='floor_waterspout_3_floor1']").prop('checked');18 const floor_waterspout_3_floor2 = $("input[name='floor_waterspout_3_floor2']").prop('checked');19 const floor_waterspout_3_floor3 = $("input[name='floor_waterspout_3_floor3']").prop('checked');20 const floor_waterspout_4_floor1 = $("input[name='floor_waterspout_4_floor1']").prop('checked');21 const floor_waterspout_4_floor2 = $("input[name='floor_waterspout_4_floor2']").prop('checked');22 const floor_waterspout_4_floor3 = $("input[name='floor_waterspout_4_floor3']").prop('checked');23 const inside_wall_1_floor1 = $("input[name='inside_wall_1_floor1']").prop('checked');24 const inside_wall_1_floor2 = $("input[name='inside_wall_1_floor2']").prop('checked');25 const inside_wall_1_floor3 = $("input[name='inside_wall_1_floor3']").prop('checked');26 const inside_wall_2_floor1 = $("input[name='inside_wall_2_floor1']").prop('checked');27 const inside_wall_2_floor2 = $("input[name='inside_wall_2_floor2']").prop('checked');28 const inside_wall_2_floor3 = $("input[name='inside_wall_2_floor3']").prop('checked');29 const inside_wall_3_floor1 = $("input[name='inside_wall_3_floor1']").prop('checked');30 const inside_wall_3_floor2 = $("input[name='inside_wall_3_floor2']").prop('checked');31 const inside_wall_3_floor3 = $("input[name='inside_wall_3_floor3']").prop('checked');32 const ceiling_1_floor1 = $("input[name='ceiling_1_floor1']").prop('checked');33 const ceiling_1_floor2 = $("input[name='ceiling_1_floor2']").prop('checked');34 const ceiling_1_floor3 = $("input[name='ceiling_1_floor3']").prop('checked');35 const ceiling_2_floor1 = $("input[name='ceiling_2_floor1']").prop('checked');36 const ceiling_2_floor2 = $("input[name='ceiling_2_floor2']").prop('checked');37 const ceiling_2_floor3 = $("input[name='ceiling_2_floor3']").prop('checked');38 const ceiling_3_floor1 = $("input[name='ceiling_3_floor1']").prop('checked');39 const ceiling_3_floor2 = $("input[name='ceiling_3_floor2']").prop('checked');40 const ceiling_3_floor3 = $("input[name='ceiling_3_floor3']").prop('checked');41 const pipe_1_floor1 = $("input[name='pipe_1_floor1']").prop('checked');42 const pipe_1_floor2 = $("input[name='pipe_1_floor2']").prop('checked');43 const pipe_1_floor3 = $("input[name='pipe_1_floor3']").prop('checked');44 const pipe_2_floor1 = $("input[name='pipe_2_floor1']").prop('checked');45 const pipe_2_floor2 = $("input[name='pipe_2_floor2']").prop('checked');46 const pipe_2_floor3 = $("input[name='pipe_2_floor3']").prop('checked');47 const ventilation_1_floor1 = $("input[name='ventilation_1_floor1']").prop('checked');48 const ventilation_1_floor2 = $("input[name='ventilation_1_floor2']").prop('checked');49 const ventilation_1_floor3 = $("input[name='ventilation_1_floor3']").prop('checked');50 const ventilation_2_floor1 = $("input[name='ventilation_2_floor1']").prop('checked');51 const ventilation_2_floor2 = $("input[name='ventilation_2_floor2']").prop('checked');52 const ventilation_2_floor3 = $("input[name='ventilation_2_floor3']").prop('checked');53 const ventilation_3_floor1 = $("input[name='ventilation_3_floor1']").prop('checked');54 const ventilation_3_floor2 = $("input[name='ventilation_3_floor2']").prop('checked');55 const ventilation_3_floor3 = $("input[name='ventilation_3_floor3']").prop('checked');56 const moth_proof_1_floor1 = $("input[name='moth_proof_1_floor1']").prop('checked');57 const moth_proof_1_floor2 = $("input[name='moth_proof_1_floor2']").prop('checked');58 const moth_proof_1_floor3 = $("input[name='moth_proof_1_floor3']").prop('checked');59 const moth_proof_2_floor1 = $("input[name='moth_proof_2_floor1']").prop('checked');60 const moth_proof_2_floor2 = $("input[name='moth_proof_2_floor2']").prop('checked');61 const moth_proof_2_floor3 = $("input[name='moth_proof_2_floor3']").prop('checked');62 const moth_proof_3_floor1 = $("input[name='moth_proof_3_floor1']").prop('checked');63 const moth_proof_3_floor2 = $("input[name='moth_proof_3_floor2']").prop('checked');64 const moth_proof_3_floor3 = $("input[name='moth_proof_3_floor3']").prop('checked');65 const moth_proof_4_floor1 = $("input[name='moth_proof_4_floor1']").prop('checked');66 const moth_proof_4_floor2 = $("input[name='moth_proof_4_floor2']").prop('checked');67 const moth_proof_4_floor3 = $("input[name='moth_proof_4_floor3']").prop('checked');68 const moth_proof_5_floor1 = $("input[name='moth_proof_5_floor1']").prop('checked');69 const moth_proof_5_floor2 = $("input[name='moth_proof_5_floor2']").prop('checked');70 const moth_proof_5_floor3 = $("input[name='moth_proof_5_floor3']").prop('checked');71 const waste_1_floor1 = $("input[name='waste_1_floor1']").prop('checked');72 const waste_2_floor1 = $("input[name='waste_2_floor1']").prop('checked');73 const waste_3_floor1 = $("input[name='waste_3_floor1']").prop('checked');74 const waste_4_floor1 = $("input[name='waste_4_floor1']").prop('checked');75 const work_place_1_floor1 = $("input[name='work_place_1_floor1']").prop('checked');76 const work_place_2_floor1 = $("input[name='work_place_2_floor1']").prop('checked');77 const work_place_3_floor1 = $("input[name='work_place_3_floor1']").prop('checked');78 $('#table2 tbody tr').each(function () {79 const write_at = $(this).find("[name='write_at']").val();80 const content = $(this).find("[name='content']").val();81 const feedback_content = $(this).find("[name='feedback_content']").val();82 const manager = $(this).find("[name='manager']").val();83 const approver = $(this).find("[name='approver']").val();84 if (content || feedback_content || manager || approver) {85 memos.push({86 write_at: write_at,87 content: content,88 feedback_content: feedback_content,89 manager: manager,90 approver: approver,91 })92 }93 })94 data = {95 "author": author,96 "reporting_date": reporting_date,97 "floor_waterspout_1_floor1": floor_waterspout_1_floor1,98 "floor_waterspout_1_floor2": floor_waterspout_1_floor2,99 "floor_waterspout_1_floor3": floor_waterspout_1_floor3,100 "floor_waterspout_2_floor1": floor_waterspout_2_floor1,101 "floor_waterspout_2_floor2": floor_waterspout_2_floor2,102 "floor_waterspout_2_floor3": floor_waterspout_2_floor3,103 "floor_waterspout_3_floor1": floor_waterspout_3_floor1,104 "floor_waterspout_3_floor2": floor_waterspout_3_floor2,105 "floor_waterspout_3_floor3": floor_waterspout_3_floor3,106 "floor_waterspout_4_floor1": floor_waterspout_4_floor1,107 "floor_waterspout_4_floor2": floor_waterspout_4_floor2,108 "floor_waterspout_4_floor3": floor_waterspout_4_floor3,109 "inside_wall_1_floor1": inside_wall_1_floor1,110 "inside_wall_1_floor2": inside_wall_1_floor2,111 "inside_wall_1_floor3": inside_wall_1_floor3,112 "inside_wall_2_floor1": inside_wall_2_floor1,113 "inside_wall_2_floor2": inside_wall_2_floor2,114 "inside_wall_2_floor3": inside_wall_2_floor3,115 "inside_wall_3_floor1": inside_wall_3_floor1,116 "inside_wall_3_floor2": inside_wall_3_floor2,117 "inside_wall_3_floor3": inside_wall_3_floor3,118 "ceiling_1_floor1": ceiling_1_floor1,119 "ceiling_1_floor2": ceiling_1_floor2,120 "ceiling_1_floor3": ceiling_1_floor3,121 "ceiling_2_floor1": ceiling_2_floor1,122 "ceiling_2_floor2": ceiling_2_floor2,123 "ceiling_2_floor3": ceiling_2_floor3,124 "ceiling_3_floor1": ceiling_3_floor1,125 "ceiling_3_floor2": ceiling_3_floor2,126 "ceiling_3_floor3": ceiling_3_floor3,127 "pipe_1_floor1": pipe_1_floor1,128 "pipe_1_floor2": pipe_1_floor2,129 "pipe_1_floor3": pipe_1_floor3,130 "pipe_2_floor1": pipe_2_floor1,131 "pipe_2_floor2": pipe_2_floor2,132 "pipe_2_floor3": pipe_2_floor3,133 "ventilation_1_floor1": ventilation_1_floor1,134 "ventilation_1_floor2": ventilation_1_floor2,135 "ventilation_1_floor3": ventilation_1_floor3,136 "ventilation_2_floor1": ventilation_2_floor1,137 "ventilation_2_floor2": ventilation_2_floor2,138 "ventilation_2_floor3": ventilation_2_floor3,139 "ventilation_3_floor1": ventilation_3_floor1,140 "ventilation_3_floor2": ventilation_3_floor2,141 "ventilation_3_floor3": ventilation_3_floor3,142 "moth_proof_1_floor1": moth_proof_1_floor1,143 "moth_proof_1_floor2": moth_proof_1_floor2,144 "moth_proof_1_floor3": moth_proof_1_floor3,145 "moth_proof_2_floor1": moth_proof_2_floor1,146 "moth_proof_2_floor2": moth_proof_2_floor2,147 "moth_proof_2_floor3": moth_proof_2_floor3,148 "moth_proof_3_floor1": moth_proof_3_floor1,149 "moth_proof_3_floor2": moth_proof_3_floor2,150 "moth_proof_3_floor3": moth_proof_3_floor3,151 "moth_proof_4_floor1": moth_proof_4_floor1,152 "moth_proof_4_floor2": moth_proof_4_floor2,153 "moth_proof_4_floor3": moth_proof_4_floor3,154 "moth_proof_5_floor1": moth_proof_5_floor1,155 "moth_proof_5_floor2": moth_proof_5_floor2,156 "moth_proof_5_floor3": moth_proof_5_floor3,157 "waste_1_floor1": waste_1_floor1,158 "waste_2_floor1": waste_2_floor1,159 "waste_3_floor1": waste_3_floor1,160 "waste_4_floor1": waste_4_floor1,161 "work_place_1_floor1": work_place_1_floor1,162 "work_place_2_floor1": work_place_2_floor1,163 "work_place_3_floor1": work_place_3_floor1,164 "memos": memos,165 }166 console.log(data)167 $.ajax({168 url: "/haccp/api/file2/",169 type: "POST",170 contentType: 'application/json',171 data: JSON.stringify(data),172 beforeSend: function (xhr, settings) {173 if (!csrfSafeMethod(settings.type) && !this.crossDomain) {174 xhr.setRequestHeader("X-CSRFToken", token);175 $(".load_bg").addClass('load_display');176 }177 },178 success: function (response) {179 alert("요청이 수락되었습니다.")180 location.href = "/haccp/file2/";181 },182 error: function (response) {183 alert(response.status);184 alert(response.responseJSON);185 alert(response.error);186 }187 })188}189function file2Update(file_ins_pk) {190 const token = $("input[name='csrfmiddlewaretoken']").val();191 let data;192 const memos = [];193 const author = $("input[name='author']").val();194 const reporting_date = $("input[name='reporting_date']").val();195 const floor_waterspout_1_floor1 = $("input[name='floor_waterspout_1_floor1']").prop('checked');196 const floor_waterspout_1_floor2 = $("input[name='floor_waterspout_1_floor2']").prop('checked');197 const floor_waterspout_1_floor3 = $("input[name='floor_waterspout_1_floor3']").prop('checked');198 const floor_waterspout_2_floor1 = $("input[name='floor_waterspout_2_floor1']").prop('checked');199 const floor_waterspout_2_floor2 = $("input[name='floor_waterspout_2_floor2']").prop('checked');200 const floor_waterspout_2_floor3 = $("input[name='floor_waterspout_2_floor3']").prop('checked');201 const floor_waterspout_3_floor1 = $("input[name='floor_waterspout_3_floor1']").prop('checked');202 const floor_waterspout_3_floor2 = $("input[name='floor_waterspout_3_floor2']").prop('checked');203 const floor_waterspout_3_floor3 = $("input[name='floor_waterspout_3_floor3']").prop('checked');204 const floor_waterspout_4_floor1 = $("input[name='floor_waterspout_4_floor1']").prop('checked');205 const floor_waterspout_4_floor2 = $("input[name='floor_waterspout_4_floor2']").prop('checked');206 const floor_waterspout_4_floor3 = $("input[name='floor_waterspout_4_floor3']").prop('checked');207 const inside_wall_1_floor1 = $("input[name='inside_wall_1_floor1']").prop('checked');208 const inside_wall_1_floor2 = $("input[name='inside_wall_1_floor2']").prop('checked');209 const inside_wall_1_floor3 = $("input[name='inside_wall_1_floor3']").prop('checked');210 const inside_wall_2_floor1 = $("input[name='inside_wall_2_floor1']").prop('checked');211 const inside_wall_2_floor2 = $("input[name='inside_wall_2_floor2']").prop('checked');212 const inside_wall_2_floor3 = $("input[name='inside_wall_2_floor3']").prop('checked');213 const inside_wall_3_floor1 = $("input[name='inside_wall_3_floor1']").prop('checked');214 const inside_wall_3_floor2 = $("input[name='inside_wall_3_floor2']").prop('checked');215 const inside_wall_3_floor3 = $("input[name='inside_wall_3_floor3']").prop('checked');216 const ceiling_1_floor1 = $("input[name='ceiling_1_floor1']").prop('checked');217 const ceiling_1_floor2 = $("input[name='ceiling_1_floor2']").prop('checked');218 const ceiling_1_floor3 = $("input[name='ceiling_1_floor3']").prop('checked');219 const ceiling_2_floor1 = $("input[name='ceiling_2_floor1']").prop('checked');220 const ceiling_2_floor2 = $("input[name='ceiling_2_floor2']").prop('checked');221 const ceiling_2_floor3 = $("input[name='ceiling_2_floor3']").prop('checked');222 const ceiling_3_floor1 = $("input[name='ceiling_3_floor1']").prop('checked');223 const ceiling_3_floor2 = $("input[name='ceiling_3_floor2']").prop('checked');224 const ceiling_3_floor3 = $("input[name='ceiling_3_floor3']").prop('checked');225 const pipe_1_floor1 = $("input[name='pipe_1_floor1']").prop('checked');226 const pipe_1_floor2 = $("input[name='pipe_1_floor2']").prop('checked');227 const pipe_1_floor3 = $("input[name='pipe_1_floor3']").prop('checked');228 const pipe_2_floor1 = $("input[name='pipe_2_floor1']").prop('checked');229 const pipe_2_floor2 = $("input[name='pipe_2_floor2']").prop('checked');230 const pipe_2_floor3 = $("input[name='pipe_2_floor3']").prop('checked');231 const ventilation_1_floor1 = $("input[name='ventilation_1_floor1']").prop('checked');232 const ventilation_1_floor2 = $("input[name='ventilation_1_floor2']").prop('checked');233 const ventilation_1_floor3 = $("input[name='ventilation_1_floor3']").prop('checked');234 const ventilation_2_floor1 = $("input[name='ventilation_2_floor1']").prop('checked');235 const ventilation_2_floor2 = $("input[name='ventilation_2_floor2']").prop('checked');236 const ventilation_2_floor3 = $("input[name='ventilation_2_floor3']").prop('checked');237 const ventilation_3_floor1 = $("input[name='ventilation_3_floor1']").prop('checked');238 const ventilation_3_floor2 = $("input[name='ventilation_3_floor2']").prop('checked');239 const ventilation_3_floor3 = $("input[name='ventilation_3_floor3']").prop('checked');240 const moth_proof_1_floor1 = $("input[name='moth_proof_1_floor1']").prop('checked');241 const moth_proof_1_floor2 = $("input[name='moth_proof_1_floor2']").prop('checked');242 const moth_proof_1_floor3 = $("input[name='moth_proof_1_floor3']").prop('checked');243 const moth_proof_2_floor1 = $("input[name='moth_proof_2_floor1']").prop('checked');244 const moth_proof_2_floor2 = $("input[name='moth_proof_2_floor2']").prop('checked');245 const moth_proof_2_floor3 = $("input[name='moth_proof_2_floor3']").prop('checked');246 const moth_proof_3_floor1 = $("input[name='moth_proof_3_floor1']").prop('checked');247 const moth_proof_3_floor2 = $("input[name='moth_proof_3_floor2']").prop('checked');248 const moth_proof_3_floor3 = $("input[name='moth_proof_3_floor3']").prop('checked');249 const moth_proof_4_floor1 = $("input[name='moth_proof_4_floor1']").prop('checked');250 const moth_proof_4_floor2 = $("input[name='moth_proof_4_floor2']").prop('checked');251 const moth_proof_4_floor3 = $("input[name='moth_proof_4_floor3']").prop('checked');252 const moth_proof_5_floor1 = $("input[name='moth_proof_5_floor1']").prop('checked');253 const moth_proof_5_floor2 = $("input[name='moth_proof_5_floor2']").prop('checked');254 const moth_proof_5_floor3 = $("input[name='moth_proof_5_floor3']").prop('checked');255 const waste_1_floor1 = $("input[name='waste_1_floor1']").prop('checked');256 const waste_2_floor1 = $("input[name='waste_2_floor1']").prop('checked');257 const waste_3_floor1 = $("input[name='waste_3_floor1']").prop('checked');258 const waste_4_floor1 = $("input[name='waste_4_floor1']").prop('checked');259 const work_place_1_floor1 = $("input[name='work_place_1_floor1']").prop('checked');260 const work_place_2_floor1 = $("input[name='work_place_2_floor1']").prop('checked');261 const work_place_3_floor1 = $("input[name='work_place_3_floor1']").prop('checked');262 $('#table2 tbody tr').each(function () {263 const write_at = $(this).find("[name='write_at']").val();264 const content = $(this).find("[name='content']").val();265 const feedback_content = $(this).find("[name='feedback_content']").val();266 const manager = $(this).find("[name='manager']").val();267 const approver = $(this).find("[name='approver']").val();268 if (content || feedback_content || manager || approver) {269 memos.push({270 write_at: write_at,271 content: content,272 feedback_content: feedback_content,273 manager: manager,274 approver: approver,275 })276 }277 })278 data = {279 "author": author,280 "reporting_date":reporting_date,281 "floor_waterspout_1_floor1": floor_waterspout_1_floor1,282 "floor_waterspout_1_floor2": floor_waterspout_1_floor2,283 "floor_waterspout_1_floor3": floor_waterspout_1_floor3,284 "floor_waterspout_2_floor1": floor_waterspout_2_floor1,285 "floor_waterspout_2_floor2": floor_waterspout_2_floor2,286 "floor_waterspout_2_floor3": floor_waterspout_2_floor3,287 "floor_waterspout_3_floor1": floor_waterspout_3_floor1,288 "floor_waterspout_3_floor2": floor_waterspout_3_floor2,289 "floor_waterspout_3_floor3": floor_waterspout_3_floor3,290 "floor_waterspout_4_floor1": floor_waterspout_4_floor1,291 "floor_waterspout_4_floor2": floor_waterspout_4_floor2,292 "floor_waterspout_4_floor3": floor_waterspout_4_floor3,293 "inside_wall_1_floor1": inside_wall_1_floor1,294 "inside_wall_1_floor2": inside_wall_1_floor2,295 "inside_wall_1_floor3": inside_wall_1_floor3,296 "inside_wall_2_floor1": inside_wall_2_floor1,297 "inside_wall_2_floor2": inside_wall_2_floor2,298 "inside_wall_2_floor3": inside_wall_2_floor3,299 "inside_wall_3_floor1": inside_wall_3_floor1,300 "inside_wall_3_floor2": inside_wall_3_floor2,301 "inside_wall_3_floor3": inside_wall_3_floor3,302 "ceiling_1_floor1": ceiling_1_floor1,303 "ceiling_1_floor2": ceiling_1_floor2,304 "ceiling_1_floor3": ceiling_1_floor3,305 "ceiling_2_floor1": ceiling_2_floor1,306 "ceiling_2_floor2": ceiling_2_floor2,307 "ceiling_2_floor3": ceiling_2_floor3,308 "ceiling_3_floor1": ceiling_3_floor1,309 "ceiling_3_floor2": ceiling_3_floor2,310 "ceiling_3_floor3": ceiling_3_floor3,311 "pipe_1_floor1": pipe_1_floor1,312 "pipe_1_floor2": pipe_1_floor2,313 "pipe_1_floor3": pipe_1_floor3,314 "pipe_2_floor1": pipe_2_floor1,315 "pipe_2_floor2": pipe_2_floor2,316 "pipe_2_floor3": pipe_2_floor3,317 "ventilation_1_floor1": ventilation_1_floor1,318 "ventilation_1_floor2": ventilation_1_floor2,319 "ventilation_1_floor3": ventilation_1_floor3,320 "ventilation_2_floor1": ventilation_2_floor1,321 "ventilation_2_floor2": ventilation_2_floor2,322 "ventilation_2_floor3": ventilation_2_floor3,323 "ventilation_3_floor1": ventilation_3_floor1,324 "ventilation_3_floor2": ventilation_3_floor2,325 "ventilation_3_floor3": ventilation_3_floor3,326 "moth_proof_1_floor1": moth_proof_1_floor1,327 "moth_proof_1_floor2": moth_proof_1_floor2,328 "moth_proof_1_floor3": moth_proof_1_floor3,329 "moth_proof_2_floor1": moth_proof_2_floor1,330 "moth_proof_2_floor2": moth_proof_2_floor2,331 "moth_proof_2_floor3": moth_proof_2_floor3,332 "moth_proof_3_floor1": moth_proof_3_floor1,333 "moth_proof_3_floor2": moth_proof_3_floor2,334 "moth_proof_3_floor3": moth_proof_3_floor3,335 "moth_proof_4_floor1": moth_proof_4_floor1,336 "moth_proof_4_floor2": moth_proof_4_floor2,337 "moth_proof_4_floor3": moth_proof_4_floor3,338 "moth_proof_5_floor1": moth_proof_5_floor1,339 "moth_proof_5_floor2": moth_proof_5_floor2,340 "moth_proof_5_floor3": moth_proof_5_floor3,341 "waste_1_floor1": waste_1_floor1,342 "waste_2_floor1": waste_2_floor1,343 "waste_3_floor1": waste_3_floor1,344 "waste_4_floor1": waste_4_floor1,345 "work_place_1_floor1": work_place_1_floor1,346 "work_place_2_floor1": work_place_2_floor1,347 "work_place_3_floor1": work_place_3_floor1,348 "memos": memos,349 }350 console.log(data)351 $.ajax({352 url: `/haccp/api/file2/${file_ins_pk}/`,353 type: "PATCH",354 contentType: 'application/json',355 data: JSON.stringify(data),356 beforeSend: function (xhr, settings) {357 if (!csrfSafeMethod(settings.type) && !this.crossDomain) {358 xhr.setRequestHeader("X-CSRFToken", token);359 $(".load_bg").addClass('load_display');360 }361 },362 success: function (response) {363 alert("요청이 수락되었습니다.")364 // location.href = `/haccp/file1/${file_ins_pk}/`;365 location.reload();366 },367 error: function (response) {368 alert(response.status);369 alert(response.responseJSON);370 alert(response.error);371 }372 })373}374function exportTables2(instance_pk) {375 var token = $("input[name='csrfmiddlewaretoken']").val();376 $.ajax({377 url: "/haccp/download/",378 type: 'POST',379 data: {380 csrfmiddlewaretoken: token,381 type_number: 'file2',382 pk: instance_pk383 },384 beforeSend: function (xhr, settings) {385 $(".load_bg").addClass('load_display');386 },387 success: function (data) {388 if (data.result == 'success') {389 $(".load_bg").removeClass('load_display');390 var a = document.createElement('a');391 a.href = '/media/' + "file2.xlsx";392 a.download = '작업장환경 위생점검표' + ".xlsx";393 a.click();394 }395 }396 });...

Full Screen

Full Screen

airport_script_base_2020.js

Source:airport_script_base_2020.js Github

copy

Full Screen

1function getAirportState(airport, ceiling, visibility, winddir, windspeed, cnd)2{3 var state = null;4 5 switch (airport)6 {7 case "ABQ":8 if ( (ceiling < 1000) || (visibility < 3))9 state = "IMC";10 else if ( (ceiling >= 3000) && (visibility >= 5))11 state = "VMC";12 else13 state = "MMC";14 break;15 case "ANC":16 if ( (ceiling < 1000) || (visibility < 3))17 state = "IMC";18 else if ( (ceiling >= 3000) && (visibility >= 5))19 state = "VMC";20 else21 state = "MMC";22 break;23 case "ATL":24 if ( (ceiling < 1000) || (visibility < 3))25 state = "IMC";26 else if ( (ceiling >= 3600) && (visibility >= 7))27 state = "VMC";28 else29 state = "MMC";30 break;31 case "AUS":32 if ( (ceiling < 1000) || (visibility < 3))33 state = "IMC";34 else if ( (ceiling >= 3500) && (visibility >= 3))35 state = "VMC";36 else37 state = "MMC";38 break;39 case "BDL":40 if ( (ceiling < 1000) || (visibility < 3))41 state = "IMC";42 else if ( (ceiling >= 3000) && (visibility >= 7))43 state = "VMC";44 else45 state = "MMC";46 break;47 case "BHM":48 if ( (ceiling < 1000) || (visibility < 3))49 state = "IMC";50 else if ( (ceiling >= 2400) && (visibility >= 3))51 state = "VMC";52 else53 state = "MMC";54 break;55 case "BNA":56 if ( (ceiling < 1000) || (visibility < 3))57 state = "IMC";58 else if ( (ceiling >= 2600) && (visibility >= 3))59 state = "VMC";60 else61 state = "MMC";62 break;63 case "BOS":64 if ( (ceiling < 1000) || (visibility < 3))65 state = "IMC";66 else if ( (ceiling >= 2500) && (visibility >= 3))67 state = "VMC";68 else69 state = "MMC";70 break;71 case "BUF":72 if ( (ceiling < 1000) || (visibility < 3))73 state = "IMC";74 else if ( (ceiling >= 2300) && (visibility >= 3))75 state = "VMC";76 else77 state = "MMC";78 break;79 case "BUR":80 if ( (ceiling < 1000) || (visibility < 3))81 state = "IMC";82 else if ( (ceiling >= 3500) && (visibility >= 3))83 state = "VMC";84 else85 state = "MMC";86 break;87 case "BWI":88 if ( (ceiling < 1000) || (visibility < 3))89 state = "IMC";90 else if ( (ceiling >= 2500) && (visibility >= 5))91 state = "VMC";92 else93 state = "MMC";94 break;95 case "CLE":96 if ( (ceiling < 1000) || (visibility < 3))97 state = "IMC";98 else if ( (ceiling >= 2600) && (visibility >= 3))99 state = "VMC";100 else101 state = "MMC";102 break;103 case "CLT":104 if ( (ceiling < 1000) || (visibility < 3))105 state = "IMC";106 else if ( (ceiling >= 3600) && (visibility >= 5))107 state = "VMC";108 else109 state = "MMC";110 break;111 case "CVG":112 if ( (ceiling < 1000) || (visibility < 3))113 state = "IMC";114 else if ( (ceiling >= 2900) && (visibility >= 3))115 state = "VMC";116 else117 state = "MMC";118 break;119 case "DAL":120 if ( (ceiling < 1000) || (visibility < 3))121 state = "IMC";122 else if ( (ceiling >= 2400) && (visibility >= 3))123 state = "VMC";124 else125 state = "MMC";126 break;127 case "DAY":128 if ( (ceiling < 1000) || (visibility < 3))129 state = "IMC";130 else if ( (ceiling >= 2800) && (visibility >= 3))131 state = "VMC";132 else133 state = "MMC";134 break;135 case "DCA":136 if ( (ceiling < 1000) || (visibility < 3))137 state = "IMC";138 else if ( (ceiling >= 3000) && (visibility >= 4))139 state = "VMC";140 else141 state = "MMC";142 break;143 case "DEN":144 if ( (ceiling < 1000) || (visibility < 3))145 state = "IMC";146 else if ( (ceiling >= 2000) && (visibility >= 3))147 state = "VMC";148 else149 state = "MMC";150 break;151 case "DFW":152 if ( (ceiling < 1000) || (visibility < 3))153 state = "IMC";154 else if ( (ceiling >= 3500) && (visibility >= 5))155 state = "VMC";156 else157 state = "MMC";158 break;159 case "DTW":160 if ( (ceiling < 1000) || (visibility < 3))161 state = "IMC";162 else if ( (ceiling >= 3000) && (visibility >= 5))163 state = "VMC";164 else165 state = "MMC";166 break;167 case "EWR":168 if ( (ceiling < 1000) || (visibility < 3))169 state = "IMC";170 else if ( (ceiling >= 3000) && (visibility >= 4))171 state = "VMC";172 else173 state = "MMC";174 break;175 case "FLL":176 if ( (ceiling < 1000) || (visibility < 3))177 state = "IMC";178 else if ( (ceiling >= 4000) && (visibility >= 5))179 state = "VMC";180 else181 state = "MMC";182 break;183 case "GYY":184 if ( (ceiling < 1000) || (visibility < 3))185 state = "IMC";186 else if ( (ceiling >= 1000) && (visibility >= 3))187 state = "VMC";188 else189 state = "MMC";190 break;191 case "HNL":192 if ( (ceiling < 1000) || (visibility < 3))193 state = "IMC";194 else if ( (ceiling >= 2500) && (visibility >= 3))195 state = "VMC";196 else197 state = "MMC";198 break;199 case "HOU":200 if ( (ceiling < 1000) || (visibility < 3))201 state = "IMC";202 else if ( (ceiling >= 2100) && (visibility >= 3))203 state = "VMC";204 else205 state = "MMC";206 break;207 case "HPN":208 if ( (ceiling < 1000) || (visibility < 3))209 state = "IMC";210 else if ( (ceiling >= 3500) && (visibility >= 5))211 state = "VMC";212 else213 state = "MMC";214 break;215 case "IAD":216 if ( (ceiling < 1000) || (visibility < 3))217 state = "IMC";218 else if ( (ceiling >= 3000) && (visibility >= 7))219 state = "VMC";220 else221 state = "MMC";222 break;223 case "IAH":224 if ( (ceiling < 1000) || (visibility < 3))225 state = "IMC";226 else if ( (ceiling >= 4000) && (visibility >= 8))227 state = "VMC";228 else229 state = "MMC";230 break;231 case "IND":232 if ( (ceiling < 1000) || (visibility < 3))233 state = "IMC";234 else if ( (ceiling >= 2200) && (visibility >= 3))235 state = "VMC";236 else237 state = "MMC";238 break;239 case "ISP":240 if ( (ceiling < 1000) || (visibility < 3))241 state = "IMC";242 else if ( (ceiling >= 2500) && (visibility >= 5))243 state = "VMC";244 else245 state = "MMC";246 break;247 case "JAX":248 if ( (ceiling < 1000) || (visibility < 3))249 state = "IMC";250 else if ( (ceiling >= 2100) && (visibility >= 3))251 state = "VMC";252 else253 state = "MMC";254 break;255 case "JFK":256 if ( (ceiling < 1000) || (visibility < 3))257 state = "IMC";258 else if ( (ceiling >= 2000) && (visibility >= 4))259 state = "VMC";260 else261 state = "MMC";262 break;263 case "LAS":264 if ( (ceiling < 1000) || (visibility < 3))265 state = "IMC";266 else if ( (ceiling >= 5000) && (visibility >= 5))267 state = "VMC";268 else269 state = "MMC";270 break;271 case "LAX":272 if ( (ceiling < 1000) || (visibility < 3))273 state = "IMC";274 else if ( (ceiling >= 2500) && (visibility >= 3))275 state = "VMC";276 else277 state = "MMC";278 break;279 case "LGA":280 if ( (ceiling < 1000) || (visibility < 3))281 state = "IMC";282 else if ( (ceiling >= 3200) && (visibility >= 4))283 state = "VMC";284 else285 state = "MMC";286 break;287 case "LGB":288 if ( (ceiling < 1000) || (visibility < 3))289 state = "IMC";290 else if ( (ceiling >= 2100) && (visibility >= 3))291 state = "VMC";292 else293 state = "MMC";294 break;295 case "MCI":296 if ( (ceiling < 1000) || (visibility < 3))297 state = "IMC";298 else if ( (ceiling >= 2000) && (visibility >= 3))299 state = "VMC";300 else301 state = "MMC";302 break;303 case "MCO":304 if ( (ceiling < 1000) || (visibility < 3))305 state = "IMC";306 else if ( (ceiling >= 2500) && (visibility >= 3))307 state = "VMC";308 else309 state = "MMC";310 break;311 case "MDW":312 if ( (ceiling < 1000) || (visibility < 3))313 state = "IMC";314 else if ( (ceiling >= 1900) && (visibility >= 3))315 state = "VMC";316 else317 state = "MMC";318 break;319 case "MEM":320 if ( (ceiling < 1000) || (visibility < 3))321 state = "IMC";322 else if ( (ceiling >= 5000) && (visibility >= 5))323 state = "VMC";324 else325 state = "MMC";326 break;327 case "MHT":328 if ( (ceiling < 1000) || (visibility < 3))329 state = "IMC";330 else if ( (ceiling >= 2500) && (visibility >= 5))331 state = "VMC";332 else333 state = "MMC";334 break;335 case "MIA":336 if ( (ceiling < 1000) || (visibility < 3))337 state = "IMC";338 else if ( (ceiling >= 2000) && (visibility >= 5))339 state = "VMC";340 else341 state = "MMC";342 break;343 case "MKE":344 if ( (ceiling < 1000) || (visibility < 3))345 state = "IMC";346 else if ( (ceiling >= 2300) && (visibility >= 3))347 state = "VMC";348 else349 state = "MMC";350 break;351 case "MSP":352 if ( (ceiling < 1000) || (visibility < 3))353 state = "IMC";354 else if ( (ceiling >= 3500) && (visibility >= 8))355 state = "VMC";356 else357 state = "MMC";358 break;359 case "MSY":360 if ( (ceiling < 1000) || (visibility < 3))361 state = "IMC";362 else if ( (ceiling >= 2000) && (visibility >= 5))363 state = "VMC";364 else365 state = "MMC";366 break;367 case "OAK":368 if ( (ceiling < 1000) || (visibility < 3))369 state = "IMC";370 else if ( (ceiling >= 2500) && (visibility >= 8))371 state = "VMC";372 else373 state = "MMC";374 break;375 case "OMA":376 if ( (ceiling < 1000) || (visibility < 3))377 state = "IMC";378 else if ( (ceiling >= 2500) && (visibility >= 5))379 state = "VMC";380 else381 state = "MMC";382 break;383 case "ONT":384 if ( (ceiling < 1000) || (visibility < 3))385 state = "IMC";386 else if ( (ceiling >= 3000) && (visibility >= 3))387 state = "VMC";388 else389 state = "MMC";390 break;391 case "ORD":392 if ( (ceiling < 1000) || (visibility < 3))393 state = "IMC";394 else if ( (ceiling >= 1900) && (visibility >= 3))395 state = "VMC";396 else397 state = "MMC";398 break;399 case "OXR":400 if ( (ceiling < 1000) || (visibility < 3))401 state = "IMC";402 else if ( (ceiling >= 1000) && (visibility >= 3))403 state = "VMC";404 else405 state = "MMC";406 break;407 case "PBI":408 if ( (ceiling < 1000) || (visibility < 3))409 state = "IMC";410 else if ( (ceiling >= 2000) && (visibility >= 3))411 state = "VMC";412 else413 state = "MMC";414 break;415 case "PDX":416 if ( (ceiling < 1000) || (visibility < 3))417 state = "IMC";418 else if ( (ceiling >= 3500) && (visibility >= 8))419 state = "VMC";420 else421 state = "MMC";422 break;423 case "PHL":424 if ( (ceiling < 1000) || (visibility < 3))425 state = "IMC";426 else if ( (ceiling >= 2300) && (visibility >= 4))427 state = "VMC";428 else429 state = "MMC";430 break;431 case "PHX":432 if ( (ceiling < 1000) || (visibility < 3))433 state = "IMC";434 else if ( (ceiling >= 3300) && (visibility >= 7))435 state = "VMC";436 else437 state = "MMC";438 break;439 case "PIT":440 if ( (ceiling < 1000) || (visibility < 3))441 state = "IMC";442 else if ( (ceiling >= 1800) && (visibility >= 3))443 state = "VMC";444 else445 state = "MMC";446 break;447 case "PVD":448 if ( (ceiling < 1000) || (visibility < 3))449 state = "IMC";450 else if ( (ceiling >= 2000) && (visibility >= 3))451 state = "VMC";452 else453 state = "MMC";454 break;455 case "RDU":456 if ( (ceiling < 1000) || (visibility < 3))457 state = "IMC";458 else if ( (ceiling >= 4000) && (visibility >= 5))459 state = "VMC";460 else461 state = "MMC";462 break;463 case "RFD":464 if ( (ceiling < 1000) || (visibility < 3))465 state = "IMC";466 else if ( (ceiling >= 1000) && (visibility >= 3))467 state = "VMC";468 else469 state = "MMC";470 break;471 case "RSW":472 if ( (ceiling < 1000) || (visibility < 3))473 state = "IMC";474 else if ( (ceiling >= 2100) && (visibility >= 3))475 state = "VMC";476 else477 state = "MMC";478 break;479 case "SAN":480 if ( (ceiling < 1000) || (visibility < 3))481 state = "IMC";482 else if ( (ceiling >= 2000) && (visibility >= 3))483 state = "VMC";484 else485 state = "MMC";486 break;487 case "SAT":488 if ( (ceiling < 1000) || (visibility < 3))489 state = "IMC";490 else if ( (ceiling >= 3000) && (visibility >= 5))491 state = "VMC";492 else493 state = "MMC";494 break;495 case "SDF":496 if ( (ceiling < 1000) || (visibility < 3))497 state = "IMC";498 else if ( (ceiling >= 3000) && (visibility >= 3))499 state = "VMC";500 else501 state = "MMC";502 break;503 case "SEA":504 if ( (ceiling < 1000) || (visibility < 3))505 state = "IMC";506 else if ( (ceiling >= 4000) && (visibility >= 3))507 state = "VMC";508 else509 state = "MMC";510 break;511 case "SFO":512 if ( (ceiling < 1000) || (visibility < 3))513 state = "IMC";514 else if ( (ceiling >= 3500) && (visibility >= 8))515 state = "VMC";516 else517 state = "MMC";518 break;519 case "SJC":520 if ( (ceiling < 1000) || (visibility < 3))521 state = "IMC";522 else if ( (ceiling >= 2500) && (visibility >= 5))523 state = "VMC";524 else525 state = "MMC";526 break;527 case "SLC":528 if ( (ceiling < 1000) || (visibility < 3))529 state = "IMC";530 else if ( (ceiling >= 5300) && (visibility >= 3))531 state = "VMC";532 else533 state = "MMC";534 break;535 case "SNA":536 if ( (ceiling < 1000) || (visibility < 3))537 state = "IMC";538 else if ( (ceiling >= 3000) && (visibility >= 5))539 state = "VMC";540 else541 state = "MMC";542 break;543 case "STL":544 if ( (ceiling < 1000) || (visibility < 3))545 state = "IMC";546 else if ( (ceiling >= 5000) && (visibility >= 5))547 state = "VMC";548 else549 state = "MMC";550 break;551 case "SWF":552 if ( (ceiling < 1000) || (visibility < 3))553 state = "IMC";554 else if ( (ceiling >= 1000) && (visibility >= 3))555 state = "VMC";556 else557 state = "MMC";558 break;559 case "TEB":560 if ( (ceiling < 1000) || (visibility < 3))561 state = "IMC";562 else if ( (ceiling >= 3500) && (visibility >= 5))563 state = "VMC";564 else565 state = "MMC";566 break;567 case "TPA":568 if ( (ceiling < 1000) || (visibility < 3))569 state = "IMC";570 else if ( (ceiling >= 2100) && (visibility >= 3))571 state = "VMC";572 else573 state = "MMC";574 break;575 case "TUS":576 if ( (ceiling < 1000) || (visibility < 3))577 state = "IMC";578 else if ( (ceiling >= 7500) && (visibility >= 3))579 state = "VMC";580 else581 state = "MMC";582 break;583 case "VNY":584 if ( (ceiling < 1000) || (visibility < 3))585 state = "IMC";586 else if ( (ceiling >= 1000) && (visibility >= 3))587 state = "VMC";588 else589 state = "MMC";590 break;591 case "ALB":592 case "BOI":593 case "BFL":594 case "BTR":595 case "CHS":596 case "CMH":597 case "COS":598 case "CRP":599 case "DAB":600 case "DSM":601 case "ELP":602 case "EUG":603 case "FAT":604 case "FNT":605 case "FXE":606 case "GFK":607 case "GRR":608 case "GSO":609 case "ICT":610 case "JNU":611 case "LAN":612 case "LIT":613 case "MLB":614 case "MSN":615 case "ORF":616 case "OKC":617 case "PHF":618 case "PIE":619 case "RIC":620 case "RNO":621 case "ROC":622 case "SBA":623 case "SMF":624 case "SYR":625 case "TUL":626 case "TVC":627 case "TYS":628 if ( (ceiling < 1000) || (visibility < 3))629 state = "IMC";630 else if ( (ceiling >= 3000) && (visibility >= 5))631 state = "VMC";632 else633 state = "MMC";634 break;635 }636 637 //state = airport + "_" + state + "_BASE";638 return state;...

Full Screen

Full Screen

airport_script_nonbase_2020.js

Source:airport_script_nonbase_2020.js Github

copy

Full Screen

1function getAirportState(airport, ceiling, visibility, winddir, windspeed, cnd)2{3 var state = null;4 5 switch (airport)6 {7 case "ABQ":8 if ( (ceiling < 1000) || (visibility < 3))9 state = "IMC";10 else if ( (ceiling >= 3000) && (visibility >= 5))11 state = "VMC";12 else13 state = "MMC";14 break;15 case "ANC":16 if ( (ceiling < 1000) || (visibility < 3))17 state = "IMC";18 else if ( (ceiling >= 3000) && (visibility >= 5))19 state = "VMC";20 else21 state = "MMC";22 break;23 case "ATL":24 if ( (ceiling < 1000) || (visibility < 3))25 state = "IMC";26 else if ( (ceiling >= 3600) && (visibility >= 7))27 state = "VMC";28 else29 state = "MMC";30 break;31 case "AUS":32 if ( (ceiling < 1000) || (visibility < 3))33 state = "IMC";34 else if ( (ceiling >= 3500) && (visibility >= 3))35 state = "VMC";36 else37 state = "MMC";38 break;39 case "BDL":40 if ( (ceiling < 1000) || (visibility < 3))41 state = "IMC";42 else if ( (ceiling >= 3000) && (visibility >= 7))43 state = "VMC";44 else45 state = "MMC";46 break;47 case "BHM":48 if ( (ceiling < 1000) || (visibility < 3))49 state = "IMC";50 else if ( (ceiling >= 2400) && (visibility >= 3))51 state = "VMC";52 else53 state = "MMC";54 break;55 case "BNA":56 if ( (ceiling < 1000) || (visibility < 3))57 state = "IMC";58 else if ( (ceiling >= 2600) && (visibility >= 3))59 state = "VMC";60 else61 state = "MMC";62 break;63 case "BOS":64 if ( (ceiling < 1000) || (visibility < 3))65 state = "IMC";66 else if ( (ceiling >= 2500) && (visibility >= 3))67 state = "VMC";68 else69 state = "MMC";70 break;71 case "BUF":72 if ( (ceiling < 1000) || (visibility < 3))73 state = "IMC";74 else if ( (ceiling >= 2300) && (visibility >= 3))75 state = "VMC";76 else77 state = "MMC";78 break;79 case "BUR":80 if ( (ceiling < 1000) || (visibility < 3))81 state = "IMC";82 else if ( (ceiling >= 3500) && (visibility >= 3))83 state = "VMC";84 else85 state = "MMC";86 break;87 case "BWI":88 if ( (ceiling < 1000) || (visibility < 3))89 state = "IMC";90 else if ( (ceiling >= 2500) && (visibility >= 5))91 state = "VMC";92 else93 state = "MMC";94 break;95 case "CLE":96 if ( (ceiling < 1000) || (visibility < 3))97 state = "IMC";98 else if ( (ceiling >= 2600) && (visibility >= 3))99 state = "VMC";100 else101 state = "MMC";102 break;103 case "CLT":104 if ( (ceiling < 1000) || (visibility < 3))105 state = "IMC";106 else if ( (ceiling >= 3600) && (visibility >= 5))107 state = "VMC";108 else109 state = "MMC";110 break;111 case "CVG":112 if ( (ceiling < 1000) || (visibility < 3))113 state = "IMC";114 else if ( (ceiling >= 2900) && (visibility >= 3))115 state = "VMC";116 else117 state = "MMC";118 break;119 case "DAL":120 if ( (ceiling < 1000) || (visibility < 3))121 state = "IMC";122 else if ( (ceiling >= 2400) && (visibility >= 3))123 state = "VMC";124 else125 state = "MMC";126 break;127 case "DAY":128 if ( (ceiling < 1000) || (visibility < 3))129 state = "IMC";130 else if ( (ceiling >= 2800) && (visibility >= 3))131 state = "VMC";132 else133 state = "MMC";134 break;135 case "DCA":136 if ( (ceiling < 1000) || (visibility < 3))137 state = "IMC";138 else if ( (ceiling >= 3000) && (visibility >= 4))139 state = "VMC";140 else141 state = "MMC";142 break;143 case "DEN":144 if ( (ceiling < 1000) || (visibility < 3))145 state = "IMC";146 else if ( (ceiling >= 2000) && (visibility >= 3))147 state = "VMC";148 else149 state = "MMC";150 break;151 case "DFW":152 if ( (ceiling < 1000) || (visibility < 3))153 state = "IMC";154 else if ( (ceiling >= 3500) && (visibility >= 5))155 state = "VMC";156 else157 state = "MMC";158 break;159 case "DTW":160 if ( (ceiling < 1000) || (visibility < 3))161 state = "IMC";162 else if ( (ceiling >= 3000) && (visibility >= 5))163 state = "VMC";164 else165 state = "MMC";166 break;167 case "EWR":168 if ( (ceiling < 1000) || (visibility < 3))169 state = "IMC";170 else if ( (ceiling >= 3000) && (visibility >= 4))171 state = "VMC";172 else173 state = "MMC";174 break;175 case "FLL":176 if ( (ceiling < 1000) || (visibility < 3))177 state = "IMC";178 else if ( (ceiling >= 4000) && (visibility >= 5))179 state = "VMC";180 else181 state = "MMC";182 break;183 case "GYY":184 if ( (ceiling < 1000) || (visibility < 3))185 state = "IMC";186 else if ( (ceiling >= 1000) && (visibility >= 3))187 state = "VMC";188 else189 state = "MMC";190 break;191 case "HNL":192 if ( (ceiling < 1000) || (visibility < 3))193 state = "IMC";194 else if ( (ceiling >= 2500) && (visibility >= 3))195 state = "VMC";196 else197 state = "MMC";198 break;199 case "HOU":200 if ( (ceiling < 1000) || (visibility < 3))201 state = "IMC";202 else if ( (ceiling >= 2100) && (visibility >= 3))203 state = "VMC";204 else205 state = "MMC";206 break;207 case "HPN":208 if ( (ceiling < 1000) || (visibility < 3))209 state = "IMC";210 else if ( (ceiling >= 3500) && (visibility >= 5))211 state = "VMC";212 else213 state = "MMC";214 break;215 case "IAD":216 if ( (ceiling < 1000) || (visibility < 3))217 state = "IMC";218 else if ( (ceiling >= 3000) && (visibility >= 7))219 state = "VMC";220 else221 state = "MMC";222 break;223 case "IAH":224 if ( (ceiling < 1000) || (visibility < 3))225 state = "IMC";226 else if ( (ceiling >= 4000) && (visibility >= 8))227 state = "VMC";228 else229 state = "MMC";230 break;231 case "IND":232 if ( (ceiling < 1000) || (visibility < 3))233 state = "IMC";234 else if ( (ceiling >= 2200) && (visibility >= 3))235 state = "VMC";236 else237 state = "MMC";238 break;239 case "ISP":240 if ( (ceiling < 1000) || (visibility < 3))241 state = "IMC";242 else if ( (ceiling >= 2500) && (visibility >= 5))243 state = "VMC";244 else245 state = "MMC";246 break;247 case "JAX":248 if ( (ceiling < 1000) || (visibility < 3))249 state = "IMC";250 else if ( (ceiling >= 2100) && (visibility >= 3))251 state = "VMC";252 else253 state = "MMC";254 break;255 case "JFK":256 if ( (ceiling < 1000) || (visibility < 3))257 state = "IMC";258 else if ( (ceiling >= 2000) && (visibility >= 4))259 state = "VMC";260 else261 state = "MMC";262 break;263 case "LAS":264 if ( (ceiling < 1000) || (visibility < 3))265 state = "IMC";266 else if ( (ceiling >= 5000) && (visibility >= 5))267 state = "VMC";268 else269 state = "MMC";270 break;271 case "LAX":272 if ( (ceiling < 1000) || (visibility < 3))273 state = "IMC";274 else if ( (ceiling >= 2500) && (visibility >= 3))275 state = "VMC";276 else277 state = "MMC";278 break;279 case "LGA":280 if ( (ceiling < 1000) || (visibility < 3))281 state = "IMC";282 else if ( (ceiling >= 3200) && (visibility >= 4))283 state = "VMC";284 else285 state = "MMC";286 break;287 case "LGB":288 if ( (ceiling < 1000) || (visibility < 3))289 state = "IMC";290 else if ( (ceiling >= 2100) && (visibility >= 3))291 state = "VMC";292 else293 state = "MMC";294 break;295 case "MCI":296 if ( (ceiling < 1000) || (visibility < 3))297 state = "IMC";298 else if ( (ceiling >= 2000) && (visibility >= 3))299 state = "VMC";300 else301 state = "MMC";302 break;303 case "MCO":304 if ( (ceiling < 1000) || (visibility < 3))305 state = "IMC";306 else if ( (ceiling >= 2500) && (visibility >= 3))307 state = "VMC";308 else309 state = "MMC";310 break;311 case "MDW":312 if ( (ceiling < 1000) || (visibility < 3))313 state = "IMC";314 else if ( (ceiling >= 1900) && (visibility >= 3))315 state = "VMC";316 else317 state = "MMC";318 break;319 case "MEM":320 if ( (ceiling < 1000) || (visibility < 3))321 state = "IMC";322 else if ( (ceiling >= 5000) && (visibility >= 5))323 state = "VMC";324 else325 state = "MMC";326 break;327 case "MHT":328 if ( (ceiling < 1000) || (visibility < 3))329 state = "IMC";330 else if ( (ceiling >= 2500) && (visibility >= 5))331 state = "VMC";332 else333 state = "MMC";334 break;335 case "MIA":336 if ( (ceiling < 1000) || (visibility < 3))337 state = "IMC";338 else if ( (ceiling >= 2000) && (visibility >= 5))339 state = "VMC";340 else341 state = "MMC";342 break;343 case "MKE":344 if ( (ceiling < 1000) || (visibility < 3))345 state = "IMC";346 else if ( (ceiling >= 2300) && (visibility >= 3))347 state = "VMC";348 else349 state = "MMC";350 break;351 case "MSP":352 if ( (ceiling < 1000) || (visibility < 3))353 state = "IMC";354 else if ( (ceiling >= 3500) && (visibility >= 8))355 state = "VMC";356 else357 state = "MMC";358 break;359 case "MSY":360 if ( (ceiling < 1000) || (visibility < 3))361 state = "IMC";362 else if ( (ceiling >= 2000) && (visibility >= 5))363 state = "VMC";364 else365 state = "MMC";366 break;367 case "OAK":368 if ( (ceiling < 1000) || (visibility < 3))369 state = "IMC";370 else if ( (ceiling >= 2500) && (visibility >= 8))371 state = "VMC";372 else373 state = "MMC";374 break;375 case "OMA":376 if ( (ceiling < 1000) || (visibility < 3))377 state = "IMC";378 else if ( (ceiling >= 2500) && (visibility >= 5))379 state = "VMC";380 else381 state = "MMC";382 break;383 case "ONT":384 if ( (ceiling < 1000) || (visibility < 3))385 state = "IMC";386 else if ( (ceiling >= 3000) && (visibility >= 3))387 state = "VMC";388 else389 state = "MMC";390 break;391 case "ORD":392 if ( (ceiling < 1000) || (visibility < 3))393 state = "IMC";394 else if ( (ceiling >= 1900) && (visibility >= 3))395 state = "VMC";396 else397 state = "MMC";398 break;399 case "OXR":400 if ( (ceiling < 1000) || (visibility < 3))401 state = "IMC";402 else if ( (ceiling >= 1000) && (visibility >= 3))403 state = "VMC";404 else405 state = "MMC";406 break;407 case "PBI":408 if ( (ceiling < 1000) || (visibility < 3))409 state = "IMC";410 else if ( (ceiling >= 2000) && (visibility >= 3))411 state = "VMC";412 else413 state = "MMC";414 break;415 case "PDX":416 if ( (ceiling < 1000) || (visibility < 3))417 state = "IMC";418 else if ( (ceiling >= 3500) && (visibility >= 8))419 state = "VMC";420 else421 state = "MMC";422 break;423 case "PHL":424 if ( (ceiling < 1000) || (visibility < 3))425 state = "IMC";426 else if ( (ceiling >= 2300) && (visibility >= 4))427 state = "VMC";428 else429 state = "MMC";430 break;431 case "PHX":432 if ( (ceiling < 1000) || (visibility < 3))433 state = "IMC";434 else if ( (ceiling >= 3300) && (visibility >= 7))435 state = "VMC";436 else437 state = "MMC";438 break;439 case "PIT":440 if ( (ceiling < 1000) || (visibility < 3))441 state = "IMC";442 else if ( (ceiling >= 1800) && (visibility >= 3))443 state = "VMC";444 else445 state = "MMC";446 break;447 case "PVD":448 if ( (ceiling < 1000) || (visibility < 3))449 state = "IMC";450 else if ( (ceiling >= 2000) && (visibility >= 3))451 state = "VMC";452 else453 state = "MMC";454 break;455 case "RDU":456 if ( (ceiling < 1000) || (visibility < 3))457 state = "IMC";458 else if ( (ceiling >= 4000) && (visibility >= 5))459 state = "VMC";460 else461 state = "MMC";462 break;463 case "RFD":464 if ( (ceiling < 1000) || (visibility < 3))465 state = "IMC";466 else if ( (ceiling >= 1000) && (visibility >= 3))467 state = "VMC";468 else469 state = "MMC";470 break;471 case "RSW":472 if ( (ceiling < 1000) || (visibility < 3))473 state = "IMC";474 else if ( (ceiling >= 2100) && (visibility >= 3))475 state = "VMC";476 else477 state = "MMC";478 break;479 case "SAN":480 if ( (ceiling < 1000) || (visibility < 3))481 state = "IMC";482 else if ( (ceiling >= 2000) && (visibility >= 3))483 state = "VMC";484 else485 state = "MMC";486 break;487 case "SAT":488 if ( (ceiling < 1000) || (visibility < 3))489 state = "IMC";490 else if ( (ceiling >= 3000) && (visibility >= 5))491 state = "VMC";492 else493 state = "MMC";494 break;495 case "SDF":496 if ( (ceiling < 1000) || (visibility < 3))497 state = "IMC";498 else if ( (ceiling >= 3000) && (visibility >= 3))499 state = "VMC";500 else501 state = "MMC";502 break;503 case "SEA":504 if ( (ceiling < 1000) || (visibility < 3))505 state = "IMC";506 else if ( (ceiling >= 4000) && (visibility >= 3))507 state = "VMC";508 else509 state = "MMC";510 break;511 case "SFO":512 if ( (ceiling < 1000) || (visibility < 3))513 state = "IMC";514 else if ( (ceiling >= 3500) && (visibility >= 8))515 state = "VMC";516 else517 state = "MMC";518 break;519 case "SJC":520 if ( (ceiling < 1000) || (visibility < 3))521 state = "IMC";522 else if ( (ceiling >= 2500) && (visibility >= 5))523 state = "VMC";524 else525 state = "MMC";526 break;527 case "SLC":528 if ( (ceiling < 1000) || (visibility < 3))529 state = "IMC";530 else if ( (ceiling >= 5300) && (visibility >= 3))531 state = "VMC";532 else533 state = "MMC";534 break;535 case "SNA":536 if ( (ceiling < 1000) || (visibility < 3))537 state = "IMC";538 else if ( (ceiling >= 3000) && (visibility >= 5))539 state = "VMC";540 else541 state = "MMC";542 break;543 case "STL":544 if ( (ceiling < 1000) || (visibility < 3))545 state = "IMC";546 else if ( (ceiling >= 5000) && (visibility >= 5))547 state = "VMC";548 else549 state = "MMC";550 break;551 case "SWF":552 if ( (ceiling < 1000) || (visibility < 3))553 state = "IMC";554 else if ( (ceiling >= 1000) && (visibility >= 3))555 state = "VMC";556 else557 state = "MMC";558 break;559 case "TEB":560 if ( (ceiling < 1000) || (visibility < 3))561 state = "IMC";562 else if ( (ceiling >= 3500) && (visibility >= 5))563 state = "VMC";564 else565 state = "MMC";566 break;567 case "TPA":568 if ( (ceiling < 1000) || (visibility < 3))569 state = "IMC";570 else if ( (ceiling >= 2100) && (visibility >= 3))571 state = "VMC";572 else573 state = "MMC";574 break;575 case "TUS":576 if ( (ceiling < 1000) || (visibility < 3))577 state = "IMC";578 else if ( (ceiling >= 7500) && (visibility >= 3))579 state = "VMC";580 else581 state = "MMC";582 break;583 case "VNY":584 if ( (ceiling < 1000) || (visibility < 3))585 state = "IMC";586 else if ( (ceiling >= 1000) && (visibility >= 3))587 state = "VMC";588 else589 state = "MMC";590 break;591 case "ALB":592 case "BOI":593 case "BFL":594 case "BTR":595 case "CHS":596 case "CMH":597 case "COS":598 case "CRP":599 case "DAB":600 case "DSM":601 case "ELP":602 case "EUG":603 case "FAT":604 case "FNT":605 case "FXE":606 case "GFK":607 case "GRR":608 case "GSO":609 case "ICT":610 case "JNU":611 case "LAN":612 case "LIT":613 case "MLB":614 case "MSN":615 case "ORF":616 case "OKC":617 case "PHF":618 case "PIE":619 case "RIC":620 case "RNO":621 case "ROC":622 case "SBA":623 case "SMF":624 case "SYR":625 case "TUL":626 case "TVC":627 case "TYS":628 if ( (ceiling < 1000) || (visibility < 3))629 state = "IMC";630 else if ( (ceiling >= 3000) && (visibility >= 5))631 state = "VMC";632 else633 state = "MMC";634 break;635 }636 637 //state = airport + "_" + state + "_BASE";638 return state;...

Full Screen

Full Screen

dynamicCeiling.js

Source:dynamicCeiling.js Github

copy

Full Screen

1// Simulate dynamic ceilings2const DynamicCeiling = artifacts.require("DynamicCeiling");3const setHiddenCurves = require("./helpers/hiddenCurves.js").setHiddenCurves;4contract("DynamicCeiling", function(accounts) {5 let dynamicCeiling;6 const curves = [7 [web3.toWei(1000), 30, 10**12],8 [web3.toWei(21000), 30, 10**12],9 [web3.toWei(61000), 30, 10**12],10 ];11 it("Deploys dynamicCeiling", async function() {12 dynamicCeiling = await DynamicCeiling.new(accounts[0], accounts[0]);13 assert.equal(await dynamicCeiling.currentIndex(), 0);14 });15 it("Checks that toCollect is 0 before curves are set", async function() {16 assert.equal(await dynamicCeiling.toCollect.call(0), 0);17 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(10)), 0);18 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(15)), 0);19 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(20)), 0);20 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(30)), 0);21 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(55)), 0);22 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(676)), 0);23 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(5555)), 0);24 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(10**8)), 0);25 assert.equal(await dynamicCeiling.currentIndex(), 0);26 });27 it("Sets the curves", async function() {28 await setHiddenCurves(dynamicCeiling, curves);29 assert.equal(await dynamicCeiling.nCurves(), 10);30 });31 it("Checks that toCollect is 0 before curves are revealed", async function() {32 assert.equal(await dynamicCeiling.toCollect.call('0'), '0');33 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(10)), 0);34 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(15)), 0);35 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(20)), 0);36 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(30)), 0);37 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(55)), 0);38 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(676)), 0);39 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(5555)), 0);40 assert.equal(await dynamicCeiling.toCollect.call(web3.toWei(10**8)), 0);41 assert.equal(await dynamicCeiling.currentIndex(), 0);42 });43 it("Reveals 1st curve", async function() {44 await dynamicCeiling.revealCurve(45 curves[0][0],46 curves[0][1],47 curves[0][2],48 false,49 web3.sha3("pwd0"));50 assert.equal(await dynamicCeiling.revealedCurves(), 1);51 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '0');52 assert.equal(await dynamicCeiling.allRevealed(), false);53 });54 it("Checks toCollect after 1st curve is revealed", async function() {55 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '0');56 assert.equal((await dynamicCeiling.toCollect.call(0)).toFixed(), '33333333333333333333');57 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(10))).toFixed(), '33000000000000000000');58 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(15))).toFixed(), '32833333333333333333');59 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(20))).toFixed(), '32666666666666666666');60 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(30))).toFixed(), '32333333333333333333');61 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(55))).toFixed(), '31500000000000000000');62 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(676))).toFixed(), '10800000000000000000');63 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(999))).toFixed(), '33333333333333333');64 assert.equal((await dynamicCeiling.toCollect.call('999999999998999999999')).toFixed(), '1000000001');65 assert.equal((await dynamicCeiling.toCollect.call('999999999999000000000')).toFixed(), '1000000000');66 assert.equal((await dynamicCeiling.toCollect.call('999999999999999999999')).toFixed(), '1');67 await dynamicCeiling.toCollect(curves[0][0]);68 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '0');69 assert.equal((await dynamicCeiling.toCollect.call(curves[0][0])).toFixed(), '0');70 });71 it("Reveals 2nd curve", async function() {72 await dynamicCeiling.revealCurve(73 curves[1][0],74 curves[1][1],75 curves[1][2],76 false,77 web3.sha3("pwd1"));78 assert.equal(await dynamicCeiling.revealedCurves(), 2);79 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '0');80 assert.equal(await dynamicCeiling.allRevealed(), false);81 });82 it("Checks toCollect after 2nd curve is revealed", async function() {83 await dynamicCeiling.toCollect(curves[0][0]);84 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '1');85 assert.equal((await dynamicCeiling.toCollect.call(curves[0][0])).toFixed(), '666666666666666666666')86 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1010))).toFixed(), '666333333333333333333');87 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1015))).toFixed(), '666166666666666666666');88 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1020))).toFixed(), '666000000000000000000');89 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1030))).toFixed(), '665666666666666666666');90 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(1055))).toFixed(), '664833333333333333333');91 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(10676))).toFixed(), '344133333333333333333');92 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(10999))).toFixed(), '333366666666666666666');93 assert.equal((await dynamicCeiling.toCollect.call('20999999999998999999999')).toFixed(), '1000000001');94 assert.equal((await dynamicCeiling.toCollect.call('20999999999999000000000')).toFixed(), '1000000000');95 assert.equal((await dynamicCeiling.toCollect.call('20999999999999999999999')).toFixed(), '1');96 await dynamicCeiling.toCollect(curves[1][0]);97 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '1');98 assert.equal((await dynamicCeiling.toCollect.call(curves[1][0])).toFixed(), '0');99 });100 it("Reveals last curve", async function() {101 await dynamicCeiling.revealCurve(102 curves[2][0],103 curves[2][1],104 curves[2][2],105 true,106 web3.sha3("pwd2"));107 assert.equal(await dynamicCeiling.revealedCurves(), 3);108 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '1');109 assert.equal(await dynamicCeiling.allRevealed(), true);110 });111 it("Checks toCollect after 3rd curve is revealed", async function() {112 await dynamicCeiling.toCollect(curves[1][0]);113 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '2');114 assert.equal((await dynamicCeiling.toCollect.call(curves[1][0])).toFixed(), '1333333333333333333333');115 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21010))).toFixed(), '1333000000000000000000');116 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21015))).toFixed(), '1332833333333333333333');117 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21020))).toFixed(), '1332666666666666666666');118 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21030))).toFixed(), '1332333333333333333333');119 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21055))).toFixed(), '1331500000000000000000');120 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21676))).toFixed(), '1310800000000000000000');121 assert.equal((await dynamicCeiling.toCollect.call(web3.toWei(21999))).toFixed(), '1300033333333333333333');122 assert.equal((await dynamicCeiling.toCollect.call('60999999999998999999999')).toFixed(), '1000000001');123 assert.equal((await dynamicCeiling.toCollect.call('60999999999999000000000')).toFixed(), '1000000000');124 assert.equal((await dynamicCeiling.toCollect.call('60999999999999999999999')).toFixed(), '1');125 await dynamicCeiling.toCollect(curves[2][0]);126 assert.equal((await dynamicCeiling.currentIndex()).toFixed(), '2');127 assert.equal((await dynamicCeiling.toCollect.call(curves[2][0])).toFixed(), '0');128 });129 it("Deploys dynamicCeiling", async function() {130 dynamicCeiling = await DynamicCeiling.new(accounts[0], accounts[0]);131 assert.equal(await dynamicCeiling.currentIndex(), 0);132 });133 it("Sets the curves", async function() {134 await setHiddenCurves(dynamicCeiling, curves);135 assert.equal(await dynamicCeiling.nCurves(), 10);136 });137 it("Reveals multiple curves", async function() {138 await dynamicCeiling.revealMulti(139 [140 curves[0][0],141 curves[1][0],142 curves[2][0],143 ],144 [145 curves[0][1],146 curves[1][1],147 curves[2][1],148 ],149 [150 curves[0][2],151 curves[1][2],152 curves[2][2],153 ],154 [155 false,156 false,157 true,158 ],159 [160 web3.sha3("pwd0"),161 web3.sha3("pwd1"),162 web3.sha3("pwd2"),163 ]164 );165 assert.equal(await dynamicCeiling.currentIndex(), 0);166 assert.equal(await dynamicCeiling.revealedCurves(), 3);167 assert.equal(await dynamicCeiling.allRevealed(), true);168 });...

Full Screen

Full Screen

brendaroom.js

Source:brendaroom.js Github

copy

Full Screen

1var brendaroomAssets = {2 'w': {3 'type': 'wall',4 'texture': [5 'yellowwall', // e6 'yellowwall', // w7 'floor', // ?8 'floor', // ?9 'yellowwall', // s10 'yellowwall' // n11 ],12 'solid': true13 },14 'e': {15 'type': 'wall',16 'texture': 'elevator-up',17 'action': function () {18 }19 },20 't': {21 'type': 'wall',22 'texture': 'elevator-down',23 'action': function () {24 warp(floor1, floor1Assets, 9, 4, 1);25 }26 },27 'y': {28 'type': 'wall',29 'texture': 'elevator-buttons',30 'solid': true31 },32 'j': {33 'type': 'wall',34 'texture': 'whitedoor-yellow',35 'action': function () {36 warp(floor3, floor3Assets, 2, 4, 3);37 }38 },39 'x': {40 'type': 'wall',41 'texture': 'door-yellow',42 'solid': true43 },44 's': {45 'type': 'short',46 'texture': [47 'counter-side', // e48 'counter-side', // w49 'counter-top', // top50 'counter-top', // bottom51 'counter-side', // s52 'counter-side' // n53 ],54 'floor': 'floor',55 'ceiling': 'ceiling',56 'solid': true,57 'addon': 'flower'58 },59 'c': {60 'type': 'sprite',61 'texture': 'chandelier',62 'floor': 'floor',63 'ceiling': 'ceiling'64 },65 ' ': {66 'type': 'open',67 'floor': 'floor',68 'ceiling': 'ceiling'69 },70 'l': {71 'type': 'sprite',72 'texture': 'plant3',73 'floor': 'floor',74 'ceiling': 'ceiling',75 'solid': true76 },77 'd': {78 'type': 'sprite',79 'texture': 'brenda-1',80 'animation': [81 'brenda-1',82 'brenda-2',83 'brenda-1',84 'brenda-2',85 'brenda-blink',86 'brenda-2',87 'brenda-1',88 'brenda-2'89 ],90 'floor': 'floor',91 'ceiling': 'ceiling',92 'solid': true,93 'action': function () {94 var self = this,95 orig = self.animation;96 if (flags['brendagone']) return;97 self.animation = [98 'brenda-2',99 'brenda-talk',100 'brenda-2',101 'brenda-talk',102 'brenda-2',103 'brenda-blink',104 ];105 if (flags['havered']) {106 runDialogue(107 [108 ['Bahh! You\'ve startled my darlings with those ghastly red hands!', 'brenda-5'],109 ['Come on sweeties! We\'re going back to Florida!', 'brenda-6'],110 ],111 function () {112 flags['brendagone'] = true;113 shrinkAway(self.mesh);114 self.solid = false;115 self.animation = orig;116 }117 );118 }119 else {120 if (!flags['brenda1']) {121 runDialogue(122 [123 ['Oh hehehe. My darlings are so taken with your lovely green hands.', 'brenda-1'],124 ['They said no pets. But I just can\'t live without my sweeties.', 'brenda-2'],125 ['Leave? No, this is our home now. Look how they love it here.', 'brenda-3'],126 ],127 function () {128 flags['brenda1'] = true;129 self.animation = orig;130 }131 );132 }133 else {134 runDialogue(135 [136 ['They adore green. Red, not so much...', 'brenda-4'],137 ],138 function () {139 self.animation = orig;140 }141 );142 }143 }144 },145 'hideif': 'brendagone'146 },147 'b': {148 'type': 'short',149 'texture': [150 'bedside', // e151 'bedside', // w152 'bedtop', // top153 'counter-top', // bottom154 'bedside', // s155 'bedside' // n156 ],157 'floor': 'floor',158 'ceiling': 'ceiling',159 'solid': true160 },161 '6': {162 'type': 'short',163 'texture': [164 'bedside', // e165 'bedside', // w166 'bedtop', // top167 'counter-top', // bottom168 'bedside', // s169 'bedside' // n170 ],171 'floor': 'floor',172 'ceiling': 'ceiling',173 'solid': true,174 'addon': 'high-cat-2',175 'hideif': 'brendagone'176 },177 't': {178 'type': 'short',179 'texture': [180 'counter-side', // e181 'counter-side', // w182 'counter-top', // top183 'counter-top', // bottom184 'counter-side', // s185 'counter-side' // n186 ],187 'floor': 'floor',188 'ceiling': 'ceiling',189 'solid': true,190 'addon': 'phone'191 },192 'f': {193 'type': 'short',194 'texture': [195 'counter-side', // e196 'counter-side', // w197 'counter-top', // top198 'counter-top', // bottom199 'counter-side', // s200 'counter-side' // n201 ],202 'floor': 'floor',203 'ceiling': 'ceiling',204 'solid': true,205 'addon': 'high-cat-1',206 'hideif': 'havekey',207 'action': function () {208 var self = this;209 if (!flags['brendagone'] || flags['havekey']) return;210 runDialogue(211 [212 ['Meow.', 'meow1'],213 ['You found a key!', ''],214 ['Meow.', 'meow2'],215 ],216 function () {217 flags['havekey'] = true;218 shrinkAway(self.mesh);219 }220 );221 }222 },223 '1': {224 'type': 'sprite',225 'texture': 'cat-1',226 'floor': 'floor',227 'ceiling': 'ceiling',228 'hideif': 'brendagone',229 },230 '2': {231 'type': 'sprite',232 'texture': 'cat-2',233 'floor': 'floor',234 'ceiling': 'ceiling',235 'hideif': 'brendagone',236 },237 '3': {238 'type': 'sprite',239 'texture': 'cat-3',240 'floor': 'floor',241 'ceiling': 'ceiling',242 'hideif': 'brendagone',243 },244 '4': {245 'type': 'sprite',246 'texture': 'cat-4',247 'floor': 'floor',248 'ceiling': 'ceiling',249 'hideif': 'brendagone',250 },251 '5': {252 'type': 'sprite',253 'texture': 'cat-5',254 'floor': 'floor',255 'ceiling': 'ceiling',256 'hideif': 'brendagone',257 },258};259var brendaroom = [260 'wwwwww',261 'w61tfw',262 'wb4d w',263 'w2c51x',264 'w352lw',265 'wwjwww',266 'wwwwww',...

Full Screen

Full Screen

danroom.js

Source:danroom.js Github

copy

Full Screen

1var danroomAssets = {2 'w': {3 'type': 'wall',4 'texture': [5 'tallwall', // e6 'tallwall', // w7 'floor', // ?8 'floor', // ?9 'tallwall', // s10 'tallwall' // n11 ],12 'solid': true13 },14 'e': {15 'type': 'wall',16 'texture': 'elevator-up',17 'action': function () {18 }19 },20 't': {21 'type': 'wall',22 'texture': 'elevator-down',23 'action': function () {24 warp(floor1, floor1Assets, 9, 4, 1);25 }26 },27 'y': {28 'type': 'wall',29 'texture': 'elevator-buttons',30 'solid': true31 },32 'j': {33 'type': 'wall',34 'texture': 'whitedoor',35 'action': function () {36 warp(floor2, floor2Assets, 2, 6, 3);37 }38 },39 'x': {40 'type': 'wall',41 'texture': 'door',42 'solid': true43 },44 's': {45 'type': 'short',46 'texture': [47 'counter-side', // e48 'counter-side', // w49 'counter-top', // top50 'counter-top', // bottom51 'counter-side', // s52 'counter-side' // n53 ],54 'floor': 'floor',55 'ceiling': 'ceiling',56 'solid': true,57 'addon': 'flower'58 },59 'c': {60 'type': 'sprite',61 'texture': 'chandelier',62 'floor': 'floor',63 'ceiling': 'ceiling'64 },65 ' ': {66 'type': 'open',67 'floor': 'floor',68 'ceiling': 'ceiling'69 },70 'l': {71 'type': 'sprite',72 'texture': 'plant2',73 'floor': 'floor',74 'ceiling': 'ceiling',75 'solid': true76 },77 'd': {78 'type': 'sprite',79 'texture': 'dan-1',80 'animation': [81 'dan-1',82 'dan-2',83 'dan-1',84 'dan-2',85 'dan-blink',86 'dan-2',87 'dan-1',88 'dan-2'89 ],90 'floor': 'floor',91 'ceiling': 'ceiling',92 'solid': true,93 'action': function () {94 var self = this,95 orig = self.animation;96 if (flags['dangone']) return;97 self.animation = [98 'dan-2',99 'dan-talk',100 'dan-2',101 'dan-talk',102 'dan-2',103 'dan-blink',104 ];105 if (flags['haveteeth']) {106 runDialogue(107 [108 ['WaAhH!? THoSE TeeTH!', 'dan-6'],109 ['OKaY ALRiGHT, i\'M OuTTa HeRE!', 'dan-7'],110 ],111 function () {112 flags['dangone'] = true;113 shrinkAway(self.mesh);114 self.solid = false;115 self.animation = orig;116 }117 );118 }119 else {120 if (!flags['dan1']) {121 runDialogue(122 [123 ['Huh?! What\'chu want??', 'dan-1'],124 ['Dirty?! Look, this place was dirty before I got here...', 'dan-2'],125 ['Leave?! Why?', 'dan-3'],126 ['Scared?! Of you? You don\'t even have any teeth.', 'dan-4'],127 ],128 function () {129 flags['dan1'] = true;130 self.animation = orig;131 }132 );133 }134 else {135 runDialogue(136 [137 ['Huh?! You might be scarier with teeth...', 'dan-5'],138 ],139 function () {140 self.animation = orig;141 }142 );143 }144 }145 },146 'hideif': 'dangone'147 },148 'b': {149 'type': 'short',150 'texture': [151 'bedside', // e152 'bedside', // w153 'bedtop', // top154 'counter-top', // bottom155 'bedside', // s156 'bedside' // n157 ],158 'floor': 'floor',159 'ceiling': 'ceiling',160 'solid': true161 },162 '0': {163 'type': 'short',164 'texture': [165 'bedside', // e166 'bedside', // w167 'bed-dirt', // top168 'counter-top', // bottom169 'bedside', // s170 'bedside' // n171 ],172 'floor': 'floor',173 'ceiling': 'ceiling',174 'solid': true175 },176 't': {177 'type': 'short',178 'texture': [179 'counter-side', // e180 'counter-side', // w181 'counter-top', // top182 'counter-top', // bottom183 'counter-side', // s184 'counter-side' // n185 ],186 'floor': 'floor',187 'ceiling': 'ceiling',188 'solid': true,189 'addon': 'phone'190 },191 'f': {192 'type': 'short',193 'texture': [194 'counter-side', // e195 'counter-side', // w196 'counter-top', // top197 'counter-top', // bottom198 'counter-side', // s199 'counter-side' // n200 ],201 'floor': 'floor',202 'ceiling': 'ceiling',203 'solid': true,204 'addon': 'flower'205 },206 '1': {207 'type': 'open',208 'floor': 'dirt-1',209 'ceiling': 'ceiling'210 },211 '2': {212 'type': 'open',213 'floor': 'dirt-2',214 'ceiling': 'ceiling'215 },216 '3': {217 'type': 'open',218 'floor': 'dirt-3',219 'ceiling': 'ceiling'220 },221 '4': {222 'type': 'open',223 'floor': 'dirt-4',224 'ceiling': 'ceiling'225 },226};227var danroom = [228 'wwwwww',229 'w0 tfw',230 'wb1d4w',231 'w2c3 x',232 'w lw',233 'wwjwww',234 'wwwwww',...

Full Screen

Full Screen

floor3.js

Source:floor3.js Github

copy

Full Screen

1var floor3Assets = {2 'w': {3 'type': 'wall',4 'texture': [5 'yellowwall', // e6 'yellowwall', // w7 'floor', // ?8 'floor', // ?9 'yellowwall', // s10 'yellowwall' // n11 ],12 'solid': true13 },14 'e': {15 'type': 'wall',16 'texture': 'elevator-up-yellow',17 'action': function () {18 warp(floor4, floor4Assets, 3, 11, 0);19 }20 },21 't': {22 'type': 'wall',23 'texture': 'elevator-down-yellow',24 'action': function () {25 warp(floor2, floor2Assets, 4, 11, 0);26 }27 },28 'y': {29 'type': 'wall',30 'texture': 'elevator-buttons-yellow',31 'solid': true32 },33 'j': {34 'type': 'wall',35 'texture': 'whitedoor-yellow',36 'solid': true37 },38 's': {39 'type': 'short',40 'texture': [41 'counter-side', // e42 'counter-side', // w43 'counter-top', // top44 'counter-top', // bottom45 'counter-side', // s46 'counter-side' // n47 ],48 'floor': 'floor',49 'ceiling': 'ceiling',50 'solid': true,51 'addon': 'flower'52 },53 'c': {54 'type': 'sprite',55 'texture': 'chandelier',56 'floor': 'floor',57 'ceiling': 'ceiling'58 },59 ' ': {60 'type': 'open',61 'floor': 'floor',62 'ceiling': 'ceiling'63 },64 'l': {65 'type': 'sprite',66 'texture': 'plant',67 'floor': 'floor',68 'ceiling': 'ceiling',69 'solid': true70 },71 'q': {72 'type': 'sprite',73 'texture': 'plant2',74 'floor': 'floor',75 'ceiling': 'ceiling',76 'solid': true77 },78 'd': {79 'type': 'wall',80 'texture': 'whitedoor-yellow',81 'action': function () {82 warp(brendaroom, brendaroomAssets, 2, 4, 0);83 }84 },85 'k': {86 'type': 'wall',87 'texture': 'whitedoor',88 'action': function () {89 warp(teethroom, teethroomAssets, 2, 4, 0);90 }91 },92 '1': {93 'type': 'sprite',94 'texture': 'cat-1',95 'floor': 'floor',96 'ceiling': 'ceiling',97 'hideif': 'brendagone',98 },99 '2': {100 'type': 'sprite',101 'texture': 'cat-2',102 'floor': 'floor',103 'ceiling': 'ceiling',104 'hideif': 'brendagone',105 },106 '3': {107 'type': 'sprite',108 'texture': 'cat-3',109 'floor': 'floor',110 'ceiling': 'ceiling',111 'hideif': 'brendagone',112 },113 '4': {114 'type': 'sprite',115 'texture': 'cat-4',116 'floor': 'floor',117 'ceiling': 'ceiling',118 'hideif': 'brendagone',119 },120 '5': {121 'type': 'sprite',122 'texture': 'cat-5',123 'floor': 'floor',124 'ceiling': 'ceiling',125 'hideif': 'brendagone',126 },127};128var floor3 = [129 'wwwwwww',130 'wwl 2ww',131 'wj c jw',132 'wwq lww',133 'wd13c2jw',134 'wwl5 qww',135 'wj c4 jw',136 'wwq lww',137 'wj c jw',138 'wwl qww',139 'wj c jw',140 'wwq lww',141 'wwytewww',142 'wwwwwwww',...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: `example.png` });7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await page.screenshot({ path: `example.png` });15 await browser.close();16})();17const { chromium } = require('playwright');18(async () => {19 const browser = await chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await page.screenshot({ path: `example.png` });23 await browser.close();24})();25const { chromium } = require('playwright');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await page.screenshot({ path: `example.png` });31 await browser.close();32})();33const { chromium } = require('playwright');34(async () => {35 const browser = await chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await page.screenshot({ path: `example.png` });39 await browser.close();40})();41const { chromium } = require('playwright');42(async () => {43 const browser = await chromium.launch();44 const context = await browser.newContext();45 const page = await context.newPage();46 await page.screenshot({

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: 'google.png' });7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await page.screenshot({ path: 'google.png' });15 await browser.close();16})();17const { chromium } = require('playwright');18(async () => {19 const browser = await chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await page.screenshot({ path: 'google.png' });23 await browser.close();24})();25const { chromium } = require('playwright');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await page.screenshot({ path: 'google.png' });31 await browser.close();32})();33const { chromium } = require('playwright');34(async () => {35 const browser = await chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await page.screenshot({ path: 'google.png' });39 await browser.close();40})();41const { chromium } = require('playwright');42(async () => {43 const browser = await chromium.launch();44 const context = await browser.newContext();45 const page = await context.newPage();46 await page.screenshot({ path: 'google.png' });47 await browser.close();48})();49const { chromium } =

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.setViewportSize({7 });8 await page.screenshot({ path: 'example.png' });9 await browser.close();10})();11const { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const context = await browser.newContext();15 const page = await context.newPage();16 await page.setViewportSize({17 });18 await page.screenshot({ path: 'example.png' });19 await browser.close();20})();21const { chromium } = require('playwright');22(async () => {23 const browser = await chromium.launch();24 const context = await browser.newContext();25 const page = await context.newPage();26 await page.setViewportSize({27 });28 await page.screenshot({ path: 'example.png' });29 await browser.close();30})();31const { chromium } = require('playwright');32(async () => {33 const browser = await chromium.launch();34 const context = await browser.newContext();35 const page = await context.newPage();36 await page.setViewportSize({37 });38 await page.screenshot({ path: 'example.png' });39 await browser.close();40})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: `google.png` });7 await browser.close();8})();9{10 "scripts": {11 },12 "dependencies": {13 }14}15const { chromium } = require('playwright');16(async () => {17 const browser = await chromium.launch();18 const context = await browser.newContext();19 const page = await context.newPage();20 await page.screenshot({ path: `google.png` });21 await browser.close();22})();23{24 "scripts": {25 },26 "dependencies": {27 }28}29const { chromium } = require('playwright');30(async () => {31 const browser = await chromium.launch();32 const context = await browser.newContext();33 const page = await context.newPage();34 await page.screenshot({ path: `google.png` });35 await browser.close();36})();37{

Full Screen

Using AI Code Generation

copy

Full Screen

1import { chromium } from 'playwright';2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: 'screenshot.png' });7 await browser.close();8})();9import { chromium } from 'playwright';10(async () => {11 const browser = await chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await page.screenshot({ path: 'screenshot.png' });15 await browser.close();16})();17import { chromium } from 'playwright';18(async () => {19 const browser = await chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await page.screenshot({ path: 'screenshot.png' });23 await browser.close();24})();25import { chromium } from 'playwright';26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await page.screenshot({ path: 'screenshot.png' });31 await browser.close();32})();33import { chromium } from 'playwright';34(async () => {35 const browser = await chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await page.screenshot({ path: 'screenshot.png' });39 await browser.close();40})();41import { chromium } from 'playwright';42(async () => {43 const browser = await chromium.launch();44 const context = await browser.newContext();45 const page = await context.newPage();46 await page.screenshot({ path

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = require('playwright');2const {ceil} = require('mathjs');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.screenshot({ path: `example.png` });8 await browser.close();9})();10SyntaxError: Unexpected token 'import'11const {ceil} = require('mathjs');12SyntaxError: Unexpected token 'import'13const {ceil} = require('mathjs');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { ceil } = require('playwright/lib/utils/progress');2const { floor } = require('playwright/lib/utils/progress');3const { round } = require('playwright/lib/utils/progress');4const { toMilliseconds } = require('playwright/lib/utils/progress');5const { toSeconds } = require('playwright/lib/utils/progress');6const { toHuman } = require('playwright/lib/utils/progress');7const { formatTime } = require('playwright/lib/utils/progress');8const { formatBytes } = require('playwright/lib/utils/progress');9const { formatPercent } = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1const { ceil } = require('playwright/lib/utils/utils');2console.log(ceil(2.1));3console.log(ceil(2.9));4console.log(ceil(2.5));5console.log(Math.ceil(2.1));6console.log(Math.ceil(2.9));7console.log(Math.ceil(2.5));

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal 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