Best JavaScript code snippet using puppeteer
menu.js
Source:menu.js
1//popup menu button2document.getElementById("menu").addEventListener("click", function(){3 document.querySelector(".popupmenu").style.display = "flex";4})5document.getElementById("menu").addEventListener("click", function(){6 document.querySelector(".menu").style.display = "none";7})8//close button9document.querySelector(".closemenu").addEventListener("click", function(){10 document.querySelector(".popupmenu").style.display = "none";11})12//reveal menu again hehe13document.querySelector(".closemenu").addEventListener("click", function(){14 document.querySelector(".menu").style.display = "flex";15})16//blur nanaman dami neto17document.getElementById("menu").addEventListener("click", function(){18 document.querySelector(".mainrec").style.filter = "blur(4px)";19})20document.getElementById("menu").addEventListener("click", function(){21 document.querySelector(".recipes").style.filter = "blur(4px)";22})23document.getElementById("menu").addEventListener("click", function(){24 document.querySelector(".origin").style.filter = "blur(4px)";25})26document.getElementById("menu").addEventListener("click", function(){27 document.querySelector(".bc").style.filter = "blur(4px)";28})29document.getElementById("menu").addEventListener("click", function(){30 document.querySelector(".bct").style.filter = "blur(4px)";31})32document.getElementById("menu").addEventListener("click", function(){33 document.querySelector(".mainrec1").style.filter = "blur(4px)";34})35document.getElementById("menu").addEventListener("click", function(){36 document.querySelector(".mainell").style.filter = "blur(4px)";37})38document.getElementById("menu").addEventListener("click", function(){39 document.querySelector(".cat1").style.filter = "blur(4px)";40})41document.getElementById("menu").addEventListener("click", function(){42 document.querySelector(".maincapulus").style.filter = "blur(4px)";43})44document.getElementById("menu").addEventListener("click", function(){45 document.querySelector(".home").style.filter = "blur(4px)";46})47document.getElementById("menu").addEventListener("click", function(){48 document.querySelector(".coffeebg").style.filter = "blur(4px)";49})50document.getElementById("menu").addEventListener("click", function(){51 document.querySelector(".cover").style.filter = "blur(4px)";52})53document.getElementById("menu").addEventListener("click", function(){54 document.querySelector(".owl").style.filter = "blur(4px)";55})56document.getElementById("menu").addEventListener("click", function(){57 document.querySelector(".poison").style.filter = "blur(4px)";58})59document.getElementById("menu").addEventListener("click", function(){60 document.querySelector(".coffeerec").style.filter = "blur(4px)";61})62//eto naman tanggal nanaman ng pakeng blur dami nanaman shet63document.querySelector(".closemenu").addEventListener("click", function(){64 document.querySelector(".mainrec").style.filter = "none";65})66document.querySelector(".closemenu").addEventListener("click", function(){67 document.querySelector(".origin").style.filter = "none";68})69document.querySelector(".closemenu").addEventListener("click", function(){70 document.querySelector(".recipes").style.filter = "none";71})72document.querySelector(".closemenu").addEventListener("click", function(){73 document.querySelector(".bc").style.filter = "none";74})75document.querySelector(".closemenu").addEventListener("click", function(){76 document.querySelector(".bct").style.filter = "none";77})78document.querySelector(".closemenu").addEventListener("click", function(){79 document.querySelector(".mainrec1").style.filter = "none";80})81document.querySelector(".closemenu").addEventListener("click", function(){82 document.querySelector(".mainell").style.filter = "none";83})84document.querySelector(".closemenu").addEventListener("click", function(){85 document.querySelector(".cat1").style.filter = "none";86})87document.querySelector(".closemenu").addEventListener("click", function(){88 document.querySelector(".maincapulus").style.filter = "none";89})90document.querySelector(".closemenu").addEventListener("click", function(){91 document.querySelector(".home").style.filter = "none";92})93document.querySelector(".closemenu").addEventListener("click", function(){94 document.querySelector(".coffeebg").style.filter = "none";95})96document.querySelector(".closemenu").addEventListener("click", function(){97 document.querySelector(".cover").style.filter = "none";98})99document.querySelector(".closemenu").addEventListener("click", function(){100 document.querySelector(".owl").style.filter = "none";101})102document.querySelector(".closemenu").addEventListener("click", function(){103 document.querySelector(".poison").style.filter = "none";104})105document.querySelector(".closemenu").addEventListener("click", function(){106 document.querySelector(".coffeerec").style.filter = "none";107})108// hide ulet109window.addEventListener('mouseup', function(event){110 var hidediv = document.querySelector(".popupmenu");111 if(event.target != hidediv){112 hidediv.style.display = 'none';113 }114}) 115// haha tanggal blur nanaman nanman dami ko kase alam shet haha ser pasado na pls ty116window.addEventListener('mouseup', function(event){117 var hidediv = document.querySelector(".mainrec");118 if(event.target != hidediv){119 hidediv.style.filter = 'none';120 }121})122window.addEventListener('mouseup', function(event){123 var hidediv = document.querySelector(".recipes");124 if(event.target != hidediv){125 hidediv.style.filter = 'none';126 }127})128window.addEventListener('mouseup', function(event){129 var hidediv = document.querySelector(".origin");130 if(event.target != hidediv){131 hidediv.style.filter = 'none';132 }133})134window.addEventListener('mouseup', function(event){135 var hidediv = document.querySelector(".bc");136 if(event.target != hidediv){137 hidediv.style.filter = 'none';138 }139})140window.addEventListener('mouseup', function(event){141 var hidediv = document.querySelector(".bct");142 if(event.target != hidediv){143 hidediv.style.filter = 'none';144 }145})146window.addEventListener('mouseup', function(event){147 var hidediv = document.querySelector(".mainrec1");148 if(event.target != hidediv){149 hidediv.style.filter = 'none';150 }151})152window.addEventListener('mouseup', function(event){153 var hidediv = document.querySelector(".cat1");154 if(event.target != hidediv){155 hidediv.style.filter = 'none';156 }157})158window.addEventListener('mouseup', function(event){159 var hidediv = document.querySelector(".mainell");160 if(event.target != hidediv){161 hidediv.style.filter = 'none';162 }163})164window.addEventListener('mouseup', function(event){165 var hidediv = document.querySelector(".maincapulus");166 if(event.target != hidediv){167 hidediv.style.filter = 'none';168 }169})170window.addEventListener('mouseup', function(event){171 var hidediv = document.querySelector(".home");172 if(event.target != hidediv){173 hidediv.style.filter = 'none';174 }175})176window.addEventListener('mouseup', function(event){177 var hidediv = document.querySelector(".coffeebg");178 if(event.target != hidediv){179 hidediv.style.filter = 'none';180 }181})182window.addEventListener('mouseup', function(event){183 var hidediv = document.querySelector(".cover");184 if(event.target != hidediv){185 hidediv.style.filter = 'none';186 }187})188window.addEventListener('mouseup', function(event){189 var hidediv = document.querySelector(".owl");190 if(event.target != hidediv){191 hidediv.style.filter = 'none';192 }193})194window.addEventListener('mouseup', function(event){195 var hidediv = document.querySelector(".poison");196 if(event.target != hidediv){197 hidediv.style.filter = 'none';198 }199})200// eto para lumabas ulet menu nawawala kasi amp201window.addEventListener('mouseup', function(event){202 var hidediv = document.querySelector(".menu");203 if(event.target != hidediv){204 hidediv.style.display = 'flex';205 }...
EventSpec.js
Source:EventSpec.js
...1314 it('works with no scope', function() {15 var someValue = 123;1617 event.addEventListener(spyListener);18 event.raiseEvent(someValue);1920 expect(spyListener).toHaveBeenCalledWith(someValue);2122 spyListener.calls.reset();2324 event.removeEventListener(spyListener);25 event.raiseEvent(someValue);2627 expect(spyListener).not.toHaveBeenCalled();28 });2930 it('works with scope', function() {31 var someValue = 123;32 var scope = {};3334 event.addEventListener(spyListener, scope);35 event.raiseEvent(someValue);3637 expect(spyListener).toHaveBeenCalledWith(someValue);38 expect(spyListener.calls.first().object).toBe(scope);3940 spyListener.calls.reset();4142 event.removeEventListener(spyListener, scope);43 event.raiseEvent(someValue);4445 expect(spyListener).not.toHaveBeenCalled();46 });4748 it('can remove from within a callback', function() {49 var doNothing = function(evt) {50 };5152 var removeEventCb = function(evt) {53 event.removeEventListener(removeEventCb);54 };5556 var doNothing2 = function(evt) {57 };5859 event.addEventListener(doNothing);60 event.addEventListener(removeEventCb);61 event.addEventListener(doNothing2);62 event.raiseEvent();63 expect(event.numberOfListeners).toEqual(2);6465 event.removeEventListener(doNothing);66 event.removeEventListener(doNothing2);67 expect(event.numberOfListeners).toEqual(0);68 });6970 it('can remove multiple listeners within a callback', function() {71 var removeEvent0 = event.addEventListener(function() { removeEvent0(); });72 event.addEventListener(function() {});73 var removeEvent2 = event.addEventListener(function() { removeEvent2(); });74 event.addEventListener(function() {});75 var removeEvent4 = event.addEventListener(function() { removeEvent4(); });76 event.addEventListener(function() {});77 var removeEvent6 = event.addEventListener(function() { removeEvent6(); });78 event.addEventListener(function() {});79 var removeEvent8 = event.addEventListener(function() { removeEvent8(); });80 event.addEventListener(function() {});8182 expect(event.numberOfListeners).toEqual(10);83 event.raiseEvent();84 expect(event.numberOfListeners).toEqual(5);85 event.raiseEvent();86 expect(event.numberOfListeners).toEqual(5);87 });8889 it('addEventListener and removeEventListener works with same function of different scopes', function() {90 var Scope = function() {91 this.timesCalled = 0;92 };9394 Scope.prototype.myCallback = function() {95 this.timesCalled++;96 };9798 var scope1 = new Scope();99 var scope2 = new Scope();100101 event.addEventListener(Scope.prototype.myCallback, scope1);102 event.addEventListener(Scope.prototype.myCallback, scope2);103 event.raiseEvent();104105 expect(scope1.timesCalled).toEqual(1);106 expect(scope2.timesCalled).toEqual(1);107108 event.removeEventListener(Scope.prototype.myCallback, scope1);109 expect(event.numberOfListeners).toEqual(1);110 event.raiseEvent();111112 expect(scope1.timesCalled).toEqual(1);113 expect(scope2.timesCalled).toEqual(2);114115 event.removeEventListener(Scope.prototype.myCallback, scope2);116 expect(event.numberOfListeners).toEqual(0);117 });118119 it('numberOfListeners returns the correct number', function() {120 var callback1 = function() {121 };122123 var callback2 = function() {124 };125126 expect(event.numberOfListeners).toEqual(0);127128 event.addEventListener(callback1);129 expect(event.numberOfListeners).toEqual(1);130131 event.addEventListener(callback2);132 expect(event.numberOfListeners).toEqual(2);133134 event.removeEventListener(callback2);135 expect(event.numberOfListeners).toEqual(1);136 });137138 it('removeEventListener indicates if the listener is registered with the event', function() {139 var callback = function() {140 };141142 event.addEventListener(callback);143 expect(event.numberOfListeners).toEqual(1);144145 expect(event.removeEventListener(callback)).toEqual(true);146 expect(event.numberOfListeners).toEqual(0);147148 expect(event.removeEventListener(callback)).toEqual(false);149 });150151 it('removeEventListener does not remove a registered listener of a different scope', function() {152 var myFunc = function() {153 };154 var scope = {};155 event.addEventListener(myFunc, scope);156 expect(event.removeEventListener(myFunc)).toEqual(false);157 });158159 it('works with no listeners', function() {160 event.raiseEvent(123);161 });162163 it('addEventListener returns a function allowing removal', function() {164 var someValue = 123;165166 var remove = event.addEventListener(spyListener);167 event.raiseEvent(someValue);168169 expect(spyListener).toHaveBeenCalledWith(someValue);170 spyListener.calls.reset();171172 remove();173 event.raiseEvent(someValue);174175 expect(spyListener).not.toHaveBeenCalled();176 });177178 it('addEventListener with scope returns a function allowing removal', function() {179 var someValue = 123;180 var scope = {};181182 var remove = event.addEventListener(spyListener, scope);183 event.raiseEvent(someValue);184185 expect(spyListener).toHaveBeenCalledWith(someValue);186 spyListener.calls.reset();187188 remove();189 event.raiseEvent(someValue);190191 expect(spyListener).not.toHaveBeenCalled();192 });193194 it('addEventListener throws with undefined listener', function() {195 expect(function() {196 event.addEventListener(undefined);197 }).toThrowDeveloperError();198 });199200 it('addEventListener throws with null listener', function() {201 expect(function() {202 event.addEventListener(null);203 }).toThrowDeveloperError();204 });205206 it('addEventListener throws with non-function listener', function() {207 expect(function() {208 event.addEventListener({});209 }).toThrowDeveloperError();210 });211212 it('removeEventListener throws with undefined listener', function() {213 expect(function() {214 event.removeEventListener(undefined);215 }).toThrowDeveloperError();216 });217218 it('removeEventListener throws with null listener', function() {219 expect(function() {220 event.removeEventListener(null);221 }).toThrowDeveloperError();222 });
...
coffee.js
Source:coffee.js
1//Black coffee remove bg2document.getElementById("coffee").addEventListener("click", function(){3 document.querySelector(".owl").style.display = "none";4})5document.getElementById("coffee").addEventListener("click", function(){6 document.querySelector(".poison").style.display = "none";7})8document.getElementById("coffee").addEventListener("click", function(){9 document.querySelector(".coffeebg").style.display = "none";10})11document.getElementById("coffee").addEventListener("click", function(){12 document.querySelector(".cover").style.display = "none";13})14document.getElementById("coffee").addEventListener("click", function(){15 document.querySelector(".owl").style.display = "none";16})17document.getElementById("coffee").addEventListener("click", function(){18 document.querySelector(".coffeerec").style.display = "none";19})20//Black coffee select reveal yez21document.getElementById("coffee").addEventListener("click", function(){22 document.querySelector(".bc").style.display = "flex";23})24document.getElementById("coffee").addEventListener("click", function(){25 document.querySelector(".backbtn").style.display = "flex";26})27document.getElementById("coffee").addEventListener("click", function(){28 document.querySelector(".bct").style.display = "flex";29})30document.getElementById("coffee").addEventListener("click", function(){31 document.querySelector(".recipes").style.display = "flex";32})33document.getElementById("coffee").addEventListener("click", function(){34 document.querySelector(".origin").style.display = "flex";35})36//Origin Pop up button37document.getElementById("origin").addEventListener("click", function(){38 document.querySelector(".originpopup").style.display = "flex";39})40document.getElementById("origin").addEventListener("click", function(){41 document.querySelector(".origindescBC").style.display = "flex";42})43//close button44document.querySelector(".closeorigin").addEventListener("click", function(){45 document.querySelector(".originpopup").style.display = "none";46})47document.querySelector(".closeorigin").addEventListener("click", function(){48 document.querySelector(".origindescBC").style.display = "none";49})50//HAHAHAHA BLUR NANAMAN SER DAMI ONTE EWAN IDK HEHE HAHA51document.getElementById("origin").addEventListener("click", function(){52 document.querySelector(".recipes").style.filter = "blur(4px)";53})54document.getElementById("origin").addEventListener("click", function(){55 document.querySelector(".mainrec").style.filter = "blur(4px)";56})57document.getElementById("origin").addEventListener("click", function(){58 document.querySelector(".origin").style.filter = "blur(4px)";59})60document.getElementById("origin").addEventListener("click", function(){61 document.querySelector(".bc").style.filter = "blur(4px)";62})63document.getElementById("origin").addEventListener("click", function(){64 document.querySelector(".bct").style.filter = "blur(4px)";65})66document.getElementById("origin").addEventListener("click", function(){67 document.querySelector(".mainrec1").style.filter = "blur(4px)";68})69document.getElementById("origin").addEventListener("click", function(){70 document.querySelector(".mainell").style.filter = "blur(4px)";71})72document.getElementById("origin").addEventListener("click", function(){73 document.querySelector(".cat1").style.filter = "blur(4px)";74})75document.getElementById("origin").addEventListener("click", function(){76 document.querySelector(".maincapulus").style.filter = "blur(4px)";77})78document.getElementById("origin").addEventListener("click", function(){79 document.querySelector(".home").style.filter = "blur(4px)";80})81document.getElementById("origin").addEventListener("click", function(){82 document.querySelector(".about").style.filter = "blur(4px)";83})84document.getElementById("origin").addEventListener("click", function(){85 document.querySelector(".menu").style.filter = "blur(4px)";86})87//Remove blur ser pagka klik ng klowz88document.getElementById("closeorigin").addEventListener("click", function(){89 document.querySelector(".mainrec").style.filter = "none";90})91document.getElementById("closeorigin").addEventListener("click", function(){92 document.querySelector(".recipes").style.filter = "none";93})94document.getElementById("closeorigin").addEventListener("click", function(){95 document.querySelector(".origin").style.filter = "none";96})97document.getElementById("closeorigin").addEventListener("click", function(){98 document.querySelector(".about").style.filter = "none";99})100document.getElementById("closeorigin").addEventListener("click", function(){101 document.querySelector(".menu").style.filter = "none";102})103document.getElementById("closeorigin").addEventListener("click", function(){104 document.querySelector(".bc").style.filter = "none";105})106document.getElementById("closeorigin").addEventListener("click", function(){107 document.querySelector(".bct").style.filter = "none";108})109document.getElementById("closeorigin").addEventListener("click", function(){110 document.querySelector(".mainrec1").style.filter = "none";111})112document.getElementById("closeorigin").addEventListener("click", function(){113 document.querySelector(".mainell").style.filter = "none";114})115document.getElementById("closeorigin").addEventListener("click", function(){116 document.querySelector(".cat1").style.filter = "none";117})118document.getElementById("closeorigin").addEventListener("click", function(){119 document.querySelector(".maincapulus").style.filter = "none";120})121document.getElementById("closeorigin").addEventListener("click", function(){122 document.querySelector(".home").style.filter = "none";123})124//hide hide hide sa bg ser125window.addEventListener('mouseup', function(event){126 var hidediv = document.querySelector(".originpopup");127 if(event.target != hidediv){128 hidediv.style.display = 'none';129 }130})131window.addEventListener('mouseup', function(event){132 var hidediv = document.querySelector(".origindescBC");133 if(event.target != hidediv){134 hidediv.style.display = 'none';135 }136})137window.addEventListener('mouseup', function(event){138 var hidediv = document.querySelector(".about");139 if(event.target != hidediv){140 hidediv.style.filter = 'none';141 }142})143window.addEventListener('mouseup', function(event){144 var hidediv = document.querySelector(".menu");145 if(event.target != hidediv){146 hidediv.style.filter = 'none';147 }...
booksajax.js
Source:booksajax.js
...9 //mouseover y mouseout sobre las imágenes capturadas por su id10 //Primera imagen11 img = document.getElementById("csstecprof");12 if (img.addEventListener) {13 img.addEventListener("mouseover", function () {14 obtenerContenido("css.html");15 }, false);16 }17 else if (img.attachEvent) {18 img.attachEvent("onmouseover", function () {19 obtenerContenido("css.html");20 });21 }22 if (img.addEventListener) {23 img.addEventListener("mouseout", borrarContenido, false);24 }25 else if (img.attachEvent) {26 img.attachEvent("onmouseout", borrarContenido);27 }28 //Segunda imagen29 img = document.getElementById("java8");30 if (img.addEventListener) {31 img.addEventListener("mouseover", function () {32 obtenerContenido("java8.html");33 }, false);34 }35 else if (img.attachEvent) {36 img.attachEvent("mouseover", function () {37 obtenerContenido("java8.html");38 });39 }40 if (img.addEventListener) {41 img.addEventListener("mouseout", borrarContenido, false);42 }43 else if (img.attachEvent) {44 img.attachEvent("onmouseout", borrarContenido);45 }46 //Tercera imagen47 img = document.getElementById("jsninja");48 if (img.addEventListener) {49 img.addEventListener("mouseover", function () {50 obtenerContenido("jsninja.html");51 }, false);52 }53 else if (img.attachEvent) {54 img.attachEvent("onmouseover", function () {55 obtenerContenido("jsninja.html");56 });57 }58 if (img.addEventListener) {59 img.addEventListener("mouseout", borrarContenido, false);60 }61 else if (img.attachEvent) {62 img.attachEvent("onmouseout", borrarContenido);63 }64 //Cuarta imagen65 img = document.getElementById("nodejs");66 if (img.addEventListener) {67 img.addEventListener("mouseover", function () {68 obtenerContenido("nodejs.html");69 }, false);70 }71 else if (img.attachEvent) {72 img.attachEvent("onmouseover", function () {73 obtenerContenido("nodejs.html");74 });75 }76 if (img.addEventListener) {77 img.addEventListener("mouseout", borrarContenido, false);78 }79 else if (img.attachEvent) {80 img.attachEvent("onmouseout", borrarContenido);81 }82 //Quinta imagen83 img = document.getElementById("phppract");84 if (img.addEventListener) {85 img.addEventListener("mouseover", function () {86 obtenerContenido("phppract.html");87 }, false);88 }89 else if (img.attachEvent) {90 img.attachEvent("onmouseover", function () {91 obtenerContenido("phppract.html");92 });93 }94 if (img.addEventListener) {95 img.addEventListener("mouseout", borrarContenido, false);96 }97 else if (img.attachEvent) {98 img.attachEvent("onmouseout", borrarContenido);99 }100 //Sexta imagen101 img = document.getElementById("proghtml5");102 if (img.addEventListener) {103 img.addEventListener("mouseover", function () {104 obtenerContenido("proghtml5.html");105 }, false);106 }107 else if (img.attachEvent) {108 img.attachEvent("onmouseover", function () {109 obtenerContenido("proghtml5.html");110 });111 }112 if (img.addEventListener) {113 img.addEventListener("mouseout", borrarContenido, false);114 }115 else if (img.attachEvent) {116 img.attachEvent("onmouseout", borrarContenido);117 }118} //Fin de la función que registra eventos sobre las imágenes119function obtenerContenido(url) {120 //Intentar crear objeto XMLHtttpRequest y realizar la petición121 try {122 //Crear objeto petición XMLHttpRequest123 //Cambiar esto por una función multinavegador para construir el objeto124 XMLHttpRequest125 solicitudAsinc = new XMLHttpRequest();126 //Registrar el manejador de eventos127 if (solicitudAsinc.addEventListener) {128 solicitudAsinc.addEventListener("readystatechange", cambiarEstado,129 false);130 }131 else if (solicitudAsinc.attachEvent) {132 solicitudAsinc.attachEvent("onreadystatechange", cambiarEstado);133 }134 //Preparar la solicitud135 solicitudAsinc.open("GET", url, true);136 //Enviar la solicitud137 solicitudAsinc.send(null);138 }139 catch (exception) {140 alert("No se procesó la petición AJAX");141 }142}143function borrarContenido() {144 var contenido = document.getElementById("descriptions");145 contenido.innerHTML = "";146}147function cambiarEstado() {148 var contenido;149 if (solicitudAsinc.readyState == 4 && solicitudAsinc.status == 200) {150 contenido = document.getElementById("descriptions");151 //Coloca el contenido devuelto en la petición en el div descriptions152 contenido.innerHTML = solicitudAsinc.responseText;153 }154}155if (window.addEventListener) {156 window.addEventListener("load", registrarManejadores, false);157}158else if (window.attachEvent) {159 window.attachEvent("onload", registrarManejadores);...
login.js
Source:login.js
1//confirm button2document.getElementById("button").addEventListener("click", function(){3 document.querySelector(".popup").style.display = "flex";4})5// Blur bg on click6document.getElementById("button").addEventListener("click", function(){7 document.querySelector(".ellipse").style.filter = "blur(4px)";8})9document.getElementById("button").addEventListener("click", function(){10 document.querySelector(".rectangle").style.filter = "blur(4px)";11})12document.getElementById("button").addEventListener("click", function(){13 document.querySelector(".rectangle2").style.filter = "blur(4px)";14})15document.getElementById("button").addEventListener("click", function(){16 document.querySelector(".cat").style.filter = "blur(4px)";17})18document.getElementById("button").addEventListener("click", function(){19 document.querySelector(".login").style.filter = "blur(4px)";20})21document.getElementById("button").addEventListener("click", function(){22 document.querySelector(".signup").style.filter = "blur(4px)";23})24document.getElementById("button").addEventListener("click", function(){25 document.querySelector(".about").style.filter = "blur(4px)";26})27document.getElementById("button").addEventListener("click", function(){28 document.querySelector(".capulus").style.filter = "blur(4px)";29})30document.getElementById("button").addEventListener("click", function(){31 document.querySelector(".rectangle3").style.filter = "blur(4px)";32})33//close button34document.querySelector(".close").addEventListener("click", function(){35 document.querySelector(".popup").style.display = "none";36})37// remove blur bg38document.querySelector(".close").addEventListener("click", function(){39 document.querySelector(".ellipse").style.filter = "none";40})41document.querySelector(".close").addEventListener("click", function(){42 document.querySelector(".rectangle").style.filter = "none";43})44document.querySelector(".close").addEventListener("click", function(){45 document.querySelector(".rectangle2").style.filter = "none";46})47document.querySelector(".close").addEventListener("click", function(){48 document.querySelector(".cat").style.filter = "none";49})50document.querySelector(".close").addEventListener("click", function(){51 document.querySelector(".login").style.filter = "none";52})53document.querySelector(".close").addEventListener("click", function(){54 document.querySelector(".signup").style.filter = "none";55})56document.querySelector(".close").addEventListener("click", function(){57 document.querySelector(".about").style.filter = "none";58})59document.querySelector(".close").addEventListener("click", function(){60 document.querySelector(".capulus").style.filter = "none";61})62document.querySelector(".close").addEventListener("click", function(){63 document.querySelector(".rectangle3").style.filter = "none";64})65//brewing button appear66document.querySelector(".confirm").addEventListener("click", function(){67 document.querySelector(".brewing").style.display = "block";68})69document.querySelector(".confirm").addEventListener("click", function(){70 document.querySelector(".aboutbtn").style.display = "block";71})72//brewing button disappear73document.querySelector(".confirm").addEventListener("click", function(){74 document.querySelector(".login").style.display = "none";75})76document.querySelector(".confirm").addEventListener("click", function(){77 document.querySelector(".signup").style.display = "none";78})79document.querySelector(".confirm").addEventListener("click", function(){80 document.querySelector(".popup").style.display = "none";81})82//remove blur after brewing button appears83document.querySelector(".confirm").addEventListener("click", function(){84 document.querySelector(".ellipse").style.filter = "none";85})86document.querySelector(".confirm").addEventListener("click", function(){87 document.querySelector(".rectangle").style.filter = "none";88})89document.querySelector(".confirm").addEventListener("click", function(){90 document.querySelector(".rectangle2").style.filter = "none";91})92document.querySelector(".confirm").addEventListener("click", function(){93 document.querySelector(".cat").style.filter = "none";94})95document.querySelector(".confirm").addEventListener("click", function(){96 document.querySelector(".login").style.filter = "none";97})98document.querySelector(".confirm").addEventListener("click", function(){99 document.querySelector(".signup").style.filter = "none";100})101document.querySelector(".confirm").addEventListener("click", function(){102 document.querySelector(".about").style.filter = "none";103})104document.querySelector(".confirm").addEventListener("click", function(){105 document.querySelector(".capulus").style.filter = "none";106})107document.querySelector(".confirm").addEventListener("click", function(){108 document.querySelector(".rectangle3").style.filter = "none";...
comparefile.js
Source:comparefile.js
...8var file_name = filename();9// Comparar el nombre para ejecutarse10switch(file_name){11 case "calculator.html":12 btn_addition.addEventListener('click', additionC);13 btn_substraction.addEventListener('click', substractionC);14 btn_multiply.addEventListener("click", multiplyC);15 btn_divide.addEventListener("click", divideC);16 break;17 case "imccalculator.html":18 btn_BMI.addEventListener("click", IMCCalculator);19 break;20 case "measures.html":21 btn_metric.addEventListener("click", measureMeters);22 break;23 case "temperatureConversion.html":24 btn_temperature.addEventListener('click', temperatureConversor);25 break;26 case "geometricFigures.html":27 btn_areaS.addEventListener("click", squareA);28 btn_areaR.addEventListener("click", rectangleA);29 btn_areaT.addEventListener("click", triangleA);30 btn_areaC.addEventListener("click", circleA);31 btn_perimeterS.addEventListener("click", squareP);32 btn_perimeterR.addEventListener("click", rectangleP);33 btn_perimeterT.addEventListener("click", triangleP);34 btn_perimeterC.addEventListener("click", circleP);35 btn_radiusC.addEventListener("click", circleR);36 btn_diameterC.addEventListener("click", circleD);37 btn_circumferenceC.addEventListener("click", circleC);38 break;39 case "mru.html":40 btn_timeMRU.addEventListener("click", mruTime);41 btn_distMRU.addEventListener("click", mruDistance);42 btn_dispMRU.addEventListener("click", mruDisplacement);43 btn_speedMRU.addEventListener("click", mruSpeed);44 btn_averagespeedMRU.addEventListener("click", mruAverageS);45 break;46 case "interest.html":47 btn_composedI.addEventListener("click", composedInterest);48 btn_simpleI.addEventListener("click", simpleInterest);49 break;50 case "equationscndgrade.html":51 btn_eqscndgrade.addEventListener("click", eqscndgrade);52 break;53 case "undolatory.html":54 btn_propagationsW.addEventListener("click", propagationsWave);55 btn_lineardW.addEventListener("click", lineardWave);56 btn_keystrokefW.addEventListener("click", keystrokefWave);57 btn_keystroketW.addEventListener("click", keystrokepWave);58 btn_periodwW.addEventListener("click", periodWave);59 btn_frequencywW.addEventListener("click", frequencyWave);60 btn_wavelenghtW.addEventListener("click", wavelengthWave)61 break;62 case "contactforce.html":63 btn_resultingforcefrCF.addEventListener("click", resultingforcefrCF);64 btn_resultingforcemaCF.addEventListener("click", resultingforcemaCF);65 btn_resultingforceaCF.addEventListener("click", resultingforceaCF)66 break;67 case "conversormass.html":68 btn_conversionMass.addEventListener("click", measureGrams)69 break;70 case "energies.html":71 btn_potentialE.addEventListener("click", potentialEnergy);72 btn_kinecticE.addEventListener("click", kinecticEnergy);73 btn_mechanicalE.addEventListener("click", mechanicalEnergy);74 break;75 case "heattransferred.html":76 btn_heattHT.addEventListener("click", heattransferredHT);77 btn_massHT.addEventListener("click", massHT);78 btn_specifichHT.addEventListener("click", specificheatHT);79 btn_temperaturevhmsHT.addEventListener("click", hmstemperatureVariation);80 btn_temperaturevtf.addEventListener("click", tftemperatureVariation);81 break;82 case "volumeconversor.html":83 btn_conversionVolume.addEventListener("click", convertVolume);84 break;85 case "pythagorastheorem.html":86 btn_hypothenusePT.addEventListener("click", hypothenusePT);87 btn_rednackaPT.addEventListener("click", rednackaPT);88 btn_rednackbPT.addEventListener("click", rednackbPT);89 break;90 case "binariesnumbers.html":91 btn_textToBinaries.addEventListener("click", textToBinaries);92 break;93 case "asciinumbers.html":94 btn_textToAscii.addEventListener("click", textToAscii);95 break;96 case "kdr.html":97 btn_calculateKDR.addEventListener("click", calculateKdr);98 break;...
events.js
Source:events.js
...16// }, 2000)17// console.dir(block)18// // DOM Level 219// // Add Event Handler20// block.addEventListener('click', function() {21// console.log('click');22// });23// block.addEventListener('mouseover', f1);24// block.addEventListener('mouseover', f2);25// // Remove Event handler26// block.removeEventListener('mouseover', f1);27// block.removeEventListener('mouseover', f2);28// }29// function f1() {30// console.log('mouseover 1', this);31// }32// function f2() {33// console.log('mouseover 2', this);34// }35// -----------------------------------------36window.addEventListener('load', function() {37 let block = document.querySelector('.block');38 let textarea = document.querySelector('.textarea');39 // Mouse events40 // block.addEventListener('mouseover', handler)41 // block.addEventListener('mouseout', handler)42 // block.addEventListener('mousemove', handler)43 // block.addEventListener('mouseenter', handler)44 // block.addEventListener('mouseleave', handler)45 // block.addEventListener('click', handler);46 // block.addEventListener('dblclick', handler);47 // block.addEventListener('contextmenu', handler);48 // block.addEventListener('mousedown', handler);49 // block.addEventListener('mouseup', handler);50 // Keyboard Events51 // textarea.addEventListener('keydown', handler);52 // textarea.addEventListener('keypress', handler);53 // textarea.addEventListener('keyup', handler);54 // Input events55 // textarea.addEventListener('input', handler);56 // textarea.addEventListener('change', handler);57 // Focus Events58 // textarea.addEventListener('focus', handler);59 // textarea.addEventListener('blur', handler);60 // ---------------------------------------61 // let checkbox = document.querySelector('#checkbox');62 // let select = document.querySelector('#select');63 64 // checkbox.addEventListener('change', handler)65 // checkbox.addEventListener('input', handler)66 // checkbox.addEventListener('focus', handler)67 // checkbox.addEventListener('blur', handler)68 // select.addEventListener('change', handler)69 // select.addEventListener('input', handler)70 // select.addEventListener('focus', handler)71 // select.addEventListener('blur', handler)72 // select.addEventListener('keydown', handler)73})74// function handler(event) {75// if (event.shiftKey) {76// return;77// }78// console.log(event.type, event);79// }80// ----------------------------81let step = 5;82window.addEventListener('load', function(){83 let block = document.querySelector('.block');84 document.addEventListener('keydown', function(event){85 const target = block;86 if (event.keyCode === 37) {87 console.log('left');88 target.style.left = target.offsetLeft - step + 'px';89 } else if (event.keyCode === 38) {90 console.log('top');91 target.style.top = target.offsetTop - step + 'px';92 } else if (event.keyCode === 39) {93 console.log('right');94 target.style.left = target.offsetLeft + step + 'px';95 } else if (event.keyCode === 40) {96 console.log('bottom');97 target.style.top = target.offsetTop + step + 'px';98 } 99 })100 let catched = false;101 setInterval(() => {102 if(catched) {103 return;104 }105 let x = window.innerWidth - block.offsetWidth;106 let y = window.innerHeight - block.offsetHeight;107 block.style.left = getRand(x) + 'px';108 block.style.top = getRand(y) + 'px';109 block.style.backgroundColor = 'rgb('+getRand(256)+', '+getRand(256)+', '+getRand(256)+')';110 }, Math.floor(Math.random()*200 + 100));111 block.addEventListener('mousedown', function() {112 catched = true;113 })114 block.addEventListener('mouseup', function() {115 catched = false;116 })117 function getRand(max) {118 return Math.floor(Math.random()*max);119 }...
view.js
Source:view.js
1/* global $, cy */2(function(){3 $("#zoom-pan-button").addEventListener('click', function(){4 cy.reset();5 });6 $("#fit-button").addEventListener('click', function(){7 cy.fit();8 });9 $("#fit-selected-button").addEventListener('click', function(){10 cy.fit( cy.elements(":selected") );11 });12 $("#center-selected-button").addEventListener('click', function(){13 cy.center( cy.elements(":selected") );14 });15 $("#enable-panning").addEventListener('click', function(){16 cy.panningEnabled(true);17 });18 $("#disable-panning").addEventListener('click', function(){19 cy.panningEnabled(false);20 });21 $("#enable-user-panning").addEventListener('click', function(){22 cy.userPanningEnabled(true);23 });24 $("#disable-user-panning").addEventListener('click', function(){25 cy.userPanningEnabled(false);26 });27 $("#enable-zooming").addEventListener('click', function(){28 cy.zoomingEnabled(true);29 });30 $("#disable-zooming").addEventListener('click', function(){31 cy.zoomingEnabled(false);32 });33 $("#enable-user-zooming").addEventListener('click', function(){34 cy.userZoomingEnabled(true);35 });36 $("#disable-user-zooming").addEventListener('click', function(){37 cy.userZoomingEnabled(false);38 });39 $("#enable-autolock").addEventListener('click', function(){40 cy.autolock(true);41 });42 $("#disable-autolock").addEventListener('click', function(){43 cy.autolock(false);44 });45 $("#enable-autoungrabify").addEventListener('click', function(){46 cy.autoungrabify(true);47 });48 $("#disable-autoungrabify").addEventListener('click', function(){49 cy.autoungrabify(false);50 });51 $("#enable-autounselectify").addEventListener('click', function(){52 cy.autounselectify(true);53 });54 $("#disable-autounselectify").addEventListener('click', function(){55 cy.autounselectify(false);56 });57 $("#show-debug").addEventListener('click', function(){58 cy.renderer().debug = true;59 // force redraws60 cy.panBy({ x: 1 });61 cy.panBy({ x: -1 });62 });63 $("#hide-debug").addEventListener('click', function(){64 cy.renderer().debug = false;65 // force redraws66 cy.panBy({ x: 1 });67 cy.panBy({ x: -1 });68 });69 var showBB = function( eles ){70 var bb = eles.renderedBoundingBox();71 var $bb = $('#bb');72 var style = {73 left: bb.x1 + 'px',74 top: bb.y1 + 'px',75 width: (bb.x2 - bb.x1) + 'px',76 height: (bb.y2 - bb.y1) + 'px',77 display: 'block'78 };79 Object.keys( style ).forEach(function( key ){80 var val = style[key];81 $bb.style[ key ] = val;82 });83 };84 $("#show-bb").addEventListener('click', function(){85 var eles = cy.$(':selected');86 if( eles.length === 0 ){87 eles = cy.elements();88 }89 showBB( eles );90 });91 $("#hide-bb").addEventListener('click', function(){92 $('#bb').style.display = 'none';93 });94 $('#mount').addEventListener('click', function(){95 cy.mount( $('#cytoscape') );96 });97 $('#unmount').addEventListener('click', function(){98 cy.unmount();99 });...
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch({headless: false});5 const page = await browser.newPage();6 await page.waitFor(1000);7 await page.click('input[name="q"]');8 await page.waitFor(1000);9 await page.type('input[name="q"]', 'puppeteer');10 await page.waitFor(1000);11 await page.click('input[name="btnK"]');12 await page.waitFor(1000);13 await page.screenshot({path: 'example.png'});14 await browser.close();15})();16const puppeteer = require('puppeteer');17const fs = require('fs');18(async () => {19 const browser = await puppeteer.launch({headless: false});20 const page = await browser.newPage();21 await page.waitFor(1000);22 await page.click('input[name="q"]');23 await page.waitFor(1000);24 await page.type('input[name="q"]', 'puppeteer');25 await page.waitFor(1000);26 await page.click('input[name="btnK"]');27 await page.waitFor(1000);28 await page.screenshot({path: 'example.png'});29 await browser.close();30})();31const puppeteer = require('puppeteer');32const fs = require('fs');33(async () => {34 const browser = await puppeteer.launch({headless: false});35 const page = await browser.newPage();36 await page.waitFor(1000);37 await page.click('input[name="q"]');38 await page.waitFor(1000);39 await page.type('input[name="q"]', 'puppeteer');40 await page.waitFor(1000);41 await page.click('input[name="btnK"]');42 await page.waitFor(1000);43 await page.screenshot({path: 'example.png'});44 await browser.close();45})();
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 await page.screenshot({path: 'google.png'});7 await page.addScriptTag({path: './jquery.js'});8 await page.addScriptTag({path: './jquery-ui.js'});9 await page.addScriptTag({path: './jquery-ui.css'});10 await page.addScriptTag({path: './jquery-ui.theme.css'});11 await page.addScriptTag({path: './jquery-ui.structure.css'});12 await page.addScriptTag({path: './jquery-ui.min.js'});13 await page.addScriptTag({path: './jquery-ui.min.css'});14 await page.addScriptTag({path: './jquery-ui.theme.min.css'});15 await page.addScriptTag({path: './jquery-ui.structure.min.css'});16 await page.addScriptTag({path: './jquery-ui.theme.css'});17 await page.addScriptTag({path: './jquery-ui.structure.css'});18 await page.addScriptTag({path: './jquery-ui.theme.min.css'});19 await page.addScriptTag({path: './jquery-ui.structure.min.css'});20 await page.addScriptTag({path: './jquery-ui-i18n.js'});21 await page.addScriptTag({path: './jquery-ui-i18n.min.js'});22 await page.addScriptTag({path: './jquery-ui-timepicker-addon.js'});23 await page.addScriptTag({path: './jquery-ui-timepicker-addon.min.js'});24 await page.addScriptTag({path: './jquery-ui-timepicker-addon.css'});25 await page.addScriptTag({path: './jquery-ui-timepicker-addon.min.css'});26 await page.addScriptTag({path: './jquery-ui-sliderAccess.js'});27 await page.addScriptTag({path: './jquery-ui-sliderAccess.min.js'});28 await page.addScriptTag({path: './jquery-ui-timepicker-zh-CN.js'});29 await page.addScriptTag({path: './jquery-ui-timepicker-zh-CN.min.js'});30 await page.addScriptTag({path: './jquery-ui-timepicker-zh-TW.js'});31 await page.addScriptTag({path: './jquery-ui-timepicker-zh-TW.min.js'});32 await page.addScriptTag({path: './jquery-ui-timepicker-zh.js'});
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 await page.screenshot({path: 'google.png'});7 await browser.close();8})();9const puppeteer = require('puppeteer');10const fs = require('fs');11(async () => {12 const browser = await puppeteer.launch();13 const page = await browser.newPage();14 await page.screenshot({path: 'google.png'});15 await browser.close();16})();17const puppeteer = require('puppeteer');18const fs = require('fs');19(async () => {20 const browser = await puppeteer.launch();21 const page = await browser.newPage();22 await page.screenshot({path: 'google.png'});23 await browser.close();24})();25const puppeteer = require('puppeteer');26const fs = require('fs');27(async () => {28 const browser = await puppeteer.launch();29 const page = await browser.newPage();30 await page.screenshot({path: 'google.png'});31 await browser.close();32})();33const puppeteer = require('puppeteer');34const fs = require('fs');35(async () => {36 const browser = await puppeteer.launch();37 const page = await browser.newPage();38 await page.screenshot({path: 'google.png'});39 await browser.close();40})();41const puppeteer = require('puppeteer');42const fs = require('fs');43(async () => {44 const browser = await puppeteer.launch();45 const page = await browser.newPage();46 await page.screenshot({path: 'google.png'});47 await browser.close();48})();
Using AI Code Generation
1const puppeteer = require('puppeteer');2const { expect } = require('chai');3describe('My first puppeteer test', () => {4 let browser;5 let page;6 before(async () => {7 browser = await puppeteer.launch({8 });9 page = await browser.newPage();10 await page.setDefaultTimeout(10000);11 await page.setDefaultNavigationTimeout(20000);12 });13 after(async () => {14 await browser.close();15 });16 it('My first test case', async () => {17 const title1 = await page.title();18 const url1 = await page.url();19 const text1 = await page.$eval('h1', element => element.textContent);20 expect(title1).to.be.a('string', 'Example Domain');21 expect(url1).to.include('example.com');22 expect(text1).to.be.a('string', 'Example Domain');23 });24});
Using AI Code Generation
1const puppeteer = require('puppeteer');2const fs = require('fs');3const path = require('path');4(async () => {5 const browser = await puppeteer.launch();6 const page = await browser.newPage();7 await page.goto(url);8 await page.screenshot({path: 'google.png'});9 await page.addScriptTag({path: path.join(__dirname, 'script.js')});10 await page.waitFor(1000);11 await page.screenshot({path: 'google2.png'});12 await browser.close();13})();14window.addEventListener('load', () => {15 document.querySelector('input[name="q"]').value = 'Puppeteer';16 document.querySelector('input[name="btnK"]').click();17});
Using AI Code Generation
1page.on('console', msg => {2 for (let i = 0; i < msg.args().length; ++i)3 console.log(`${i}: ${msg.args()[i]}`);4});5page.on('console', msg => {6 for (let i = 0; i < msg.args().length; ++i)7 console.log(`${i}: ${msg.args()[i]}`);8});9page.on('console', msg => {10 for (let i = 0; i < msg.args().length; ++i)11 console.log(`${i}: ${msg.args()[i]}`);12});13page.on('console', msg => {14 for (let i = 0; i < msg.args().length; ++i)15 console.log(`${i}: ${msg.args()[i]}`);16});17page.on('console', msg => {18 for (let i = 0; i < msg.args().length; ++i)19 console.log(`${i}: ${msg.args()[i]}`);20});21page.on('console', msg => {22 for (let i = 0; i < msg.args().length; ++i)23 console.log(`${i}: ${msg.args()[i]}`);24});25page.on('console', msg => {26 for (let i = 0; i < msg.args().length; ++i)27 console.log(`${i}: ${msg.args()[i]}`);28});29page.on('console', msg => {30 for (
Using AI Code Generation
1await page.evaluate(() => {2 const element = document.querySelector('button');3 element.addEventListener('click', () => {4 alert('Button clicked!');5 });6});7await page.click('button');8await page.waitForFunction('window.clicked');
Using AI Code Generation
1page.on('console', msg => console.log('PAGE LOG:', msg.text()));2page.addListener('console', msg => console.log('PAGE LOG:', msg.text()));3page.on('console', msg => console.log('PAGE LOG:', msg.text()));4page.once('console', msg => console.log('PAGE LOG:', msg.text()));5page.prependListener('console', msg => console.log('PAGE LOG:', msg.text()));6page.prependOnceListener('console', msg => console.log('PAGE LOG:', msg.text()));7page.removeListener('console', msg => console.log('PAGE LOG:', msg.text()));8page.removeAllListeners('console');9page.listeners('console');10page.rawListeners('console');11page.eventNames();12page.listenerCount('console');13page.off('console', msg => console.log('PAGE LOG:',
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!