message.js 956 B

1234567891011121314151617181920212223242526272829303132333435
  1. var TrexMessage = function () {
  2. var __MESSAGES = {};
  3. function decorateIconPath(message) {
  4. return (message.indexOf("#iconpath") > -1) ?
  5. TrexConfig.getIconPath(message) : message;
  6. }
  7. function decorateDecoPath(message) {
  8. return (message.indexOf("#decopath") > -1) ?
  9. TrexConfig.getDecoPath(message) : message;
  10. }
  11. return {
  12. getMsg: function (msgid) {
  13. var message = __MESSAGES[msgid] || "";
  14. return decorateIconPath(decorateDecoPath(message));
  15. },
  16. addMsg: function (messages) {
  17. $tx.deepcopy(__MESSAGES, messages);
  18. },
  19. printAll: function () {
  20. for (var name in __MESSAGES) {
  21. if (__MESSAGES.hasOwnProperty(name)) {
  22. console.log(name + '=' + __MESSAGES[name]);
  23. }
  24. }
  25. }
  26. };
  27. }();
  28. _WIN.TXMSG = TrexMessage.getMsg;
  29. _WIN.TrexMessage = TrexMessage;