1
0

idestarter.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. define(["jquery", "mousetrap", "jquery.blockUI"], function ($, mouseTrap) {
  2. var exports = {
  3. html: "<p><em>Esc</em> to escape; <em>Shift Shift Ctrl Shift</em> to show again</p>" +
  4. "<p><button class=\"unblockUI\" onclick=\"require('amber/helpers').globals.Browser._open()\">legacy IDE</button>" +
  5. "<button class=\"unblockUI\" onclick=\"require('amber/helpers').popupHelios()\">Helios IDE</button></p>",
  6. keystroke: "shift shift ctrl shift",
  7. start: function () {
  8. $(document).ready(openMe);
  9. }
  10. };
  11. function openMe() {
  12. $.blockUI({message: exports.html});
  13. $(".unblockUI").on("click", closeMe);
  14. $(document).on("keyup", escapeBinding);
  15. mouseTrap.unbind(exports.keystroke);
  16. }
  17. function closeMe() {
  18. $.unblockUI();
  19. $(".unblockUI").off("click", closeMe);
  20. $(document).off("keyup", escapeBinding);
  21. mouseTrap.bind(exports.keystroke, openMe);
  22. }
  23. function escapeBinding(event) {
  24. if (event.keyCode == 27) { //esc
  25. closeMe();
  26. }
  27. }
  28. return exports;
  29. });