/** * Author: TsaiKoga * Comment: These code are used to convert the image tags and other tags into marks. * Tags: Bold ([bold][-bold] => ) * Itablic ([italic][-italic] => ) * Emotions ([smile] => ) * FontColor ([color:#FFFFFF][-color] => ) */ function convertTagToMark(str) { var emotions = [ "smile", "despressed", "like", "dull", "proud", "cry", "shy", "shut_up", "nap", "big_cry", "awkward_red", "angry", "naughty", "snag", "surprise", "bad", "cool", "awkward", "scream", "vomit", "giggle", "lovely", "who_cares", "zhuai", "hungry", "sleepy", "scared", "sweat", "simper", "solider", "strive", "shout", "questionaire", "hiss", "dizzy", "impantient", "be_bombed", "skull", "hit_head", "bye" ]; var s = ""; if (str.length == 0) return ""; s = str.replace(//g, "[bold]"); s = s.replace(/<\/b>/g, "[-bold]"); s = s.replace(//g, "[italic]"); s = s.replace(/<\/i>/g, "[-italic]"); s = s.replace(/()/g, function(m, p1, p2, p3) { return "[color:"+ p2 +"]"; }); s = s.replace(/<\/span>/g, "[-color]"); s = s.replace(/()/g, function(m, p1, p2, p3) { return "[" + emotions[p2] + "]"; }); return s; }