Page 1 of 1

SleepSnug Scripts for Tampermonkey

Posted: Thu Mar 16, 2023 2:07 am
by eatdasammich
Thanks to deepstate for writing these.

Script to mute snugcoin spam in the chat

Link to pastebin: https://pastebin.com/8UFtZAzr


// ==UserScript==
// @name MuteSnugspam
// @namespace http://tampermonkey.net/
// @version 0.1
// @description mutes snugcoin spam
// @author deepstate
// @match http://cytu.be/r/sleepsnug
// @match https://cytu.be/r/sleepsnug
// @match http://www.cytu.be/r/sleepsnug
// @match https://www.cytu.be/r/sleepsnug
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==

(function() {
'use strict';

var chatbox = document.getElementById("messagebuffer");

setInterval(function(){

var msg_list = chatbox.getElementsByTagName('*');

for (var i = 0; i < msg_list.length; i++) {
if(msg_list.item(i).className.includes("chat-msg-")){
msg_list.item(i).querySelectorAll('span').forEach(curr_span => {
if (curr_span.textContent.startsWith("/snugcoin"))
{
msg_list.item(i).remove();
}
})
}
}

},750);

})();

Re: SleepSnug Scripts for Tampermonkey

Posted: Thu Mar 16, 2023 2:09 am
by eatdasammich
Script to Add Snugcoin Ante button to the home bar

Link to pastebin: https://pastebin.com/3ubYGnGB

// ==UserScript==
// @name Snugcoin Ante
// @namespace http://tampermonkey.net/
// @version 0.1
// @description adds a convenient button for degenerate gamblers
// @author deepstate
// @match http://cytu.be/r/sleepsnug
// @match https://cytu.be/r/sleepsnug
// @match http://www.cytu.be/r/sleepsnug
// @match https://www.cytu.be/r/sleepsnug
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==

(function() {
'use strict';

const chathandle = document.getElementById("chatline");
const enterpress = new KeyboardEvent('keydown', {
bubbles: true, cancelable: true, keyCode: 13
});

const newbutton = document.createElement("li");

const buttontext = document.createElement("a");
buttontext.href = "javascript:void(0)";

buttontext.onclick = function(){
chathandle.value = "/snugcoin ante";

chathandle.dispatchEvent(enterpress);
}

buttontext.appendChild(document.createTextNode("Snugcoin Ante"));

newbutton.appendChild(buttontext);

const list = document.getElementsByClassName("navbar-nav");
list.item(0).appendChild(newbutton);

})();