1 function isEmojiCharacter(substring) { 2 for(var i = 0; i < substring.length; i++) { 3 var hs = substring.charCodeAt(i); 4 if(0xd800 <= hs && hs <= 0xdbff) { 5 if(substring.length > 1) { 6 var ls = substring.charCodeAt(i + 1); 7 var uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000; 8 if(0x1d000 <= uc && uc <= 0x1f77f) { 9 return true; 10 } 11 } 12 } else if(substring.length > 1) { 13 var ls = substring.charCodeAt(i + 1); 14 if(ls == 0x20e3) { 15 return true; 16 } 17 } else { 18 if(0x2100 <= hs && hs <= 0x27ff) { 19 return true; 20 } else if(0x2B05 <= hs && hs <= 0x2b07) { 21 return true; 22 } else if(0x2934 <= hs && hs <= 0x2935) { 23 return true; 24 } else if(0x3297 <= hs && hs <= 0x3299) { 25 return true; 26 } else if(hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 || 27 hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b || 28 hs == 0x2b50) { 29 return true; 30 } 31 } 32 } 33 }