How to use textContent method in Playwright Internal

Best JavaScript code snippet using playwright-internal

script.js

Source:script.js Github

copy

Full Screen

1console.log("Подключено");23// Че же написать456//6а7let sixA1 = document.querySelectorAll("th, td");8sixA1 = sixA1[15];9console.log(sixA1);1011//6б12let sixB1 = document.querySelectorAll("th, td");13sixB1 = sixB1[16];14console.log(sixB1);1516//6в17let sixV1 = document.querySelectorAll("th, td");18sixV1 = sixV1[17];19console.log(sixV1);2021//7a22let sevenA1 = document.querySelectorAll("th, td");23sevenA1 = sevenA1[18];24console.log(sevenA1);2526//7б27let sevenB1 = document.querySelectorAll("th, td");28sevenB1 = sevenB1[19];29console.log(sevenB1);3031//7в32let sevenV1 = document.querySelectorAll("th, td");33sevenV1 = sevenV1[20];34console.log(sevenV1);3536//8а37let eightA1 = document.querySelectorAll("th, td");38eightA1 = eightA1[21];39console.log(eightA1);4041//8б42let eightB1 = document.querySelectorAll("th, td");43eightB1 = eightB1[22];44console.log(eightB1);4546//8в47let eightV1 = document.querySelectorAll("th, td");48eightV1 = eightV1[23];49console.log(eightV1);50515253// Вторая строка54555657//6а58let sixA2 = document.querySelectorAll("th, td");59sixA2 = sixA2[26];60console.log(sixA2);6162//6б63let sixB2 = document.querySelectorAll("th, td");64sixB2 = sixB2[27];65console.log(sixB2);6667//6в68let sixV2 = document.querySelectorAll("th, td");69sixV2 = sixV2[28];70console.log(sixV2);7172//7a73let sevenA2 = document.querySelectorAll("th, td");74sevenA2 = sevenA2[29];75console.log(sevenA2);7677//7б78let sevenB2 = document.querySelectorAll("th, td");79sevenB2 = sevenB2[30];80console.log(sevenB2);8182//7в83let sevenV2 = document.querySelectorAll("th, td");84sevenV2 = sevenV2[31];85console.log(sevenV2);8687//8а88let eightA2 = document.querySelectorAll("th, td");89eightA2 = eightA2[32];90console.log(eightA2);9192//8б93let eightB2 = document.querySelectorAll("th, td");94eightB2 = eightB2[33];95console.log(eightB2);9697//8в98let eightV2 = document.querySelectorAll("th, td");99eightV2 = eightV2[34];100console.log(eightV2);101102103104// Третяяя строка105106107108//6а109let sixA3 = document.querySelectorAll("th, td");110sixA3 = sixA3[37];111console.log(sixA3);112113//6б114let sixB3 = document.querySelectorAll("th, td");115sixB3 = sixB3[38];116console.log(sixB3);117118//6в119let sixV3 = document.querySelectorAll("th, td");120sixV3 = sixV3[39];121console.log(sixV3);122123//7a124let sevenA3 = document.querySelectorAll("th, td");125sevenA3 = sevenA3[40];126console.log(sevenA3);127128//7б129let sevenB3 = document.querySelectorAll("th, td");130sevenB3 = sevenB3[41];131console.log(sevenB3);132133//7в134let sevenV3 = document.querySelectorAll("th, td");135sevenV3 = sevenV3[42];136console.log(sevenV3);137138//8а139let eightA3 = document.querySelectorAll("th, td");140eightA3 = eightA3[43];141console.log(eightA3);142143//8б144let eightB3 = document.querySelectorAll("th, td");145eightB3 = eightB3[44];146console.log(eightB3);147148//8в149let eightV3 = document.querySelectorAll("th, td");150eightV3 = eightV3[45];151console.log(eightV3);152153154155// Четвертая строка156157158159//6а160let sixA4 = document.querySelectorAll("th, td");161sixA4 = sixA4[48];162console.log(sixA4);163164//6б165let sixB4 = document.querySelectorAll("th, td");166sixB4 = sixB4[49];167console.log(sixB4);168169//6в170let sixV4 = document.querySelectorAll("th, td");171sixV4 = sixV4[50];172console.log(sixV4);173174//7a175let sevenA4 = document.querySelectorAll("th, td");176sevenA4 = sevenA4[51];177console.log(sevenA4);178179//7б180let sevenB4 = document.querySelectorAll("th, td");181sevenB4 = sevenB4[52];182console.log(sevenB4);183184//7в185let sevenV4 = document.querySelectorAll("th, td");186sevenV4 = sevenV4[53];187console.log(sevenV4);188189//8а190let eightA4 = document.querySelectorAll("th, td");191eightA4 = eightA4[54];192console.log(eightA4);193194//8б195let eightB4 = document.querySelectorAll("th, td");196eightB4 = eightB4[55];197console.log(eightB4);198199//8в200let eightV4 = document.querySelectorAll("th, td");201eightV4 = eightV4[56];202console.log(eightV4);203204205// Пятая строка206207208//6а209let sixA5 = document.querySelectorAll("th, td");210sixA5 = sixA5[59];211console.log(sixA5);212213//6б214let sixB5 = document.querySelectorAll("th, td");215sixB5 = sixB5[60];216console.log(sixB5);217218//6в219let sixV5 = document.querySelectorAll("th, td");220sixV5 = sixV5[61];221console.log(sixV5);222223//7a224let sevenA5 = document.querySelectorAll("th, td");225sevenA5 = sevenA5[62];226console.log(sevenA5);227228//7б229let sevenB5 = document.querySelectorAll("th, td");230sevenB5 = sevenB5[63];231console.log(sevenB5);232233//7в234let sevenV5 = document.querySelectorAll("th, td");235sevenV5 = sevenV5[64];236console.log(sevenV5);237238//8а239let eightA5 = document.querySelectorAll("th, td");240eightA5 = eightA5[65];241console.log(eightA5);242243//8б244let eightB5 = document.querySelectorAll("th, td");245eightB5 = eightB5[66];246console.log(eightB5);247248//8в249let eightV5 = document.querySelectorAll("th, td");250eightV5 = eightV5[67];251console.log(eightV5);252253254// Шестая строка255256257//6а258let sixA6 = document.querySelectorAll("th, td");259sixA6 = sixA6[70];260console.log(sixA6);261262//6б263let sixB6 = document.querySelectorAll("th, td");264sixB6 = sixB6[71];265console.log(sixB6);266267//6в268let sixV6 = document.querySelectorAll("th, td");269sixV6 = sixV6[72];270console.log(sixV6);271272//7a273let sevenA6 = document.querySelectorAll("th, td");274sevenA6 = sevenA6[73];275console.log(sevenA6);276277//7б278let sevenB6 = document.querySelectorAll("th, td");279sevenB6 = sevenB6[74];280console.log(sevenB6);281282//7в283let sevenV6 = document.querySelectorAll("th, td");284sevenV6 = sevenV6[75];285console.log(sevenV6);286287//8а288let eightA6 = document.querySelectorAll("th, td");289eightA6 = eightA6[76];290console.log(eightA6);291292//8б293let eightB6 = document.querySelectorAll("th, td");294eightB6 = eightB6[77];295console.log(eightB6);296297//8в298let eightV6 = document.querySelectorAll("th, td");299eightV6 = eightV6[78];300console.log(eightV6);301302303// Седьмая строка304305306//6а307let sixA7 = document.querySelectorAll("th, td");308sixA7 = sixA7[81];309console.log(sixA7);310311//6б312let sixB7 = document.querySelectorAll("th, td");313sixB7 = sixB7[82];314console.log(sixB7);315316//6в317let sixV7 = document.querySelectorAll("th, td");318sixV7 = sixV7[83];319console.log(sixV7);320321//7a322let sevenA7 = document.querySelectorAll("th, td");323sevenA7 = sevenA7[84];324console.log(sevenA7);325326//7б327let sevenB7 = document.querySelectorAll("th, td");328sevenB7 = sevenB7[85];329console.log(sevenB7);330331//7в332let sevenV7 = document.querySelectorAll("th, td");333sevenV7 = sevenV7[86];334console.log(sevenV7);335336//8а337let eightA7 = document.querySelectorAll("th, td");338eightA7 = eightA7[87];339console.log(eightA7);340341//8б342let eightB7 = document.querySelectorAll("th, td");343eightB7 = eightB7[88];344console.log(eightB7);345346//8в347let eightV7 = document.querySelectorAll("th, td");348eightV7 = eightV7[89];349console.log(eightV7);350351352// Седьмая строка353354355//6а356let sixA8 = document.querySelectorAll("th, td");357sixA8 = sixA8[92];358console.log(sixA8);359360//6б361let sixB8 = document.querySelectorAll("th, td");362sixB8 = sixB8[93];363console.log(sixB8);364365//6в366let sixV8 = document.querySelectorAll("th, td");367sixV8 = sixV8[94];368console.log(sixV8);369370//7a371let sevenA8 = document.querySelectorAll("th, td");372sevenA8 = sevenA8[95];373console.log(sevenA8);374375//7б376let sevenB8 = document.querySelectorAll("th, td");377sevenB8 = sevenB8[96];378console.log(sevenB8);379380//7в381let sevenV8 = document.querySelectorAll("th, td");382sevenV8 = sevenV8[97];383console.log(sevenV8);384385//8а386let eightA8 = document.querySelectorAll("th, td");387eightA8 = eightA8[98];388console.log(eightA8);389390//8б391let eightB8 = document.querySelectorAll("th, td");392eightB8 = eightB8[99];393console.log(eightB8);394395//8в396let eightV8 = document.querySelectorAll("th, td");397eightV8 = eightV8[100];398console.log(eightV8);399400401// Выделяем элементы кнопок с классами402403let ponedelnik = document.getElementById("pn");404let vtornik = document.getElementById("vt");405let sreda = document.getElementById("sr");406let chetverg = document.getElementById("ch");407let patnicha = document.getElementById("pt");408let subbota = document.getElementById("sb");409410// console.log(ponedelnik, vtornik, sreda, chetverg, patnicha, subbota);411412// Выделяем день недели413414let zagolovokDenNedely = document.querySelectorAll("th, td");415zagolovokDenNedely = zagolovokDenNedely[12];416// console.log(zagolovokDenNedely);417418419420421422423424425// Основной код426427const pn = {428 sixA: "",429 sixB: "",430 sixV: "",431 sevenA: "",432 sevenB: "",433 sevenV: "",434 eightA: "",435 eightB: "",436 eightV: "",437438 sixA1: "",439 sixB1: "",440 sixV1: "",441 sevenA1: "",442 sevenB1: "",443 sevenV1: "",444 eightA1: "",445 eightB1: "",446 eightV1: "",447448 sixA2: "",449 sixB2: "",450 sixV2: "",451 sevenA2: "",452 sevenB2: "",453 sevenV2: "",454 eightA2: "",455 eightB2: "",456 eightV2: "",457458 sixA3: "",459 sixB3: "",460 sixV3: "",461 sevenA3: "",462 sevenB3: "",463 sevenV3: "",464 eightA3: "",465 eightB3: "",466 eightV3: "",467468 sixA4: "",469 sixB4: "",470 sixV4: "",471 sevenA4: "",472 sevenB4: "",473 sevenV4: "",474 eightA4: "",475 eightB4: "",476 eightV4: "",477478 sixA5: "",479 sixB5: "",480 sixV5: "",481 sevenA5: "",482 sevenB5: "",483 sevenV5: "",484 eightA5: "",485 eightB5: "",486 eightV5: "",487488 sixA6: "",489 sixB6: "",490 sixV6: "",491 sevenA6: "",492 sevenB6: "",493 sevenV6: "",494 eightA6: "",495 eightB6: "",496 eightV6: "",497498 sixA7: "",499 sixB7: "",500 sixV7: "",501 sevenA7: "",502 sevenB7: "",503 sevenV7: "",504 eightA7: "",505 eightB7: "",506 eightV7: "",507508}; // База данных на понедельник509510511const vt = {512 sixA: "",513 sixB: "",514 sixV: "",515 sevenA: "",516 sevenB: "",517 sevenV: "",518 eightA: "",519 eightB: "",520 eightV: "",521522 sixA1: "",523 sixB1: "",524 sixV1: "",525 sevenA1: "",526 sevenB1: "",527 sevenV1: "",528 eightA1: "",529 eightB1: "",530 eightV1: "",531532 sixA2: "",533 sixB2: "",534 sixV2: "",535 sevenA2: "",536 sevenB2: "",537 sevenV2: "",538 eightA2: "",539 eightB2: "",540 eightV2: "",541542 sixA3: "",543 sixB3: "",544 sixV3: "",545 sevenA3: "",546 sevenB3: "",547 sevenV3: "",548 eightA3: "",549 eightB3: "",550 eightV3: "",551552 sixA4: "",553 sixB4: "",554 sixV4: "",555 sevenA4: "",556 sevenB4: "",557 sevenV4: "",558 eightA4: "",559 eightB4: "",560 eightV4: "",561562 sixA5: "",563 sixB5: "",564 sixV5: "",565 sevenA5: "",566 sevenB5: "",567 sevenV5: "",568 eightA5: "",569 eightB5: "",570 eightV5: "",571572 sixA6: "",573 sixB6: "",574 sixV6: "",575 sevenA6: "",576 sevenB6: "",577 sevenV6: "",578 eightA6: "",579 eightB6: "",580 eightV6: "",581582 sixA7: "",583 sixB7: "",584 sixV7: "",585 sevenA7: "",586 sevenB7: "",587 sevenV7: "",588 eightA7: "",589 eightB7: "",590 eightV7: "",591592}; // База данных на вторник593594const sr = {595 sixA: "",596 sixB: "",597 sixV: "",598 sevenA: "",599 sevenB: "",600 sevenV: "",601 eightA: "",602 eightB: "",603 eightV: "",604605 sixA1: "",606 sixB1: "",607 sixV1: "",608 sevenA1: "",609 sevenB1: "",610 sevenV1: "",611 eightA1: "",612 eightB1: "",613 eightV1: "",614615 sixA2: "",616 sixB2: "",617 sixV2: "",618 sevenA2: "",619 sevenB2: "",620 sevenV2: "",621 eightA2: "",622 eightB2: "",623 eightV2: "",624625 sixA3: "",626 sixB3: "",627 sixV3: "",628 sevenA3: "",629 sevenB3: "",630 sevenV3: "",631 eightA3: "",632 eightB3: "",633 eightV3: "",634635 sixA4: "",636 sixB4: "",637 sixV4: "",638 sevenA4: "",639 sevenB4: "",640 sevenV4: "",641 eightA4: "",642 eightB4: "",643 eightV4: "",644645 sixA5: "",646 sixB5: "",647 sixV5: "",648 sevenA5: "",649 sevenB5: "",650 sevenV5: "",651 eightA5: "",652 eightB5: "",653 eightV5: "",654655 sixA6: "",656 sixB6: "",657 sixV6: "",658 sevenA6: "",659 sevenB6: "",660 sevenV6: "",661 eightA6: "",662 eightB6: "",663 eightV6: "",664665 sixA7: "",666 sixB7: "",667 sixV7: "",668 sevenA7: "",669 sevenB7: "",670 sevenV7: "",671 eightA7: "",672 eightB7: "",673 eightV7: "",674675}; // База данных на среду676677const ch = {678 sixA: "",679 sixB: "",680 sixV: "",681 sevenA: "",682 sevenB: "",683 sevenV: "",684 eightA: "",685 eightB: "",686 eightV: "",687688 sixA1: "",689 sixB1: "",690 sixV1: "",691 sevenA1: "",692 sevenB1: "",693 sevenV1: "",694 eightA1: "",695 eightB1: "",696 eightV1: "",697698 sixA2: "",699 sixB2: "",700 sixV2: "",701 sevenA2: "",702 sevenB2: "",703 sevenV2: "",704 eightA2: "",705 eightB2: "",706 eightV2: "",707708 sixA3: "",709 sixB3: "",710 sixV3: "",711 sevenA3: "",712 sevenB3: "",713 sevenV3: "",714 eightA3: "",715 eightB3: "",716 eightV3: "",717718 sixA4: "",719 sixB4: "",720 sixV4: "",721 sevenA4: "",722 sevenB4: "",723 sevenV4: "",724 eightA4: "",725 eightB4: "",726 eightV4: "",727728 sixA5: "",729 sixB5: "",730 sixV5: "",731 sevenA5: "",732 sevenB5: "",733 sevenV5: "",734 eightA5: "",735 eightB5: "",736 eightV5: "",737738 sixA6: "",739 sixB6: "",740 sixV6: "",741 sevenA6: "",742 sevenB6: "",743 sevenV6: "",744 eightA6: "",745 eightB6: "",746 eightV6: "",747748 sixA7: "",749 sixB7: "",750 sixV7: "",751 sevenA7: "",752 sevenB7: "",753 sevenV7: "",754 eightA7: "",755 eightB7: "",756 eightV7: "",757758}; // База данных на четверг759760const pt = {761 sixA: "",762 sixB: "",763 sixV: "",764 sevenA: "",765 sevenB: "",766 sevenV: "",767 eightA: "",768 eightB: "",769 eightV: "",770771 sixA1: "",772 sixB1: "",773 sixV1: "",774 sevenA1: "",775 sevenB1: "",776 sevenV1: "",777 eightA1: "",778 eightB1: "",779 eightV1: "",780781 sixA2: "",782 sixB2: "",783 sixV2: "",784 sevenA2: "",785 sevenB2: "",786 sevenV2: "",787 eightA2: "",788 eightB2: "",789 eightV2: "",790791 sixA3: "",792 sixB3: "",793 sixV3: "",794 sevenA3: "",795 sevenB3: "",796 sevenV3: "",797 eightA3: "",798 eightB3: "",799 eightV3: "",800801 sixA4: "",802 sixB4: "",803 sixV4: "",804 sevenA4: "",805 sevenB4: "",806 sevenV4: "",807 eightA4: "",808 eightB4: "",809 eightV4: "",810811 sixA5: "",812 sixB5: "",813 sixV5: "",814 sevenA5: "",815 sevenB5: "",816 sevenV5: "",817 eightA5: "",818 eightB5: "",819 eightV5: "",820821 sixA6: "",822 sixB6: "",823 sixV6: "",824 sevenA6: "",825 sevenB6: "",826 sevenV6: "",827 eightA6: "",828 eightB6: "",829 eightV6: "",830831 sixA7: "",832 sixB7: "",833 sixV7: "",834 sevenA7: "",835 sevenB7: "",836 sevenV7: "",837 eightA7: "",838 eightB7: "",839 eightV7: "",840841}; // База данных на пятницу842843const su = {844 sixA: "",845 sixB: "",846 sixV: "",847 sevenA: "",848 sevenB: "",849 sevenV: "",850 eightA: "",851 eightB: "",852 eightV: "",853854 sixA1: "",855 sixB1: "",856 sixV1: "",857 sevenA1: "",858 sevenB1: "",859 sevenV1: "",860 eightA1: "",861 eightB1: "",862 eightV1: "",863864 sixA2: "",865 sixB2: "",866 sixV2: "",867 sevenA2: "",868 sevenB2: "",869 sevenV2: "",870 eightA2: "",871 eightB2: "",872 eightV2: "",873874 sixA3: "",875 sixB3: "",876 sixV3: "",877 sevenA3: "",878 sevenB3: "",879 sevenV3: "",880 eightA3: "",881 eightB3: "",882 eightV3: "",883884 sixA4: "",885 sixB4: "",886 sixV4: "",887 sevenA4: "",888 sevenB4: "",889 sevenV4: "",890 eightA4: "",891 eightB4: "",892 eightV4: "",893894 sixA5: "",895 sixB5: "",896 sixV5: "",897 sevenA5: "",898 sevenB5: "",899 sevenV5: "",900 eightA5: "",901 eightB5: "",902 eightV5: "",903904 sixA6: "",905 sixB6: "",906 sixV6: "",907 sevenA6: "",908 sevenB6: "",909 sevenV6: "",910 eightA6: "",911 eightB6: "",912 eightV6: "",913914 sixA7: "",915 sixB7: "",916 sixV7: "",917 sevenA7: "",918 sevenB7: "",919 sevenV7: "",920 eightA7: "",921 eightB7: "",922 eightV7: "",923924}; // База данных на субботу925926927928929// const vt = {930// sixA: "", // 6а931// sixB: "", // 6б932// sixV: "ЖП" // 6в933// }; // База данных на вторник934935zagolovokDenNedely.textContent = `Понедельник`;936937sixA1.textContent = pn.sixA;938sixB1.textContent = pn.sixB;939sixV1.textContent = pn.sixV;940sevenA1.textContent = pn.sevenA;941sevenB1.textContent = pn.sevenB;942sevenV1.textContent = pn.sevenV;943eightA1.textContent = pn.eightA;944eightB1.textContent = pn.eightB;945eightV1.textContent = pn.eightV;946947sixA2.textContent = pn.sixA1;948sixB2.textContent = pn.sixB1;949sixV2.textContent = pn.sixV1;950sevenA2.textContent = pn.sevenA1;951sevenB2.textContent = pn.sevenB1;952sevenV2.textContent = pn.sevenV1;953eightA2.textContent = pn.eightA1;954eightB2.textContent = pn.eightB1;955eightV2.textContent = pn.eightV1;956957sixA3.textContent = pn.sixA2;958sixB3.textContent = pn.sixB2;959sixV3.textContent = pn.sixV2;960sevenA3.textContent = pn.sevenA2;961sevenB3.textContent = pn.sevenB2;962sevenV3.textContent = pn.sevenV2;963eightA3.textContent = pn.eightA2;964eightB3.textContent = pn.eightB2;965eightV3.textContent = pn.eightV2;966967sixA4.textContent = pn.sixA3;968sixB4.textContent = pn.sixB3;969sixV4.textContent = pn.sixV3;970sevenA4.textContent = pn.sevenA3;971sevenB4.textContent = pn.sevenB3;972sevenV4.textContent = pn.sevenV3;973eightA4.textContent = pn.eightA3;974eightB4.textContent = pn.eightB3;975eightV4.textContent = pn.eightV3;976977sixA5.textContent = pn.sixA4;978sixB5.textContent = pn.sixB4;979sixV5.textContent = pn.sixV4;980sevenA5.textContent = pn.sevenA4;981sevenB5.textContent = pn.sevenB4;982sevenV5.textContent = pn.sevenV4;983eightA5.textContent = pn.eightA4;984eightB5.textContent = pn.eightB4;985eightV5.textContent = pn.eightV4;986987sixA6.textContent = pn.sixA5;988sixB6.textContent = pn.sixB5;989sixV6.textContent = pn.sixV5;990sevenA6.textContent = pn.sevenA5;991sevenB6.textContent = pn.sevenB5;992sevenV6.textContent = pn.sevenV5;993eightA6.textContent = pn.eightA5;994eightB6.textContent = pn.eightB5;995eightV6.textContent = pn.eightV5;996997sixA7.textContent = pn.sixA6;998sixB7.textContent = pn.sixB6;999sixV7.textContent = pn.sixV6;1000sevenA7.textContent = pn.sevenA6;1001sevenB7.textContent = pn.sevenB6;1002sevenV7.textContent = pn.sevenV6;1003eightA7.textContent = pn.eightA6;1004eightB7.textContent = pn.eightB6;1005eightV7.textContent = pn.eightV6;10061007ponedelnik.addEventListener('click', () => {1008 zagolovokDenNedely.textContent = `Понедельник`;10091010 sixA1.textContent = pn.sixA;1011 sixB1.textContent = pn.sixB;1012 sixV1.textContent = pn.sixV;1013 sevenA1.textContent = pn.sevenA;1014 sevenB1.textContent = pn.sevenB;1015 sevenV1.textContent = pn.sevenV;1016 eightA1.textContent = pn.eightA;1017 eightB1.textContent = pn.eightB;1018 eightV1.textContent = pn.eightV;10191020 sixA2.textContent = pn.sixA1;1021 sixB2.textContent = pn.sixB1;1022 sixV2.textContent = pn.sixV1;1023 sevenA2.textContent = pn.sevenA1;1024 sevenB2.textContent = pn.sevenB1;1025 sevenV2.textContent = pn.sevenV1;1026 eightA2.textContent = pn.eightA1;1027 eightB2.textContent = pn.eightB1;1028 eightV2.textContent = pn.eightV1;10291030 sixA3.textContent = pn.sixA2;1031 sixB3.textContent = pn.sixB2;1032 sixV3.textContent = pn.sixV2;1033 sevenA3.textContent = pn.sevenA2;1034 sevenB3.textContent = pn.sevenB2;1035 sevenV3.textContent = pn.sevenV2;1036 eightA3.textContent = pn.eightA2;1037 eightB3.textContent = pn.eightB2;1038 eightV3.textContent = pn.eightV2;10391040 sixA4.textContent = pn.sixA3;1041 sixB4.textContent = pn.sixB3;1042 sixV4.textContent = pn.sixV3;1043 sevenA4.textContent = pn.sevenA3;1044 sevenB4.textContent = pn.sevenB3;1045 sevenV4.textContent = pn.sevenV3;1046 eightA4.textContent = pn.eightA3;1047 eightB4.textContent = pn.eightB3;1048 eightV4.textContent = pn.eightV3;10491050 sixA5.textContent = pn.sixA4;1051 sixB5.textContent = pn.sixB4;1052 sixV5.textContent = pn.sixV4;1053 sevenA5.textContent = pn.sevenA4;1054 sevenB5.textContent = pn.sevenB4;1055 sevenV5.textContent = pn.sevenV4;1056 eightA5.textContent = pn.eightA4;1057 eightB5.textContent = pn.eightB4;1058 eightV5.textContent = pn.eightV4;10591060 sixA6.textContent = pn.sixA5;1061 sixB6.textContent = pn.sixB5;1062 sixV6.textContent = pn.sixV5;1063 sevenA6.textContent = pn.sevenA5;1064 sevenB6.textContent = pn.sevenB5;1065 sevenV6.textContent = pn.sevenV5;1066 eightA6.textContent = pn.eightA5;1067 eightB6.textContent = pn.eightB5;1068 eightV6.textContent = pn.eightV5;10691070 sixA7.textContent = pn.sixA6;1071 sixB7.textContent = pn.sixB6;1072 sixV7.textContent = pn.sixV6;1073 sevenA7.textContent = pn.sevenA6;1074 sevenB7.textContent = pn.sevenB6;1075 sevenV7.textContent = pn.sevenV6;1076 eightA7.textContent = pn.eightA6;1077 eightB7.textContent = pn.eightB6;1078 eightV7.textContent = pn.eightV6;107910801081});10821083vtornik.addEventListener('click', () => {1084 zagolovokDenNedely.textContent = `Вторник`;10851086 sixA1.textContent = vt.sixA;1087 sixB1.textContent = vt.sixB;1088 sixV1.textContent = vt.sixV;1089 sevenA1.textContent = vt.sevenA;1090 sevenB1.textContent = vt.sevenB;1091 sevenV1.textContent = vt.sevenV;1092 eightA1.textContent = vt.eightA;1093 eightB1.textContent = vt.eightB;1094 eightV1.textContent = vt.eightV;10951096 sixA2.textContent = vt.sixA1;1097 sixB2.textContent = vt.sixB1;1098 sixV2.textContent = vt.sixV1;1099 sevenA2.textContent = vt.sevenA1;1100 sevenB2.textContent = vt.sevenB1;1101 sevenV2.textContent = vt.sevenV1;1102 eightA2.textContent = vt.eightA1;1103 eightB2.textContent = vt.eightB1;1104 eightV2.textContent = vt.eightV1;11051106 sixA3.textContent = vt.sixA2;1107 sixB3.textContent = vt.sixB2;1108 sixV3.textContent = vt.sixV2;1109 sevenA3.textContent = vt.sevenA2;1110 sevenB3.textContent = vt.sevenB2;1111 sevenV3.textContent = vt.sevenV2;1112 eightA3.textContent = vt.eightA2;1113 eightB3.textContent = vt.eightB2;1114 eightV3.textContent = vt.eightV2;11151116 sixA4.textContent = vt.sixA3;1117 sixB4.textContent = vt.sixB3;1118 sixV4.textContent = vt.sixV3;1119 sevenA4.textContent = vt.sevenA3;1120 sevenB4.textContent = vt.sevenB3;1121 sevenV4.textContent = vt.sevenV3;1122 eightA4.textContent = vt.eightA3;1123 eightB4.textContent = vt.eightB3;1124 eightV4.textContent = vt.eightV3;11251126 sixA5.textContent = vt.sixA4;1127 sixB5.textContent = vt.sixB4;1128 sixV5.textContent = vt.sixV4;1129 sevenA5.textContent = vt.sevenA4;1130 sevenB5.textContent = vt.sevenB4;1131 sevenV5.textContent = vt.sevenV4;1132 eightA5.textContent = vt.eightA4;1133 eightB5.textContent = vt.eightB4;1134 eightV5.textContent = vt.eightV4;11351136 sixA6.textContent = vt.sixA5;1137 sixB6.textContent = vt.sixB5;1138 sixV6.textContent = vt.sixV5;1139 sevenA6.textContent = vt.sevenA5;1140 sevenB6.textContent = vt.sevenB5;1141 sevenV6.textContent = vt.sevenV5;1142 eightA6.textContent = vt.eightA5;1143 eightB6.textContent = vt.eightB5;1144 eightV6.textContent = vt.eightV5;11451146 sixA7.textContent = vt.sixA6;1147 sixB7.textContent = vt.sixB6;1148 sixV7.textContent = vt.sixV6;1149 sevenA7.textContent = vt.sevenA6;1150 sevenB7.textContent = vt.sevenB6;1151 sevenV7.textContent = vt.sevenV6;1152 eightA7.textContent = vt.eightA6;1153 eightB7.textContent = vt.eightB6;1154 eightV7.textContent = vt.eightV6;1155});11561157sreda.addEventListener('click', () => {1158 zagolovokDenNedely.textContent = `Среда`;11591160 sixA1.textContent = sr.sixA;1161 sixB1.textContent = sr.sixB;1162 sixV1.textContent = sr.sixV;1163 sevenA1.textContent = sr.sevenA;1164 sevenB1.textContent = sr.sevenB;1165 sevenV1.textContent = sr.sevenV;1166 eightA1.textContent = sr.eightA;1167 eightB1.textContent = sr.eightB;1168 eightV1.textContent = sr.eightV;11691170 sixA2.textContent = sr.sixA1;1171 sixB2.textContent = sr.sixB1;1172 sixV2.textContent = sr.sixV1;1173 sevenA2.textContent = sr.sevenA1;1174 sevenB2.textContent = sr.sevenB1;1175 sevenV2.textContent = sr.sevenV1;1176 eightA2.textContent = sr.eightA1;1177 eightB2.textContent = sr.eightB1;1178 eightV2.textContent = sr.eightV1;11791180 sixA3.textContent = sr.sixA2;1181 sixB3.textContent = sr.sixB2;1182 sixV3.textContent = sr.sixV2;1183 sevenA3.textContent = sr.sevenA2;1184 sevenB3.textContent = sr.sevenB2;1185 sevenV3.textContent = sr.sevenV2;1186 eightA3.textContent = sr.eightA2;1187 eightB3.textContent = sr.eightB2;1188 eightV3.textContent = sr.eightV2;11891190 sixA4.textContent = sr.sixA3;1191 sixB4.textContent = sr.sixB3;1192 sixV4.textContent = sr.sixV3;1193 sevenA4.textContent = sr.sevenA3;1194 sevenB4.textContent = sr.sevenB3;1195 sevenV4.textContent = sr.sevenV3;1196 eightA4.textContent = sr.eightA3;1197 eightB4.textContent = sr.eightB3;1198 eightV4.textContent = sr.eightV3;11991200 sixA5.textContent = sr.sixA4;1201 sixB5.textContent = sr.sixB4;1202 sixV5.textContent = sr.sixV4;1203 sevenA5.textContent = sr.sevenA4;1204 sevenB5.textContent = sr.sevenB4;1205 sevenV5.textContent = sr.sevenV4;1206 eightA5.textContent = sr.eightA4;1207 eightB5.textContent = sr.eightB4;1208 eightV5.textContent = sr.eightV4;12091210 sixA6.textContent = sr.sixA5;1211 sixB6.textContent = sr.sixB5;1212 sixV6.textContent = sr.sixV5;1213 sevenA6.textContent = sr.sevenA5;1214 sevenB6.textContent = sr.sevenB5;1215 sevenV6.textContent = sr.sevenV5;1216 eightA6.textContent = sr.eightA5;1217 eightB6.textContent = sr.eightB5;1218 eightV6.textContent = sr.eightV5;12191220 sixA7.textContent = sr.sixA6;1221 sixB7.textContent = sr.sixB6;1222 sixV7.textContent = sr.sixV6;1223 sevenA7.textContent = sr.sevenA6;1224 sevenB7.textContent = sr.sevenB6;1225 sevenV7.textContent = sr.sevenV6;1226 eightA7.textContent = sr.eightA6;1227 eightB7.textContent = sr.eightB6;1228 eightV7.textContent = sr.eightV6;1229});12301231chetverg.addEventListener('click', () => {1232 zagolovokDenNedely.textContent = `Четверг`;12331234 sixA1.textContent = ch.sixA;1235 sixB1.textContent = ch.sixB;1236 sixV1.textContent = ch.sixV;1237 sevenA1.textContent = ch.sevenA;1238 sevenB1.textContent = ch.sevenB;1239 sevenV1.textContent = ch.sevenV;1240 eightA1.textContent = ch.eightA;1241 eightB1.textContent = ch.eightB;1242 eightV1.textContent = ch.eightV;12431244 sixA2.textContent = ch.sixA1;1245 sixB2.textContent = ch.sixB1;1246 sixV2.textContent = ch.sixV1;1247 sevenA2.textContent = ch.sevenA1;1248 sevenB2.textContent = ch.sevenB1;1249 sevenV2.textContent = ch.sevenV1;1250 eightA2.textContent = ch.eightA1;1251 eightB2.textContent = ch.eightB1;1252 eightV2.textContent = ch.eightV1;12531254 sixA3.textContent = ch.sixA2;1255 sixB3.textContent = ch.sixB2;1256 sixV3.textContent = ch.sixV2;1257 sevenA3.textContent = ch.sevenA2;1258 sevenB3.textContent = ch.sevenB2;1259 sevenV3.textContent = ch.sevenV2;1260 eightA3.textContent = ch.eightA2;1261 eightB3.textContent = ch.eightB2;1262 eightV3.textContent = ch.eightV2;12631264 sixA4.textContent = ch.sixA3;1265 sixB4.textContent = ch.sixB3;1266 sixV4.textContent = ch.sixV3;1267 sevenA4.textContent = ch.sevenA3;1268 sevenB4.textContent = ch.sevenB3;1269 sevenV4.textContent = ch.sevenV3;1270 eightA4.textContent = ch.eightA3;1271 eightB4.textContent = ch.eightB3;1272 eightV4.textContent = ch.eightV3;12731274 sixA5.textContent = ch.sixA4;1275 sixB5.textContent = ch.sixB4;1276 sixV5.textContent = ch.sixV4;1277 sevenA5.textContent = ch.sevenA4;1278 sevenB5.textContent = ch.sevenB4;1279 sevenV5.textContent = ch.sevenV4;1280 eightA5.textContent = ch.eightA4;1281 eightB5.textContent = ch.eightB4;1282 eightV5.textContent = ch.eightV4;12831284 sixA6.textContent = ch.sixA5;1285 sixB6.textContent = ch.sixB5;1286 sixV6.textContent = ch.sixV5;1287 sevenA6.textContent = ch.sevenA5;1288 sevenB6.textContent = ch.sevenB5;1289 sevenV6.textContent = ch.sevenV5;1290 eightA6.textContent = ch.eightA5;1291 eightB6.textContent = ch.eightB5;1292 eightV6.textContent = ch.eightV5;12931294 sixA7.textContent = ch.sixA6;1295 sixB7.textContent = ch.sixB6;1296 sixV7.textContent = ch.sixV6;1297 sevenA7.textContent = ch.sevenA6;1298 sevenB7.textContent = ch.sevenB6;1299 sevenV7.textContent = ch.sevenV6;1300 eightA7.textContent = ch.eightA6;1301 eightB7.textContent = ch.eightB6;1302 eightV7.textContent = ch.eightV6;1303});13041305patnicha.addEventListener('click', () => {1306 zagolovokDenNedely.textContent = `Пятница`;13071308 sixA1.textContent = pt.sixA;1309 sixB1.textContent = pt.sixB;1310 sixV1.textContent = pt.sixV;1311 sevenA1.textContent = pt.sevenA;1312 sevenB1.textContent = pt.sevenB;1313 sevenV1.textContent = pt.sevenV;1314 eightA1.textContent = pt.eightA;1315 eightB1.textContent = pt.eightB;1316 eightV1.textContent = pt.eightV;13171318 sixA2.textContent = pt.sixA1;1319 sixB2.textContent = pt.sixB1;1320 sixV2.textContent = pt.sixV1;1321 sevenA2.textContent = pt.sevenA1;1322 sevenB2.textContent = pt.sevenB1;1323 sevenV2.textContent = pt.sevenV1;1324 eightA2.textContent = pt.eightA1;1325 eightB2.textContent = pt.eightB1;1326 eightV2.textContent = pt.eightV1;13271328 sixA3.textContent = pt.sixA2;1329 sixB3.textContent = pt.sixB2;1330 sixV3.textContent = pt.sixV2;1331 sevenA3.textContent = pt.sevenA2;1332 sevenB3.textContent = pt.sevenB2;1333 sevenV3.textContent = pt.sevenV2;1334 eightA3.textContent = pt.eightA2;1335 eightB3.textContent = pt.eightB2;1336 eightV3.textContent = pt.eightV2;13371338 sixA4.textContent = pt.sixA3;1339 sixB4.textContent = pt.sixB3;1340 sixV4.textContent = pt.sixV3;1341 sevenA4.textContent = pt.sevenA3;1342 sevenB4.textContent = pt.sevenB3;1343 sevenV4.textContent = pt.sevenV3;1344 eightA4.textContent = pt.eightA3;1345 eightB4.textContent = pt.eightB3;1346 eightV4.textContent = pt.eightV3;13471348 sixA5.textContent = pt.sixA4;1349 sixB5.textContent = pt.sixB4;1350 sixV5.textContent = pt.sixV4;1351 sevenA5.textContent = pt.sevenA4;1352 sevenB5.textContent = pt.sevenB4;1353 sevenV5.textContent = pt.sevenV4;1354 eightA5.textContent = pt.eightA4;1355 eightB5.textContent = pt.eightB4;1356 eightV5.textContent = pt.eightV4;13571358 sixA6.textContent = pt.sixA5;1359 sixB6.textContent = pt.sixB5;1360 sixV6.textContent = pt.sixV5;1361 sevenA6.textContent = pt.sevenA5;1362 sevenB6.textContent = pt.sevenB5;1363 sevenV6.textContent = pt.sevenV5;1364 eightA6.textContent = pt.eightA5;1365 eightB6.textContent = pt.eightB5;1366 eightV6.textContent = pt.eightV5;13671368 sixA7.textContent = pt.sixA6;1369 sixB7.textContent = pt.sixB6;1370 sixV7.textContent = pt.sixV6;1371 sevenA7.textContent = pt.sevenA6;1372 sevenB7.textContent = pt.sevenB6;1373 sevenV7.textContent = pt.sevenV6;1374 eightA7.textContent = pt.eightA6;1375 eightB7.textContent = pt.eightB6;1376 eightV7.textContent = pt.eightV6;1377});137813791380subbota.addEventListener('click', () => {1381 zagolovokDenNedely.textContent = `Суббота`;13821383 sixA1.textContent = su.sixA;1384 sixB1.textContent = su.sixB;1385 sixV1.textContent = su.sixV;1386 sevenA1.textContent = su.sevenA;1387 sevenB1.textContent = su.sevenB;1388 sevenV1.textContent = su.sevenV;1389 eightA1.textContent = su.eightA;1390 eightB1.textContent = su.eightB;1391 eightV1.textContent = su.eightV;13921393 sixA2.textContent = su.sixA1;1394 sixB2.textContent = su.sixB1;1395 sixV2.textContent = su.sixV1;1396 sevenA2.textContent = su.sevenA1;1397 sevenB2.textContent = su.sevenB1;1398 sevenV2.textContent = su.sevenV1;1399 eightA2.textContent = su.eightA1;1400 eightB2.textContent = su.eightB1;1401 eightV2.textContent = su.eightV1;14021403 sixA3.textContent = pt.sixA2;1404 sixB3.textContent = su.sixB2;1405 sixV3.textContent = su.sixV2;1406 sevenA3.textContent = su.sevenA2;1407 sevenB3.textContent = su.sevenB2;1408 sevenV3.textContent = su.sevenV2;1409 eightA3.textContent = su.eightA2;1410 eightB3.textContent = su.eightB2;1411 eightV3.textContent = su.eightV2;14121413 sixA4.textContent = su.sixB3;1414 sixV4.textContent = su.sixV3;1415 sevenA4.textContent = su.sevenA3;1416 sevenB4.textContent = su.sevenB3;1417 sevenV4.textContent = su.sevenV3;1418 eightA4.textContent = su.eightA3;1419 eightB4.textContent = su.eightB3;1420 eightV4.textContent = su.eightV3;14211422 sixA5.textContent = su.sixA4;1423 sixB5.textContent = su.sixB4;1424 sixV5.textContent = su.sixV4;1425 sevenA5.textContent = su.sevenA4;1426 sevenB5.textContent = su.sevenB4;1427 sevenV5.textContent = su.sevenV4;1428 eightA5.textContent = su.eightA4;1429 eightB5.textContent = su.eightB4;1430 eightV5.textContent = su.eightV4;14311432 sixA6.textContent = su.sixA5;1433 sixB6.textContent = su.sixB5;1434 sixV6.textContent = su.sixV5;1435 sevenA6.textContent = su.sevenA5;1436 sevenB6.textContent = su.sevenB5;1437 sevenV6.textContent = su.sevenV5;1438 eightA6.textContent = su.eightA5;1439 eightB6.textContent = su.eightB5;1440 eightV6.textContent = su.eightV5;14411442 sixA7.textContent = su.sixA6;1443 sixB7.textContent = su.sixB6;1444 sixV7.textContent = su.sixV6;1445 sevenA7.textContent = su.sevenA6;1446 sevenB7.textContent = su.sevenB6;1447 sevenV7.textContent = su.sevenV6;1448 eightA7.textContent = su.eightA6;1449 eightB7.textContent = su.eightB6;1450 eightV7.textContent = su.eightV6; ...

Full Screen

Full Screen

jexcel.js

Source:jexcel.js Github

copy

Full Screen

12const studentList = []3var student;4var a;5var tr;6$(function () {78 $.getJSON("StudentClasses/elec1.json", function (data) {910 student = data;111213 });1415161718 $("#calc").click(function () {19 a = $('.draggable').children();20 for (var i = 3; i < a.length; i++) {21 tr = a[i].querySelectorAll('[data-x]')22 var returnedStudent = fillStudent(tr, student)23 studentList.push(JSON.parse(JSON.stringify(returnedStudent)))24252627 }28 });2930 $("#fixedPresentageBtn").click(function () {31 var fixedPresentageValue = document.getElementById("fixedPresentagevalue").value;32 a = $('.draggable').children();33 for (var i = 3; i < a.length; i++) {34 tr = a[i].querySelectorAll('[data-x]')35 var returnedStudent = fillStudentFixedPresentage(tr, studentList[i - 3], fixedPresentageValue)36 //studentList.push(JSON.parse(JSON.stringify(returnedStudent)))37383940 }41 });42434445}46474849);5051function fillStudent(tr, student) {52 let q = [];53 let wExam = []54 var i = 0;55 var studentTotalMarks = 0;5657 student.id = tr[i].textContent;58 student.code = tr[++i].textContent;59 student.name = tr[++i].textContent;60 student.status = tr[++i].textContent;61 student.subjects.forEach(function (subject) {6263 if ((subject.term == 1 && !subject.havePracticalExam) || (subject.term == 2 && !subject.havePracticalExam && !subject.isContinued)) {64 //465 var isRasibLiha = false;66 subject.studentTermActivity = tr[++i].textContent;67 subject.studentWrittenExam = tr[++i].textContent;6869 subject.studentMark = Number(subject.studentTermActivity) + Number(subject.studentWrittenExam);7071 (subject.writtenExam * 0.3 <= subject.studentWrittenExam) ? tr[++i].textContent = subject.studentMark : (tr[++i].textContent = "رل", isRasibLiha = true); //,subject.studentMark="رل"72 (isRasibLiha) ? (subject.studentGrade = "رل", tr[++i].textContent = "رل") : (subject.studentGrade = calcGrade(subject.fullMark, subject.studentMark), tr[++i].textContent = subject.studentGrade)73 if (subject.isContinued && subject.term == 1) {74 q.push(subject.studentMark); wExam.push(subject.studentWrittenExam)75 };7677 if (student.status != "مستجد" && !subject.isContinued && subject.studentGrade != "رل") {78 var j = i;79 if (subject.studentGrade != "ض" && subject.studentMark > subject.fullMark * 0.65 - 1) {80 tr[j].textContent = "ل";81 tr[--j].textContent = (subject.fullMark * 0.65 - 1);82 subject.studentMark = (subject.fullMark * 0.65 - 1);83 }8485 }8687 if (!subject.isContinued && !isRasibLiha) studentTotalMarks = studentTotalMarks + subject.studentMark;88 }899091 else if ((subject.term == 1 && subject.havePracticalExam)92 || (subject.term == 2 && subject.havePracticalExam && !subject.isContinued)) {93 //594 var isRasibLiha = false;95 subject.studentTermActivity = tr[++i].textContent;96 subject.studentPracticalExam = tr[++i].textContent;97 subject.studentWrittenExam = tr[++i].textContent;98 subject.studentMark = Number(subject.studentTermActivity) + Number(subject.studentWrittenExam) + Number(subject.studentPracticalExam);99 (subject.writtenExam * 0.3 <= subject.studentWrittenExam) ? tr[++i].textContent = subject.studentMark : (tr[++i].textContent = "رل", isRasibLiha = true);//,subject.studentMark="رل"100 (isRasibLiha) ? (subject.studentGrade = "رل", tr[++i].textContent = "رل") : (subject.studentGrade = calcGrade(subject.fullMark, subject.studentMark), tr[++i].textContent = subject.studentGrade)101 if (subject.isContinued && subject.term == 1) {102 q.push(subject.studentMark); wExam.push(subject.studentWrittenExam)103 };104105106 if (student.status != "مستجد" && !subject.isContinued && subject.studentGrade != "رل") {107 var j = i;108 if (subject.studentGrade != "ض" && subject.studentMark > subject.fullMark * 0.65 - 1) {109110 tr[j].textContent = "ل";111 tr[--j].textContent = (subject.fullMark * 0.65 - 1);112 subject.studentMark = (subject.fullMark * 0.65 - 1);113 }114115 }116117 if (!subject.isContinued && !isRasibLiha) studentTotalMarks = studentTotalMarks + subject.studentMark;118 }119120121122123 else if (subject.term == 2 && !subject.havePracticalExam && subject.isContinued) {124 //6125 var isRasibLiha = false;126 subject.studentTermActivity = tr[++i].textContent;127 subject.studentWrittenExam = tr[++i].textContent;128129130 subject.studentMark = Number(subject.studentTermActivity) + Number(subject.studentWrittenExam);131 (subject.writtenExam * 0.3 <= subject.studentWrittenExam) ? tr[++i].textContent = subject.studentMark : (tr[++i].textContent = "رل", isRasibLiha = true);//,subject.studentMark="رل"132 (isRasibLiha) ? (subject.studentGrade = "رل", tr[++i].textContent = "رل") : (subject.studentGrade = calcGrade(subject.fullMark, subject.studentMark), tr[++i].textContent = subject.studentGrade)133 //////////134135 if (Number(subject.studentWrittenExam) + Number(wExam.shift()) < 0.3 * 2 * subject.writtenExam) {136 subject.student2termsMark = "رل";137 tr[++i].textContent = "رل";138139 }140 else {141 subject.student2termsMark = Number(subject.studentMark) + Number(q.shift());142 tr[++i].textContent = subject.student2termsMark;143 }144145146147 if (subject.student2termsMark == "رل") {148 subject.studentTotalGrade = "رل";149 tr[++i].textContent = subject.studentTotalGrade;150 }151 else {152 subject.studentTotalGrade = calcGrade(subject.totalFullMark, subject.student2termsMark);153 tr[++i].textContent = subject.studentTotalGrade;154 }155156157 if (student.status != "مستجد" && subject.studentTotalGrade != "رل") {158 var j = i;159 /////subject.studentGrade160 if (subject.studentTotalGrade != "ض" && subject.student2termsMark > subject.totalFullMark * 0.65 - 1) {161162 tr[j].textContent = "ل";163 tr[--j].textContent = (subject.totalFullMark * 0.65 - 1);164 subject.student2termsMark = (subject.totalFullMark * 0.65 - 1);165 }166167 }168 if (!isRasibLiha) studentTotalMarks = studentTotalMarks + subject.student2termsMark;169 }170171172173 else if (subject.term == 2 && subject.havePracticalExam && subject.isContinued) {174 //7175 //////////////////176 var isRasibLiha = false;177 subject.studentTermActivity = tr[++i].textContent;178 subject.studentPracticalExam = tr[++i].textContent;179180181 subject.studentWrittenExam = tr[++i].textContent;182 subject.studentMark = Number(subject.studentTermActivity) + Number(subject.studentWrittenExam) + Number(subject.studentPracticalExam);183 ////////////////////////////////////////////////184 (subject.writtenExam * 0.3 <= subject.studentWrittenExam) ? tr[++i].textContent = subject.studentMark : (tr[++i].textContent = "رل", isRasibLiha = true);//,subject.studentMark="رل"185 (isRasibLiha) ? (subject.studentGrade = "رل", tr[++i].textContent = "رل") : (subject.studentGrade = calcGrade(subject.fullMark, subject.studentMark), tr[++i].textContent = subject.studentGrade)186187 if (Number(subject.studentWrittenExam) + Number(wExam.shift()) < 0.3 * 2 * subject.writtenExam) {188 subject.student2termsMark = "رل";189 tr[++i].textContent = "رل";190191 }192 else {193 subject.student2termsMark = Number(subject.studentMark) + Number(q.shift());194 tr[++i].textContent = subject.student2termsMark;195 }196197198199 if (subject.student2termsMark == "رل") {200 subject.studentTotalGrade = "رل";201 tr[++i].textContent = subject.studentTotalGrade;202 }203 else {204 subject.studentTotalGrade = calcGrade(subject.totalFullMark, subject.student2termsMark);205 tr[++i].textContent = subject.studentTotalGrade;206 }207208209 if (student.status != "مستجد" && subject.studentTotalGrade != "رل") {210 var j = i;211 if (subject.studentTotalGrade != "ض" && subject.student2termsMark > subject.totalFullMark * 0.65 - 1) {212213 tr[j].textContent = "ل";214 tr[--j].textContent = (subject.totalFullMark * 0.65 - 1);215 subject.student2termsMark = (subject.totalFullMark * 0.65 - 1);216 }217218 }219 if (!isRasibLiha) studentTotalMarks = studentTotalMarks + subject.student2termsMark;220221 }222223 else if (subject.isFromPastYear) {224 // 9225226 if (tr[++i].textContent == "") {227 i = i + 8;228 } else {229 var isRasibLiha;230 subject.name = tr[i].textContent;231 subject.termActivity = tr[++i].textContent;232 subject.practicalExam = tr[++i].textContent;233 subject.writtenExam = tr[++i].textContent;234 subject.fullMark = Number(subject.termActivity) + Number(subject.practicalExam) + Number(subject.writtenExam);235 subject.studentTermActivity = tr[++i].textContent;236 subject.studentPracticalExam = tr[++i].textContent;237 subject.studentWrittenExam = tr[++i].textContent;238 subject.studentMark = Number(subject.studentTermActivity) + Number(subject.studentPracticalExam) + Number(subject.studentWrittenExam);239 //calc the marks240241242 if (subject.writtenExam * 0.3 > subject.studentWrittenExam) {243 tr[++i].textContent = "رل";244 tr[++i].textContent = "رل";245 }246 else if ((subject.writtenExam * 0.3 <= subject.studentWrittenExam) && (subject.studentMark > subject.fullMark * 0.65 - 1)) {247 tr[++i].textContent = subject.fullMark * 0.65 - 1;248 tr[++i].textContent = "ل";249 }250251 else if ((subject.writtenExam * 0.3 <= subject.studentWrittenExam) && (subject.studentMark < subject.fullMark * 0.5)) {252 tr[++i].textContent = subject.studentMark;253 tr[++i].textContent = "ض";254 }255 else {256 tr[++i].textContent = subject.studentMark;257 tr[++i].textContent = "ل";258 }259260 }261262263 }264 else {265 console.log(subject.name + "4")266267 console.log("undefiend situation")268 }269270 })271 tr[++i].textContent = studentTotalMarks;272 student.totalMarks = studentTotalMarks;273 student.totalGrade = calcGrade(student.totalYearMarks, studentTotalMarks)274 tr[++i].textContent = student.totalGrade;275276 return student;277}278279280// second iteration281282283function fillStudentFixedPresentage(tr, student, fixedPresentageValue) {284 var i = 4;285286287 student.subjects.forEach(function (subject) {288289 //term 1 and is contiued290 if (subject.isContinued && subject.term == 1 && !subject.havePracticalExam) i = i + 4;291 else if (subject.isContinued && subject.term == 1 && subject.havePracticalExam) i = i + 5;292 // not continued293 else if (!subject.isContinued && !subject.isFromPastYear) {294 (subject.havePracticalExam) ? i = i + 3 : i = i + 2;295296 if (subject.studentMark == "رل") i = i + 2;297 else if (isNeedFixedPresentage(subject.fullMark, subject.studentMark, fixedPresentageValue)) {298 subject.studentMark = subject.fullMark * 0.5;299 subject.studentGrade = "ل";300 tr[i].textContent = subject.studentMark;301 tr[++i].textContent = subject.studentGrade;302 }303 else {304 305 i = i + 2306 };307308 }309310 // subject in term 2 and mekamela311 else if (subject.isContinued && subject.term == 2) {312 (subject.havePracticalExam) ? i = i + 5 : i = i + 4;313 if (subject.studentTotalGrade == "رل") i = i + 2;314 else if (isNeedFixedPresentage(subject.totalFullMark, subject.student2termsMark, fixedPresentageValue)) {315 subject.student2termsMark = subject.totalFullMark * 0.5;316 subject.studentTotalgrade = "ل";317 tr[++i].textContent = subject.student2termsMark;318 tr[++i].textContent = subject.studentTotalgrade;319 }320 else {321 322 i = i + 2323 };324 }325326 // subjects form past year 327 else if (subject.isFromPastYear) {328 //فيه حوار هنا أو الحالة بتاعت خمس مواد مش شغالة 329 console.log(tr[i].textContent)330 i = i + 7;331 if (subject.studentMark == "رل") i = i + 2;332 else if (isNeedFixedPresentage(subject.fullMark, subject.studentMark, fixedPresentageValue)) {333 subject.studentMark = subject.fullMark * 0.5;334 subject.studentGrade = "ل";335 tr[i].textContent = subject.studentMark;336 tr[++i].textContent = subject.studentGrade;337 }338 else i = i + 2;339340 }341342 });343344 return student;345}346347348349350351352353354355356357358function calcGrade(fullMark, studentMark) {359360 if (studentMark > fullMark * 0.85) return "م"361 else if (studentMark >= fullMark * 0.75) return "جج"362 else if (studentMark >= fullMark * 0.65) return "ج"363 else if (studentMark >= fullMark * 0.50) return "ل"364 else return "ض"365366}367368function isNeedFixedPresentage(fullMark, studentMark, fixedPresentage) {369 var fixed = 0.5 - fixedPresentage * 0.01;370 if (studentMark < fullMark * 0.5 && studentMark > fullMark * fixed) return true;371 else return false;372373374}375376function exportTableToCSV(filename) {377 var csv = [];378 var rows = document.querySelectorAll("table tr");379380 for (var i = 0; i < rows.length; i++) {381 var row = [], cols = rows[i].querySelectorAll("td, th");382383 for (var j = 0; j < cols.length; j++)384 row.push(cols[j].innerText);385386 csv.push(row.join(","));387 }388389 // Download CSV file390 downloadCSV(csv.join("\n"), filename);391}392393function downloadCSV(csv, filename) {394 var csvFile;395 var downloadLink;396397398 // CSV file399 csvFile = new Blob(["\ufeff", [csv]]);400401 //csvFile = new Blob([csv], {type: "application/xlxs"});402403 // Download link404 downloadLink = document.createElement("a");405406 // File name407 downloadLink.download = filename;408409 // Create a link to the file410 downloadLink.href = window.URL.createObjectURL(csvFile);411412 // Hide download link413 downloadLink.style.display = "none";414415 // Add the link to DOM416 document.body.appendChild(downloadLink);417418 // Click download link419 downloadLink.click(); ...

Full Screen

Full Screen

tic-tac-toe.js

Source:tic-tac-toe.js Github

copy

Full Screen

1const player1Input = document.querySelector(".player1-input")2const player2Input = document.querySelector(".player2-input")3const submitName = document.querySelector(".submit")4const player1Name = document.querySelector(".player1-label")5const player2Name = document.querySelector(".player2-label")6const p1X = document.querySelector(".p1-X")7const p1O = document.querySelector(".p1-O")8const p2X = document.querySelector(".p2-X")9const p2O = document.querySelector(".p2-O")10const cells = document.querySelectorAll(".cell")11const one = document.querySelector(".one")12const two = document.querySelector(".two")13const three = document.querySelector(".three")14const four = document.querySelector(".four")15const five = document.querySelector(".five")16const six = document.querySelector(".six")17const seven = document.querySelector(".seven")18const eight = document.querySelector(".eight")19const nine = document.querySelector(".nine")20const reset = document.querySelector(".reset")21const winner = document.querySelector(".winner")22const p1Score = document.querySelector(".p1-score")23const p2Score = document.querySelector(".p2-score")24let playerOne;25let playerTwo;26let gameStatus;27p1X.addEventListener("click", () => {28 playerOne = "X";29 playerTwo = "O";30 p1O.disabled = true;31 p2X.disabled = true;32 p1X.style.cssText = "background: green; transform: scale(1.3);"33 p2O.style.cssText = "background: red; transform: scale(1.3);"34})35p1O.addEventListener("click", () => {36 playerOne = "O";37 playerTwo = "X";38 p1X.disabled = true;39 p2O.disabled = true;40 p1O.style.cssText = "background: green; transform: scale(1.3);"41 p2X.style.cssText = "background: red; transform: scale(1.3);"42})43let option = false;44function currentPlayer() {45 if(option === true) {46 return option = false47 }48 else if(option === false) {49 return option = true50 }51}52one.addEventListener("click", () => {53 currentPlayer()54 if(option === true) {55 one.textContent = playerOne;56 }57 else if(option === false) {58 one.textContent = playerTwo;59 }60 if(one.textContent === playerOne || playerTwo) {61 one.style.pointerEvents = "none";62 }63 checkWinner()64})65two.addEventListener("click", () => {66 currentPlayer()67 if(option === true) {68 two.textContent = playerOne;69 }70 else if(option === false) {71 two.textContent = playerTwo72 }73 if(one.textContent === playerOne || playerTwo) {74 two.style.pointerEvents = "none";75 }76 checkWinner()77})78three.addEventListener("click", () => {79 currentPlayer()80 if(option === true) {81 three.textContent = playerOne;82 }83 else if(option === false) {84 three.textContent = playerTwo85 }86 if(one.textContent === playerOne || playerTwo) {87 three.style.pointerEvents = "none"; 88 }89 checkWinner()90 91})92four.addEventListener("click", () => {93 currentPlayer()94 if(option === true) {95 four.textContent = playerOne;96 }97 else if(option === false) {98 four.textContent = playerTwo99 }100 if(one.textContent === playerOne || playerTwo) {101 four.style.pointerEvents = "none";102 }103 checkWinner()104})105five.addEventListener("click", () => {106 currentPlayer()107 if(option === true) {108 five.textContent = playerOne;109 }110 else if(option === false) {111 five.textContent = playerTwo112 }113 if(one.textContent === playerOne || playerTwo) {114 five.style.pointerEvents = "none";115 }116 checkWinner()117})118six.addEventListener("click", () => {119 currentPlayer()120 if(option === true) {121 six.textContent = playerOne;122 }123 else if(option === false) {124 six.textContent = playerTwo125 }126 if(one.textContent === playerOne || playerTwo) {127 six.style.pointerEvents = "none";128 }129 checkWinner()130})131seven.addEventListener("click", () => {132 currentPlayer()133 if(option === true) {134 seven.textContent = playerOne;135 }136 else if(option === false) {137 seven.textContent = playerTwo138 }139 if(one.textContent === playerOne || playerTwo) {140 seven.style.pointerEvents = "none";141 }142 checkWinner()143})144eight.addEventListener("click", () => {145 currentPlayer()146 if(option === true) {147 eight.textContent = playerOne;148 }149 else if(option === false) {150 eight.textContent = playerTwo151 }152 if(one.textContent === playerOne || playerTwo) {153 eight.style.pointerEvents = "none";154 }155 checkWinner()156})157nine.addEventListener("click", () => {158 currentPlayer()159 if(option === true) {160 nine.textContent = playerOne;161 }162 else if(option === false) {163 nine.textContent = playerTwo164 }165 if(one.textContent === playerOne || playerTwo) {166 nine.style.pointerEvents = "none";167 }168 checkWinner()169})170function checkWinner() {171 if((one.textContent === playerOne) && (two.textContent === playerOne) && (three.textContent === playerOne)) {172 one.style.cssText = "background: lightgreen; color: white;"173 two.style.cssText = "background: lightgreen; color: white;"174 three.style.cssText = "background: lightgreen; color: white;"175 cells.forEach(cell => cell.style.pointerEvents = "none")176 winner.textContent = `${player1Input.value} Wins`177 incrementPlayer1Score(p1Score)178 gameStatus = false;179 }180 else if((one.textContent === playerTwo) && (two.textContent === playerTwo) && (three.textContent === playerTwo)) {181 one.style.cssText = "background: lightgreen; color: white;"182 two.style.cssText = "background: lightgreen; color: white;"183 three.style.cssText = "background: lightgreen; color: white;"184 cells.forEach(cell => cell.style.pointerEvents = "none")185 winner.textContent = `${player2Input.value} Wins`186 incrementPlayer2Score(p2Score)187 gameStatus = false;188 }189 else if((one.textContent === playerOne) && (four.textContent === playerOne) && (seven.textContent === playerOne)) {190 one.style.cssText = "background: lightgreen; color: white;"191 four.style.cssText = "background: lightgreen; color: white;"192 seven.style.cssText = "background: lightgreen; color: white;"193 cells.forEach(cell => cell.style.pointerEvents = "none")194 winner.textContent = `${player1Input.value} Wins`195 incrementPlayer1Score(p1Score)196 gameStatus = false;197 }198 else if((one.textContent === playerTwo) && (four.textContent === playerTwo) && (seven.textContent === playerTwo)) {199 one.style.cssText = "background: lightgreen; color: white;"200 four.style.cssText = "background: lightgreen; color: white;"201 seven.style.cssText = "background: lightgreen; color: white;"202 cells.forEach(cell => cell.style.pointerEvents = "none")203 winner.textContent = `${player2Input.value} Wins`204 incrementPlayer2Score(p2Score)205 gameStatus = false;206 }207 else if((seven.textContent === playerOne) && (eight.textContent === playerOne) && (nine.textContent === playerOne)) {208 seven.style.cssText = "background: lightgreen; color: white;"209 eight.style.cssText = "background: lightgreen; color: white;"210 nine.style.cssText = "background: lightgreen; color: white;"211 cells.forEach(cell => cell.style.pointerEvents = "none")212 winner.textContent = `${player1Input.value} Wins`213 incrementPlayer1Score(p1Score)214 gameStatus = false;215 }216 else if((seven.textContent === playerTwo) && (eight.textContent === playerTwo) && (nine.textContent === playerTwo)) {217 seven.style.cssText = "background: lightgreen; color: white;"218 eight.style.cssText = "background: lightgreen; color: white;"219 nine.style.cssText = "background: lightgreen; color: white;"220 cells.forEach(cell => cell.style.pointerEvents = "none")221 winner.textContent = `${player2Input.value} Wins`222 incrementPlayer2Score(p2Score)223 gameStatus = false;224 }225 else if((three.textContent === playerOne) && (six.textContent === playerOne) && (nine.textContent === playerOne)) {226 three.style.cssText = "background: lightgreen; color: white;"227 six.style.cssText = "background: lightgreen; color: white;"228 nine.style.cssText = "background: lightgreen; color: white;"229 cells.forEach(cell => cell.style.pointerEvents = "none")230 winner.textContent = `${player1Input.value} Wins`231 incrementPlayer1Score(p1Score)232 gameStatus = false;233 }234 else if((three.textContent === playerTwo) && (six.textContent === playerTwo) && (nine.textContent === playerTwo)) {235 three.style.cssText = "background: lightgreen; color: white;"236 six.style.cssText = "background: lightgreen; color: white;"237 nine.style.cssText = "background: lightgreen; color: white;"238 cells.forEach(cell => cell.style.pointerEvents = "none")239 winner.textContent = `${player2Input.value} Wins`240 incrementPlayer2Score(p2Score)241 gameStatus = false;242 }243 else if((one.textContent === playerOne) && (five.textContent === playerOne) && (nine.textContent === playerOne)) {244 one.style.cssText = "background: lightgreen; color: white;"245 five.style.cssText = "background: lightgreen; color: white;"246 nine.style.cssText = "background: lightgreen; color: white;"247 cells.forEach(cell => cell.style.pointerEvents = "none")248 winner.textContent = `${player1Input.value} Wins`249 incrementPlayer1Score(p1Score)250 gameStatus = false;251 }252 else if((one.textContent === playerTwo) && (five.textContent === playerTwo) && (nine.textContent === playerTwo)) {253 one.style.cssText = "background: lightgreen; color: white;"254 five.style.cssText = "background: lightgreen; color: white;"255 nine.style.cssText = "background: lightgreen; color: white;"256 cells.forEach(cell => cell.style.pointerEvents = "none")257 winner.textContent = `${player2Input.value} Wins`258 incrementPlayer2Score(p2Score)259 gameStatus = false;260 }261 else if((three.textContent === playerOne) && (five.textContent === playerOne) && (seven.textContent === playerOne)) {262 three.style.cssText = "background: lightgreen; color: white;"263 five.style.cssText = "background: lightgreen; color: white;"264 seven.style.cssText = "background: lightgreen; color: white;"265 cells.forEach(cell => cell.style.pointerEvents = "none")266 winner.textContent = `${player1Input.value} Wins`267 incrementPlayer1Score(p1Score)268 gameStatus = false;269 }270 else if((three.textContent === playerTwo) && (five.textContent === playerTwo) && (seven.textContent === playerTwo)) {271 three.style.cssText = "background: lightgreen; color: white;"272 five.style.cssText = "background: lightgreen; color: white;"273 seven.style.cssText = "background: lightgreen; color: white;"274 cells.forEach(cell => cell.style.pointerEvents = "none")275 winner.textContent = `${player2Input.value} Wins`276 incrementPlayer2Score(p2Score)277 gameStatus = false;278 }279 else if((four.textContent === playerOne) && (five.textContent === playerOne) && (six.textContent === playerOne)) {280 four.style.cssText = "background: lightgreen; color: white;"281 five.style.cssText = "background: lightgreen; color: white;"282 six.style.cssText = "background: lightgreen; color: white;"283 cells.forEach(cell => cell.style.pointerEvents = "none")284 winner.textContent = `${player1Input.value} Wins`285 incrementPlayer1Score(p1Score)286 gameStatus = false;287 }288 else if((four.textContent === playerTwo) && (five.textContent === playerTwo) && (six.textContent === playerTwo)) {289 four.style.cssText = "background: lightgreen; color: white;"290 five.style.cssText = "background: lightgreen; color: white;"291 six.style.cssText = "background: lightgreen; color: white;"292 cells.forEach(cell => cell.style.pointerEvents = "none")293 winner.textContent = `${player2Input.value} Wins`294 incrementPlayer2Score(p2Score)295 gameStatus = false;296 }297 else if((two.textContent === playerOne) && (five.textContent === playerOne) && (eight.textContent === playerOne)) {298 two.style.cssText = "background: lightgreen; color: white;"299 five.style.cssText = "background: lightgreen; color: white;"300 eight.style.cssText = "background: lightgreen; color: white;"301 cells.forEach(cell => cell.style.pointerEvents = "none")302 winner.textContent = `${player1Input.value} Wins`303 incrementPlayer1Score(p1Score)304 gameStatus = false;305 }306 else if((two.textContent === playerTwo) && (five.textContent === playerTwo) && (eight.textContent === playerTwo)) {307 two.style.cssText = "background: lightgreen; color: white;"308 five.style.cssText = "background: lightgreen; color: white;"309 eight.style.cssText = "background: lightgreen; color: white;"310 cells.forEach(cell => cell.style.pointerEvents = "none")311 winner.textContent = `${player2Input.value} Wins`312 incrementPlayer2Score(p2Score)313 gameStatus = false;314 }315}316function incrementPlayer1Score(p1Score) {317 318 p1Score.textContent = parseInt(p1Score.textContent) + 1319 320}321function incrementPlayer2Score(p2Score) {322 323 p2Score.textContent = parseInt(p2Score.textContent) + 1324}325reset.addEventListener("click", () => {326 327 gameStatus = true;328 currentPlayer()329 document.querySelectorAll(".cell").forEach(cell => {cell.textContent = " "330 cell.style.cssText = "background: darkgoldenrod;"331 cell.style.pointerEvents = "auto"332})333})334submitName.addEventListener("click", () => {335 document.querySelector(".welcome").style.cssText = "display: none"336 document.querySelector("section").style.cssText = "display: flex;"337 player1Name.textContent = player1Input.value + " : ";338 player2Name.textContent = " : " + player2Input.value ;339 document.querySelector(".p1-score-label").textContent = player1Input.value;340 document.querySelector(".p2-score-label").textContent = player2Input.value;...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1var city_input; 2var search_button; 3var results;4var image1;5var image2;6var hum;7var tem;8var T;9var illust;10var wind;11var comm;12var rare;13var body;14var api_key = "159e01e6d3a2e8ff9e5056122f8a631c";15window.onload = function() {16 // HTMLの要素を取得する17 city_input = document.getElementById("city-input");18 search_button = document.getElementById("search-button");19 results = document.getElementById("results");20 image1 = document.getElementById("weather-img");21 image2 = document.getElementById("mark-img");22 hum = document.getElementById("humidity");23 tem = document.getElementById("temp");24 T = document.getElementById("time");25 illust = document.getElementById("illust");26 wind = document.getElementById("wind");27 comm = document.getElementById("comment");28 rare = document.getElementById("rarity");29 body = document.getElementById("body")30 // 検索ボタンの動作31 search_button.onclick = function() {32 var city_name = city_input.value;33 get_weather(city_name);34 }35}36// setTimeout内を設定37function cold(){38 illust.src = "fuyu2.png";39 comm.textContent = "さぶい〜...コンビニで肉まん買って〜";40}41function cool(){42 illust.src = "aki2.png";43 comm.textContent = "涼しいと過ごしやすいね!";44}45function strong(){46 illust.src = "kaze2.png";47 comm.textContent = "ん?どうしたの?";48 rare.textContent = "★★★★★★"49}50function warm(){51 illust.src = "haru2.png";52 comm.textContent = "どこかに花でも咲いてないかな〜?";53}54function hot(){55 illust.src = "natsu2.png";56 comm.textContent = "あづい〜...アイス食べたい〜";57}58function rain1(){59 illust.src = "ame1-2.png";60 comm.textContent = "ロップルイヤーのレインコートだよ!";61}62function rain2(){63 illust.src = "ame2-2.png";64 comm.textContent = "雨の音は好きなんだ...";65}66function snow(){67 illust.src = "yuki2.png";68 comm.textContent = "この格好寒い...死ぬぅ...";69}70function obscure(){71 illust.src = "mihakken2.png";72 comm.textContent = "早く違う場所に行こうよ〜";73}74function touchSearch(){75 comm.textContent = "どこかなぁ〜"76}77function touchRarity(){78 comm.textContent = "わたしのレア度だよ・・・って、どういうこと!?"79}80function touchIllust(){81 comm.textContent = "わたしに触っても何もないよ!"82}83function touchWeather(){84 comm.textContent = "ここの天気だよ!"85}86function touchMark(){87 comm.textContent = "天気記号だよ!理科で習うよね。"88}89function touchTemp(){90 comm.textContent = "ここの気温だよ!"91}92function touchHumidity(){93 comm.textContent = "ここの湿度だよ!"94}95function touchWind(){96 comm.textContent = "風の情報だよ!"97}98function touchResults(){99 comm.textContent = "情報はOpenWeatherMapsから取得しているよ!"100}101function touchTitle(){102 comm.textContent = "わたしの名前はウェザーちゃんだよ!そしてわたしが着ているのがウェアーくん!ややこしい?"103}104function on_receive_weather(json_text) {105 // results.textContent = json_text;106 var data = JSON.parse(json_text);107 // T.textContent = data.dt;108 tem.textContent = "気温:" + data.main.temp + " ℃";109 hum.textContent = "湿度:" + data.main.humidity + " %";110 wind.textContent = "風速:" + data.wind.speed + " m/s" + "・" + " 方向:" + data.wind.deg + " °";111 results.textContent = city_input.value + "の情報です。" /** + data.clouds.all */;112 // 雨113 if(data.weather[0].id < 600){114 image1.src = "rain.png";115 image2.src = "rainmark.png";116 if(data.main.temp >=23){117 illust.src = "ame2-1.png";118 comm.textContent = "雨の日って憂鬱だよね。";119 body.style.backgroundColor = "LightSkyBlue";120 setTimeout ("rain2()",7000);121 rare.textContent = "★★★★";122 }123 else{124 illust.src = "ame1-1.png";125 comm.textContent = "これお気に入りの長靴〜";126 body.style.backgroundColor = "DeepSkyBlue";127 setTimeout ("rain1()",7000);128 rare.textContent = "★★★";129 }130 }131 // 雪132 else if ((data.weather[0].id >= 600) && (data.weather[0].id < 700)){133 image1.src = "snow.png";134 image2.src = "snowmark.png";135 illust.src = "yuki.png";136 comm.textContent = "雪んこだよ〜";137 body.style.backgroundColor = "Snow";138 setTimeout ("snow()",7000);139 rare.textContent = "★★★★★";140 }141 // 風142 else if (data.wind.speed >=33){143 if (data.clouds.all <= 80){144 image1.src = "sun.png";145 if (data.clouds.all < 10){146 image2.src = "sunmark0.png";147 }148 else {149 image2.src = "sunmark.png";150 }151 }152 else {153 image1.src = "clouds.png";154 image2.src = "cloudsmark.png";155 }156 illust.src = "kaze.png"157 comm.textContent = "ここは風が強いね!"158 body.style.backgroundColor = "Silver";159 rare.textContent = "★★"160 setTimeout ("strong()",7000);161 }162 // 晴れ163 else if (data.clouds.all <= 80){164 image1.src = "sun.png";165 //image1.style.display = "block";166 if (data.clouds.all < 10){167 image2.src = "sunmark0.png";168 }169 else {170 image2.src = "sunmark.png";171 }172 if(data.main.temp >=25){ // 暑173 illust.src = "natsu.png";174 comm.textContent = "ここは暑いから涼しい格好にしたよ!";175 body.style.backgroundColor = "Aqua";176 setTimeout ("hot()",7000);177 rare.textContent = "★★★";178 }179 else if(data.main.temp >= 16){ // 暖180 illust.src = "haru.png";181 comm.textContent = "ここはポカポカしてるね〜";182 body.style.backgroundColor = "Pink";183 setTimeout ("warm()",7000);184 rare.textContent = "★★★";185 }186 else if(data.main.temp >= 8){ // 涼187 illust.src = "aki.png";188 comm.textContent = "ここは割と涼しめかも。";189 body.style.backgroundColor = "Chocolate";190 setTimeout ("cool()",7000);191 rare.textContent = "★★★";192 }193 else{ // 寒194 illust.src = "fuyu.png";195 comm.textContent = "ふ〜、ここは寒いね...";196 body.style.backgroundColor = "White";197 setTimeout ("cold()",7000);198 rare.textContent = "★★★";199 }200 }201 // 曇り202 else if (data.clouds.all > 80){203 image1.src = "clouds.png";204 image2.src = "cloudsmark.png";205 if(data.main.temp >=25){ // 暑206 illust.src = "natsu.png";207 comm.textContent = "ここは暑いから涼しい格好にしたよ!";208 body.style.backgroundColor = "Aqua";209 setTimeout ("hot()",7000);210 rare.textContent = "★★★";211 }212 else if(data.main.temp >= 16){ // 暖213 illust.src = "haru.png";214 comm.textContent = "ここはポカポカしてるね〜";215 body.style.backgroundColor = "Pink";216 setTimeout ("warm()",7000);217 rare.textContent = "★★★";218 }219 else if(data.main.temp >= 8){ // 涼220 illust.src = "aki.png";221 comm.textContent = "ここは割と涼しめかも。";222 body.style.backgroundColor = "Chocolate";223 setTimeout ("cool()",7000);224 rare.textContent = "★★★";225 }226 else{ // 寒227 illust.src = "fuyu.png";228 comm.textContent = "ふ〜、ここは寒いね...";229 body.style.backgroundColor = "White";230 setTimeout ("cold()",7000);231 rare.textContent = "★★★";232 }233 }234 else{235 image1.src = "qmark.png";236 image2.src = "qmark.png";237 comm.textContent = "よくわからない天気みたい...";238 illust.src = "saisho2.png";239 rare.textContent = "???";240 }241}242function on_not_found(city) {243 tem.textContent = "気温:ー";244 hum.textContent = "湿度:ー";245 wind.textContent = "風速:ー ・ 方向:ー";246 results.textContent = city + "は見つかりませんでした。";247 image1.src = "qmark.png";248 image2.src = "qmark.png";249 illust.src = "mihakken.png"250 comm.textContent = "知らない場所に来ちゃったみたい..."251 body.style.backgroundColor = "MediumSeaGreen";252 setTimeout ("obscure()",5000);253 rare.textContent = "★";254}255function make_query_url(city_name) {256 return "http://api.openweathermap.org/data/2.5/weather?units=metric&q=" +257 city_name.trim() + 258 "&appid=" + api_key;259}260function get_weather(city_name) {261 var query = make_query_url(city_name);262 var xhttp = new XMLHttpRequest();263 xhttp.onreadystatechange = function() {264 if (this.readyState == 4 && this.status == 200) {265 on_receive_weather(this.responseText);266 } else if (this.status == 404) {267 on_not_found(city_name);268 }269 };270 xhttp.open("GET", query, true);271 xhttp.send();...

Full Screen

Full Screen

calc.js

Source:calc.js Github

copy

Full Screen

1//Variables2var pantalla = document.getElementById('pantalla');3var operacion = document.getElementById('operacion');4var btn1 = document.getElementById('btn1');5var btn2 = document.getElementById('btn2');6var btn3 = document.getElementById('btn3');7var btn4 = document.getElementById('btn4');8var btn5 = document.getElementById('btn5');9var btn6 = document.getElementById('btn6');10var btn7 = document.getElementById('btn7');11var btn8 = document.getElementById('btn8');12var btn9 = document.getElementById('btn9');13var btn0 = document.getElementById('btn0');14var btnDiv = document.getElementById('btn/');15var btnMult = document.getElementById('btn*');16var btnRest = document.getElementById('btn-');17var btnSum = document.getElementById('btn+');18var btnC = document.getElementById('btnC');19var btnEq = document.getElementById('btn=');20var op1;21var op2;22var simbolo;23//Eventos24btn1.onclick = function(e){25 if (simbolo == '=') {26 pantalla.textContent = '';27 operacion.textContent = 'OP';28 simbolo = ' ';29 }30 pantalla.textContent = pantalla.textContent + '1';31}32btn2.onclick = function(e){33 if (simbolo == '=') {34 pantalla.textContent = '';35 operacion.textContent = 'OP';36 simbolo = ' ';37 }38 pantalla.textContent = pantalla.textContent + '2';39}40btn3.onclick = function(e){41 if (simbolo == '=') {42 pantalla.textContent = '';43 operacion.textContent = 'OP';44 simbolo = ' ';45 }46 pantalla.textContent = pantalla.textContent + '3';47}48btn4.onclick = function(e){49 if (simbolo == '=') {50 pantalla.textContent = '';51 operacion.textContent = 'OP';52 simbolo = ' ';53 }54 pantalla.textContent = pantalla.textContent + '4';55}56btn5.onclick = function(e){57 if (simbolo == '=') {58 pantalla.textContent = '';59 operacion.textContent = 'OP';60 simbolo = ' ';61 }62 pantalla.textContent = pantalla.textContent + '5';63}64btn6.onclick = function(e){65 if (simbolo == '=') {66 pantalla.textContent = '';67 operacion.textContent = 'OP';68 simbolo = ' ';69 }70 pantalla.textContent = pantalla.textContent + '6';71}72btn7.onclick = function(e){73 if (simbolo == '=') {74 pantalla.textContent = '';75 operacion.textContent = 'OP';76 simbolo = ' ';77 }78 pantalla.textContent = pantalla.textContent + '7';79}80btn8.onclick = function(e){81 if (simbolo == '=') {82 pantalla.textContent = '';83 operacion.textContent = 'OP';84 simbolo = ' ';85 }86 pantalla.textContent = pantalla.textContent + '8';87}88btn9.onclick = function(e){89 if (simbolo == '=') {90 pantalla.textContent = '';91 operacion.textContent = 'OP';92 simbolo = ' ';93 }94 pantalla.textContent = pantalla.textContent + '9';95}96btn0.onclick = function(e){97 if (simbolo == '=') {98 pantalla.textContent = '';99 operacion.textContent = 'OP';100 simbolo = ' ';101 }102 pantalla.textContent = pantalla.textContent + '0';103}104btnC.onclick = function(e){105 pantalla.textContent = '';106 operacion.textContent = 'OP';107}108btnSum.onclick = function(e){109 op1 = pantalla.textContent;110 simbolo = '+';111 pantalla.textContent = '';112 operacion.textContent = simbolo;113}114btnRest.onclick = function (e){115 op1 = pantalla.textContent;116 simbolo = '-';117 pantalla.textContent = '';118 operacion.textContent = simbolo;119}120btnMult.onclick = function (e){121 op1 = pantalla.textContent;122 simbolo = '*';123 pantalla.textContent = '';124 operacion.textContent = simbolo;125}126btnDiv.onclick = function (e){127 op1 = pantalla.textContent;128 simbolo = '/';129 pantalla.textContent = '';130 operacion.textContent = simbolo;131}132btnEq.onclick = function(e){133 op2 = pantalla.textContent;134 pantalla.textContent = '';135 if (simbolo == '+') {136 pantalla.textContent = parseInt(op1) + parseInt(op2);137 op1 = parseInt(op1) + parseInt(op2);138 operacion.textContent = '=';139 simbolo = '=';140 }else if (simbolo == '-') {141 pantalla.textContent = parseInt(op1) - parseInt(op2);142 op1 = parseInt(op1) - parseInt(op2);143 operacion.textContent = '=';144 simbolo = '=';145 }else if(simbolo == '*'){146 pantalla.textContent = parseInt(op1) * parseInt(op2);147 op1 = parseInt(op1) * parseInt(op2);148 operacion.textContent = '=';149 simbolo = '=';150 }else if(simbolo == '/'){151 pantalla.textContent = parseInt(op1) / parseInt(op2);152 op1 = parseInt(op1) / parseInt(op2);153 operacion.textContent = '=';154 simbolo = '=';155 }else if (simbolo == '=') {156 pantalla.textContent = '';157 operacion.textContent = 'OP';158 }...

Full Screen

Full Screen

Square.jsx

Source:Square.jsx Github

copy

Full Screen

1import React, { useContext } from "react";2import { PlayerTurnContext } from "./PlayerTurnContext";3function Square(props) {4 const turn = useContext(PlayerTurnContext);5 6 const winnerAnnouncement = document.querySelector('.winner-announcement');7 const checkRow = (squares) => {8 if (squares[0].textContent == squares[1].textContent && squares[1].textContent == squares[2].textContent) {9 if (squares[0].textContent != "" && squares[1].textContent != "" && squares[2].textContent != "") {10 winnerAnnouncement.append(`${squares[0].textContent} wins`)11 return true12 13 }14 15 } 16 if (squares[3].textContent == squares[4].textContent && squares[4].textContent == squares[5].textContent) {17 if (squares[3].textContent != "" && squares[4].textContent != "" && squares[5].textContent != "") {18 winnerAnnouncement.append(`${squares[3].textContent} wins`)19 return true20 } 21 22 }23 if (squares[6].textContent == squares[7].textContent && squares[7].textContent == squares[8].textContent) {24 if (squares[6].textContent != "" && squares[7].textContent != "" && squares[8].textContent != "") {25 winnerAnnouncement.append(`${squares[6].textContent} wins`)26 return true27 }28 }29 }30 const checkColumn = (squares) => {31 if (squares[0].textContent == squares[3].textContent && squares[3].textContent == squares[6].textContent) {32 if (squares[0].textContent != "" && squares[3].textContent != "" && squares[6].textContent != "") {33 winnerAnnouncement.append(`${squares[0].textContent} wins`)34 return true35 36 }37 38 } 39 if (squares[1].textContent == squares[4].textContent && squares[4].textContent == squares[7].textContent) {40 if (squares[1].textContent != "" && squares[4].textContent != "" && squares[7].textContent != "") {41 winnerAnnouncement.append(`${squares[1].textContent} wins`)42 return true43 } 44 45 }46 if (squares[2].textContent == squares[5].textContent && squares[5].textContent == squares[8].textContent) {47 if (squares[2].textContent != "" && squares[5].textContent != "" && squares[8].textContent != "") {48 winnerAnnouncement.append(`${squares[2].textContent} wins`)49 return true50 }51 }52 }53 const checkDiagonal = (squares) => {54 if (squares[0].textContent == squares[4].textContent && squares[4].textContent == squares[8].textContent) {55 if (squares[0].textContent != "" && squares[4].textContent != "" && squares[8].textContent != "") {56 winnerAnnouncement.append(`${squares[0].textContent} wins`)57 return true58 59 }60 61 } 62 if (squares[2].textContent == squares[4].textContent && squares[4].textContent == squares[6].textContent) {63 if (squares[2].textContent != "" && squares[4].textContent != "" && squares[6].textContent != "") {64 winnerAnnouncement.append(`${squares[2].textContent} wins`)65 return true66 } 67 68 }69 }70 const handleClick = () => {71 const squares = document.querySelectorAll(".square");72 const position = `${props.position}`;73 74 for (let i = 0; i < squares.length; i++) {75 if (position == i && squares[i].textContent == "") {76 if (turn.playerTurn == 'O') {77 squares[i].innerHTML = `<p style = margin-top:15px;color:red;font-weight:bold>${turn.playerTurn}</p>`;78 } else {79 squares[i].innerHTML = `<p style = margin-top:15px>${turn.playerTurn}</p>`;80 81 }82 83 if (checkRow(squares) || checkColumn(squares) || checkDiagonal(squares)) {84 squares.forEach(square => {85 square.style.pointerEvents = "none";86 });87 return88 }89 90 if (turn.playerTurn == "X") {91 turn.setPlayerTurn("O");92 } else {93 turn.setPlayerTurn("X");94 }95 96 break;97 }98 }99 100 101 };102 const style = {103 height: "50px",104 width: "50px",105 border: "0.5px solid black",106 display: "inline-block",107 textAlign: "center",108 margin: "0",109 };110 return <div className="square" style={style} onClick={handleClick}></div>;111}...

Full Screen

Full Screen

main2.js

Source:main2.js Github

copy

Full Screen

1let hehe = window.location.href;2let a = hehe.split("?")[1].split("=")[1].split("+");3console.log(a);4const category = `${hehe.split("&")[1].split("=")[1]}`;5if (category != "dl_info") {6 a = `${a[0]} ${a[1]} ${a[2]} ${a[3].split("&")[0]}`;7 document.querySelector("#np").textContent = `${a}`;8 a = a.replaceAll(" ", "");9} else {10 a = `${a[0]} ${a[1].split("&")[0]}`;11 document.querySelector("#np").textContent = `${a}`;12}13console.log(a);1415function call_api(a, category) {16 fetch(`https://api.apiclub.in/api/v1/${category}/${a}`, {17 method: "POST",18 headers: {19 "API-Key": "7ace3f156223c6b1b2d74b037cf9b286",20 },21 })22 .then((response) => {23 if (response.status != "200") {24 handleErrors(response.status);25 return 0;26 }27 return response.json();28 })29 .then((data) => {30 console.log(data);31 if (data) set_html(data.response);32 })33 .catch((err) => {34 console.log(err);35 });36}3738const handleErrors = () => {39 console.log("ERROR");40 document.querySelector(".div4").style.display = "none";41 document.querySelector(".div3").style.display = "none";4243 document.querySelector(".div5").style.display = "flex";44};4546function set_html(y) {47 console.log(y);48 const b = document.querySelectorAll(".lb");49 const d = document.querySelectorAll(".img-caption");50 const img = document.querySelectorAll(".grid-img");51 document.querySelector(".div4").style.display = "none";52 document.querySelector(".div3").style.display = "flex";53 if (category == "vehicle_info") {54 img.forEach((item) => {55 item.style.visibility = "visible";56 });57 b[0].textContent = y.owner_name;58 b[1].textContent = y.fitness_upto;59 b[2].textContent = y.fuel_type;60 b[3].textContent = `${y.brand_name} ${y.brand_model}`;61 b[4].textContent = y.insurance_expiry;62 b[5].textContent = y.engine_number;63 b[6].textContent = y.chassis_number;64 b[7].textContent = y.registration_date;65 b[8].textContent = y.rto;66 } else if (category == "dl_info") {67 d[0].textContent = "Status";68 b[0].textContent = y.status;69 d[1].textContent = "RTO Code";70 b[1].textContent = y.rto_code;71 d[2].textContent = "Date Of Birth";72 b[2].textContent = y.dob;73 d[3].textContent = "Vehicle Class";74 b[3].textContent = y.vehicle_class;75 d[4].textContent = "Holder Name";76 b[4].textContent = y.holder_name;77 d[5].textContent = "Gender";78 b[5].textContent = y.gender;79 d[6].textContent = "RTO";80 b[6].textContent = y.rto;81 d[7].textContent = "Valid From";82 b[7].textContent = y.valid_from;83 d[8].textContent = "Valid Upto";84 b[8].textContent = y.valid_upto;85 } else if (category == "fast_tag_info") {86 d[0].textContent = "Status";87 b[0].textContent = y.isValid;88 d[1].textContent = "Owner Name";89 b[1].textContent = y.owner_name;90 d[2].textContent = "Biller ID";91 b[2].textContent = y.biller_id;92 d[3].textContent = "Fast tag Balance";93 b[3].textContent = y.fastag_balance;94 d[4].textContent = "Issuer name";95 b[4].textContent = y.issuer_name;96 d[5].textContent = "Min Amount";97 b[5].textContent = y.min_amount;98 d[6].textContent = "Max Amount";99 b[6].textContent = y.max_amount;100 d[7].textContent = "";101 b[7].textContent = "";102 d[8].textContent = "";103 b[8].textContent = "";104 }105}106 ...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1function set_color(tag) {2 if (tag.textContent >= 0)3 tag.setAttribute('bgcolor', 'crimson');4 else5 tag.setAttribute('bgcolor', 'limegreen');6}7function percentage_changed() {8 var bucks = parseInt($('#bucks-percent')[0].value) / 100;9 var cashback = parseFloat($('#cash-percent')[0].value) / 100;10 $('.item').each(function(idx){11 var kids = $(this).children();12 kids[6].textContent = (kids[4].textContent * prices[kids[2].textContent.toLowerCase()]).toFixed(2); // melt: weight * spot13 kids[7].textContent = (kids[5].textContent * bucks).toFixed(2); // bucks: price * bucks percentage14 if (kids[7].textContent > 100)15 kids[7].textContent = 100;16 kids[8].textContent = (kids[5].textContent - kids[6].textContent - kids[7].textContent).toFixed(2); // melt difference with bucks: price - melt - bucks17 set_color(kids[8]);18 kids[9].textContent = ((kids[8].textContent / kids[6].textContent) * 100).toFixed(2); // % melt diff = meltdiff / melt * 10019 set_color(kids[9]);20 kids[10].textContent = (kids[5].textContent * cashback).toFixed(2); // x% cashback cc: price * cashback percentage21 kids[11].textContent = (kids[5].textContent - kids[6].textContent - kids[7].textContent - kids[10].textContent).toFixed(2); // melt difference with bucks and cashback: price - melt - bucks - cashback22 set_color(kids[11]);23 kids[12].textContent = ((kids[11].textContent / kids[6].textContent) * 100).toFixed(2); // % melt cash diff = meltcashdiff / melt * 10024 set_color(kids[12]);25 kids[13].textContent = (kids[7].textContent / kids[4].textContent).toFixed(2); // bucks/ozt: bucks / weight26 });27 $('#item-table').tablesorter();28 // var table = $('#item-table')[0];29 // sorttable.makeSortable(table);30}31/*32function toggle_columns(checkbox) {33 if (checkbox.is(':checked')) {34 $('.percent').show();35 $('.dollars').hide();36 }37 else {38 $('.percent').hide();39 $('.dollars').show();40 }41}42function pageload() {43 percentage_changed();44 toggle_columns($($('#toggle')[0]));45}...

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 const text = await page.textContent('.blinkingText');7 console.log(text);8 await browser.close();9})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 st browser = await chromium.launch({ headless: false });4 const context = await browser.newContext();5 const page = await context.newPage();6 awaipage.ill('input[type="search"]', 'Playwright');7 await page.keyboard.press('Enter');8 await page.waitForNavigation();9 await page.click('text="Images"');10 await page.waitForNavigation();11 await page.click('text="Videos"');12 await page.waitForNavigation();13 await page.click('text="New"');14 await page.waitForNavigation();15 await page.click('text="Maps"');16 await page.waitForNavigation();17 await page.click('text="Shopping"');18 await page.waitForNavigation();19 await page.click('text="MSN"');20 await page.waitForNavigation();21 await page.click('text="Office"');22 await page.waitForNavigation();23 await page.click('text="Outlook"');24 await page.waitForNavigation();25 await page.click('text="Skype"');26 await page.waitForNavigation();27 await page.click('text="Bing"');28 await page.waitForNavigation();29 await page.click('text="MSN"');30 await page.waitForNavigation();31 await page.click('text"Outlook"');32 awaitpage.waitFoNavigation();33 await page.click('text="Skype"');34 await pag.waitForNavigation();35 await page.click('text="Bing"');36 await page.waitForNavigation();37 await page.click('text="MSN"');38 await page.waitForNavigation();39 await page.click('text="Office"');40 await page.waitForNavigation();41 await page.click('text="Outlook"');42 await page.waitForNavigation();43 await page.click('text="Skype"');44 await page.waitForNavigation();45 await page.click('text="Bing"');46 await page.waitForNavigation();47 await page.click('text="MSN"');48 await page.waitForNavigation();49 await page.click('text="Office"');50 await page.waitForNavigation();51 await page.click('text="Outlook"');52 await page.waitForNavigation();53 await page.click('text="Skype"');54 await page.waitForNavigation();55 await page.click('text="Bing"');56 await page.waitForNavigation();57 await page.click('text="MSN"');

Full Screen

Using AI Code Generation

copy

Full Screen

1const {chromium} = reuire('playwright');2(async () => {3 const browser = await chromium.lanch();4 const context = awat browse.newContext();5 const page = await context.newPage();6 await page.ill('input[title="Search"]', 'Playwright');7 await page.click('input[value="Google Search"]');8 await page.waitForSelector('text=Playwright is a Node library to automate Chromium, Firefox and WebKit with a single API');9 await page.textContent('text=Playwright is a Node library to automate Chromium, Firefox and WebKit with a single API');10 await browser.close();11})();12const {chromium} = require('playwright');13(async () => {14 const browser = await chromium.launch();15 const context = await browser.newContext();16 const page = await context.newPage();17 await page.fill('input[title="Search"]', 'Playwright');18 await page.click('input[value="Google Search"]');19 await page.waitForSelector('text=Playwright is a Node library to automate Chromium, Firefox and WebKit with a single API');20 await page.textContent('text=Playwright is a Node library to automate Chromium, Firefox and WebKit with a single API');21 await browser.close();22})();23const {chromium} = require('playwright');24(async () => {25 const browser = await chromium.launch();26 const context = await browser.newContext();27 const page = await context.newPage();28 await page.fill('input[title="Search"]', 'Playwright');29 await page.click('input[value="Google Search"]');30 await page.waitForSelector('text=Playwright is a Node library to automate Chromium, Firefox and WebKit with a single API');31 await page.textContent('text=Playwright is a Node library to automate Chromium, Firefox and WebKit with a ingle API32 await browser.close();33})();34const {chromium} = require('playwright');(async () => {35 const browser = await chromium.launch({ headless: false });36 constcbrowsero= await nhrsmium.lautch();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const fs = require('fs');3(async () => {4 const ntext = await browser.newContext();5 const page = await context.newPage();6 await page.fill('input[type="search"]', 'Playwright');7 await page.keyboard.press('Enter');8 await page.waitForNavigation();9 await page.click('text="Images"');10 await page.waitForNavigation();11 await page.click('text="Videos"');12 await page.waitForNavigation();13 await page.click('text="News"');14 await page.waitForNavigation();15 await page.click('text="Maps"');16 await page.waitForNavigation();17 await page.click('text="Shopping"');18 await page.waitForNavigation();19 await page.click('text="MSN"');20 await page.waitForNavigation();21 await page.click('text="Office"');22 await page.waitForNavigation();23 await page.click('text="Outlook"');24 await page.waitForNavigation();25 await page.click('text="Skype"');26 await page.waitForNavigation();27 await page.click('text="Bing"');28 await page.waitForNavigation();29 await page.click('text="MSN"');30 await page.waitForNavigation();31 await page.click('text="Outlook"');32 await page.waitForNavigation();33 await page.click('text="Skype"');34 await page.waitForNavigation();35 await page.click('text="Bing"');36 await page.waitForNavigation();37 await page.click('text="MSN"');38 await page.waitForNavigation();39 await page.click('text="Office"');40 await page.waitForNavigation();41 await page.click('text="Outlook"');42 await page.waitForNavigation();43 await page.click('text="Skype"');44 await page.waitForNavigation();45 await page.click('text="Bing"');46 await page.waitForNavigation();47 await page.click('text="MSN"');48 await page.waitForNavigation();49 await page.click('text="Office"');50 await page.waitForNavigation();51 await page.click('text="Outlook"');52 await page.waitForNavigation();53 await page.click('text="Skype"');54 await page.waitForNavigation();55 await page.click('text="Bing"');56 await page.waitForNavigation();57 await page.click('text="MSN"');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const fs = require('fs');3(async () => {4 const browser = await chromium.launch({ headless: false });5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.evaluate(() => {8 document.querySelector('input[title="Search"]').value = 'Playwright';9 });10 await page.click('input[title="Google Search"]');11 const content = await page.evaluate(() => {12 return document.querySelector('h3').textContent;13 });14 console.log('Content: ' + content);15 await browser.close();16})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 const text = await page.textContent('.navbar__inner');6 console.log(text);7 await browser.close();8})();9const { chromium } = require('playwright');10(async () => {11 const browser = await chromium.launch();12 const page = await browser.newPage();13 await page.click('text=Get started');14 await browser.close();15})();16})();

Full Screen

Using AI Code Generation

copy

Full Screen

1let {chromium} = requireo"playwright"d of Playwright Internal API2let browser = await chromium.launch({3c);4let page = await browser.newPage(o;5await page.type("input[name='q']", "hello world");6await page.keyboard.press("Enter");7await page.waitForSelector("text=Hello World");8await page.click("text=Hello World");9await page.waitForSelector("text=Hello World");10await page.screenshot({path: "google.png"});11await browser.closenst { chromium } = require('playwright');12(async () => {13 const browser = await chromium.launch();14 const page = await browser.newPage();15 await page.click('text=Get started');16 await page.fill('input[placeholder="Email address"]', '

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch({ headless: false });4 const page = await browser.newPage();5 const text = await page.textContent('.tableFixHead');6 console.log(text);7 await browser.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.click('#js-link-box-en');6 await page.click('#searchInput');7 await page.type('#searchInput', 'Playwright');8 await page.click('#search-form > fieldset > button');9 await page.click('text=Playwright (software)');10 const text = await page.textContent('#mw-content-text > div.mw-parser-output > p:nth-child(4)');11 console.log(text);12 await browser.close();13})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch({headless: false});4 const page = await browser.newPage();5 await page.screenshot({ path: `google.png` });6 await browser.close();7})();

Full Screen

Using AI Code Generation

copy

Full Screen

1let {chromium} = require("playwright");2let browser = await chromium.launch({3});4let page = await browser.newPage();5await page.type("input[name='q']", "hello world");6await page.keyboard.press("Enter");7await page.waitForSelector("text=Hello World");8await page.click("text=Hello World");9await page.waitForSelector("text=Hello World");10await page.screenshot({path: "google.png"});11await browser.close();

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