forked from Code0010110ai/tampermonkey-patreon-post-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCode0010110ai
34 lines (27 loc) · 875 Bytes
/
Code0010110ai
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
// ==UserScript==
// @name Free Patreon Posts
// @description Automatically shows any Patreon post for free.
// @match *://*.patreon.com/*
// @grant none
// @version 1.0.0
// ==/UserScript==
// Find 'lock' content control
let lockContentCtrl = document.querySelectorAll('[data-testid="post-lock-control"]');
// If found
if (lockContentCtrl.length > 0) {
// Iterate over locks
lockContentCtrl.forEach(function (lock) {
// Get the unlock button
let unlockBtn = lock.querySelector('button');
// If there's an unlock button
if (unlockBtn !== null) {
// Set a click event
unlockBtn.addEventListener('click', function () {
let event = new Event('mousedown');
this.dispatchEvent(event);
});
// Simulate a click
unlockBtn.click();
}
});
}