-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathquietly_reject_stackexchange_cookies.user.js
56 lines (53 loc) · 2.15 KB
/
quietly_reject_stackexchange_cookies.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// ==UserScript==
// @name Quietly Reject StackExchange Cookies
// @namespace https://github.com/StaticPH
// @match https://*.stackexchange.com/*
// @match https://askubuntu.com/*
// @match https://mathoverflow.com/*
// @match https://serverfault.com/*
// @match https://stackapps.com/*
// @match https://stackexchange.com/*
// @match https://stackoverflow.com/*
// @match https://superuser.com/*
// @version 1.0
// @createdAt 5/11/2023, 10:15:04 AM
// @author StaticPH
// @description Hide the pesky cookie permission requests on StackExchange sites, which don't actually appear to set even "necessary" cookies until the user responds to the permission prompt. Also hides a few other little things.
// @license MIT
// @updateURL https://raw.githubusercontent.com/StaticPH/Userscripts/master/quietly_reject_stackexchange_cookies.user.js
// @downloadURL https://raw.githubusercontent.com/StaticPH/Userscripts/master/quietly_reject_stackexchange_cookies.user.js
// @homepageURL https://github.com/StaticPH/UserScripts
// @supportURL https://github.com/StaticPH/UserScripts/issues
// @icon https://cdn.sstatic.net/sites/stackexchange/Img/favicon.ico
// @grant GM.addStyle
// @grant GM_addStyle
// @noframes
// @run-at document-end
// ==/UserScript==
(function(){
'use strict';
// Prefer asychronous Greasemonkey4-API GM.addStyle, but allow use of GM_addStyle as a fallback if necessary.
if (typeof GM == 'undefined'){
this.GM = {};
}
if (typeof GM['addStyle'] == 'undefined'){
console.log('GM.addStyle is not defined. Falling back to GM_addStyle Promise.');
GM['addStyle'] = function(...args){
return new Promise((onResolve, onReject) => {
try{ onResolve(GM_addStyle.apply(this, args)); }
catch(err){ onReject(err); }
});
}
}
GM.addStyle(`
/* Hide cookie consent prompt */
.js-consent-banner.z-nav-fixed.ps-fixed {
display: none;
}
/* Hide other random bits and bobs */
.facebook-login.s-btn__icon.s-btn__muted.s-btn.flex--item,
.ps-relative.js-freemium-cta {
display: none;
}
`);
})();