progress.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. define(function(require, exports, module){
  2. function ProgressRuntime() {
  3. var minder = this.minder;
  4. var hotbox = this.hotbox;
  5. var main = hotbox.state('main');
  6. main.button({
  7. position: 'top',
  8. label: '进度',
  9. key: 'G',
  10. next: 'progress',
  11. enable: function() {
  12. return minder.queryCommandState('progress') != -1;
  13. }
  14. });
  15. var progress = hotbox.state('progress');
  16. '012345678'.replace(/./g, function(p) {
  17. progress.button({
  18. position: 'ring',
  19. label: 'G' + p,
  20. key: p,
  21. action: function() {
  22. minder.execCommand('Progress', parseInt(p) + 1);
  23. }
  24. });
  25. });
  26. progress.button({
  27. position: 'center',
  28. label: '移除',
  29. key: 'Del',
  30. action: function() {
  31. minder.execCommand('Progress', 0);
  32. }
  33. });
  34. progress.button({
  35. position: 'top',
  36. label: '返回',
  37. key: 'esc',
  38. next: 'back'
  39. });
  40. }
  41. return module.exports = ProgressRuntime;
  42. });