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,

  1. // ==UserScript==
  2. // @name Hide stackoverflow.com privacy panel
  3. // @name:zh-CN 隐藏Stackoverflow左下角Cookie固定弹窗
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.5
  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. // @match *://askubuntu.com/*
  13. // @match *://serverfault.com/*
  14. // @match *://*.stackexchange.com/*
  15.  
  16. // @require https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js
  17. /* globals jQuery, $, waitForKeyElements */
  18. // @grant none
  19. // ==/UserScript==
  20.  
  21. (function() {
  22. 'use strict';
  23.  
  24. // Your code here...
  25.  
  26.  
  27. // find the div,some conditions
  28. /*
  29. class:
  30. ps-fixed z-nav-fixed
  31.  
  32. z-index:
  33.  
  34. 5050 or other value greater than 1000 ???
  35.  
  36. p content
  37. Your privacy
  38.  
  39. Button
  40.  
  41. Accept all cookies
  42. Customize settings
  43.  
  44. */
  45.  
  46. var panels = $('.ps-fixed.z-nav-fixed')
  47. if (panels.length < 1) return;
  48.  
  49. panels.each(function () {
  50. var panel = $(this)
  51.  
  52. var zindex = panel.css('z-index')
  53. if (zindex < 1000) return;
  54.  
  55.  
  56. // !!! Hide it
  57. panel.css("display", "none")
  58. return;
  59.  
  60. /*
  61. // more conditions ???
  62. const keywords = ["Your privacy",
  63. "accept",
  64. "cookie",
  65. "cookies",
  66. ]
  67. var pArr = panel.children('p')
  68.  
  69. var matchsArr = []
  70. pArr.each(function (){
  71. var p = $(this)
  72. var text = p.text().toLowerCase()
  73. $(keywords).each(function (){
  74. debugger
  75. var aKeyword = this.toLowerCase()
  76. if (text.includes(aKeyword)) {
  77. var pair = [text, aKeyword]
  78. matchsArr.push(pair)
  79. }
  80. })
  81. })
  82. console.log(matchsArr)
  83.  
  84.  
  85. // buttons
  86.  
  87. */
  88.  
  89. })
  90. })();