diff --git a/build.sh b/build.sh index 40da2f5..899b01a 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,11 @@ #!/bin/bash #cat merger/core.js > inquirer-full.js #cat inquirer.js >>inquirer-full.js -curl -X POST -s --data-urlencode 'input@merger/core.js' https://javascript-minifier.com/raw > inquirer.min.js -curl -X POST -s --data-urlencode 'input@inquirer.js' https://javascript-minifier.com/raw >> inquirer.min.js \ No newline at end of file +MY_PATH="`dirname \"$0\"`" +cd "$MY_PATH" +echo "Starting minification" +echo "//Inquirer Minified file (C) XWolfOverride"> inquirer.min.js +echo "//License and details on github">> inquirer.min.js +curl -X POST -s --data-urlencode 'input@merger/core.js' https://javascript-minifier.com/raw >> inquirer.min.js +curl -X POST -s --data-urlencode 'input@inquirer.js' https://javascript-minifier.com/raw >> inquirer.min.js +echo Done! diff --git a/inquirer.js b/inquirer.js index dfe9c8f..4d3f5b9 100644 --- a/inquirer.js +++ b/inquirer.js @@ -26,6 +26,16 @@ }), ], menu: [ + merger.ui.menuItem("app_main", { + text: "Inquirer", + items: [merger.ui.menuItem("app_close", { + text: "Close", + onClick: function () { + merger.leave(); + } + }), + ], + }), merger.ui.menuItem("app_tools", { text: "Tools", items: [merger.ui.menuItem("tool_console", { @@ -33,15 +43,6 @@ }) ] }), - merger.ui.menuItem("test3", { - text: "Choose two", - items: [merger.ui.menuItem("test3_s1", { - text: "One", - }), merger.ui.menuItem("test3_s2", { - text: "Two", - }), - ], - }), merger.ui.menuItem("test4", { text: "Colors", items: [merger.ui.menuItem("test4_s1", { @@ -127,6 +128,9 @@ onLoad: function () { }, + onAbout: function () { + alert("Pos claro"); + }, showError: function (message, data) { this.windows.Wmain.setError(message, data); }, diff --git a/merger/core.js b/merger/core.js index 0d64e26..dbd0c1b 100644 --- a/merger/core.js +++ b/merger/core.js @@ -16,6 +16,8 @@ windowtitle: "black", selection: "lightskyblue", }, + icons: { + } }; /** @@ -42,9 +44,7 @@ * Toolbar clock logic */ function clockTick() { - var now = new Date(); - var h = now.getHours(); - var m = now.getMinutes(); + var now = new Date(), h = now.getHours(), m = now.getMinutes(); if (h < 10) h = "0" + h; if (m < 10) m = "0" + m; ui.menu.time.innerText = h + ":" + m; @@ -112,6 +112,20 @@ } /** + * Create a standard SVG icon + */ + function mkIcon(color, text) { + return "data:image/svg+xml;utf8," + text + ""; + } + + /** + * Return current configured help icon + */ + function getHelpIcon() { + return sys.icons.help ? sys.icons.help : mkIcon(sys.color.frame, '?'); + } + + /** * Drag'N'Drop system */ @@ -317,7 +331,7 @@ } /** - * MenĂº Item control creation + * Menu Item control creation */ function menuItem(id, def) { var client, dirty = true, icon, openMark, textElement, m = control("menu", id, mkDefinition({ @@ -427,6 +441,31 @@ } /** + * Menu separator control creation + */ + function menuSeparator(id, def) { + var line, m = menuItem(id, { + setText: undefined, + setIcon: undefined, + showMoreMark: undefined, + onmouseenter: undefined, + onmouseleave: undefined, + onclick: function () { + ui.menu.showMenu = this.parentControl; + }, + onControlCreate: function () { + this.appendChild(line = document.createElement("div")); + line.style.merge({ + width: "100%", + height: "1px", + background: sys.color.frame, + }); + }, + }) + return m; + } + + /** * Window control creation */ function window(id, def) { @@ -649,11 +688,25 @@ var i, m, a; ui.menu.sysMenu.setIcon(app.icon ? app.icon : sys.icon); ui.menu.sysMenu.items = []; + if (app.onAbout) { + ui.menu.sysMenu.items.push( + m = merger.ui.menuItem("sys_about" + i, { + icon: getHelpIcon(), + text: "About " + app.title, + onClick: function () { + app.onAbout(); + } + }) + ); + m.parentControl = ui.menu.sysMenu; + ui.menu.sysMenu.items.push(m = menuSeparator("sys_sep1")); + m.parentControl = ui.menu.sysMenu; + } for (i in ui.app) { a = ui.app[i]; ui.menu.sysMenu.items.push( m = merger.ui.menuItem("sys_app_" + i, { - icon: a.icon, + icon: a.icon ? a.icon : sys.icon, text: a.title, _app: a, onClick: function () { @@ -755,9 +808,14 @@ button: button, picture: picture, menuItem: menuItem, + menuSeparator: menuSeparator, + }, + media: { + createIcon: mkIcon, }, conf: { color: sys.color, + icon: sys.icons, } });