diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.js index dfde1aa46..605070b41 100644 --- a/modules/UI/side_pannels/chat/Chat.js +++ b/modules/UI/side_pannels/chat/Chat.js @@ -8,7 +8,7 @@ import VideoLayout from "../../videolayout/VideoLayout"; import UIUtil from '../../util/UIUtil'; import UIEvents from '../../../../service/UI/UIEvents'; -var smileys = require("./smileys.json").smileys; +import { smileys } from './smileys'; var unreadMessages = 0; diff --git a/modules/UI/side_pannels/chat/Replacement.js b/modules/UI/side_pannels/chat/Replacement.js index 6d6d3d071..a4b00559a 100644 --- a/modules/UI/side_pannels/chat/Replacement.js +++ b/modules/UI/side_pannels/chat/Replacement.js @@ -1,5 +1,5 @@ /* jshint -W101 */ -var Smileys = require("./smileys.json"); +import { regexes } from './smileys'; /** * Processes links and smileys in "body" @@ -29,7 +29,7 @@ export function linkify(inputText) { replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim; replacedText = replacedText.replace(replacePattern2, '$1$2'); - //Change email addresses to mailto:: links. + //Change email addresses to mailto: links. replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim; replacedText = replacedText.replace(replacePattern3, '$1'); @@ -44,10 +44,9 @@ function smilify(body) { return body; } - var regexs = Smileys.regexs; - for(var smiley in regexs) { - if(regexs.hasOwnProperty(smiley)) { - body = body.replace(regexs[smiley], + for(var smiley in regexes) { + if(regexes.hasOwnProperty(smiley)) { + body = body.replace(regexes[smiley], ''); } } diff --git a/modules/UI/side_pannels/chat/smileys.js b/modules/UI/side_pannels/chat/smileys.js new file mode 100644 index 000000000..0a52e43ac --- /dev/null +++ b/modules/UI/side_pannels/chat/smileys.js @@ -0,0 +1,47 @@ +export const smileys = { + smiley1: ":)", + smiley2: ":(", + smiley3: ":D", + smiley4: "(y)", + smiley5: " :P", + smiley6: "(wave)", + smiley7: "(blush)", + smiley8: "(chuckle)", + smiley9: "(shocked)", + smiley10: ":*", + smiley11: "(n)", + smiley12: "(search)", + smiley13: " <3", + smiley14: "(oops)", + smiley15: "(angry)", + smiley16: "(angel)", + smiley17: "(sick)", + smiley18: ";(", + smiley19: "(bomb)", + smiley20: "(clap)", + smiley21: " ;)" +}; + +export const regexes = { + smiley2: /(:-\(\(|:-\(|:\(\(|:\(|\(sad\))/gi, + smiley3: /(:-\)\)|:\)\)|\(lol\)|:-D|:D)/gi, + smiley1: /(:-\)|:\))/gi, + smiley4: /(\(y\)|\(Y\)|\(ok\))/gi, + smiley5: /(:-P|:P|:-p|:p)/gi, + smiley6: /(\(wave\))/gi, + smiley7: /(\(blush\))/gi, + smiley8: /(\(chuckle\))/gi, + smiley9: /(:-0|\(shocked\))/gi, + smiley10: /(:-\*|:\*|\(kiss\))/gi, + smiley11: /(\(n\))/gi, + smiley12: /(\(search\))/g, + smiley13: /(<3|<3|&lt;3|\(L\)|\(l\)|\(H\)|\(h\))/gi, + smiley14: /(\(oops\))/gi, + smiley15: /(\(angry\))/gi, + smiley16: /(\(angel\))/gi, + smiley17: /(\(sick\))/gi, + smiley18: /(;-\(\(|;\(\(|;-\(|;\(|:"\(|:"-\(|:~-\(|:~\(|\(upset\))/gi, + smiley19: /(\(bomb\))/gi, + smiley20: /(\(clap\))/gi, + smiley21: /(;-\)|;\)|;-\)\)|;\)\)|;-D|;D|\(wink\))/gi +}; diff --git a/modules/UI/side_pannels/chat/smileys.json b/modules/UI/side_pannels/chat/smileys.json deleted file mode 100644 index 60a8201d9..000000000 --- a/modules/UI/side_pannels/chat/smileys.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "smileys": { - "smiley1": ":)", - "smiley2": ":(", - "smiley3": ":D", - "smiley4": "(y)", - "smiley5": " :P", - "smiley6": "(wave)", - "smiley7": "(blush)", - "smiley8": "(chuckle)", - "smiley9": "(shocked)", - "smiley10": ":*", - "smiley11": "(n)", - "smiley12": "(search)", - "smiley13": " <3", - "smiley14": "(oops)", - "smiley15": "(angry)", - "smiley16": "(angel)", - "smiley17": "(sick)", - "smiley18": ";(", - "smiley19": "(bomb)", - "smiley20": "(clap)", - "smiley21": " ;)" - }, - "regexs": { - "smiley2": /(:-\(\(|:-\(|:\(\(|:\(|\(sad\))/gi, - "smiley3": /(:-\)\)|:\)\)|\(lol\)|:-D|:D)/gi, - "smiley1": /(:-\)|:\))/gi, - "smiley4": /(\(y\)|\(Y\)|\(ok\))/gi, - "smiley5": /(:-P|:P|:-p|:p)/gi, - "smiley6": /(\(wave\))/gi, - "smiley7": /(\(blush\))/gi, - "smiley8": /(\(chuckle\))/gi, - "smiley9": /(:-0|\(shocked\))/gi, - "smiley10": /(:-\*|:\*|\(kiss\))/gi, - "smiley11": /(\(n\))/gi, - "smiley12": /(\(search\))/g, - "smiley13": /(<3|<3|&lt;3|\(L\)|\(l\)|\(H\)|\(h\))/gi, - "smiley14": /(\(oops\))/gi, - "smiley15": /(\(angry\))/gi, - "smiley16": /(\(angel\))/gi, - "smiley17": /(\(sick\))/gi, - "smiley18": /(;-\(\(|;\(\(|;-\(|;\(|:"\(|:"-\(|:~-\(|:~\(|\(upset\))/gi, - "smiley19": /(\(bomb\))/gi, - "smiley20": /(\(clap\))/gi, - "smiley21": /(;-\)|;\)|;-\)\)|;\)\)|;-D|;D|\(wink\))/gi - } -}