微信上运行JavaScript代码

1. 登录微信网页版

2. 选择要聊天的对象

3. F12打开控制台 console 面板

4. 粘贴以下代码

var appElement = document.querySelector('[ng-controller=chatSenderController]')
var $scope = angular.element(appElement).scope()
setInterval(function(){
    var nowLocalTime = new Date()
    var nowTime = nowLocalTime.toLocaleTimeString()
    var s = nowLocalTime.getSeconds()
    var h = nowLocalTime.getHours()
    var m = nowLocalTime.getMinutes()
     var sh = 17 - h
     if(sh >= 0){
        sh = sh+"小时"
     }else{
        sh = ""
     }
     var sm = 60 - m;
     if(sm == "0"){
        sm = ""
     }else{
        sm = sm +"分钟"
     }
     var ss = 60 - s 
     if(ss == "0"){
        ss = ""
     } else {
        ss = ss + "秒"
     }
    // s == "0" // 一分钟一次
        $scope.editAreaCtn = "现在是"+nowTime+"距离五一放假还剩" +sh + sm + ss ;
        $scope.sendTextMessage()
},1000)

5. 回车

setInterval(function(){$('.edit_area').html('发送的文字')
$(".edit_area").trigger($.Event("keydown", { keyCode: 13,ctrlKey: true}))
$('.btn_send').click();},3000)

 

posted @ 2021-12-09 13:36  zhangpanxin  阅读(575)  评论(0编辑  收藏  举报