? SmileBASIC Source Javascript Editor

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Editor

WARNING! COPYING OTHER PEOPLE'S SCRIPTS IS VERY DANGEROUS! They can easily steal your password. Please use caution and inspect the scripts before using them. If you don't know that a script is safe, don't use it!

If you mess up:

Sometimes, you might get to the point where your custom script or styling stops you from being able to use the editor. Don't worry, you're not stuck! Use these to disable custom scripts and custom styling:

Add nositeJS=1 to the URL query string to disable siteJS for that page. For instance, if you need to load the siteJS editor without your custom scripts, use the link: /editor?type=site&nositeJS=1

Add nositeColor=1 to the URL query string to disable custom colors for that page. For instance, if you need to load the siteColor editor without your custom styling, use the link: /editor?type=color&nositeColor=1

A community plugin manager: http://sbs-plugin-system.github.io

Add a simple command:

commands.push(new Command("time", function() { var date = new Date(); systemMessage(date.toLocaleString()); }));

Add a command with a parameter:

commands.push(new Command("rnd", function(param) { //The "param" is just a big string of all the parameters. //Use this function to split it based on spaces. var params = quickParamParse(param); if(params.length !== 1) { warningMessage("You're using it wrong! Example: /rnd 10"); return; } //Note: You cannot pass just a number to the systemMessage function. It must be a string systemMessage("Random: " + (Math.floor(Math.random() * Number(params[0])) + 1)); }));

Send Message:

commands.push(new Command("lenny", function() { sendMessage("( ͡° ͜ʖ ͡°)"); }));

React To Incoming Message:

addMessageEvent(function(messageElement) { var messageContent = messageElement.querySelector("message-part"); if(messageContent) console.log("Got message: " + messageContent.innerHTML); });

React To Submitted Message:

//Allows you to perform actions just before a message is submitted onSubmitMessage.events.push(function(messageBox) { //Here we perform a general substitution on the whole texbox text. messageBox.value = messageBox.value.replace(/\(lenny\)/g, "( ͡° ͜ʖ ͡°)"); //If you return TRUE from a submit event, the chat will not submit the message. //This is because TRUE means you've "handled" the message yourself. //This is not the case here, so we still want the chat to do its magic. });

Download Stuff from the Internets:

commands.push(new Command("myJS", function() { //Replace "/query/chatJS" with your URL genericXHRSimple("/query/chatJS", function(output) { systemMessage(output); }); }));

Store and load variables on the server (persistent storage):

//How to store a variable writePersistent("yourVariableName", "yourVariableValue"); //How to read a variable (asynchronous only) readPersistent("yourVariableName", function(value) { //Do something with your value here. alert(value); }); //The problem is that reading is asynchronous, and there's no way to change this. //You will not be able to get your value immediately, so instead you pass in a function //which knows what to do with your value when it's finished. This makes programming //around reading persistent storage more complex, so it's best to do it only once. //If you're having trouble with this, look into javascript events. The function //you're passing in will be called when the readPersistent "event" is complete.

Example color file (the blue theme)

Use this code as a template for your color theme. This is the blue theme template

Server Variable Storage

Enter name to get variable. Enter name and value to store variable.