Greasy Fork is available in English.

拒绝二维码登录(淘宝、京东等网站默认出现账号密码登录界面)

淘宝、京东、阿里云等网站默认使用账号密码登录,不出现二维码登录界面

< Feedback on 拒绝二维码登录(淘宝、京东等网站默认出现账号密码登录界面)

Question/comment

§
Posted: 2017.12.25.
Edited: 2017.12.25.

自己写的一段支付宝默认账号密码登录的代码,匹配auth.alipay.com和www.alipay.com


// @match        *://auth.alipay.com/*
// @match        *://www.alipay.com/*

function isNull(v)
{
    return (v === undefined) || (v === null);
}


if (location.hostname === 'www.alipay.com') {
    // 移除video
    var video = document.getElementById('J_video_player');
    video.parentNode.removeChild(video);
    var poster = document.getElementById('J_poster');
    poster.parentNode.removeChild(poster);
    var auto = setInterval(function() {
        // 条件:用户点了登录按钮
        var popbox = document.getElementsByClassName('popbox stat-login');
        if (popbox.length !== 0)
        {
            // 获取嵌套的iframe
            var iframe = document.getElementById('J_loginIframe');
            if(!isNull(iframe))
            {
                var contentWindow = iframe.contentWindow;
                if(!isNull(contentWindow))
                {
                    var loginMethod = contentWindow.document.getElementById('J-loginFormMethod');
                    if(!isNull(loginMethod))
                    {
                        contentWindow.document.getElementById('J-qrcode-target').click();
                        clearInterval(auto);
                    }
                }
            }
        }
    }, 50);
}


if (location.hostname === 'auth.alipay.com') {
   var pathname = location.pathname;
   if (pathname === '/login/express.htm')
   {
       var auto = setInterval(function() {
           var loginMethod = document.getElementById('J-loginFormMethod');
           if(!isNull(loginMethod))
           {
               var style = window.getComputedStyle(loginMethod);
               if (!isNull(style) && isNull(style.value)) {
                   var qrcode = document.getElementById('J-qrcode-target');
                   if (!isNull(qrcode))
                   {
                       qrcode.click();
                       clearInterval(auto);
                   }
               }
           }
       }, 50);
   }
   else if (pathname === '/login/index.htm')
   {
       // 显示账密登录
       var loginForm = document.getElementById('J-login');
       if(!isNull(loginForm))
       {
           loginForm.setAttribute('class', 'login login-modern');
       }
       // 隐藏扫码登录
       var qrCodeForm = document.getElementById('J-qrcode');
       if(!isNull(qrCodeForm))
       {
           qrCodeForm.setAttribute('class', 'qrcode qrcode-modern  fn-hide');
       }
   }
}
§
Posted: 2018.01.02.

好用,加在作者的脚本里就可以用了,谢谢!

§
Posted: 2018.05.12.

感谢贡献,已加入脚本

Post reply

Sign in to post a reply.