How to use scrolldown method in pyatom

Best Python code snippet using pyatom_python

BUPTdaka.js

Source:BUPTdaka.js Github

copy

Full Screen

1//清除后台进程2function clearall(Appname) {3 var count = 0;4 var result = false;5 do {6 recents();7 sleep(3500);8 var b = className("android.widget.RelativeLayout").id("clearbox").findOne(5000);9 if (b == null) {10 back();11 launchApp(Appname);12 sleep(1000);13 back();14 }15 } while (b == null);16 b = b.bounds();17 do {18 result = click(b.centerX(), b.centerY());19 sleep(1000);20 count++;21 if (count > 2) {22 // console.log("break from here!!!");23 return false;24 }25 } while (!result && (!className("android.widget.RelativeLayout").id("clearbox").exists()));26 return result;27}//返回是否成功按下清除按钮28//used to send intent to the tasker to notify users!!!!29//It's marvelous!!!30function sendintent(actions, detail) {31 // send-broadcast.js32 app.sendBroadcast({33 action: actions,34 extras: {35 from: 'Autojs',36 version: '3.1.0 Beta',37 info: detail,38 },39 });40}41// open用来打开app42function open(Appname) {43 var flag = false;44 do {45 flag = launchApp(Appname);46 sleep(3000) //等待应用打开47 } while (!flag);48 return flag;49}//返回是否成功打开app50//进入微信,开始进入公众号打卡51function wechatentrance() {52 // 1st53 //format UIcontainer open code54 var count = 0;55 do {56 var home = text('北京邮电大学').className('android.view.View').depth(20).findOne(5000);57 count++;58 if (count > 2 && count <= 4) {59 scrollDown();60 sleep(1000);61 } else if (count > 4) {62 console.log("没有找到北邮公众号");63 return false;64 }65 } while (home == null);66 var result1 = home.parent().parent().parent().parent().parent().click();67 console.log("是否打开北邮公众号:", result1);68 sleep(2000);69 //end format70 //2nd71 count = 0;72 do {73 var corona = textContains('疫情防控通').className('android.view.View').depth(20).findOne(5000);74 count++;75 if (count > 2 && count <= 4) {76 scrollDown();77 sleep(1000);78 } else if (count > 4) {79 console.log("没有找到公众号的疫情防控通");80 return false;81 }82 } while (corona == null);83 var result2 = corona.parent().parent().parent().parent().click();84 console.log("是否打开公众号的疫情防控通:", result2);85 sleep(2000);86 // //2nd87 // var corona = id('com.tencent.mm:id/btf').row(0).depth(16).clickable(true).findOne(10000);88 // if (corona == null) {89 // console.log("没有找到疫情防控通");90 // return false;91 // }92 // var result2 = corona.click();93 // console.log("是否找到疫情防控通:" + result2);94 // sleep(4000);95 //3rd直接从每日填报进入96 count = 0;97 do {98 var daily = text('每日填报').className('android.widget.TextView').depth(12).findOne(5000);99 count++;100 sleep(1000);101 if (count > 4) {102 console.log("没有找到每日填报");103 return false;104 }105 } while (daily == null);106 var result3 = daily.parent().parent().click();107 console.log("是否打开每日填报:", result3);108 sleep(3000);109 // //3rd110 // var daily = id('com.tencent.mm:id/gs1').row(-1).depth(10).clickable(true).indexInParent(0).findOne(10000);111 // if (daily == null) {112 // console.log("没有找到每日填报");113 // return false;114 // }115 // var result3 = daily.click();116 // console.log("是否找到每日填报:" + result3);117 // sleep(5000);118 do {119 var dailyresult = text('每日填报').findOne(3000);120 scrollDown();121 } while (!dailyresult);122 return dailyresult;123}124//填报每日打卡125function dailyonce() {126 scrollDown();127 sleep(1000);128 var dailyonce = text("每日填报").depth(22).findOne(10000);129 if (dailyonce == null) {130 console.log("没有找到每日填报打卡进入口");131 return false;132 }133 var result3;134 do {135 result3 = dailyonce.parent().click();136 sleep(2000);137 } while (!result3);138 console.log("是否找到每日填报打卡进入口:" + result3);139 sleep(4000);140 scrollDown();141 //here starts the main part of the sheet142 //first choose ifatschool143 var ifatschool = text('今日是否在校?').depth(22).indexInParent(0).className('android.widget.TextView').findOne(10000);144 sleep(2000);145 var count = 0;146 var backcount = 0;147 while (!ifatschool) {148 scrollDown();149 ifatschool = text('今日是否在校?').depth(22).indexInParent(0).className('android.widget.TextView').findOne(10000);150 sleep(1000);151 count++;152 if (backcount == 2) {153 console.log('无法打开网页!!');154 return false;155 }156 if (count == 2) {157 back();158 console.log('打卡网页打开失败,执行回退操作');159 backcount++;160 sleep(2000);161 scrollDown();162 sleep(1000);163 //repeat of the former code, to refresh the landing page164 var dailyonce2 = className('android.view.View').row(9).depth(21).clickable(true).indexInParent(9).findOne(10000);165 if (dailyonce2 == null) {166 console.log("回退后,没有找到每日填报打卡进入口");167 return false;168 }169 var res;170 do {171 res = dailyonce2.click();172 sleep(2000);173 } while (!res);174 console.log("回退后,是否找到每日填报打卡进入口:" + res);175 sleep(4000);176 count = 0;177 }178 }179 var result4 = ifatschool.parent().child(4).click();180 //important !!!181 //如果返校,需要自行修改!!!182 //在家child(4)183 //在学校child(3)184 console.log("是否选择了是否在校:" + result4);185 scrollDown();186 sleep(500);187 scrollDown();188 //now set the location189 var location = text('所在地点(请打开手机位置功能,并在手机权限设置中选择允许微信访问位置信息)').depth(23).indexInParent(0).className('android.widget.TextView').findOne(10000);190 sleep(2000);191 while (!location) {192 scrollDown();193 location = text('所在地点(请打开手机位置功能,并在手机权限设置中选择允许微信访问位置信息)').depth(23).indexInParent(0).className('android.widget.TextView').findOne(10000);194 sleep(1000);195 }196 var result5 = location.parent().click();197 sleep(2000);198 console.log("是否获取了位置信息:" + result5);199 //此处问题:点击对象应该是depth(22)的控件,然而depth(23)也是可点击的,但是点击无效!!!200 scrollDown();201 sleep(500);202 scrollDown();203 //now choose if at the risky location204 var risky = text('今日是否在中高风险地区?(中高风险地区信息可通过国务院客户端小程序实时查询)').depth(22).indexInParent(0).className('android.widget.TextView').findOne(10000);205 sleep(2000);206 while (!risky) {207 scrollDown();208 risky = text('今日是否在中高风险地区?(中高风险地区信息可通过国务院客户端小程序实时查询)').depth(22).indexInParent(0).className('android.widget.TextView').findOne(10000);209 sleep(1000);210 }211 var result6 = risky.parent().child(4).click();212 while (!result6) {213 scrollDown();214 result6 = risky.parent().child(4).click();215 }216 sleep(2000);217 console.log("是否勾选了不在中高风险区:" + result6);218 scrollDown();219 scrollDown();220 scrollDown();221 scrollDown();222 scrollDown();223 scrollDown();224 sleep(1000);225 scrollDown();226 scrollDown();227 scrollDown();228 scrollDown();229 scrollDown();230 scrollDown();231 sleep(1000);232 scrollDown();233 scrollDown();234 scrollDown();235 scrollDown();236 scrollDown();237 scrollDown();238 var submit = text('提交信息(Submit)').depth(21).indexInParent(0).findOne(4000);239 while (!submit) {240 scrollDown();241 submit = text('提交信息(Submit)').depth(21).indexInParent(0).findOne(4000);242 sleep(1000);243 }244 submit.click();245 sleep(2000);246 var confirm = textContains('确认').clickable(true).findOne(10000);247 sleep(1000);248 while (!confirm) {249 confirm = textContains('确认').clickable(true).findOne(10000);250 sleep(1000);251 }252 var finalresult = confirm.click();253 back();254 return finalresult;255}256//填报晨午晚检257function daily3times() {258 var daily3times = className('android.view.View').row(10).depth(21).clickable(true).indexInParent(10).findOne(10000);259 if (daily3times == null) {260 console.log("没有找到每日填报打卡界面");261 return false;262 }263 var result3 = daily3times.click();264 console.log("是否找到每日填报打卡界面:" + result3);265 sleep(5000);266}267function verify() {268 scrollDown();269 sleep(1000);270 var verify = text("每日填报").depth(22).findOne(10000);271 if (verify == null) {272 return false;273 }274 var result1 = verify.parent().click();275 sleep(4000);276 scrollDown();277 //here is the copy of dailyonce278 //first choose ifatschool279 var ifatschool = text('今日是否在校?').depth(22).indexInParent(0).className('android.widget.TextView').findOne(10000);280 sleep(2000);281 while (!ifatschool) {282 scrollDown();283 ifatschool = text('今日是否在校?').depth(22).indexInParent(0).className('android.widget.TextView').findOne(10000);284 sleep(1000);285 }286 var result4 = ifatschool.parent().child(4).click();287 console.log("是否选择了是否在校:" + result4);288 scrollDown();289 sleep(500);290 scrollDown();291 //now set the location292 var location = text('所在地点(请打开手机位置功能,并在手机权限设置中选择允许微信访问位置信息)').depth(23).indexInParent(0).className('android.widget.TextView').findOne(10000);293 sleep(2000);294 while (!location) {295 scrollDown();296 location = text('所在地点(请打开手机位置功能,并在手机权限设置中选择允许微信访问位置信息)').depth(23).indexInParent(0).className('android.widget.TextView').findOne(10000);297 sleep(1000);298 }299 var result5 = location.parent().click();300 sleep(2000);301 console.log("是否获取了位置信息:" + result5);302 scrollDown();303 sleep(500);304 scrollDown();305 //now choose if at the risky location306 var risky = text('今日是否在中高风险地区?(中高风险地区信息可通过国务院客户端小程序实时查询)').depth(22).indexInParent(0).className('android.widget.TextView').findOne(10000);307 sleep(2000);308 while (!risky) {309 scrollDown();310 risky = text('今日是否在中高风险地区?(中高风险地区信息可通过国务院客户端小程序实时查询)').depth(22).indexInParent(0).className('android.widget.TextView').findOne(10000);311 sleep(1000);312 }313 var result6 = risky.parent().child(4).click();314 while (!result6) {315 scrollDown();316 result6 = risky.parent().child(4).click();317 }318 sleep(2000);319 scrollDown();320 scrollDown();321 scrollDown();322 scrollDown();323 scrollDown();324 scrollDown();325 sleep(1000);326 scrollDown();327 scrollDown();328 scrollDown();329 scrollDown();330 scrollDown();331 scrollDown();332 sleep(1000);333 scrollDown();334 scrollDown();335 scrollDown();336 scrollDown();337 scrollDown();338 scrollDown();339 var submit = text('提交信息(Submit)').depth(21).indexInParent(0).findOne(4000);340 while (!submit) {341 scrollDown();342 submit = text('提交信息(Submit)').depth(21).indexInParent(0).findOne(4000);343 sleep(1000);344 }345 submit.click();346 sleep(2000);347 if (textContains('请确认信息是否全部正确').exists()) {348 return false;349 } else if (textContains('你已提交过').exists()) {350 return true;351 } else { return false; }352}353//main function code354// console.show();355// console.setPosition(255, 525);356function main1() {357 do {358 clearall("微信");359 open("微信");360 } while (currentActivity() != 'com.tencent.mm.ui.LauncherUI');361}362function main2() {363 entrance = wechatentrance();364 while (!entrance) {365 main1();366 entrance = wechatentrance();367 }368}369function main3() {370 var once2 = dailyonce();371 while (!once2) {372 main1();373 main2();374 var once2 = dailyonce();375 }376 return once2;377}378var once;379var entrance;380main1();381main2();382once = main3();383once = once & verify();384clearall("微信");385if (entrance && once) {386 sendintent('autojs.intent.action.dakasucceed', 'succeed✪ ω ✪!!!')387} else {388 sendintent('autojs.intent.action.dakafail', 'fail╯︿╰!!!')...

