autox.js嘎嘎牛p的悬浮窗模板

不说废话 直接上代码。

我是自学的,别喷我哈兄弟们!!!

// 日志框是否显示
var rzk = 0
window = floaty.window(
    <horizontal gravity="center_vertical">
        <img id="floaty_icon" src="https://pic4.58cdn.com.cn/nowater/webim/big/n_v2c03cea6fbe3447978a999d5581ec6b69.jpg" w="50" h="50" alpha="1" radius="10" />
        <horizontal id="h_drawer">
            <vertical>
                <img padding="5 5 5 10" id="ui_tt" src="https://pic6.58cdn.com.cn/nowater/webim/big/n_v295958409863045678a469b12384ff3e1.png" w="45" h="45" alpha="1" radius="10" />
                <text text="" h="3" />
                <img padding="5 5 5 10" id="ui_cc" src="https://pic5.58cdn.com.cn/nowater/webim/big/n_v200ac1d3d06f5464d90b35657394c01ff.png" w="45" h="45" alpha="1" radius="10" />
            </vertical>
        </horizontal>
    </horizontal>
);
window.setPosition(50, device.height / 3);
window.h_drawer.visibility = 8;
var x = 0,
    y = 0;
var windowX, windowY;
window.floaty_icon.setOnTouchListener(function (view, event) {
    switch (event.getAction()) {
        case event.ACTION_DOWN:
            x = event.getRawX();
            y = event.getRawY();
            windowX = window.getX();
            windowY = window.getY();
            return true;
        case event.ACTION_MOVE:
            //移动手指时调整悬浮窗位置
            let movexx = windowX + (event.getRawX() - x);
            let moveyy = windowY + (event.getRawY() - y);
            if (movexx < 0 || movexx > device.width) {
                movexx = 0;
            }
            if (moveyy < 0 || moveyy > device.height) {
                moveyy = 0;
            }
            window.setPosition(movexx, moveyy);
            return true;
        case event.ACTION_UP:
            if (Math.abs(event.getRawY() - y) < 5 && Math.abs(event.getRawX() - x) < 5) {
                drawerStatus();
            }
            return true;
    }
    return true;
});

function drawerStatus() {
    if (window.h_drawer.visibility == 8) {
        window.h_drawer.visibility = 0;
    } else {
        window.h_drawer.visibility = 8;
    }
}

// 开始按钮监听
window.ui_tt.on('click', function () {
    // 开始运行
    if (isplay) {
        isplay = 0
        window.ui_tt.attr("src", "https://pic6.58cdn.com.cn/nowater/webim/big/n_v295958409863045678a469b12384ff3e1.png")
        toast("停止运行")
        nn.interrupt()
    } else {
        isplay = 1
        window.ui_tt.attr("src", "https://kefu.cckefu1.com/app/upload/temp/202401_p/09/09_1704776307954143cdbe409a5.png")
        toast("开始运行")
            //运行脚本
            //todo 在这里运行你的脚本
            nn =  threads.start(()=>{
                device.keepScreenOn()
                while(true){
                    log(666666)
                }
            })
        //两秒不点击暂停,则隐藏抽屉
        setTimeout(function () {
            if (isplay) {
                drawerStatus()
            }
        }, 2000)

        //监控运行还是暂停
        var monitoringStatus = setInterval(function () {
            if (!isplay) { //是运行说明暂停了
                nn.interrupt()
                clearInterval(monitoringStatus)
                drawerStatus()
            }
        }, 2000)
    }
});

// 日志按钮监听
window.ui_cc.on('click', function () {
    // 启动日志框
    threads.start(function () {
        // 判断日志狂
        if (rzk) {
            console.hide()
            rzk = 0
        } else {
            console.show(true)
            rzk = 1
        }
    })
})

setInterval(()=>{}, 1000);

  • 14
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值