dictionary.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @fileoverview
  3. * 영어 사전 팝업을 띄워 주는 '사전' Icon을 위해 필요한 source, configuration과 Class Trex.Tool.Dictionary을/를 포함
  4. *
  5. */
  6. TrexConfig.addTool(
  7. "dictionary",
  8. {
  9. url: 'http://engdic.daum.net/dicen/small_view_top.do',
  10. sync: _FALSE,
  11. status: _FALSE
  12. }
  13. );
  14. Trex.Tool.Dictionary = Trex.Class.create({
  15. $const: {
  16. __Identity: 'dictionary'
  17. },
  18. $extend: Trex.Tool,
  19. oninitialized: function(config) {
  20. var _canvas = this.canvas;
  21. var _toolHandler = function() {
  22. var _word = _canvas.query(function(processor) {
  23. return encodeURI(processor.getText());
  24. });
  25. var _popupUrl = (_word.length > 0) ? "http://engdic.daum.net/dicen/small_search.do" : config.url;
  26. var _dicWin = _WIN.open(_popupUrl + '?q=' + _word, 'dicWin', 'width=410,height=550,scrollbars=yes');
  27. _dicWin.focus();
  28. };
  29. /* button & menu weave */
  30. this.weave.bind(this)(
  31. /* button */
  32. new Trex.Button(this.buttonCfg),
  33. /* menu */
  34. _NULL,
  35. /* handler */
  36. _toolHandler
  37. );
  38. }
  39. });