Full Screen

Full Screen

faucets.py

Source:faucets.py Github

copy

Full Screen

1import tools2import datetime3from commands import Commands4import time5import os6import OCR7import inspect8def bitcoinker():9 '''10 Recipe name: bitcoinker11 ''' 12 _iamnotarobot_ = "assets/iamnotarobot"13 _iamnotarobot_done_ = "assets/iamnotarobot-done"14 config = tools.JSON.get("config.json")15 links = config["links"]16 cmd = Commands()17 cmd.is_animation_on = True18 cmd.animation_time = 0.0119 selected_link = "bitcoinker"20 cmd.link(links[selected_link])21 cmd.wait_for("HTML is done?", f'assets/{selected_link}/htmlisdone.png', scrolldown_enabled=False)22 if cmd.solve_recaptcha():23 print("solve_recaptcha fail")24 tools.Logging.fail(f"logs/time/{selected_link}.txt", "solve_recaptcha fail")25 cmd.link("localhost")26 exit()27 28 if cmd.wait_for("Waiting process done", _iamnotarobot_done_, scrolldown_enabled=False):29 cmd.link("localhost")30 tools.Logging.fail(f"logs/time/{selected_link}.txt", "Process done yakalanamadı.")31 exit()32 if not cmd.wait_for("Claim edilcek.", f'assets/bitcoinker/claim_bitcoin', scrolldown_enabled=True, sensitive=True):33 cmd.find_and_click(f'assets/bitcoinker/claim_bitcoin', sensitive=True)34 time.sleep(2)35 cmd.payment_solver(selected_link, sensitive=True)36 tools.Logging.success(f"logs/time/{selected_link}.txt")37 else:38 tools.Logging.fail(f"logs/time/{selected_link}.txt", "Claim edilemedi!")39 cmd.link("localhost")40def bitfun():41 '''42 Recipe name: bitcoinker43 ''' 44 _iamnotarobot_ = "assets/iamnotarobot"45 _iamnotarobot_done_ = "assets/iamnotarobot-done"46 config = tools.JSON.get("config.json")47 links = config["links"]48 cmd = Commands()49 cmd.is_animation_on = True50 cmd.animation_time = 0.0151 selected_link = "bitfun"52 cmd.link(links[selected_link])53 cmd.wait_for("HTML is done?", f'assets/{selected_link}/htmlisdone', scrolldown_enabled=False)54 cmd.wait_for("Searching claim button?", f'assets/{selected_link}/claim', scrolldown_enabled=True, sensitive=True)55 cmd.find_and_click(f'assets/{selected_link}/claim', sensitive=True)56 57 if cmd.solve_recaptcha(firstly_go_to_top=False):58 print("solve_recaptcha fail")59 tools.Logging.fail(f"logs/time/{selected_link}.txt", "solve_recaptcha fail")60 cmd.link("localhost")61 exit()62 63 time.sleep(2)64 cmd.find_and_click(f'assets/{selected_link}/claim', sensitive=True)65 time.sleep(2)66 67 if not cmd.wait_for("Searching claim button?", f'assets/{selected_link}/close', scrolldown_enabled=False, sensitive=True):68 cmd.find_and_click(f'assets/{selected_link}/close', sensitive=True)69 tools.Logging.success(f"logs/time/{selected_link}.txt")70 else:71 tools.Logging.fail(f"logs/time/{selected_link}.txt", "Claim edilemedi!")72 cmd.link("localhost")73def bonusbitcoin():74 '''75 Recipe name: bonusbitcoin76 '''77 _iamnotarobot_ = "assets/iamnotarobot"78 _iamnotarobot_done_ = "assets/iamnotarobot-done"79 config = tools.JSON.get("config.json")80 links = config["links"]81 cmd = Commands()82 cmd.is_animation_on = True83 cmd.animation_time = 0.0184 selected_link = "bonusbitcoin"85 86 cmd.link(links[selected_link])87 cmd.wait_for("HTML is done?", f'assets/{selected_link}/htmlisdone.png', scrolldown_enabled=False)88 89 cmd.wait_for("I'am not a robot bulunacak.",_iamnotarobot_, scrolldown_enabled=True, sensitive=False)90 if cmd.solve_recaptcha(scrolldown_enabled=False, firstly_go_to_top=False):91 print("solve_recaptcha fail")92 tools.Logging.fail(f"logs/time/{selected_link}.txt", "solve_recaptcha fail")93 cmd.link("localhost")94 exit()95 96 cmd.wait_for("Waiting process done", _iamnotarobot_done_, scrolldown_enabled=False)97 if not cmd.wait_for("Claim edilcek.", f'assets\{selected_link}\claim_now.png', scrolldown_enabled=True, sensitive=True):98 time.sleep(2)99 cmd.find_and_click(f'assets\{selected_link}\claim_now.png', sensitive=True)100 #cmd.payment_solver(selected_link, sensitive=True)101 tools.Logging.success(f"logs/time/{selected_link}.txt")102 else:103 tools.Logging.fail(f"logs/time/{selected_link}.txt", "Claim edilemedi!")104 cmd.link("localhost")105def freebitco():106 '''107 Recipe name: freebitco108 '''109 _iamnotarobot_ = "assets/iamnotarobot"110 _iamnotarobot_done_ = "assets/iamnotarobot-done"111 config = tools.JSON.get("config.json")112 links = config["links"]113 cmd = Commands()114 cmd.is_animation_on = True115 cmd.animation_time = 0.01116 selected_link = "freebitco"117 118 cmd.link(links[selected_link])119 cmd.wait_for("HTML is done?", f'assets/{selected_link}/htmlisdone.png', scrolldown_enabled=False)120 cmd.mouse.position = config["location"]["temp"]121 cmd.click_l()122 if cmd.solve_recaptcha():123 print("solve_recaptcha fail")124 tools.Logging.fail(f"logs/time/{selected_link}.txt", "solve_recaptcha fail")125 cmd.link("localhost")126 exit()127 128 cmd.wait_for("Waiting process done", _iamnotarobot_done_, scrolldown_enabled=False)129 if not cmd.wait_for("Roll edilcek.", f'assets/{selected_link}/roll.png', scrolldown_enabled=True, sensitive=True):130 cmd.find_and_click(f'assets/{selected_link}/roll.png', sensitive=True)131 time.sleep(2)132 cmd.mouse.position = config["location"]["temp"]133 cmd.click_l()134 #cmd.payment_solver(selected_link, sensitive=True)135 tools.Logging.success(f"logs/time/{selected_link}.txt")136 137 else:138 tools.Logging.fail(f"logs/time/{selected_link}.txt", "Claim edilemedi!")139 cmd.link("localhost")140def moon(selected_link):141 f'''142 Recipe name: {selected_link}143 '''144 this_func = eval(inspect.stack()[0][3])145 def check():146 if "blank" in OCR.resolve_url():147 print("! RESET")148 return this_func(selected_link)149 else:150 if OCR.check_current_url():151 time.sleep(1)152 cmd = Commands()153 cmd.go_to_top()154 BASE_ASSET_DIR = f'assets/__faucets__/{selected_link}'155 _iamnotarobot_ = "assets/iamnotarobot"156 _iamnotarobot_done_ = "assets/iamnotarobot-done"157 config = tools.JSON.get("config.json")158 links = config["links"]159 cmd = Commands()160 cmd.is_animation_on = True161 cmd.animation_time = 0.01162 163 cmd.link(links[selected_link])164 cmd.wait_for("HTML is done?", os.path.join(BASE_ASSET_DIR, "htmlisdone"), scrolldown_enabled=False)165 cmd.mouse.position = config["location"]["temp"]166 cmd.click_l(close_after_click=False)167 time.sleep(5)168 check()169 time.sleep(2)170 # Double Close Check171 if not cmd.wait_for("Reklam Kapatılacak.", os.path.join(BASE_ASSET_DIR, 'close'), scrolldown_enabled=False, sensitive=True):172 cmd.find_and_click(os.path.join(BASE_ASSET_DIR, 'close'), sensitive=True, close_after_click=False)173 time.sleep(2)174 check()175 time.sleep(2)176 if not cmd.wait_for("Reklam Kapatılacak.", os.path.join(BASE_ASSET_DIR, 'close'), scrolldown_enabled=False, sensitive=True, timeout=10):177 cmd.find_and_click(os.path.join(BASE_ASSET_DIR, 'close'), sensitive=True, close_after_click=False)178 time.sleep(2)179 check()180 time.sleep(2)181 ###.............182 if not cmd.wait_for("Claim edilcek.", os.path.join(BASE_ASSET_DIR, 'claim'), scrolldown_enabled=True, sensitive=True):183 cmd.find_and_click(os.path.join(BASE_ASSET_DIR, 'claim'), sensitive=True, close_after_click=False)184 time.sleep(2)185 check()186 if cmd.solve_recaptcha(scrolldown_enabled=False, firstly_go_to_top=False):187 print("solve_recaptcha fail")188 tools.Logging.fail(f"logs/time/{selected_link}.txt", "solve_recaptcha fail")189 cmd.link("localhost")190 exit()191 192 cmd.wait_for("Waiting process done", _iamnotarobot_done_, scrolldown_enabled=False)193 if not cmd.wait_for("Claim edilcek.", os.path.join(BASE_ASSET_DIR, 'claim'), scrolldown_enabled=True, sensitive=True):194 cmd.find_and_click(os.path.join(BASE_ASSET_DIR, 'claim'), sensitive=True, close_after_click=False)195 time.sleep(2)196 check()197 tools.Logging.success(f"logs/time/{selected_link}.txt")198 else:199 tools.Logging.fail(f"logs/time/{selected_link}.txt", "Claim edilemedi!")200 201 time.sleep(5)202 cmd.link("localhost")...

Full Screen

Full Screen

discover.js

Source:discover.js Github

copy

Full Screen

1$(document).ready(function () {2 let current=1;3 $('#box'+current).css('width','100%')4 $('#s1c'+current).css('display','grid')5 $('#li1').click(function () {6 $('#box'+current).css('width','0%')7 $('#s1c'+current).css('display','none')8 current=19 $('#box'+current).css('width','100%')10 $('#s1c'+current).css('display','grid')11 });12 $('#li2').click(function () {13 $('#box'+current).css('width','0%')14 $('#s1c'+current).css('display','none')15 current=216 $('#box'+current).css('width','100%')17 $('#s1c'+current).css('display','grid')18 });19 $('#li3').click(function () {20 $('#box'+current).css('width','0%')21 $('#s1c'+current).css('display','none')22 current=323 $('#box'+current).css('width','100%')24 $('#s1c'+current).css('display','grid')25 });26 $('#li4').click(function () {27 $('#box'+current).css('width','0%')28 $('#s1c'+current).css('display','none')29 current=430 $('#box'+current).css('width','100%')31 $('#s1c'+current).css('display','grid')32 });33 $('#li5').click(function () {34 $('#box'+current).css('width','0%')35 $('#s1c'+current).css('display','none')36 current=537 $('#box'+current).css('width','100%')38 $('#s1c'+current).css('display','grid')39 });40 $('#li6').click(function () {41 $('#box'+current).css('width','0%')42 $('#s1c'+current).css('display','none')43 current=644 $('#box'+current).css('width','100%')45 $('#s1c'+current).css('display','grid')46 });47 48 $('#btn_hscroll').click(function () {49 $('html,body').animate({50 scrollTop: $('#section1').offset().top51 },1000);52 });53 $('#btn_secscroll').click(function () {54 $('html,body').animate({55 scrollTop: $('#section1').offset().top56 }, 1000)57 })58 ///////////////////////////////////// ScrollMagic59 var controller = new ScrollMagic.Controller();60 if(document.body.clientWidth <= 320){61 new ScrollMagic.Scene({62 triggerElement: '#section1',63 offset: 45064 }).setClassToggle('.con_scroll','fixed').addTo(controller).reverse(true);65 new ScrollMagic.Scene({66 triggerElement: '#footer',67 offset: -40068 }).setClassToggle('.con_scroll','absolute').addTo(controller).reverse(true);69 70 }71 else if(document.body.clientWidth <= 768){72 new ScrollMagic.Scene({73 triggerElement: '#section1',74 offset: 45075 }).setClassToggle('.con_scroll','fixed').addTo(controller).reverse(true)76 new ScrollMagic.Scene({77 triggerElement: '#footer',78 offset: -40079 }).setClassToggle('.con_scroll','absolute').addTo(controller).reverse(true);80 }81 else{82 new ScrollMagic.Scene({83 triggerElement: '#section1',84 offset: 450, duration: 250085 }).setClassToggle('.con_scroll','fixed').addTo(controller).reverse(true);86 }87 $('.scrolldown').click(function () {88 new TimelineMax()89 .addLabel('a')90 .to('.ul_s',0.5,{ opacity: "1"})91 .to('.scrolldown',0.3,{ opacity:'0',ease:'power2.inOut'},"a")92 .to('.scrolldown',0,{ display: 'none'},"a+=0.25")93 .to('.scrollup',0.3,{ opacity: '1',ease:'power2.inOut'},"a+=0.25")94 })95 $('.scrollup').click(function () {96 new TimelineMax()97 .addLabel('b')98 .to('.ul_s',0.25,{ opacity: "0"})99 .to('.scrollup',0.3,{ opacity:'0',ease:'power2.inOut'},"b")100 .to('.scrolldown',0,{ display: 'block'},"b+=0.25")101 .to('.scrolldown',0.3,{ opacity: '1',ease:'power2.inOut'},"b+=0.25")102 })103 104 $('#li_s_1').click(function () {105 new TimelineMax()106 .addLabel('c')107 .to('.ul_s',0.5,{ opacity: "0"})108 .to('.scrollup',0.3,{ opacity:'0',ease:'power2.inOut'},"c")109 .to('.scrolldown',0,{ display: 'block'},"c+=0.25")110 .to('.scrolldown',0.3,{ opacity: '1',ease:'power2.inOut'},"c+=0.25")111 $('#s1c'+current).css('display','none')112 current=1113 $('#s1c'+current).css('display','grid')114 $('#t_li_current').html("ALL")115 })116 $('#li_s_2').click(function () {117 new TimelineMax()118 .addLabel('c')119 .to('.ul_s',0.5,{ opacity: "0"})120 .to('.scrollup',0.3,{ opacity:'0',ease:'power2.inOut'},"c")121 .to('.scrolldown',0,{ display: 'block'},"c+=0.25")122 .to('.scrolldown',0.3,{ opacity: '1',ease:'power2.inOut'},"c+=0.25")123 $('#s1c'+current).css('display','none')124 current=2125 $('#s1c'+current).css('display','grid')126 $('#t_li_current').html("POP")127 })128 $('#li_s_3').click(function () {129 new TimelineMax()130 .addLabel('c')131 .to('.ul_s',0.5,{ opacity: "0"})132 .to('.scrollup',0.3,{ opacity:'0',ease:'power2.inOut'},"c")133 .to('.scrolldown',0,{ display: 'block'},"c+=0.25")134 .to('.scrolldown',0.3,{ opacity: '1',ease:'power2.inOut'},"c+=0.25")135 $('#s1c'+current).css('display','none')136 current=3137 $('#s1c'+current).css('display','grid')138 $('#t_li_current').html("ROCK")139 })140 $('#li_s_4').click(function () {141 new TimelineMax()142 .addLabel('c')143 .to('.ul_s',0.5,{ opacity: "0"})144 .to('.scrollup',0.3,{ opacity:'0',ease:'power2.inOut'},"c")145 .to('.scrolldown',0,{ display: 'block'},"c+=0.25")146 .to('.scrolldown',0.3,{ opacity: '1',ease:'power2.inOut'},"c+=0.25")147 $('#s1c'+current).css('display','none')148 current=4149 $('#s1c'+current).css('display','grid')150 $('#t_li_current').html("COUNTRY")151 })152 $('#li_s_5').click(function () {153 new TimelineMax()154 .addLabel('c')155 .to('.ul_s',0.5,{ opacity: "0"})156 .to('.scrollup',0.3,{ opacity:'0',ease:'power2.inOut'},"c")157 .to('.scrolldown',0,{ display: 'block'},"c+=0.25")158 .to('.scrolldown',0.3,{ opacity: '1',ease:'power2.inOut'},"c+=0.25")159 $('#s1c'+current).css('display','none')160 current=5161 $('#s1c'+current).css('display','grid')162 $('#t_li_current').html("HIP HOP")163 })164 $('#li_s_6').click(function () {165 new TimelineMax()166 .addLabel('c')167 .to('.ul_s',0.5,{ opacity: "0"})168 .to('.scrollup',0.3,{ opacity:'0',ease:'power2.inOut'},"c")169 .to('.scrolldown',0,{ display: 'block'},"c+=0.25")170 .to('.scrolldown',0.3,{ opacity: '1',ease:'power2.inOut'},"c+=0.25")171 $('#s1c'+current).css('display','none')172 current=6173 $('#s1c'+current).css('display','grid')174 $('#t_li_current').html("EDM")175 })...

Full Screen

Full Screen

scroll-animate.test.js

Source:scroll-animate.test.js Github

copy

Full Screen

1const { ScrollAnimate } = require('../lib/vue-animate-onscroll.cjs')2const createFixture = require('./utils')3describe('ScrollAnimate', function() {4 let scrollAnimate = null5 6 beforeEach(() => scrollAnimate = ScrollAnimate() )7 describe('General tests', () => {8 test('should not remove existing classes', () => {9 const previousClassName = 'default'10 const animationClass = 'flip'11 const fixture = createFixture(12 scrollAnimate, { previousClassName, animationClass }13 )14 expect(fixture.getClassName()).toBe(previousClassName)15 fixture.scrollDown(true)16 expect(fixture.getClassName()).not.toBeNull()17 expect(fixture.getClassNames()).toContain(previousClassName)18 })19 })20 describe('Non-directional', () => {21 const animationClass = 'flip'22 test('should add animation classes', () => {23 const fixture = createFixture(scrollAnimate, { animationClass })24 expect(fixture.getClassName()).toBeFalsy()25 fixture.scrollDown(true)26 expect(fixture.getClassName()).toEqual(animationClass)27 })28 test('should toggle animation when repeat is on', () => {29 const fixture = createFixture(30 scrollAnimate, { animationClass, repeat: true }31 )32 expect(fixture.getClassName()).toBeFalsy()33 fixture.scrollDown(true)34 expect(fixture.getClassName()).toEqual(animationClass)35 fixture.scrollDown(false)36 expect(fixture.getClassName()).toBeFalsy()37 fixture.scrollUp(true)38 expect(fixture.getClassName()).toEqual(animationClass)39 })40 41 test('should not toggle animation when repeat is off', () => {42 const fixture = createFixture(43 scrollAnimate, { animationClass, repeat: false }44 )45 expect(fixture.getClassName()).toBeFalsy()46 fixture.scrollDown(true)47 expect(fixture.getClassName()).toEqual(animationClass)48 fixture.scrollDown(false)49 expect(fixture.getClassName()).toEqual(animationClass)50 fixture.scrollUp(true)51 expect(fixture.getClassName()).toEqual(animationClass)52 fixture.scrollUp(false)53 fixture.scrollDown(true)54 fixture.scrollDown(false)55 expect(fixture.getClassName()).toEqual(animationClass)56 })57 })58 describe('Downwards animation', () => {59 const animationClass = {down: 'rotate'}60 test('should apply animation on scroll once', () => {61 const fixture = createFixture(scrollAnimate, { animationClass })62 expect(fixture.getClassName()).toBeFalsy()63 fixture.scrollDown(true)64 expect(fixture.getClassName()).toEqual(animationClass.down)65 fixture.scrollDown(false)66 expect(fixture.getClassName()).toEqual(animationClass.down)67 fixture.scrollUp(true)68 expect(fixture.getClassName()).toEqual(animationClass.down)69 fixture.scrollUp(false)70 expect(fixture.getClassName()).toEqual(animationClass.down)71 })72 test('should toggle animation when repeat is on', () => {73 const fixture = createFixture(74 scrollAnimate, { animationClass, repeat: true }75 )76 expect(fixture.getClassName()).toBeFalsy()77 fixture.scrollDown(true)78 expect(fixture.getClassName()).toEqual(animationClass.down)79 fixture.scrollDown(false)80 expect(fixture.getClassName()).toEqual(animationClass.down)81 fixture.scrollUp(true)82 fixture.scrollUp(false)83 expect(fixture.getClassName()).toBeFalsy()84 fixture.scrollDown(true)85 expect(fixture.getClassName()).toEqual(animationClass.down)86 })87 })88 describe('Upwards animation', () => {89 const animationClass = { up: 'jackInTheBox' }90 test('should apply animation on scroll once', () => {91 const fixture = createFixture(scrollAnimate, { animationClass })92 expect(fixture.getClassName()).toBeFalsy()93 fixture.scrollDown(true)94 expect(fixture.getClassName()).toBeFalsy()95 fixture.scrollDown(false)96 expect(fixture.getClassName()).toBeFalsy()97 fixture.scrollUp(true)98 expect(fixture.getClassName()).toEqual(animationClass.up)99 fixture.scrollUp(false)100 expect(fixture.getClassName()).toEqual(animationClass.up)101 fixture.scrollDown(true)102 expect(fixture.getClassName()).toEqual(animationClass.up)103 fixture.scrollDown(false)104 expect(fixture.getClassName()).toEqual(animationClass.up)105 })106 test('should toggle animation when repeat is on', () => {107 const fixture = createFixture(108 scrollAnimate, { animationClass, repeat: true }109 )110 expect(fixture.getClassName()).toBeFalsy()111 fixture.scrollDown(true)112 expect(fixture.getClassName()).toBeFalsy()113 fixture.scrollDown(false)114 expect(fixture.getClassName()).toBeFalsy()115 fixture.scrollUp(true)116 expect(fixture.getClassName()).toBe(animationClass.up)117 fixture.scrollUp(false)118 expect(fixture.getClassName()).toBe(animationClass.up)119 fixture.scrollDown(true)120 fixture.scrollDown(false)121 expect(fixture.getClassName()).toBeFalsy()122 fixture.scrollUp(true)123 expect(fixture.getClassName()).toBe(animationClass.up)124 fixture.scrollUp(false)125 fixture.scrollDown(true)126 fixture.scrollDown(false)127 expect(fixture.getClassName()).toBeFalsy()128 })129 })130 describe('Bi-directional animation', () => {131 const animationClass = {up: 'zoomIn', down: 'zoomOut'}132 test('should toggle appropriate direction', () => {133 const fixture = createFixture(scrollAnimate, { animationClass })134 expect(fixture.getClassName()).toBeFalsy()135 fixture.scrollDown(true)136 expect(fixture.getClassName()).toBe(animationClass.down)137 fixture.scrollDown(false)138 expect(fixture.getClassName()).toBe(animationClass.down)139 fixture.scrollUp(true)140 expect(fixture.getClassName()).toBe(animationClass.up)141 fixture.scrollUp(false)142 expect(fixture.getClassName()).toBe(animationClass.up)143 fixture.scrollDown(true)144 expect(fixture.getClassName()).toBe(animationClass.down)145 fixture.scrollDown(false)146 expect(fixture.getClassName()).toBe(animationClass.down)147 })148 test('should toggle appropriate animation regardless of repeat', () => {149 const fixture = createFixture(150 scrollAnimate, { animationClass, repeat: true }151 )152 expect(fixture.getClassName()).toBeFalsy()153 fixture.scrollDown(true)154 expect(fixture.getClassName()).toBe(animationClass.down)155 fixture.scrollDown(false)156 fixture.scrollUp(true)157 expect(fixture.getClassName()).toBe(animationClass.up)158 fixture.scrollUp(false)159 fixture.scrollDown(true)160 expect(fixture.getClassName()).toBe(animationClass.down)161 })162 })163 ...

Full Screen

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Run pyatom 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