You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5 KiB

8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <script type="text/javascript" src="../internal.js"></script>
  6. <style type="text/css">
  7. .section {
  8. text-align: center;
  9. margin-top: 10px;
  10. }
  11. .section input {
  12. margin-left: 5px;
  13. width: 70px;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <div class="section">
  19. <span><var id="lang_tdBkColor"></var></span>
  20. <input type="text" id="J_tone"/>
  21. </div>
  22. <script type="text/javascript">
  23. var tone = $G("J_tone"),
  24. colorPiker = new UE.ui.ColorPicker({
  25. editor:editor
  26. }),
  27. colorPop = new UE.ui.Popup({
  28. editor:editor,
  29. content:colorPiker
  30. });
  31. domUtils.on(tone, "click", function () {
  32. colorPop.showAnchor(tone);
  33. });
  34. domUtils.on(document, 'mousedown', function () {
  35. colorPop.hide();
  36. });
  37. colorPiker.addListener("pickcolor", function () {
  38. tone.value = arguments[1];
  39. colorPop.hide();
  40. });
  41. colorPiker.addListener("picknocolor", function () {
  42. tone.value="";
  43. colorPop.hide();
  44. });
  45. dialog.onok=function(){
  46. editor.execCommand("edittd",tone.value);
  47. };
  48. var start = editor.selection.getStart(),
  49. cell = start && domUtils.findParentByTagName(start, ["td", "th"], true);
  50. if(cell){
  51. var color = domUtils.getComputedStyle(cell,'background-color');
  52. if(/^#/.test(color)){
  53. tone.value = color
  54. }
  55. }
  56. </script>
  57. </body>
  58. </html>