當(dāng)前位置:
首頁(yè) >
前端技术
> javascript
>内容正文
javascript
autoJS 网易公开课app封装函数
生活随笔
收集整理的這篇文章主要介紹了
autoJS 网易公开课app封装函数
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
收藏下~~
/*** 關(guān)注用戶* @return bool true or false*/ function followUser() {waitForActivity("com.netease.vopen.feature.timeline.ui.UserTimelineActivity");if (id('timeline_profile_care_btn').exists()) {var text = id('timeline_profile_care_btn').findOnce().text();if (text == "關(guān)注") {id('timeline_profile_care_btn').click();log('關(guān)注成功');return true;} else if (text == "已關(guān)注") {log('已關(guān)注');return true;} else {log('關(guān)注失敗');return false;}} else {log("ERROR:未找到控件");return false;} }/*** 獲取用戶性別* @return str gender */ function getUserGender() {if (!requestScreenCapture()) {toast("請(qǐng)求截圖失敗");exit();}waitForActivity("com.netease.vopen.feature.timeline.ui.UserTimelineActivity");if (id('timeline_profile_gender').exists()) {var rect = id('timeline_profile_gender').findOnce().bounds();var img = captureScreen();var point = findColor(img, -622207, {region: [rect.left, rect.top, rect.width(), rect.height()],threshold: 4});if (point) {return "女";} else {var point = findColor(img, -7943189, {region: [rect.left, rect.top, rect.width(), rect.height()],threshold: 4});if (point) {return "男";}};} else {return "未知";} } /*** 獲取用戶昵稱* @return str userName*/ function getUserName() {var userName = '';//等待個(gè)人人資料頁(yè)面出現(xiàn)waitForActivity("com.netease.vopen.feature.timeline.ui.UserTimelineActivity");if (id('mid_title').exists()) {userName = id('mid_title').findOnce().text();} else {log('ERROR:未獲取到用戶昵稱');}return userName; }總結(jié)
以上是生活随笔為你收集整理的autoJS 网易公开课app封装函数的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 阿里云 MVP Tech Show 第2
- 下一篇: 锐龙7 7840U参数 r7 7840U