🏠 Home 

百度第三方登入

把不能使用第三方登入的都改成能使用的


Installer dette script?
  1. // ==UserScript==
  2. // @name 百度第三方登入
  3. // @namespace https://blog.maple3142.net/
  4. // @version 0.1
  5. // @description 把不能使用第三方登入的都改成能使用的
  6. // @author maple3142
  7. // @match *://*.baidu.com/*
  8. // @grant none
  9. // @compatible firefox >=52
  10. // @compatible chrome >=55
  11. // ==/UserScript==
  12. ;(function() {
  13. 'use strict'
  14. const $ = s => document.querySelector(s)
  15. const $el = (tag, after) => {
  16. const el = document.createElement(tag)
  17. if (typeof after === 'function') after(el)
  18. return el
  19. }
  20. const clearChild = el => {
  21. while (el.firstChild) el.removeChild(el.firstChild)
  22. }
  23. if (top === window) {
  24. // normal page login
  25. const lif = $el('iframe', lif => {
  26. lif.src = 'https://passport.baidu.com/v2/login'
  27. lif.style.height = '430px'
  28. lif.style.width = '100%'
  29. lif.style.overflow = 'hidden'
  30. lif.scrolling = 'no'
  31. lif.frameBorder = '0'
  32. })
  33. const id = setInterval(() => {
  34. const lg = $('#passport-login-pop-dialog')
  35. if (!lg) return
  36. if (lg.contains(lif)) return
  37. clearChild(lg)
  38. lg.appendChild(lif)
  39. }, 100)
  40. }
  41. if (location.href === 'https://passport.baidu.com/v2/login' && top !== window) {
  42. // login page in iframe
  43. const it = setInterval(() => {
  44. const lf = $('.login-form')
  45. if (!lf) return
  46. clearInterval(it)
  47. const els = document.body.children
  48. for (const el of els) {
  49. el.style.display = 'none'
  50. }
  51. document.body.appendChild(lf)
  52. lf.style.float = 'none'
  53. lf.style.border = 'none'
  54. lf.style.paddingTop = '0'
  55. $el('h1', h1 => {
  56. h1.textContent = '登入成功後請手動重整'
  57. h1.style.textAlign = 'center'
  58. h1.style.paddingTop = '5px'
  59. document.body.appendChild(h1)
  60. })
  61. }, 100)
  62. }
  63. })()