Minecraft PC IP: play.cubecraft.net

Max ♠

Forum Expert
Feb 20, 2016
1,420
2,940
344
24
North pole
Hi...

I made a little client side script which plays a sound when you receive notifications on the forums,

Code:
// ==UserScript==
// @name Cubecraft Alerts
// @namespace Landviz' script
// @grant none
// @match https://*.cubecraft.net/*
// ==/UserScript==

var refreshTimer = 30;
var notification = new Audio('http://landviz.nl/host/plucky.mp3');
var newAlerts = Number(document.querySelector('#VisitorExtraMenu_AlertsCounter span.Total').innerHTML);
var newConv = Number(document.querySelector('#VisitorExtraMenu_ConversationsCounter span.Total').innerHTML);
var notified;

if(sessionStorage.getItem('alerts') !== null) {
    if( newAlerts > sessionStorage.getItem('alerts') || newConv > sessionStorage.getItem('conv')) {
        notification.play();
    }
}

sessionStorage.setItem('alerts', newAlerts);
sessionStorage.setItem('conv', newConv);

setInterval(function() {
    if(!document.hasFocus()) {
        location.reload();
    }
}, refreshTimer*1000);

How to install
Chrome - Click
Firefox - Click
Opera - Click

As of right now there's no version of ViolentMonkey for Microsoft Edge, there might be a different addon similair to ViolentMonkey, haven't looked for alternatives myself.

The script refreshes your page every 30 seconds unless the tab is focussed, you can change this easily by editing "var refreshTime = 30;", the sound can also be changed by editing the url @ "var notification = new Audio('http://landviz.nl/host/plucky.mp3');" (Keep in mind that some browsers might not support other file formats)

For whoever knows how to use Greasy Fork:
https://greasyfork.org/nl/scripts/32163-cubecraft-alerts
Install link doesnt have the correct link for the sound file, if you don't know how to edit it, just use the videos to install instead
 
Last edited:

Despacito 2

Forum Professional
Dec 6, 2015
7,507
10,289
564
23
You're my hero.
Edit: I do want to customize my sound. Can I do that?
Double edit: Already found my way how to do it.
 
  • Like
Reactions: Max ♠

Max ♠

Forum Expert
Feb 20, 2016
1,420
2,940
344
24
North pole
I'll definitely be using this.
Also: How does one upload an mp3 file to a site like what you did? I've attempted it but it didn't seem to be working.
(I'm also making this post so I can get a notification if someone responds to the thread)
https://www.000webhost.com/

You can host ANY file type here

(It's also possible to use a local file, change the url to C:\whatever\whatever\coolsound.mp3)
 
  • Like
Reactions: Eli and Despacito 2

Max ♠

Forum Expert
Feb 20, 2016
1,420
2,940
344
24
North pole
Cleaned up the code a bit, added support for conversations. Installment is the same, just edit the existing file instead of creating a new one if you're already using the old script & want to update
 

Max ♠

Forum Expert
Feb 20, 2016
1,420
2,940
344
24
North pole

Max ♠

Forum Expert
Feb 20, 2016
1,420
2,940
344
24
North pole
What about the lovely Safari users? :c
Uhh.. I can't really install safari on a windows machine to try... (a version from the past 3 years at least)

With a browser which supposedly mimics Safari I couldnt find an add-on for userscripts, couldnt find a video on how to use userscripts with Safari either. Try looking for "userscripts" in the add-ons, pretty much any add-on which allows says "Customize web browsing with custom scripts" or something along those lines would probably work. Installing the script shouldnt be much different.
 
I

iDontPlayMinecraft.exe

Guest
Would be cool if you could do this for Discord, nonetheless this is pretty cool, Ill edit the script for ait to fit a different minecraft forum.
 
Members Online

Latest posts

Latest profile posts

Malek_kh wrote on CrystalLegend01's profile.
Happy birthday!! 🎉
Malek_kh wrote on privqted's profile.
Happy birthday!! 🎉
This is YOUR daily dose of facts #65-
Canada has the longest coastline of any country in the world, stretching over 202,080 kilometers (125,570 miles).
At this point, facts are becoming harder and harder to find.
Thunder wrote on privqted's profile.
Happy birthday!
Mintypie231 wrote on CrystalLegend01's profile.
Happy birthday! ✨🎂
Top Bottom