Jike Enhanced

即刻网页版增强,支持全局返回和消息跳转,来愉快地刷即刻吧!

  1. // ==UserScript==
  2. // @name Jike Enhanced
  3. // @namespace https://web.okjike.com/
  4. // @version 0.3
  5. // @description 即刻网页版增强,支持全局返回和消息跳转,来愉快地刷即刻吧!
  6. // @author iMaeGoo
  7. // @match https://web.okjike.com/*
  8. // @grant GM_addStyle
  9. // @grant unsafeWindow
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. // 添加返回 btn
  16. function addBackBth () {
  17. const backEl = document.createElement('a')
  18. backEl.classList.add('gm-back-btn')
  19. // backEl.innerText = '<'
  20. backEl.innerHTML = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAPHUlEQVR4Xu2de6wcdRXHz7m3kWjv3hJNd7fRYDQaNdFod7cajUaNRqPRaFS2gkBLSyktLYVCeZaWFsr7/Sqv0tIKtviMRqPR+IpEoTsLGBISAgkJUHYmNZadAST27jGzu7cve3tnZmfm/Gbne/+kv9/5nt/n/D7s3r337jLhCwRAYEoCDDYgAAJTE4AguB0gcAwCEATXAwQgCO4ACEQjgEeQaNywKycEIEhOBo1jRiMAQaJxw66cEIAgORk0jhmNAASJxg27ckIAguRk0DhmNAIQJBo37MoJAQiSk0HjmNEIQJBo3LArJwQgiMKgx8rVE72W9WOFaESGJABBQgIbdPl4qbpLiOpMfFLbbuwctB72J0sAgiTL97Dqk3JM/kcWOaXtNB9OsQVEhSQAQUICi7r8SDkOSsIL2k5je9S62JcsAQiSLN9u9fFS9VEhOnHKKJZFbqu5NYVWEBGSAAQJCSzs8mnlOFhwiWtbD4Stj/XJEoAgCfINIUe3CxFZ6jnN+xJsCaVDEoAgIYEFXR5Wjsm6IrTcc6zNQXOwLlkCECQBvlHlOCAJy0qv1bwzgdZQMiQBCBIS2HTLB5Vjsj4TrWrb1u3T5eHfkyUAQWLkG5ccByXh1W27cUuMLaJUSAIQJCSwqZbHLceBHKELXMe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S5j5Wqn2UpPNd/Mp6yuAjxkGQiOCwLR8EIEg+5oxTRiQAQSKCw7Z8EIAg+ZgzThmRAASJCA7b8kEAguRjzjhlRAIQJCI4bMsHAQiSjznjlBEJQJCI4LAtHwQgSD7mjFNGJABBIoLDtnwQgCD5mDNOGZEABIkIDtvyQeB/LUXUBcGh784AAAAASUVORK5CYII=" style="color:hsl(0, 0%, 25%);width:20px;height:20px"/>'
  21. backEl.onclick = () => { history.back() }
  22. document.body.appendChild(backEl)
  23. }
  24.  
  25. // 拦截请求
  26. function interceptRequest () {
  27. const originFetch = fetch
  28. unsafeWindow.fetch = async (url, request) => {
  29. const response = await originFetch(url, request)
  30. if (url === 'https://web-api.okjike.com/api/graphql') {
  31. // 拦截处理即刻 API
  32. try {
  33. const text = await response.text()
  34. response.text = () => { return new Promise((resolve) => { resolve(text) }) }
  35. const req = JSON.parse(request.body)
  36. const res = JSON.parse(text)
  37. if (req.operationName === 'ListNotification') {
  38. setTimeout(() => { addNotificationLink(res) }, 200)
  39. }
  40. } catch (e) {
  41. console.error(e)
  42. }
  43. }
  44. return response
  45. }
  46. }
  47.  
  48. // 添加通知链接
  49. function addNotificationLink (res) {
  50. const nodes = res.data.viewer.notifications.nodes
  51. const notificationsEl = document.querySelectorAll('[class^="Notification__NotiItemContainer"]')
  52. const startIndex = notificationsEl.length - nodes.length
  53. let index = -1
  54. for (const node of nodes) {
  55. index++
  56. if (node.referenceItem && node.linkUrl) {
  57. let url
  58. if (node.linkType === 'COMMENT') {
  59. const postId = node.linkUrl.substr(node.linkUrl.indexOf('targetId=') + 'targetId='.length, 24)
  60. url = `https://web.okjike.com/originalPost/${postId}`
  61. } else {
  62. url = node.linkUrl.replace('jike://page.jk', 'https://web.okjike.com')
  63. }
  64. const elem = notificationsEl[startIndex + index]
  65. if (elem) {
  66. elem.onclick = () => { location.href = url }
  67. elem.style.cursor = 'pointer'
  68. }
  69. }
  70. }
  71. }
  72.  
  73. GM_addStyle(`
  74. .gm-back-btn {
  75. position: fixed;
  76. z-index: 101;
  77. top: 0;
  78. left: 0;
  79. width: 32px;
  80. height: 32px;
  81. border-radius: 16px;
  82. margin: 12px;
  83. display: flex;
  84. align-items: center;
  85. justify-content: center;
  86. font-weight: bold;
  87. color: rgb(153, 153, 153);
  88. background-color: rgb(242, 245, 248);
  89. cursor: pointer;
  90. }
  91.  
  92. .cDyYuq {
  93. width:300px !important;
  94. }
  95.  
  96. .iFOUyg {
  97. flex: none !important;
  98. }
  99.  
  100. .EdRZd {
  101. padding: 0px 48px !important;
  102. `)
  103.  
  104. addBackBth()
  105. interceptRequest()
  106. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址