Greasy Fork 支持简体中文。

Hide stackoverflow.com privacy panel

Many websites show panel on the left down corner to ask us to accept cookies. But it will connect google API which is NOT reachable from our country,

目前為 2021-05-10 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Hide stackoverflow.com privacy panel
  3. // @name:zh-CN 隐藏Stackoverflow左下角Cookie固定弹窗
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.2
  6. // @description Many websites show panel on the left down corner to ask us to accept cookies. But it will connect google API which is NOT reachable from our country,
  7. // and the panel will never disappear. This simple script will hide the panel directly without any tips!
  8. // @description:zh-CN 你好
  9. // @author Andy Cui
  10. // @match *://superuser.com/*
  11. // @match *://stackoverflow.com/*
  12. // @require https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js
  13. /* globals jQuery, $, waitForKeyElements */
  14. // @grant none
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. // Your code here...
  21.  
  22.  
  23. // find the div,some conditions
  24. /*
  25. class:
  26. ps-fixed z-nav-fixed
  27.  
  28. z-index:
  29.  
  30. 5050 or other value greater than 1000 ???
  31.  
  32. p content
  33. Your privacy
  34.  
  35. Button
  36.  
  37. Accept all cookies
  38. Customize settings
  39.  
  40. */
  41.  
  42. var panels = $('.ps-fixed.z-nav-fixed')
  43. if (panels.length < 1) return;
  44.  
  45. panels.each(function () {
  46. var panel = $(this)
  47.  
  48. var zindex = panel.css('z-index')
  49. if (zindex < 1000) return;
  50.  
  51.  
  52. // !!! Hide it
  53. panel.css("display", "none")
  54. return;
  55.  
  56. /*
  57. // more conditions ???
  58. const keywords = ["Your privacy",
  59. "accept",
  60. "cookie",
  61. "cookies",
  62. ]
  63. var pArr = panel.children('p')
  64.  
  65. var matchsArr = []
  66. pArr.each(function (){
  67. var p = $(this)
  68. var text = p.text().toLowerCase()
  69. $(keywords).each(function (){
  70. debugger
  71. var aKeyword = this.toLowerCase()
  72. if (text.includes(aKeyword)) {
  73. var pair = [text, aKeyword]
  74. matchsArr.push(pair)
  75. }
  76. })
  77. })
  78. console.log(matchsArr)
  79.  
  80.  
  81. // buttons
  82.  
  83. */
  84.  
  85. })
  86. })();