Last active
April 3, 2016 09:05
-
-
Save Two9A/3f33ee6f6daf6a14c1cc3f18f276dacd to your computer and use it in GitHub Desktop.
Robin filter and vote clock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Robin Autovoter | |
// @namespace http://jerl.im | |
// @version 1.9 | |
// @description Autovotes via text on /r/robin | |
// @author /u/keythkatz | |
// @match https://www.reddit.com/robin* | |
// @grant none | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; | |
function sendMessage(message){ | |
$("#robinSendMessage > input[type='text']").val(message); | |
$("#robinSendMessage > input[type='submit']").click(); | |
} | |
setTimeout(function(){ | |
var participants = $(".robin-room-participant").length; | |
var partiText = ""; | |
if (participants == 200) partiText = 200 + " " + $(".robin-user-list-overflow-indicator").text(); | |
else partiText = participants; | |
sendMessage("/vote grow"); | |
setTimeout(function(){ | |
window.location.reload(); | |
}, 1200000); | |
}, 5000); | |
$('#robinChatMessageList').on('DOMSubtreeModified',function(){ | |
var last = $('#robinChatMessageList > .robin-message:last-child > .robin-message--message'); | |
last[0].innerHTML = last.text().replace(/(https?:[^\s]+)/g,'<a href="$1" target="_blank">$1</a>'); | |
var user = last.siblings('.robin--username'); | |
var colors = { | |
'$': 'rgba(255,0,0,0.2)', | |
'%': 'rgba(0,255,0,0.2)', | |
'*': 'rgba(255,255,0,0.2)', | |
'#': 'rgba(0,0,255,0.2)', | |
'@': 'rgba(0,255,255,0.2)', | |
'&': 'rgba(255,0,255,0.2)' | |
}; | |
for (var k in colors) { | |
if (last.text().startsWith(k)) { | |
last.parent().css({backgroundColor: colors[k]}); | |
break; | |
} | |
} | |
var matches = [ | |
/WE.ARE.ALL.FRANK/, | |
/\[Robin Auto.*?\]/, | |
/\[Robin-Grow\]/, | |
/WARNING.WARNING.WARNING/, | |
/RIP.IN.PEPPERONIS/, | |
/FUCKING.WHITE.MALE/, | |
/CANT.STOP.THIS/, | |
/NIGGER.NIGGER/, | |
/Lets.build.a.ladder/, | |
/leve.tes.lasagnas/, | |
/CHILLARY/, | |
/curvefever/, | |
/^\d+$/, | |
/zoidberg/ | |
]; | |
var usernames = [ | |
/Thomas_K_Brannigan/, | |
/__user/, | |
/Reviken/, | |
/Mj11jM/, | |
/Toddler_Puncher/, | |
/CAN_THRUST_HILLARY/, | |
/Mathemagicland/, | |
/SARAHPALIN/, | |
/ianandthepanda/, | |
/vampirhuahua/, | |
/nynchaligger/, | |
/Tallzebra/, | |
/2Talt/, | |
/kism3/, | |
/SadZr40/, | |
/waxsemantic/, | |
/dojosnail/, | |
/carlostheedwarf/, | |
/sprremix/, | |
/Sebaer/, | |
/FriendlyYak/, | |
/TigerBalmer/, | |
/_ZoeQ/, | |
/TheDishonorableRat/, | |
/FengaPappit/, | |
/janukss/, | |
/epic_maymay/, | |
/AnAngryAntelope/, | |
/bytester/, | |
/TesticleBot/, | |
/Russian-Assassin/, | |
/1CH1B4N/, | |
/pHorniCaiTe/, | |
/exponant/, | |
/PotatoBadger/, | |
/Wolfendeath/, | |
/dremills/, | |
/kory_dc/, | |
/Dynamic_Equilibrium/, | |
/montugar/, | |
/Took2arrows/, | |
/slicshuter/, | |
/bobstooder/, | |
/screamcheese/, | |
/RepoMan/, | |
/TheUndead/, | |
/Shooby_Taylor/, | |
/Sceptile/, | |
/symmathos/, | |
/astralboy/, | |
/yzgncx/, | |
/zynerd/, | |
/KingJongUn/, | |
/VinnyP/, | |
/chrismash/, | |
/properthyme/, | |
/aprilpooz/ | |
]; | |
for (var i = 0; i < matches.length; i++) { | |
if (matches[i].test(last.text())) { | |
last.parent().remove(); | |
break; | |
} | |
} | |
for (var j = 0; j < usernames.length; j++) { | |
if (usernames[j].test(user.text())) { | |
user.parent().remove(); | |
break; | |
} | |
} | |
}); | |
$('header') | |
.css({position:'relative'}) | |
.append('<h2 style="position:absolute;top:1em;right:1em"></h2>'); | |
setInterval(function(){ | |
var lft=((r.config.robin_room_reap_time-(new Date()).getTime())/1000)|0; | |
$('header h2').text(lft<=0? | |
'Voting has ended': | |
('0'+((lft/60)|0)).slice(-2)+':'+('0'+(lft%60)).slice(-2) | |
); | |
},1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment