emoticon.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. (function() {
  2. TrexMessage.addMsg({
  3. '@emoticon.subtitle.person': '사람',
  4. '@emoticon.subtitle.animal': '동식물',
  5. '@emoticon.subtitle.thing': '사물',
  6. '@emoticon.subtitle.etc': '기타'
  7. });
  8. var createEmoticonURLs = function (category, maxNum){
  9. var urls = [];
  10. for (var i = 1; i <= maxNum; i++) {
  11. urls.push('#decopath/emoticon/' + category + '_' + addZeroPadding(i) + '.gif?v=2');
  12. }
  13. return urls;
  14. };
  15. var addZeroPadding = function (number) {
  16. return (number < 10) ? '0' + number : String(number);
  17. };
  18. TrexConfig.addTool("emoticon",
  19. {
  20. sync: _FALSE,
  21. status: _TRUE,
  22. rows: 5,
  23. cols: 7,
  24. matrices: [
  25. {
  26. title: TXMSG("@emoticon.subtitle.person"),
  27. klass: "tx-menu-matrix-per",
  28. options: createEmoticonURLs("per", 29)
  29. },
  30. {
  31. title: TXMSG("@emoticon.subtitle.animal"),
  32. klass: "tx-menu-matrix-ani",
  33. options: createEmoticonURLs("ani", 28)
  34. },
  35. {
  36. title: TXMSG("@emoticon.subtitle.thing"),
  37. klass: "tx-menu-matrix-things",
  38. options: createEmoticonURLs("things", 35),
  39. defaultshow: _TRUE
  40. },
  41. {
  42. title: TXMSG("@emoticon.subtitle.etc"),
  43. klass: "tx-menu-matrix-etc",
  44. options: createEmoticonURLs("etc", 29)
  45. }
  46. ],
  47. asyncUrl: "trex/tool/async/emoticon.js"
  48. },
  49. function(root) {
  50. var emoticonConfig = TrexConfig.getTool("emoticon", root);
  51. emoticonConfig.matrices.each(function (matrix) {
  52. for (var i = 0, len = matrix.options.length; i < len; i++) {
  53. matrix.options[i] = TrexConfig.getDecoPath(matrix.options[i]);
  54. }
  55. });
  56. }
  57. );
  58. Trex.Tool.Emoticon = Trex.Class.create({
  59. $const: {
  60. __Identity: 'emoticon'
  61. },
  62. $extend: Trex.AsyncTool,
  63. oninitialized: function () {
  64. this.weave.bind(this)(
  65. new Trex.Button(this.buttonCfg),
  66. _NULL,
  67. this.onLoadModule // define in Trex.AsyncTool
  68. );
  69. }
  70. });
  71. })();