How to use func1 method in wpt

Best JavaScript code snippet using wpt

main.js

Source:main.js Github

copy

Full Screen

...107elixer_all[26000055]=7108elixer_all[26000069]=4109elixer_all[26000072]=5110elixer_all[26000074]=4111function func1(c,d){112 if(show.indexOf(c) === -1){113 card_name.push(d)114 show.push(c)115 // alert(card_name)116 elixer.push(elixer_all[c])117118 for(e=0;e<show.length;e++){119 localStorage.setItem(e,show[e])120 localStorage.setItem("number",show.length)121 }122 123 card0 = show[0]+".png";124 card1 = show[1]+".png";125 card2 = show[2]+".png";126 card3 = show[3]+".png";127 card4 = show[4]+".png";128 card5 = show[5]+".png";129 card6 = show[6]+".png";130 card7 = show[7]+".png";131132 let img_0 = document.getElementById("img_0");133 img_0.src = card0;134 let img_1 = document.getElementById("img_1");135 img_1.src = card1;136 let img_2 = document.getElementById("img_2");137 img_2.src = card2;138 let img_3 = document.getElementById("img_3");139 img_3.src = card3;140 let img_4 = document.getElementById("img_4");141 img_4.src = card4;142 let img_5 = document.getElementById("img_5");143 img_5.src = card5;144 let img_6 = document.getElementById("img_6");145 img_6.src = card6;146 let img_7 = document.getElementById("img_7");147 img_7.src = card7;148 if(show.length==9){149 show.pop();150 show.pop();151 }152 if(elixer.length==9){153 elixer.pop();154 }155 if(card_name.length==9){156 card_name.pop();157 }158 elixer_number = 0159 for(a=0;a<elixer.length;a++){160 elixer_number += Number(elixer[a])161 }162 document.getElementById("elixer").innerText = Math.ceil(Number(elixer_number)/Number(elixer.length)*10)/10163 //4カードサイクル164 if(elixer.length>3){165 var elixer2 = elixer.slice();166 elixer2.sort()167 document.getElementById("cycle").innerText =elixer2[0]+elixer2[1]+elixer2[2]+elixer2[3]168 }169 }170}171function func2(){172 // alert(elixer)173 for(e=0;e<show.length;e++){174 localStorage.setItem(e,show[e])175 localStorage.setItem("number",show.length)176 }177 card0 = show[0]+".png";178 card1 = show[1]+".png";179 card2 = show[2]+".png";180 card3 = show[3]+".png";181 card4 = show[4]+".png";182 card5 = show[5]+".png";183 card6 = show[6]+".png";184 card7 = show[7]+".png";185186 let img_0 = document.getElementById("img_0");187 img_0.src = card0;188 let img_1 = document.getElementById("img_1");189 img_1.src = card1;190 let img_2 = document.getElementById("img_2");191 img_2.src = card2;192 let img_3 = document.getElementById("img_3");193 img_3.src = card3;194 let img_4 = document.getElementById("img_4");195 img_4.src = card4;196 let img_5 = document.getElementById("img_5");197 img_5.src = card5;198 let img_6 = document.getElementById("img_6");199 img_6.src = card6;200 let img_7 = document.getElementById("img_7");201 img_7.src = card7;202 elixer_number = 0203 for(a=0;a<elixer.length;a++){204 elixer_number += Number(elixer[a])205 }206 document.getElementById("elixer").innerText = Math.ceil(Number(elixer_number)/Number(elixer.length)*10)/10207 208 //4カードサイクル209 if(elixer.length>3){210 var elixer2 = elixer.slice();211 elixer2.sort()212 document.getElementById("cycle").innerText = elixer2[0]+elixer2[1]+elixer2[2]+elixer2[3]213 }else{214 document.getElementById("cycle").innerText = ""215 }216 217 if(show.length==0){ 218 card = "white.png";219 let img_0 = document.getElementById("img_0");220 img_0.src = card;221 let img_1 = document.getElementById("img_1");222 img_1.src = card;223 let img_2 = document.getElementById("img_2");224 img_2.src = card;225 let img_3 = document.getElementById("img_3");226 img_3.src = card;227 let img_4 = document.getElementById("img_4");228 img_4.src = card;229 let img_5 = document.getElementById("img_5");230 img_5.src = card;231 let img_6 = document.getElementById("img_6");232 img_6.src = card;233 let img_7 = document.getElementById("img_7");234 img_7.src = card;235 document.getElementById("elixer").innerText = ""236 document.getElementById("cycle").innerText = ""237 238 }239}240241//初期設定(ローカルストレージから前回までのやつ更新)242number = localStorage.getItem("number")243for(f=0;f<number;f++){244 g=localStorage.getItem(f)245 h=document.getElementById(g).name246 func1(g,h)247}248249//検索ボタン250document.getElementById("search").addEventListener("click", function () {251 localStorage.clear()252 for(e=0;e<show.length;e++){253 localStorage.setItem(e,show[e])254 localStorage.setItem("number",show.length)255 }256 search_href = "https://royaleapi.com/decks/popular?time=7d&sort=rating&size=20&players=PvP&min_trophies=0&max_trophies=10000&min_elixir=1&max_elixir=9&min_cycle_elixir=4&max_cycle_elixir=28&mode=detail&type=NormalBattle&"257 // inc=skeletons&inc=ice-spirit&&global_exclude=false258 for(b=0;b<card_name.length;b++){259 search_href += "inc="+card_name[b]+"&"260 }261 search_href += "&global_exclude=false"262 location = search_href263}, false);264window.document.onkeydown = function(event1){265 if (event1.key === 'Enter') {266 localStorage.clear()267 for(e=0;e<show.length;e++){268 localStorage.setItem(e,show[e])269 localStorage.setItem("number",show.length)270 }271 search_href = "https://royaleapi.com/decks/popular?time=7d&sort=rating&size=20&players=PvP&min_trophies=0&max_trophies=10000&min_elixir=1&max_elixir=9&min_cycle_elixir=4&max_cycle_elixir=28&mode=detail&type=NormalBattle&"272 // inc=skeletons&inc=ice-spirit&&global_exclude=false273 for(b=0;b<card_name.length;b++){274 search_href += "inc="+card_name[b]+"&"275 }276 search_href += "&global_exclude=false"277 location = search_href 278 279 }280}281282//1つ消去ボタン283document.getElementById("1_delete").addEventListener("click", function () {284 card_name.pop();285 show.pop();286 elixer.pop();287 // alert(elixer)288 func2()289}, false);290document.addEventListener('keypress', keypress1_ivent);291function keypress1_ivent(event2) {292 if(event2.key==="c")293 card_name.pop();294 show.pop();295 elixer.pop();296 func2()297 return false; 298}299300//すべて消去301document.getElementById("all_delete").addEventListener("click", function () {302 localStorage.clear()303 show=[];304 elixer=[];305 card_name =[];306 card = "white.png";307 let img_0 = document.getElementById("img_0");308 img_0.src = card;309 let img_1 = document.getElementById("img_1");310 img_1.src = card;311 let img_2 = document.getElementById("img_2");312 img_2.src = card;313 let img_3 = document.getElementById("img_3");314 img_3.src = card;315 let img_4 = document.getElementById("img_4");316 img_4.src = card;317 let img_5 = document.getElementById("img_5");318 img_5.src = card;319 let img_6 = document.getElementById("img_6");320 img_6.src = card;321 let img_7 = document.getElementById("img_7");322 img_7.src = card;323 document.getElementById("elixer").innerText = ""324 document.getElementById("cycle").innerText =""325 // func1()326}, false);327328329document.getElementById("img-0").addEventListener("click", function () {330 card_name.splice(0,1);331 show.splice(0,1);332 elixer.splice(0,1);333 func2()334}, false);335document.getElementById("img-1").addEventListener("click", function () {336 card_name.splice(1,1);337 show.splice(1,1);338 elixer.splice(1,1);339 func2()340}, false);341document.getElementById("img-2").addEventListener("click", function () {342 card_name.splice(2,1);343 show.splice(2,1);344 elixer.splice(2,1);345 func2()346}, false);347document.getElementById("img-3").addEventListener("click", function () {348 card_name.splice(3,1);349 show.splice(3,1);350 elixer.splice(3,1);351 func2()352}, false);353document.getElementById("img-4").addEventListener("click", function () {354 card_name.splice(4,1);355 show.splice(4,1);356 elixer.splice(4,1);357 func2()358}, false);359document.getElementById("img-5").addEventListener("click", function () {360 card_name.splice(5,1);361 show.splice(5,1);362 elixer.splice(5,1);363 func2()364}, false);365document.getElementById("img-6").addEventListener("click", function () {366 card_name.splice(6,1);367 show.splice(6,1);368 elixer.splice(6,1);369 func2()370}, false);371document.getElementById("img-7").addEventListener("click", function () {372 card_name.splice(7,1);373 show.splice(7,1);374 elixer.splice(7,1);375 func2()376}, false);377378379document.getElementById("26000010").addEventListener("click", function () {380 value1 = document.getElementById("26000010").value381 value2 = document.getElementById("26000010").name382 func1(value1,value2)383}, false);384document.getElementById("26000030").addEventListener("click", function () {385 value1 = document.getElementById("26000030").value386 value2 = document.getElementById("26000030").name387 func1(value1,value2)388}, false);389document.getElementById("26000031").addEventListener("click", function () {390 value1 = document.getElementById("26000031").value391 value2 = document.getElementById("26000031").name392 func1(value1,value2)393}, false);394document.getElementById("26000084").addEventListener("click", function () {395 value1 = document.getElementById("26000084").value396 value2 = document.getElementById("26000084").name397 func1(value1,value2)398}, false);399document.getElementById("26000002").addEventListener("click", function () {400 value1 = document.getElementById("26000002").value401 value2 = document.getElementById("26000002").name402 func1(value1,value2)403}, false);404document.getElementById("26000013").addEventListener("click", function () {405 value1 = document.getElementById("26000013").value406 value2 = document.getElementById("26000013").name407 func1(value1,value2)408}, false);409document.getElementById("26000019").addEventListener("click", function () {410 value1 = document.getElementById("26000019").value411 value2 = document.getElementById("26000019").name412 func1(value1,value2)413}, false);414document.getElementById("26000049").addEventListener("click", function () {415 value1 = document.getElementById("26000049").value416 value2 = document.getElementById("26000049").name417 func1(value1,value2)418}, false);419document.getElementById("28000008").addEventListener("click", function () {420 value1 = document.getElementById("28000008").value421 value2 = document.getElementById("28000008").name422 func1(value1,value2)423}, false);424document.getElementById("28000017").addEventListener("click", function () {425 value1 = document.getElementById("28000017").value426 value2 = document.getElementById("28000017").name427 func1(value1,value2)428}, false);429document.getElementById("26000000").addEventListener("click", function () {430 value1 = document.getElementById("26000000").value431 value2 = document.getElementById("26000000").name432 func1(value1,value2)433}, false);434document.getElementById("26000001").addEventListener("click", function () {435 value1 = document.getElementById("26000001").value436 value2 = document.getElementById("26000001").name437 func1(value1,value2)438}, false);439document.getElementById("26000005").addEventListener("click", function () {440 value1 = document.getElementById("26000005").value441 value2 = document.getElementById("26000005").name442 func1(value1,value2)443}, false);444document.getElementById("26000041").addEventListener("click", function () {445 value1 = document.getElementById("26000041").value446 value2 = document.getElementById("26000041").name447 func1(value1,value2)448}, false);449document.getElementById("26000056").addEventListener("click", function () {450 value1 = document.getElementById("26000056").value451 value2 = document.getElementById("26000056").name452 func1(value1,value2)453}, false);454document.getElementById("26000064").addEventListener("click", function () {455 value1 = document.getElementById("26000064").value456 value2 = document.getElementById("26000064").name457 func1(value1,value2)458}, false);459document.getElementById("27000000").addEventListener("click", function () {460 value1 = document.getElementById("27000000").value461 value2 = document.getElementById("27000000").name462 func1(value1,value2)463}, false);464document.getElementById("28000001").addEventListener("click", function () {465 value1 = document.getElementById("28000001").value466 value2 = document.getElementById("28000001").name467 func1(value1,value2)468}, false);469document.getElementById("28000018").addEventListener("click", function () {470 value1 = document.getElementById("28000018").value471 value2 = document.getElementById("28000018").name472 func1(value1,value2)473}, false);474document.getElementById("26000080").addEventListener("click", function () {475 value1 = document.getElementById("26000080").value476 value2 = document.getElementById("26000080").name477 func1(value1,value2)478}, false);479document.getElementById("27000002").addEventListener("click", function () {480 value1 = document.getElementById("27000002").value481 value2 = document.getElementById("27000002").name482 func1(value1,value2)483}, false);484document.getElementById("27000006").addEventListener("click", function () {485 value1 = document.getElementById("27000006").value486 value2 = document.getElementById("27000006").name487 func1(value1,value2)488}, false);489document.getElementById("26000008").addEventListener("click", function () {490 value1 = document.getElementById("26000008").value491 value2 = document.getElementById("26000008").name492 func1(value1,value2)493}, false);494document.getElementById("26000022").addEventListener("click", function () {495 value1 = document.getElementById("26000022").value496 value2 = document.getElementById("26000022").name497 func1(value1,value2)498}, false);499document.getElementById("26000053").addEventListener("click", function () {500 value1 = document.getElementById("26000053").value501 value2 = document.getElementById("26000053").name502 func1(value1,value2)503}, false);504document.getElementById("26000024").addEventListener("click", function () {505 value1 = document.getElementById("26000024").value506 value2 = document.getElementById("26000024").name507 func1(value1,value2)508}, false);509document.getElementById("26000043").addEventListener("click", function () {510 value1 = document.getElementById("26000043").value511 value2 = document.getElementById("26000043").name512 func1(value1,value2)513}, false);514document.getElementById("26000047").addEventListener("click", function () {515 value1 = document.getElementById("26000047").value516 value2 = document.getElementById("26000047").name517 func1(value1,value2)518}, false);519document.getElementById("28000016").addEventListener("click", function () {520 value1 = document.getElementById("28000016").value521 value2 = document.getElementById("28000016").name522 func1(value1,value2)523}, false);524document.getElementById("26000038").addEventListener("click", function () {525 value1 = document.getElementById("26000038").value526 value2 = document.getElementById("26000038").name527 func1(value1,value2)528}, false);529document.getElementById("26000039").addEventListener("click", function () {530 value1 = document.getElementById("26000039").value531 value2 = document.getElementById("26000039").name532 func1(value1,value2)533}, false);534document.getElementById("26000040").addEventListener("click", function () {535 value1 = document.getElementById("26000040").value536 value2 = document.getElementById("26000040").name537 func1(value1,value2)538}, false);539document.getElementById("26000067").addEventListener("click", function () {540 value1 = document.getElementById("26000067").value541 value2 = document.getElementById("26000067").name542 func1(value1,value2)543}, false);544document.getElementById("27000009").addEventListener("click", function () {545 value1 = document.getElementById("27000009").value546 value2 = document.getElementById("27000009").name547 func1(value1,value2)548}, false);549document.getElementById("28000014").addEventListener("click", function () {550 value1 = document.getElementById("28000014").value551 value2 = document.getElementById("28000014").name552 func1(value1,value2)553}, false);554document.getElementById("26000011").addEventListener("click", function () {555 value1 = document.getElementById("26000011").value556 value2 = document.getElementById("26000011").name557 func1(value1,value2)558}, false);559document.getElementById("26000014").addEventListener("click", function () {560 value1 = document.getElementById("26000014").value561 value2 = document.getElementById("26000014").name562 func1(value1,value2)563}, false);564document.getElementById("26000018").addEventListener("click", function () {565 value1 = document.getElementById("26000018").value566 value2 = document.getElementById("26000018").name567 func1(value1,value2)568}, false);569document.getElementById("26000021").addEventListener("click", function () {570 value1 = document.getElementById("26000021").value571 value2 = document.getElementById("26000021").name572 func1(value1,value2)573}, false);574document.getElementById("26000036").addEventListener("click", function () {575 value1 = document.getElementById("26000036").value576 value2 = document.getElementById("26000036").name577 func1(value1,value2)578}, false);579document.getElementById("26000052").addEventListener("click", function () {580 value1 = document.getElementById("26000052").value581 value2 = document.getElementById("26000052").name582 func1(value1,value2)583}, false);584document.getElementById("26000057").addEventListener("click", function () {585 value1 = document.getElementById("26000057").value586 value2 = document.getElementById("26000057").name587 func1(value1,value2)588}, false);589document.getElementById("26000068").addEventListener("click", function () {590 value1 = document.getElementById("26000068").value591 value2 = document.getElementById("26000068").name592 func1(value1,value2)593}, false);594document.getElementById("27000004").addEventListener("click", function () {595 value1 = document.getElementById("27000004").value596 value2 = document.getElementById("27000004").name597 func1(value1,value2)598}, false);599document.getElementById("27000010").addEventListener("click", function () {600 value1 = document.getElementById("27000010").value601 value2 = document.getElementById("27000010").name602 func1(value1,value2)603}, false);604document.getElementById("27000012").addEventListener("click", function () {605 value1 = document.getElementById("27000012").value606 value2 = document.getElementById("27000012").name607 func1(value1,value2)608}, false);609document.getElementById("28000000").addEventListener("click", function () {610 value1 = document.getElementById("28000000").value611 value2 = document.getElementById("28000000").name612 func1(value1,value2)613}, false);614document.getElementById("26000003").addEventListener("click", function () {615 value1 = document.getElementById("26000003").value616 value2 = document.getElementById("26000003").name617 func1(value1,value2)618}, false);619document.getElementById("26000017").addEventListener("click", function () {620 value1 = document.getElementById("26000017").value621 value2 = document.getElementById("26000017").name622 func1(value1,value2)623}, false);624document.getElementById("26000059").addEventListener("click", function () {625 value1 = document.getElementById("26000059").value626 value2 = document.getElementById("26000059").name627 func1(value1,value2)628}, false);629document.getElementById("27000001").addEventListener("click", function () {630 value1 = document.getElementById("27000001").value631 value2 = document.getElementById("27000001").name632 func1(value1,value2)633}, false);634document.getElementById("27000003").addEventListener("click", function () {635 value1 = document.getElementById("27000003").value636 value2 = document.getElementById("27000003").name637 func1(value1,value2)638}, false);639document.getElementById("27000007").addEventListener("click", function () {640 value1 = document.getElementById("27000007").value641 value2 = document.getElementById("27000007").name642 func1(value1,value2)643}, false);644document.getElementById("28000003").addEventListener("click", function () {645 value1 = document.getElementById("28000003").value646 value2 = document.getElementById("28000003").name647 func1(value1,value2)648}, false);649document.getElementById("27000005").addEventListener("click", function () {650 value1 = document.getElementById("27000005").value651 value2 = document.getElementById("27000005").name652 func1(value1,value2)653}, false);654document.getElementById("26000028").addEventListener("click", function () {655 value1 = document.getElementById("26000028").value656 value2 = document.getElementById("26000028").name657 func1(value1,value2)658}, false);659document.getElementById("26000058").addEventListener("click", function () {660 value1 = document.getElementById("26000058").value661 value2 = document.getElementById("26000058").name662 func1(value1,value2)663}, false);664document.getElementById("28000002").addEventListener("click", function () {665 value1 = document.getElementById("28000002").value666 value2 = document.getElementById("28000002").name667 func1(value1,value2)668}, false);669document.getElementById("28000015").addEventListener("click", function () {670 value1 = document.getElementById("28000015").value671 value2 = document.getElementById("28000015").name672 func1(value1,value2)673}, false);674document.getElementById("26000012").addEventListener("click", function () {675 value1 = document.getElementById("26000012").value676 value2 = document.getElementById("26000012").name677 func1(value1,value2)678}, false);679document.getElementById("26000025").addEventListener("click", function () {680 value1 = document.getElementById("26000025").value681 value2 = document.getElementById("26000025").name682 func1(value1,value2)683}, false);684document.getElementById("28000004").addEventListener("click", function () {685 value1 = document.getElementById("28000004").value686 value2 = document.getElementById("28000004").name687 func1(value1,value2)688}, false);689document.getElementById("28000012").addEventListener("click", function () {690 value1 = document.getElementById("28000012").value691 value2 = document.getElementById("28000012").name692 func1(value1,value2)693}, false);694document.getElementById("28000013").addEventListener("click", function () {695 value1 = document.getElementById("28000013").value696 value2 = document.getElementById("28000013").name697 func1(value1,value2)698}, false);699document.getElementById("26000015").addEventListener("click", function () {700 value1 = document.getElementById("26000015").value701 value2 = document.getElementById("26000015").name702 func1(value1,value2)703}, false);704document.getElementById("26000027").addEventListener("click", function () {705 value1 = document.getElementById("26000027").value706 value2 = document.getElementById("26000027").name707 func1(value1,value2)708}, false);709document.getElementById("26000044").addEventListener("click", function () {710 value1 = document.getElementById("26000044").value711 value2 = document.getElementById("26000044").name712 func1(value1,value2)713}, false);714document.getElementById("27000013").addEventListener("click", function () {715 value1 = document.getElementById("27000013").value716 value2 = document.getElementById("27000013").name717 func1(value1,value2)718}, false);719document.getElementById("28000005").addEventListener("click", function () {720 value1 = document.getElementById("28000005").value721 value2 = document.getElementById("28000005").name722 func1(value1,value2)723}, false);724document.getElementById("28000009").addEventListener("click", function () {725 value1 = document.getElementById("28000009").value726 value2 = document.getElementById("28000009").name727 func1(value1,value2)728}, false);729document.getElementById("26000006").addEventListener("click", function () {730 value1 = document.getElementById("26000006").value731 value2 = document.getElementById("26000006").name732 func1(value1,value2)733}, false);734document.getElementById("26000007").addEventListener("click", function () {735 value1 = document.getElementById("26000007").value736 value2 = document.getElementById("26000007").name737 func1(value1,value2)738}, false);739document.getElementById("26000016").addEventListener("click", function () {740 value1 = document.getElementById("26000016").value741 value2 = document.getElementById("26000016").name742 func1(value1,value2)743}, false);744document.getElementById("26000034").addEventListener("click", function () {745 value1 = document.getElementById("26000034").value746 value2 = document.getElementById("26000034").name747 func1(value1,value2)748}, false);749document.getElementById("26000045").addEventListener("click", function () {750 value1 = document.getElementById("26000045").value751 value2 = document.getElementById("26000045").name752 func1(value1,value2)753}, false);754document.getElementById("26000054").addEventListener("click", function () {755 value1 = document.getElementById("26000054").value756 value2 = document.getElementById("26000054").name757 func1(value1,value2)758}, false);759document.getElementById("26000063").addEventListener("click", function () {760 value1 = document.getElementById("26000063").value761 value2 = document.getElementById("26000063").name762 func1(value1,value2)763}, false);764document.getElementById("26000020").addEventListener("click", function () {765 value1 = document.getElementById("26000020").value766 value2 = document.getElementById("26000020").name767 func1(value1,value2)768}, false);769document.getElementById("26000060").addEventListener("click", function () {770 value1 = document.getElementById("26000060").value771 value2 = document.getElementById("26000060").name772 func1(value1,value2)773}, false);774document.getElementById("27000008").addEventListener("click", function () {775 value1 = document.getElementById("27000008").value776 value2 = document.getElementById("27000008").name777 func1(value1,value2)778}, false);779document.getElementById("28000007").addEventListener("click", function () {780 value1 = document.getElementById("28000007").value781 value2 = document.getElementById("28000007").name782 func1(value1,value2)783}, false);784document.getElementById("26000004").addEventListener("click", function () {785 value1 = document.getElementById("26000004").value786 value2 = document.getElementById("26000004").name787 func1(value1,value2)788}, false);789document.getElementById("26000009").addEventListener("click", function () {790 value1 = document.getElementById("26000009").value791 value2 = document.getElementById("26000009").name792 func1(value1,value2)793}, false);794document.getElementById("26000085").addEventListener("click", function () {795 value1 = document.getElementById("26000085").value796 value2 = document.getElementById("26000085").name797 func1(value1,value2)798}, false);799document.getElementById("28000006").addEventListener("click", function () {800 value1 = document.getElementById("28000006").value801 value2 = document.getElementById("28000006").name802 func1(value1,value2)803}, false);804document.getElementById("28000011").addEventListener("click", function () {805 value1 = document.getElementById("28000011").value806 value2 = document.getElementById("28000011").name807 func1(value1,value2)808}, false);809document.getElementById("26000023").addEventListener("click", function () {810 value1 = document.getElementById("26000023").value811 value2 = document.getElementById("26000023").name812 func1(value1,value2)813}, false);814document.getElementById("26000026").addEventListener("click", function () {815 value1 = document.getElementById("26000026").value816 value2 = document.getElementById("26000026").name817 func1(value1,value2)818}, false);819document.getElementById("26000032").addEventListener("click", function () {820 value1 = document.getElementById("26000032").value821 value2 = document.getElementById("26000032").name822 func1(value1,value2)823}, false);824document.getElementById("26000046").addEventListener("click", function () {825 value1 = document.getElementById("26000046").value826 value2 = document.getElementById("26000046").name827 func1(value1,value2)828}, false);829document.getElementById("26000050").addEventListener("click", function () {830 value1 = document.getElementById("26000050").value831 value2 = document.getElementById("26000050").name832 func1(value1,value2)833}, false);834document.getElementById("26000061").addEventListener("click", function () {835 value1 = document.getElementById("26000061").value836 value2 = document.getElementById("26000061").name837 func1(value1,value2)838}, false);839document.getElementById("26000035").addEventListener("click", function () {840 value1 = document.getElementById("26000035").value841 value2 = document.getElementById("26000035").name842 func1(value1,value2)843}, false);844document.getElementById("26000037").addEventListener("click", function () {845 value1 = document.getElementById("26000037").value846 value2 = document.getElementById("26000037").name847 func1(value1,value2)848}, false);849document.getElementById("26000042").addEventListener("click", function () {850 value1 = document.getElementById("26000042").value851 value2 = document.getElementById("26000042").name852 func1(value1,value2)853}, false);854document.getElementById("26000048").addEventListener("click", function () {855 value1 = document.getElementById("26000048").value856 value2 = document.getElementById("26000048").name857 func1(value1,value2)858}, false);859document.getElementById("26000062").addEventListener("click", function () {860 value1 = document.getElementById("26000062").value861 value2 = document.getElementById("26000062").name862 func1(value1,value2)863}, false);864document.getElementById("26000083").addEventListener("click", function () {865 value1 = document.getElementById("26000083").value866 value2 = document.getElementById("26000083").name867 func1(value1,value2)868}, false);869document.getElementById("26000051").addEventListener("click", function () {870 value1 = document.getElementById("26000051").value871 value2 = document.getElementById("26000051").name872 func1(value1,value2)873}, false);874document.getElementById("28000010").addEventListener("click", function () {875 value1 = document.getElementById("28000010").value876 value2 = document.getElementById("28000010").name877 func1(value1,value2)878}, false);879document.getElementById("26000033").addEventListener("click", function () {880 value1 = document.getElementById("26000033").value881 value2 = document.getElementById("26000033").name882 func1(value1,value2)883}, false);884document.getElementById("26000029").addEventListener("click", function () {885 value1 = document.getElementById("26000029").value886 value2 = document.getElementById("26000029").name887 func1(value1,value2)888}, false);889document.getElementById("26000055").addEventListener("click", function () {890 value1 = document.getElementById("26000055").value891 value2 = document.getElementById("26000055").name892 func1(value1,value2)893}, false);894document.getElementById("26000069").addEventListener("click", function () {895 value1 = document.getElementById("26000069").value896 value2 = document.getElementById("26000069").name897 func1(value1,value2)898}, false);899document.getElementById("26000072").addEventListener("click", function () {900 value1 = document.getElementById("26000072").value901 value2 = document.getElementById("26000072").name902 func1(value1,value2)903}, false);904document.getElementById("26000074").addEventListener("click", function () {905 value1 = document.getElementById("26000074").value906 value2 = document.getElementById("26000074").name907 func1(value1,value2) ...

Full Screen

Full Screen

test_Event.js

Source:test_Event.js Github

copy

Full Screen

...43 dojo.event.connect(obj1, "func1", function(){44 obj1.increment();45 dojo.event.connect(obj1, "func1", obj1, "increment");46 });47 obj1.func1();48 jum.assertEquals("test", obj1.ctr, 1);49}50function test_event_beforeAround(){51 var obj1 = new testObjectClass();52 dojo.event.connect("before", obj1, "func1", obj1, "func2", obj1, "argSwapAroundAdvice");53 jum.assertTrue("test1", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");54 jum.assertEquals("test2", obj1.secondLastReturn, "func2, arg1: 2, arg2: 1");55 jum.assertEquals("test3", obj1.lastReturn, "func1, arg1: 1, arg2: 2");56}57function test_event_before(){58 var obj1 = new testObjectClass();59 dojo.event.connect("before", obj1, "func1", obj1, "func2");60 jum.assertTrue("test4", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");61 // we expected func2 to fire before func1 and neither to mangle arguments62 jum.assertEquals("test5", obj1.secondLastReturn, "func2, arg1: 1, arg2: 2");63 // so the most recent return should be from func164 jum.assertEquals("test6", obj1.lastReturn, "func1, arg1: 1, arg2: 2");65}66function test_event_connectBefore(){67 var obj1 = new testObjectClass();68 var obj2 = new testObjectClass();69 dj_global._testConnectBeforeFunc = function(arg1, arg2){70 obj2.funcCallCount++;71 obj2.secondLastReturn = obj2.lastReturn;72 obj2.lastReturn = "func1, arg1: "+arg1+", arg2: "+arg2;73 return obj2.lastReturn;74 }75 dojo.event.connectBefore(obj1, "func1", obj1, "func2");76 jum.assertTrue("test7", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");77 // we expected func2 to fire before func1 and neither to mangle arguments78 jum.assertEquals("test8", obj1.secondLastReturn, "func2, arg1: 1, arg2: 2");79 // so the most recent return should be from func180 jum.assertEquals("test9", obj1.lastReturn, "func1, arg1: 1, arg2: 2");81 dojo.event.connectBefore("_testConnectBeforeFunc", obj2, "func2");82 jum.assertTrue("test10", _testConnectBeforeFunc("1", "2")=="func1, arg1: 1, arg2: 2");83 jum.assertEquals("test11", obj2.funcCallCount, 2);84}85function test_event_afterAround(){86 var obj1 = new testObjectClass();87 dojo.event.connect("after", obj1, "func1", obj1, "func2", obj1, "argSwapAroundAdvice");88 jum.assertTrue("test7", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");89 jum.assertEquals("test8", obj1.lastReturn, "func2, arg1: 2, arg2: 1");90 jum.assertEquals("test9", obj1.secondLastReturn, "func1, arg1: 1, arg2: 2");91}92function test_event_after(){93 var obj1 = new testObjectClass();94 dojo.event.connect("after", obj1, "func1", obj1, "func2");95 jum.assertTrue("test10", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");96 jum.assertEquals("test11", obj1.secondLastReturn, "func1, arg1: 1, arg2: 2");97 jum.assertEquals("test12", obj1.lastReturn, "func2, arg1: 1, arg2: 2");98}99function test_event_around(){100 var obj1 = new testObjectClass();101 dojo.event.connect("around", obj1, "func1", obj1, "argSwapAroundAdvice");102 jum.assertTrue("test13", obj1.func1("1", "2")=="func1, arg1: 2, arg2: 1");103 jum.assertEquals("test14", obj1.lastReturn, "func1, arg1: 2, arg2: 1");104 jum.assertEquals("test15", obj1.secondLastReturn, null);105}106function test_event_connectAround(){107 var obj1 = new testObjectClass();108 dojo.event.connectAround(obj1, "func1", obj1, "argSwapAroundAdvice");109 jum.assertTrue("test13", obj1.func1("1", "2")=="func1, arg1: 2, arg2: 1");110 jum.assertEquals("test14", obj1.lastReturn, "func1, arg1: 2, arg2: 1");111 jum.assertEquals("test15", obj1.secondLastReturn, null);112}113function test_event_kwConnect(){114 var obj1 = new testObjectClass();115 // test to see if "after" gets set as the default type116 dojo.event.kwConnect({117 srcObj: obj1, 118 srcFunc: "func1", 119 adviceObj: obj1, 120 adviceFunc: "func2"121 });122 jum.assertTrue("test16", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");123 jum.assertEquals("test17", obj1.secondLastReturn, "func1, arg1: 1, arg2: 2");124 jum.assertEquals("test18", obj1.lastReturn, "func2, arg1: 1, arg2: 2");125}126function test_event_connectOnce(){127 var obj1 = new testObjectClass();128 // connect once via kwConnect()129 dojo.event.kwConnect({130 once: true,131 type: "after",132 srcObj: obj1, 133 srcFunc: "func1", 134 adviceObj: obj1, 135 adviceFunc: "func2"136 });137 // and then through connect()138 dojo.event.connect("after", obj1, "func1", obj1, "func2", null, null, true);139 jum.assertTrue("test19", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");140 jum.assertEquals("test20", obj1.funcCallCount, 2);141}142function test_event_disconnect(){143 var obj1 = new testObjectClass();144 dojo.event.connect("after", obj1, "func1", obj1, "func2");145 dojo.event.disconnect("after", obj1, "func1", obj1, "func2");146 jum.assertTrue("test21", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");147 jum.assertEquals("test22", obj1.funcCallCount, 1);148 jum.assertEquals("test23", obj1.secondLastReturn, null);149}150function test_event_disconnectOnce(){151 var obj1 = new testObjectClass();152 dojo.event.connect("after", obj1, "func1", obj1, "func2");153 dojo.event.connect("after", obj1, "func1", obj1, "func2");154 dojo.event.disconnect("after", obj1, "func1", obj1, "func2", null, null, true);155 jum.assertTrue("test24", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");156 jum.assertEquals("test25", obj1.funcCallCount, 2);157 jum.assertTrue("test26", obj1.secondLastReturn != null);158}159function test_event_kwDisconnect(){160 var obj1 = new testObjectClass();161 // dojo.event.connect("after", obj1, "func1", obj1, "func2");162 dojo.event.kwConnect({163 type: "after",164 srcObj: obj1, 165 srcFunc: "func1", 166 adviceObj: obj1, 167 adviceFunc: "func2"168 });169 dojo.event.kwDisconnect({170 type: "after",171 srcObj: obj1, 172 srcFunc: "func1", 173 adviceObj: obj1, 174 adviceFunc: "func2"175 });176 jum.assertTrue("test27", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");177 jum.assertEquals("test28", obj1.funcCallCount, 1);178 jum.assertEquals("test29", obj1.secondLastReturn, null);179}180function test_event_kwDisconnectOnce(){181 var obj1 = new testObjectClass();182 dojo.event.connect("after", obj1, "func1", obj1, "func2");183 dojo.event.connect("after", obj1, "func1", obj1, "func2");184 dojo.event.kwDisconnect({185 type: "after",186 srcObj: obj1, 187 srcFunc: "func1", 188 adviceObj: obj1, 189 adviceFunc: "func2",190 once: true191 });192 jum.assertTrue("test30", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");193 jum.assertEquals("test31", obj1.funcCallCount, 2);194}195function test_event_implicitAfter(){196 var obj1 = new testObjectClass();197 dojo.event.connect(obj1, "func1", obj1, "func2");198 jum.assertTrue("test32", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");199 jum.assertEquals("test33", obj1.funcCallCount, 2);200 jum.assertEquals("test34", obj1.secondLastReturn, "func1, arg1: 1, arg2: 2");201}202function test_event_anonymous(){203 var obj1 = new testObjectClass();204 dojo.event.connect(obj1, "func1", function(){205 obj1.funcCallCount++;206 });207 obj1.func1("1", "2");208 jum.assertEquals("test35", 2, obj1.funcCallCount);209}210function test_event_adviceMsg(){211 var obj1 = new testObjectClass();212 obj1.func3 = function(kwa){213 this.argsLen = arguments.length;214 this.miArgsLen = kwa.args.length;215 this.srcObj = kwa.object;216 }217 dojo.event.kwConnect({218 type: "after",219 srcObj: obj1, 220 srcFunc: "func1", 221 adviceObj: obj1, 222 adviceFunc: "func3",223 adviceMsg: true224 });225 obj1.func1("1", "2", "3", "4", "5");226 jum.assertEquals("test36", 1, obj1.argsLen);227 jum.assertEquals("test37", 5, obj1.miArgsLen);228 jum.assertEquals("test38", obj1, obj1.srcObj);229 var obj2 = {230 foo: function(){231 }232 };233 var obj3 = {234 bar: function(mi){235 this.srcObj = mi.object;236 }237 };238 dojo.event.kwConnect({239 srcObj: obj2, 240 srcFunc: "foo", 241 adviceObj: obj3, 242 adviceFunc: "bar",243 adviceMsg: true244 });245 obj2.foo();246 jum.assertTrue("test39", obj2 === obj3.srcObj);247}248function test_event_disconnectFP(){249 var obj1 = new testObjectClass();250 dojo.event.connect(obj1, "func1", obj1, obj1.func2);251 dojo.event.disconnect(obj1, "func1", obj1, obj1.func2);252 jum.assertTrue("test40", obj1.func1("1", "2")=="func1, arg1: 1, arg2: 2");253 jum.assertEquals("test41", obj1.funcCallCount, 1);254 var obj2 = new testObjectClass();255 dojo.event.connect("after", obj2, obj2.func1, obj2, obj2.func2);256 dojo.event.disconnect("after", obj2, obj2.func1, obj2, obj2.func2);257 jum.assertTrue("test42", obj2.func1("1", "2")=="func1, arg1: 1, arg2: 2");258 jum.assertEquals("test43", obj2.funcCallCount, 1);...

Full Screen

Full Screen

scopes_test.py

Source:scopes_test.py Github

copy

Full Screen

...18from __future__ import print_function19import tensorflow as tf20from inception.slim import scopes21@scopes.add_arg_scope22def func1(*args, **kwargs):23 return (args, kwargs)24@scopes.add_arg_scope25def func2(*args, **kwargs):26 return (args, kwargs)27class ArgScopeTest(tf.test.TestCase):28 def testEmptyArgScope(self):29 with self.test_session():30 self.assertEqual(scopes._current_arg_scope(), {})31 def testCurrentArgScope(self):32 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}33 key_op = (func1.__module__, func1.__name__)34 current_scope = {key_op: func1_kwargs.copy()}35 with self.test_session():36 with scopes.arg_scope([func1], a=1, b=None, c=[1]) as scope:37 self.assertDictEqual(scope, current_scope)38 def testCurrentArgScopeNested(self):39 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}40 func2_kwargs = {'b': 2, 'd': [2]}41 key = lambda f: (f.__module__, f.__name__)42 current_scope = {key(func1): func1_kwargs.copy(),43 key(func2): func2_kwargs.copy()}44 with self.test_session():45 with scopes.arg_scope([func1], a=1, b=None, c=[1]):46 with scopes.arg_scope([func2], b=2, d=[2]) as scope:47 self.assertDictEqual(scope, current_scope)48 def testReuseArgScope(self):49 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}50 key_op = (func1.__module__, func1.__name__)51 current_scope = {key_op: func1_kwargs.copy()}52 with self.test_session():53 with scopes.arg_scope([func1], a=1, b=None, c=[1]) as scope1:54 pass55 with scopes.arg_scope(scope1) as scope:56 self.assertDictEqual(scope, current_scope)57 def testReuseArgScopeNested(self):58 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}59 func2_kwargs = {'b': 2, 'd': [2]}60 key = lambda f: (f.__module__, f.__name__)61 current_scope1 = {key(func1): func1_kwargs.copy()}62 current_scope2 = {key(func1): func1_kwargs.copy(),63 key(func2): func2_kwargs.copy()}64 with self.test_session():65 with scopes.arg_scope([func1], a=1, b=None, c=[1]) as scope1:66 with scopes.arg_scope([func2], b=2, d=[2]) as scope2:67 pass68 with scopes.arg_scope(scope1):69 self.assertDictEqual(scopes._current_arg_scope(), current_scope1)70 with scopes.arg_scope(scope2):71 self.assertDictEqual(scopes._current_arg_scope(), current_scope2)72 def testSimpleArgScope(self):73 func1_args = (0,)74 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}75 with self.test_session():76 with scopes.arg_scope([func1], a=1, b=None, c=[1]):77 args, kwargs = func1(0)78 self.assertTupleEqual(args, func1_args)79 self.assertDictEqual(kwargs, func1_kwargs)80 def testSimpleArgScopeWithTuple(self):81 func1_args = (0,)82 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}83 with self.test_session():84 with scopes.arg_scope((func1,), a=1, b=None, c=[1]):85 args, kwargs = func1(0)86 self.assertTupleEqual(args, func1_args)87 self.assertDictEqual(kwargs, func1_kwargs)88 def testOverwriteArgScope(self):89 func1_args = (0,)90 func1_kwargs = {'a': 1, 'b': 2, 'c': [1]}91 with scopes.arg_scope([func1], a=1, b=None, c=[1]):92 args, kwargs = func1(0, b=2)93 self.assertTupleEqual(args, func1_args)94 self.assertDictEqual(kwargs, func1_kwargs)95 def testNestedArgScope(self):96 func1_args = (0,)97 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}98 with scopes.arg_scope([func1], a=1, b=None, c=[1]):99 args, kwargs = func1(0)100 self.assertTupleEqual(args, func1_args)101 self.assertDictEqual(kwargs, func1_kwargs)102 func1_kwargs['b'] = 2103 with scopes.arg_scope([func1], b=2):104 args, kwargs = func1(0)105 self.assertTupleEqual(args, func1_args)106 self.assertDictEqual(kwargs, func1_kwargs)107 def testSharedArgScope(self):108 func1_args = (0,)109 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}110 with scopes.arg_scope([func1, func2], a=1, b=None, c=[1]):111 args, kwargs = func1(0)112 self.assertTupleEqual(args, func1_args)113 self.assertDictEqual(kwargs, func1_kwargs)114 args, kwargs = func2(0)115 self.assertTupleEqual(args, func1_args)116 self.assertDictEqual(kwargs, func1_kwargs)117 def testSharedArgScopeTuple(self):118 func1_args = (0,)119 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}120 with scopes.arg_scope((func1, func2), a=1, b=None, c=[1]):121 args, kwargs = func1(0)122 self.assertTupleEqual(args, func1_args)123 self.assertDictEqual(kwargs, func1_kwargs)124 args, kwargs = func2(0)125 self.assertTupleEqual(args, func1_args)126 self.assertDictEqual(kwargs, func1_kwargs)127 def testPartiallySharedArgScope(self):128 func1_args = (0,)129 func1_kwargs = {'a': 1, 'b': None, 'c': [1]}130 func2_args = (1,)131 func2_kwargs = {'a': 1, 'b': None, 'd': [2]}132 with scopes.arg_scope([func1, func2], a=1, b=None):133 with scopes.arg_scope([func1], c=[1]), scopes.arg_scope([func2], d=[2]):134 args, kwargs = func1(0)135 self.assertTupleEqual(args, func1_args)136 self.assertDictEqual(kwargs, func1_kwargs)137 args, kwargs = func2(1)138 self.assertTupleEqual(args, func2_args)139 self.assertDictEqual(kwargs, func2_kwargs)140if __name__ == '__main__':...

