aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsD <stoned@derpymail.org>2019-12-19 15:59:55 +0100
committersD <stoned@derpymail.org>2019-12-19 15:59:55 +0100
commitbf15ff1b5df6877c14011ebe7f5ca8b7d4b8f060 (patch)
treedd618de011d21b3b6b729a0a4d481e57767f4612
parentb317fba28af94d433ebd64a2c30a905e8f0e9d10 (diff)
delete bbcode
only supported by the webclient, while the desktop client has similiar features with a different implementation
-rw-r--r--webAO/client.js56
1 files changed, 2 insertions, 54 deletions
diff --git a/webAO/client.js b/webAO/client.js
index 9cf59fb..567eb02 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -331,38 +331,6 @@ class Client extends EventEmitter {
}
/**
- * Create observer to detect BBCode elements
- * then manipulate them.
- */
- initialObservBBCode() {
- const target = document.getElementById("client_inner_chat");
- const observer = new MutationObserver(mutations => {
- mutations.forEach(mutation => {
- const children = mutation.addedNodes;
- if (children !== null) {
- children.forEach(function (node) {
- if (node.tagName === "C") {
- node.style.color = node.getAttribute("a");
- } else if (node.tagName === "M") {
- if (node.hasAttribute("a")) {
- node.style.backgroundColor = node.getAttribute("a");
- } else {
- node.style.backgroundColor = "yellow";
- node.style.color = "black";
- }
- }
- });
- }
- });
- });
- const config = {
- attributes: true,
- childList: true
- };
- observer.observe(target, config);
- }
-
- /**
* Requests to play as a specified character.
* @param {number} character the character ID
*/
@@ -450,7 +418,7 @@ class Client extends EventEmitter {
*/
prepChat(msg) {
// TODO: make this less awful
- return decodeBBCode(unescapeChat(decodeChat(msg)));
+ return unescapeChat(decodeChat(msg));
}
/**
@@ -467,7 +435,7 @@ class Client extends EventEmitter {
name: args[3],
speaking: "(b)" + escape(args[4]),
silent: "(a)" + escape(args[4]),
- content: this.prepChat(args[5]), // Escape HTML tag, Use BBCode Only!
+ content: this.prepChat(args[5]), // Escape HTML tag
side: args[6],
sound: escape(args[7]),
type: args[8],
@@ -2188,25 +2156,6 @@ function decodeChat(estring) {
}
}
-/**
- * Decoding text on client side.
- * @param {string} estring the string to be decoded
- */
-function decodeBBCode(estring) {
- return estring
- .replace(/\\n/g, "<br>") // Newline \n
- .replace(/\[(\/?)b\]/g, "<$1b>") // Bold [b][/b]
- .replace(/\[(\/?)i\]/g, "<$1i>") // Italic [i][/i]
- .replace(/\[(\/?)s\]/g, "<$1del>") // Strikethrough [s][/s]
- .replace(/\[(\/?)u\]/g, "<$1u>") // Underline [u][/u]
- .replace(/\[(\/?)sub\]/g, "<$1sub>") // Subscript [sub][/sub]
- .replace(/\[(\/?)sup\]/g, "<$1sup>") // Superscript [sup][/sup]
- .replace(/\[m=([#a-zA-Z0-9]+)\]/g, "<m a=\"$1\">") // Markup [m=#0ff]
- .replace(/\[(\/?)m\]/g, "<$1m>") // [m][/m]
- .replace(/\[c=?([#a-zA-Z0-9]+)\]/g, "<c a=\"$1\">") // Color [c=red]
- .replace(/\[\/c\]/g, "</c>"); // [/c]
-}
-
//
// Client code
//
@@ -2215,7 +2164,6 @@ let client = new Client(serverIP);
let viewport = new Viewport();
export function onLoad(){
- client.initialObservBBCode();
client.loadResources();
}
window.onLoad = onLoad;