Minecraft PC IP: play.cubecraft.net

NoahvdAa

Member
May 31, 2019
22
49
14
Are you lazy? Do you want to save some time while browsing the forums? Well, look no further, you've found the right user script for you!

The CubeCraft Forums Auto Filler saves you some time by giving you a neat little dropdown to select whatever pre-set message you want to use!
Screenshot:
Schermafbeelding 2019-07-17 om 19.31.15.jpg


Now you may ask, how do I get this? Glad you asked!

1) Install the TamperMonkey browser extension (or GreaseMonkey if you like it more)
2) Go to the scripts manager of the user script manager of your choice.
3) Create a new script and remove its contents.
4) Copy paste this code into the code field (don't click save yet!):
Code:
// ==UserScript==
// @name         CubecraftAutoFill
// @namespace    https://www.cubecraft.net/threads/cubecraft-forums-auto-filler.219921/
// @version      1.1.3
// @description  Reply with pre-set messages on the CubeCraft forums.
// @author       NoahvdAa
// @match        https://www.cubecraft.net/threads/*
// @grant        none
// ==/UserScript==

// ⬇⬇⬇⬇⬇ REMOVE THIS LINE, THEN PASTE CONFIG HERE ⬇⬇⬇⬇⬇
var XFPMOptions = {"Simple Example":"Example 1 :)","Example BBCode":"[b]BBCode[/b] is supported.","Example Spacer":"disabled","Link Example":"[URL='http://example.com']example link[/URL]"};

(function() {
    'use strict';

    $(function(){
        var html = '<select onchange="setMessage(this.value);"><option value="_empty_">Custom Message</option><option disabled>__________</option>';
        Object.keys(XFPMOptions).forEach(option=>{
            html += '<option value="'+option+'" '+(function(){if(XFPMOptions[option] == 'disabled') return 'disabled'; else return '';})()+'>'+option+'</option>';
        });
        document.getElementsByClassName("draftUpdate")[0].parentElement.innerHTML += html+'</select>';
    });
})();

window.setMessage = function(option){
    var valueToSet = '';
    if(typeof(XFPMOptions[option]) == 'string') valueToSet = XFPMOptions[option];
    $(".redactor_btn_container_switchmode").children()[0].click();
    setTimeout(function(){$(".bbCodeEditorContainer>textarea").val(valueToSet);},500);
    setTimeout(function(){$(".bbCodeEditorContainer>div>a").click();},1500);

}
5) Now, open this tool in a new tab: XenForoPresetMessages Config Generator.
Name: Pretty straightforward
BBCode: The BBCode you want to fill with. (Page icon with a wrench next to it)
Disabled: When this is enabled the item will work as a spacer and cannot be clicked. (BBCode won't matter for this item)
6) Make your custom items.
7) Press the GENERATE CONFIG button and copy the text that starts with var XFPMOptions = {.
8) Now replace the line below // ⬇⬇⬇⬇⬇ REMOVE THIS LINE, THEN PASTE CONFIG HERE ⬇⬇⬇⬇⬇ with the config you just copied.
9) Save the user script.

Now, you may ask: What could I use this for?
The answer is very simple: Whatever you like (as long as it's allowed by the rules)! You can use it to quickly reply with a message about 1.13 and 1.14 being buggy, you could inform someone about a certain rule, the possibilities are endless!

If you want to use this on a different forum, go to my XenForoPresetMessages Github page and follow the instructions there.

I'd like to hear your opinion about this!

- Noah
 
Top Bottom