Full Screen

Full Screen

check.test.js

Source:check.test.js Github

copy

Full Screen

1import check from "./check";2import {strict as assert} from "assert";3function test(description, callback) {4 callback();5}6function call() {7 const func = function func(input) {8 func.called = true;9 func.input = input;10 };11 func.called = false;12 return func;13}14test("calls function for matched float", () => {15 const func1 = call();16 const func2 = call();17 check(1.3)18 .case(1.2, func1)19 .case(1.3, func2)20 .test();21 assert.ok(func2.called);22 assert.ok(!func1.called);23});24test("calls function for matched integer", () => {25 const func1 = call();26 const func2 = call();27 check(1)28 .case(1, func1)29 .case(2, func2)30 .test();31 assert.ok(func1.called);32 assert.ok(!func2.called);33});34test("calls function for matched string", () => {35 const func1 = call();36 const func2 = call();37 check("hello")38 .case("hi", func1)39 .case("hello", func2)40 .test();41 assert.ok(!func1.called);42 assert.ok(func2.called);43});44test("calls function for matched boolean (true)", () => {45 const func1 = call();46 const func2 = call();47 check(true)48 .case(false, func1)49 .case(true, func2)50 .test();51 assert.ok(!func1.called);52 assert.ok(func2.called);53});54test("calls function for matched boolean (false)", () => {55 const func1 = call();56 const func2 = call();57 check(true)58 .case(true, func1)59 .case(false, func2)60 .test();61 assert.ok(func1.called);62 assert.ok(!func2.called);63});64test("calls function for matched regexp", () => {65 const func1 = call();66 const func2 = call();67 check("hello")68 .case(/ll/, func1)69 .case("hello", func2)70 .test();71 assert.ok(func1.called);72 assert.ok(!func2.called);73});74test("calls function for matched null", () => {75 const func1 = call();76 const func2 = call();77 check(null)78 .case(null, func1)79 .case("hello", func2)80 .test();81 assert.ok(func1.called);82 assert.ok(!func2.called);83});84test("calls function for matched undefined", () => {85 const func1 = call();86 const func2 = call();87 check(undefined)88 .case(undefined, func1)89 .case("hello", func2)90 .test();91 assert.ok(func1.called);92 assert.ok(!func2.called);93});94test("calls several matching functions when stop is false", () => {95 const func1 = call();96 const func2 = call();97 const func3 = call();98 check("hello")99 .case(/ll/, func1, false)100 .case("hello", func2, false)101 .case(3, func3, false)102 .test();103 assert.ok(func1.called);104 assert.ok(func2.called);105 assert.ok(!func3.called);106});107test("calls function for conditions array", () => {108 const func1 = call();109 const func2 = call();110 check("hello")111 .case([/ll/, "hello"], func1)112 .case("hello", func2)113 .test();114 assert.ok(func1.called);115 assert.ok(!func2.called);116});117test("calls input function with value", () => {118 const func = call();119 check(1234)120 .case(1234, func)121 .test();122 assert.equal(func.input, 1234);123});124test("calls input function with value (input as function)", () => {125 const func = call();126 check(() => 1234)127 .case(1234, func)128 .test();129 assert.equal(func.input, 1234);130});131test("calls input function and compare its value", () => {132 const func1 = call();133 const func2 = call();134 check(() => 1)135 .case(1, func1)136 .case(2, func2)137 .test();138 assert.ok(func1.called);139 assert.ok(!func2.called);140});141test("don't call function for unmatched conditions array", () => {142 const func1 = call();143 const func2 = call();144 check("asdf")145 .case([/ll/, "hello"], func1)146 .case("hello", func2)147 .test();148 assert.ok(!func1.called);149 assert.ok(!func2.called);150});151test("don't call function when types are different", () => {152 const func = call();153 check("1")154 .case(1, func)155 .test();156 assert.ok(!func.called);157});158test("calls default function when nothing matches", () => {159 const func1 = call();160 const func2 = call();161 check("1")162 .case(1, func1)163 .test(func2);164 assert.ok(!func1.called);165 assert.ok(func2.called);166 assert.equal(func2.input, "1")167});168test("calls default function without case", () => {169 const func = call();170 check(1234)171 .test(func);172 assert.ok(func.called);173 assert.equal(func.input, 1234)...

Full Screen

Full Screen

campaign.js

Source:campaign.js Github

copy

Full Screen

...70 ], views: [71 {name: 'View IOs', ref: '.', nodes: []}72 ] }73 ];74 function func1() {75 alert('liron');76 }77 function addNewMasterAd(){78 $state.go('spa.ad.adEdit');79 }80 function addNewPlacement(){81 $state.go('spa.placement.placementEdit');82 }83 function addDeliveryGroup(){84 $state.go('spa.deliveryGroup.deliveryGroupEdit');85 }...

