This repository was archived by the owner on Jan 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTamperMonkeyAutomator.js
More file actions
63 lines (58 loc) · 2.57 KB
/
TamperMonkeyAutomator.js
File metadata and controls
63 lines (58 loc) · 2.57 KB
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
57
58
59
60
61
62
63
// ==UserScript==
// @name AniV
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://old.reddit.com/r/anime/
// @match https://old.reddit.com/user/AutoLovepon
// @match https://youpoll.me/*
// @match https://ssl.reddit.com/api/v1/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com
// @grant GM_addStyle
// @grant GM_openInTab
// @grant window.close
// @require https://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==
(function() {
if(window.location=="https://old.reddit.com/r/anime/"||window.location=="https://old.reddit.com/user/AutoLovepon"){
$(document).on('click', '#siteTable div[data-author="AutoLovepon"] div[data-event-action]', function() {
var dataEventAction = $(this).data('event-action');
// Traverse upwards to find the relevant expando button
var $expandoButton = $(this).closest('.midcol').siblings('.entry').find('.expando-button');
// Click on the expando button and wait for a second
if ($expandoButton.hasClass('collapsed')) {
$expandoButton.click();
}
setTimeout(function() {
if ($expandoButton.hasClass('expanded')) {
// Find the link inside the expanded content and open it in a new tab
var $expando = $expandoButton.parent().siblings('.expando');
var $link = $expando.find('form div div h1 a');
var newTab = GM_openInTab($link.attr('href')+'?'+dataEventAction, '_blank', 'noopener,noreferrer', { active: false });
$expandoButton.click();
}
}, 1000);
});
}
if(window.location.hostname=="youpoll.me"){
if (window.location.pathname.endsWith('r')||window.location.pathname.endsWith("user-voted")) {
window.close();
}
if (!$('.alert.alert-info.status-update').length) {
var $radio;
if(window.location.search=="?downvote"){
$radio = $('.instructions').siblings('.radio').last();
}
else if(window.location.search=="?upvote"){
$radio = $('.instructions').siblings('.radio').first();
}
$radio.find('label').click();
setTimeout(function() {
$('.voting-btn').click();
}, 500);
}
}
if(window.location.hostname=='ssl.reddit.com'){
$('.fancybutton.newbutton.allow').click();}
})();