not really known
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.

158 lines
9.2 KiB

  1. /* This file is generated, do not edit directly */
  2. riot.tag2('tool-bar', '<div id="main-toolbar" class="toolbar"> <button class="toolbutton" id="activity-button" title="Jappy Activity"></button> <hr> <button class="toolbutton" id="example-button" title="Load an example" ref="examplebutton"></button> <hr> <button class="toolbutton {colored: window.state!=\'run\'}" id="run-button" title="Execute" ref="runbutton"></button> <button class="toolbutton {colored: window.state==\'run\'}" id="break-button" title="Break execution" ref="breakbutton"></button> <button class="toolbutton {colored: window.state!=\'clean\'}" id="erase-button" title="Clear the canvas" ref="erasebutton"></button> <button class="toolbutton {hidden: window.state==\'run\'}" id="start-button" title="Start fullscreen" ref="startbutton"></button> <button class="toolbutton {hidden: window.state==\'stopped\'} {hidden: window.state==\'clean\'}" id="full-button" title="View fullscreen" ref="fullbutton"></button> <button class="toolbutton" id="export-button" title="Export or publish" ref="exportbutton"></button> <button class="toolbutton pull-right" id="stop-button" title="Stop" ref="stopbutton"></button> </div>', 'tool-bar #main-toolbar #run-button,[data-is="tool-bar"] #main-toolbar #run-button{ background-image: url(icons/run_bw.svg); } tool-bar #main-toolbar #run-button.colored,[data-is="tool-bar"] #main-toolbar #run-button.colored{ background-image: url(icons/run_color.svg); } tool-bar #main-toolbar #break-button,[data-is="tool-bar"] #main-toolbar #break-button{ background-image: url(icons/stopit_bw.svg); } tool-bar #main-toolbar #break-button.colored,[data-is="tool-bar"] #main-toolbar #break-button.colored{ background-image: url(icons/stopit_color.svg); } tool-bar #main-toolbar #erase-button,[data-is="tool-bar"] #main-toolbar #erase-button{ background-image: url(icons/eraser_bw.svg); } tool-bar #main-toolbar #erase-button.colored,[data-is="tool-bar"] #main-toolbar #erase-button.colored{ background-image: url(icons/eraser_color.svg); } tool-bar #main-toolbar #example-button,[data-is="tool-bar"] #main-toolbar #example-button{ background-image: url(icons/load-example.svg); } tool-bar #main-toolbar #start-button,[data-is="tool-bar"] #main-toolbar #start-button{ background-image: url(icons/activity-start.svg); } tool-bar #main-toolbar #full-button,[data-is="tool-bar"] #main-toolbar #full-button{ background-image: url(icons/view-fullscreen.svg); } tool-bar #main-toolbar #export-button,[data-is="tool-bar"] #main-toolbar #export-button{ background-image: url(icons/export-or-publish.svg); } tool-bar .hidden,[data-is="tool-bar"] .hidden{ display: none !important; }', '', function(opts) {
  3. var tag, examples;
  4. tag = this;
  5. examples = ρσ_list_decorate([ "welcome.pyj", "memorize.pyj", "mandala.pyj", "input.pyj", "repl.pyj", "unicode.pyj" ]);
  6. window.state = "clean";
  7. function init() {
  8. this.refs.runbutton.onclick = function () {
  9. window.state = "run";
  10. tag.update();
  11. event_bus.trigger("run-code");
  12. };
  13. this.refs.startbutton.onclick = function () {
  14. window.state = "run";
  15. tag.update();
  16. event_bus.trigger("run-fullscreen");
  17. };
  18. this.refs.fullbutton.onclick = function () {
  19. window.state = "run";
  20. tag.update();
  21. event_bus.trigger("run-fullscreen", false);
  22. };
  23. this.refs.breakbutton.onclick = function () {
  24. window.state = "stopped";
  25. tag.update();
  26. event_bus.trigger("break-code");
  27. };
  28. this.refs.erasebutton.onclick = function () {
  29. window.state = "clean";
  30. event_bus.trigger("clear-output");
  31. event_bus.trigger("traybutton-close", false);
  32. tag.update();
  33. };
  34. function activity_ready(activity) {
  35. tag.refs.stopbutton.onclick = function () {
  36. event_bus.trigger("activity-save", activity);
  37. };
  38. };
  39. if (!activity_ready.__argnames__) Object.defineProperties(activity_ready, {
  40. __argnames__ : {value: ["activity"]}
  41. });
  42. event_bus.on("activity-ready", activity_ready);
  43. function enable_standalone() {
  44. tag.refs.stopbutton.onclick = function () {
  45. var base_url;
  46. event_bus.trigger("activity-save", activity);
  47. base_url = window.location.protocol + "//" + window.location.host + "/";
  48. window.location = base_url + "shutdown";
  49. };
  50. };
  51. event_bus.on("enable-standalone", enable_standalone);
  52. requirejs(ρσ_list_decorate([ "sugar-web/graphics/palette" ]), (function() {
  53. var ρσ_anonfunc = function (palette) {
  54. var items, row, item, span, text, i;
  55. tag.example_palette = new palette.Palette(tag.refs.examplebutton, "Load an example");
  56. items = ρσ_list_decorate([]);
  57. var ρσ_Iter0 = ρσ_Iterable(examples);
  58. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  59. i = ρσ_Iter0[ρσ_Index0];
  60. row = document.createElement("div");
  61. row.classList.add("menu");
  62. item = document.createElement("button");
  63. item.classList.add("icon");
  64. span = document.createElement("span");
  65. span.classList.add("pyj");
  66. text = document.createTextNode(i);
  67. item.appendChild(span);
  68. item.appendChild(text);
  69. function trigger_load(el) {
  70. return function () {
  71. tag.example_palette.popDown();
  72. event_bus.trigger("example-load", el);
  73. };
  74. };
  75. if (!trigger_load.__argnames__) Object.defineProperties(trigger_load, {
  76. __argnames__ : {value: ["el"]}
  77. });
  78. item.onclick = trigger_load(i);
  79. row.appendChild(item);
  80. items.append(row);
  81. }
  82. tag.example_palette.setContent(items);
  83. tag.export_palette = new palette.Palette(tag.refs.exportbutton, "Export");
  84. function as_zip() {
  85. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  86. as_zip.prototype.__init__.apply(this, arguments);
  87. }
  88. as_zip.prototype.__init__ = function __init__ () {
  89. };
  90. as_zip.prototype.__repr__ = function __repr__ () {
  91. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  92. };
  93. as_zip.prototype.__str__ = function __str__ () {
  94. return this.__repr__();
  95. };
  96. Object.defineProperty(as_zip.prototype, "__bases__", {value: []});
  97. as_zip.prototype.label = "Export as zipped HTML";
  98. as_zip.prototype.icon = "html";
  99. as_zip.prototype.trigger = "save-as-zip";
  100. function import_file() {
  101. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  102. import_file.prototype.__init__.apply(this, arguments);
  103. }
  104. import_file.prototype.__init__ = function __init__ () {
  105. };
  106. import_file.prototype.__repr__ = function __repr__ () {
  107. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  108. };
  109. import_file.prototype.__str__ = function __str__ () {
  110. return this.__repr__();
  111. };
  112. Object.defineProperty(import_file.prototype, "__bases__", {value: []});
  113. import_file.prototype.label = "Import";
  114. import_file.prototype.icon = "zip";
  115. import_file.prototype.trigger = "import-file";
  116. items = ρσ_list_decorate([]);
  117. var ρσ_Iter1 = ρσ_Iterable(ρσ_list_decorate([ new as_zip, new import_file ]));
  118. for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
  119. i = ρσ_Iter1[ρσ_Index1];
  120. row = document.createElement("div");
  121. row.classList.add("menu");
  122. item = document.createElement("button");
  123. item.classList.add("icon");
  124. span = document.createElement("span");
  125. span.classList.add(i.icon);
  126. text = document.createTextNode(i.label);
  127. item.appendChild(span);
  128. item.appendChild(text);
  129. function trigger_export(event) {
  130. return function () {
  131. tag.export_palette.popDown();
  132. event_bus.trigger(event);
  133. };
  134. };
  135. if (!trigger_export.__argnames__) Object.defineProperties(trigger_export, {
  136. __argnames__ : {value: ["event"]}
  137. });
  138. item.onclick = trigger_export(i.trigger);
  139. row.appendChild(item);
  140. items.append(row);
  141. }
  142. tag.export_palette.setContent(items);
  143. };
  144. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  145. __argnames__ : {value: ["palette"]}
  146. });
  147. return ρσ_anonfunc;
  148. })());
  149. };
  150. this.on("mount", init);
  151. });