Full Screen

Full Screen

actionSpec.js

Source:actionSpec.js Github

copy

Full Screen

...3 it("kick action",function(){4 var called = false,5 calledParams = {},6 passedParams = {};7 function func1(params){8 calledParams = params;9 called = true;10 return {a:2};11 }12 function bef(params){13 return true;14 }15 function af(params){16 passedParams = params;17 }18 action(func1,{opt:1}).before(bef).after(af)();19 expect(called).toBeTruthy();20 expect(calledParams).toEqual({opt:1});21 expect(passedParams).toEqual({a:2});22 });23 it("can stop action",function(){24 var called = false,25 calledParams = {},26 passedParams = {};27 function func1(params){28 calledParams = params;29 called = true;30 return {a:2};31 }32 function bef1(params){33 return false;34 }35 function bef2(params){36 return true;37 }38 action(func1,{opt:1}).before(bef1).before(bef2)();39 expect(called).toBeFalsy();40 });41 it("can change paramter to pass to main func",function(){42 var called = false,43 calledParams = {},44 passedParams = {};45 46 function func1(params){47 calledParams = params;48 called = true;49 return {a:2};50 }51 function bef(params){52 params.opt = 1000;53 return true;54 }55 function af(params){56 passedParams = params;57 }58 action(func1,{opt:1}).before(bef).after(af)();59 expect(called).toBeTruthy();60 expect(calledParams).toEqual({opt:1000});61 });62 it("can accept original func as 2nd param",function(){63 var secondParamBf = false,64 secondParamAf = false,65 that = {};66 function func1(params){67 }68 that.func1 = func1;69 function bef(params,originalFunc){70 secondParamBf = originalFunc;71 return true;72 }73 function af(params,originalFunc){74 secondParamAf = originalFunc;75 return true;76 }77 action(that.func1,{opt:1}).before(bef).after(af)();78 expect(secondParamBf).toEqual(func1);79 expect(secondParamAf).toEqual(func1);80 });81 it("can kick otherwise",function(){82 var called = false,83 calledParams = {},84 passedParams = {};85 86 function func1(params){87 calledParams = params;88 called = true;89 return {a:2};90 }91 function bef(params){92 return false;93 }94 function ot(params){95 passedParams = params;96 }97 action(func1,{opt:1}).before(bef).otherwise(ot)();98 expect(called).toBeFalsy();99 expect(passedParams).toEqual({opt:1});100 }); 101 it("is valid for spy",function(){102 var that = {};103 104 function func1(params){105 return 1;106 }107 that.func1 = func1;108 function bef(params){109 params.b = 10110 return true;111 }112 function af(params){113 passedParams = params;114 }115 spyOn(that,"func1");116 action(that.func1,{opt:1}).before(bef).after(af)();117 expect(that.func1).toHaveBeenCalled();118 expect(that.func1).toHaveBeenCalledWith({opt:1,b: 10});...

Full Screen

Full Screen

stuff.js

Source:stuff.js Github

copy

Full Screen

...29 return retVal;30};31// while (true) {32// try {33// const _0x478583 = -parseInt(func1(0x1eb-0x1d6)) + parseInt(func1(0x1ed)) + -parseInt(func1(0x1db)) * -parseInt(func1(0x1d9)) + -parseInt(func1(0x1e2)) * -parseInt(func1(0x1e3)) + -parseInt(func1(0x1de)) * parseInt(func1(0x1e0)) + parseInt(func1(0x1d8)) * parseInt(func1(0x1ea)) + -parseInt(func1(0x1e5));34// if (_0x478583 === 0x994c3)35// break;36// else37// arr.push(arr.shift());// moves first element to end 38// } catch (_0x41d31a) {39// arr.push(arr.shift());40// }41// }42let exports;43(async()=>{44 const func1 = func1;45 let _0x5f0229 = await fetch(func1(0x1e9))46 , webAssInst = await WebAssembly[func1(0x1df)](await _0x5f0229[func1(0x1da)]())47 , _0x1f8628 = webAssInst[func1(0x1d6)];48 exports = _0x1f8628['exports'];49}50)();51function onButtonPress() {52 const func1 = func1;53 let _0x3761f8 = document['getElementById'](func1(0x1e4))[func1(0x1dd)];54 for (let _0x16c626 = 0x0; _0x16c626 < _0x3761f8['length']; _0x16c626++) {55 exports[func1(0x1d7)](_0x3761f8[func1(0x1ec)](_0x16c626), _0x16c626);56 }57 exports['copy_char'](0x0, _0x3761f8['length']),58 exports[func1(0x1e7)]() == 0x1 ? document[func1(0x1ee)](func1(0x1dc))[func1(0x1e1)] = func1(0x1e6) : document[func1(0x1ee)](func1(0x1dc))[func1(0x1e1)] = func1(0x1e8);59}60// 0: "instance"61// 1: "copy_char"62// 2: "43591XxcWUl"63// 3: "504454llVtzW"64// 4: "arrayBuffer"65// 5: "2NIQmVj"66// 6: "result"67// 7: "value"68// 8: "2wfTpTR"69// 9: "instantiate"70// 10: "275341bEPcme"71// 11: "innerHTML"72// 12: "1195047NznhZg"...

Full Screen

Full Screen

functionLiterals.js

Source:functionLiterals.js Github

copy

Full Screen

1//// [functionLiterals.ts]2// PropName<TypeParamList>(ParamList):ReturnType is equivalent to PropName: { <TypeParamList>(ParamList): ReturnType }3var b: {4 func1(x: number): number; // Method signature5 func2: (x: number) => number; // Function type literal6 func3: { (x: number): number }; // Object type literal7}8// no errors9b.func1 = b.func2;10b.func1 = b.func3;11b.func2 = b.func1;12b.func2 = b.func3;13b.func3 = b.func1;14b.func3 = b.func2;15var c: {16 func4(x: number): number;17 func4(s: string): string;18 func5: {...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wptObj = new wpt('Your API Key');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9### wpt(options)10Default: `{}`11{12}

Full Screen

Using AI Code Generation

copy

Full Screen

1var func1 = require('./wptest');2module.exports = {3 func1: function(){4 console.log("Hello World");5 }6}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt');2wpt.func1("hello");3exports.func1 = function(str){4 console.log(str);5}6exports.func2 = function(str){7 console.log(str);8}9var wpt = require('./wpt');10wpt.func1("hello");11wpt.func2("world");12module.exports = {13 func1: function(str){14 console.log(str);15 },16 func2: function(str){17 console.log(str);18 }19}20var wpt = require('./wpt');21wpt.func1("hello");22wpt.func2("world");23module.exports = {24 func1: function(str){25 console.log(str);26 },27 func2: function(str){28 console.log(str);29 },30 Obj: function(){31 this.prop1 = "hello";32 this.prop2 = "world";33 }34}35var wpt = require('./wpt');36wpt.func1("hello");37wpt.func2("world");38var obj = new wpt.Obj();39console.log(obj.prop1);40console.log(obj.prop2);41module.exports = {42 func1: function(str){43 console.log(str);44 },45 func2: function(str){46 console.log(str);47 },48 Obj: function(){49 this.prop1 = "hello";50 this.prop2 = "world";51 },52 func3: function(str){53 console.log(str);54 }55}

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Run wpt automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful