app.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @typedef desktopDBItem
  3. * @type {object}
  4. * @property {string} name - name of the figure
  5. * @property {string} icon - specify an icon relative to SETTINGS_ICONS_LARGE_PATH
  6. * @property {boolean} alias - true if figure is an alias
  7. * @property {string} format - for disk figures Info Window
  8. * @property {string} capacity - for disk figures Info Window
  9. * @property {string} available - for disk figures Info Window
  10. * @property {string} used - for disk figures Info Window
  11. * @property {number} size - size in bytes for Info Window
  12. * @property {string} version - for Info Window
  13. * @property {string} kind - disk/folder/picture/movie/document/download/link/application/trash
  14. * @property {string} url - for picture/document/download/link
  15. * @property {string} infoContents - for trash Info Window
  16. * @property {string} where - for Info Window
  17. * @property {string} created - date for Info Window
  18. * @property {string} modified - date for Info Window
  19. * @property {string} comments - for Info Window
  20. * @property {array} contents - array of other desktopDBItems for folders
  21. * @property {"text"} dataType - "text" if the document needs to be parsed for whitespaces
  22. * @property {"left-nn"} position - put figure on left of desktop in column nn
  23. * @property {number} top - Added during window drag
  24. * @property {number} left - Added during window drag
  25. */
  26. let g_DesktopDB = {};
  27. let g_jScrollPaneSettings = {
  28. showArrows: true,
  29. alwaysShowHScroll: true,
  30. alwaysShowVScroll: true,
  31. verticalArrowPositions: "after",
  32. horizontalArrowPositions: "after",
  33. clickOnTrack: true,
  34. verticalDragMinHeight: 16
  35. };
  36. $(function () {
  37. let appInit = true;
  38. $(".startup").load("startup.html", function () {
  39. let $progressBarMiddle = $(".startup .progress .middle");
  40. let $progressBarRight = $(".startup .progress .right");
  41. $(".startup-dialog").hide();
  42. Actions.wake(function() {
  43. $(".startup-dialog").show();
  44. });
  45. $progressBarMiddle.css("width", "20%");
  46. $(".menubar").load("menubar.html", function () {
  47. $progressBarMiddle.css("width", "40%");
  48. $(".desktop").load("desktop.html", function () {
  49. $progressBarMiddle.css("width", "80%");
  50. if (appInit) {
  51. $.getJSON("json/desktopdb.json").then(function (db) {
  52. g_DesktopDB = db;
  53. generateDesktopDBIDs(g_DesktopDB);
  54. generateWhereStrings(g_DesktopDB, SETTINGS_WHERE_ROOT);
  55. }).then(function () {
  56. $progressBarMiddle.css("width", "85%");
  57. initMenus();
  58. }).then(function () {
  59. $progressBarMiddle.css("width", "90%");
  60. initDesktop();
  61. }).then(function () {
  62. $progressBarMiddle.css("width", "100%");
  63. $progressBarRight.addClass("done");
  64. setTimeout(function () {
  65. $(".startup").hide();
  66. }, 2000);
  67. });
  68. /* Because .load() is called for every .window... */
  69. appInit = false;
  70. }
  71. });
  72. });
  73. });
  74. $(".sleep").on("click", function () {
  75. Actions.wake();
  76. });
  77. });