messages listlengths 3 3 | repo stringlengths 9 40 ⌀ |
|---|---|
[
{
"role": "system",
"content": "You are an expert coding assistant specializing in Javascript GUI frameworks."
},
{
"role": "user",
"content": "Project Description: \n\nREADME:\n# kdinstall\nIU Karst Desktop Installer\n\n\nTask: Create the file structure."
},
{
"role": "assistant",
"content": "<FILE path=\"app.js\">\n\"use strict\";\nvar electron = require('electron');\n// Module to control application life.\nvar app = electron.app;\n// Module to create native browser window.\nvar BrowserWindow = electron.BrowserWindow;\n// Keep a global reference of the window object, if you don't, the window will\n// be closed automatically when the JavaScript object is garbage collected.\nvar win;\nfunction createWindow() {\n // Create the browser window.\n win = new BrowserWindow({ width: 800, height: 600 });\n //get rid of the default electron menubar \n win.setMenu(null);\n // and load the index.html of the app.\n win.loadURL(\"file://\" + __dirname + \"/index.html\");\n // Open the DevTools.\n //win.webContents.openDevTools();\n // Emitted when the window is closed.\n win.on('closed', function () {\n // Dereference the window object, usually you would store windows\n // in an array if your app supports multi windows, this is the time\n // when you should delete the corresponding element.\n win = null;\n });\n}\n// This method will be called when Electron has finished\n// initialization and is ready to create browser windows.\n// Some APIs can only be used after this event occurs.\napp.on('ready', createWindow);\n// Quit when all windows are closed.\napp.on('window-all-closed', function () {\n // On OS X it is common for applications and their menu bar\n // to stay active until the user quits explicitly with Cmd + Q\n if (process.platform !== 'darwin') {\n app.quit();\n }\n});\napp.on('activate', function () {\n // On OS X it's common to re-create a window in the app when the\n // dock icon is clicked and there are no other windows open.\n if (win === null) {\n createWindow();\n }\n});\n// In this file you can include the rest of your app's specific main process\n// code. You can also put them in separate files and require them here.\nelectron.ipcMain.on('show-console', function (e) {\n //console.log(\"show-consolle called\");\n win.webContents.openDevTools();\n});\nelectron.ipcMain.on('quit', function () {\n console.log(\"quit request\");\n app.quit();\n});\n//# sourceMappingURL=app.js.map\n</FILE>\n<FILE path=\"styles.css\">\nbody {\nfont-family: 'Lato', sans-serif;\n}\n\nh1 {\n color: #7d110c;\n}\n\n.clickable {\n cursor: pointer;\n}\n\nfooter {\n position: absolute;\n width: 100%;\n bottom: 0px;\n background-color: #7d110c;\n color: white;\n margin-top: 10px;\n padding-top: 10px;\n}\n\nfooter .iulogo {\n position: absolute;\n top: -10px;\n width: 43px;\n height: 50px;\n background-image: url('images/block-iu-top-43x40.png');\n background-repeat: no-repeat;\n background-color: #960D00;\n}\nfooter p {\n margin-left: 50px;\n}\n.ng-valid[required] {\n border-left: 5px solid #42A948; /* green */\n}\n\n.ng-invalid {\n border-left: 5px solid #960D00; /* red */\n}\n.fa-check {\n color: #449d44;\n font-size: 150%;\n}\n</FILE>\n<FILE path=\"app.ts\">\nimport electron = require('electron');\nimport fs = require('fs');\n\n// Module to control application life.\nconst {app} = electron;\n// Module to create native browser window.\nconst {BrowserWindow} = electron;\n\n// Keep a global reference of the window object, if you don't, the window will\n// be closed automatically when the JavaScript object is garbage collected.\nlet win;\n\nfunction createWindow() {\n // Create the browser window.\n win = new BrowserWindow({width: 800, height: 600});\n\n //get rid of the default electron menubar \n win.setMenu(null);\n \n // and load the index.html of the app.\n win.loadURL(`file://${__dirname}/index.html`);\n\n // Open the DevTools.\n //win.webContents.openDevTools();\n\n // Emitted when the window is closed.\n win.on('closed', () => {\n // Dereference the window object, usually you would store windows\n // in an array if your app supports multi windows, this is the time\n // when you should delete the corresponding element.\n win = null;\n });\n}\n\n\n// This method will be called when Electron has finished\n// initialization and is ready to create browser windows.\n// Some APIs can only be used after this event occurs.\napp.on('ready', createWindow);\n\n// Quit when all windows are closed.\napp.on('window-all-closed', () => {\n // On OS X it is common for applications and their menu bar\n // to stay active until the user quits explicitly with Cmd + Q\n if (process.platform !== 'darwin') {\n app.quit();\n }\n});\n\napp.on('activate', () => {\n // On OS X it's common to re-create a window in the app when the\n // dock icon is clicked and there are no other windows open.\n if (win === null) {\n createWindow();\n }\n});\n\n// In this file you can include the rest of your app's specific main process\n// code. You can also put them in separate files and require them here.\nelectron.ipcMain.on('show-console', (e) => {\n //console.log(\"show-consolle called\");\n win.webContents.openDevTools();\n})\nelectron.ipcMain.on('quit', () => {\n console.log(\"quit request\");\n app.quit();\n})\n</FILE>\n<FILE path=\"index.html\">\n<html>\n <head>\n <title>Karst Desktop Client Installer</title>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n <link rel=\"stylesheet\" href=\"//fonts.googleapis.com/css?family=Lato:400,700\">\n <link rel=\"stylesheet\" href=\"node_modules/bootstrap/dist/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"node_modules/angular2-toaster/lib/toaster.css\" />\n <link rel=\"stylesheet\" href=\"node_modules/font-awesome/css/font-awesome.min.css\" />\n <link rel=\"stylesheet\" href=\"styles.css\">\n \n <!-- 1. Load libraries -->\n <!-- Polyfill(s) for older browsers -->\n <script src=\"node_modules/es6-shim/es6-shim.min.js\"></script>\n\n <script src=\"node_modules/zone.js/dist/zone.js\"></script>\n <script src=\"node_modules/reflect-metadata/Reflect.js\"></script>\n <script src=\"node_modules/systemjs/dist/system.src.js\"></script>\n\n <!-- 2. Configure SystemJS -->\n <script src=\"systemjs.config.js\"></script>\n <script>\n global.nodeRequire = function (modulePath) {\n return require(modulePath);\n };\n </script>\n <script>\n System.import('app').catch(function(err){ console.error(err); });\n </script>\n </head>\n\n <!-- 3. Display the application -->\n <body>\n \n <div class=\"container\">\n <kdinstall><h3>Starting...</h3></kdinstall>\n </div>\n \n <footer>\n <div class=\"container\">\n <div class=\"iulogo\"></div>\n <p>INDIANA UNIVERSITY | SciApt \n <span class=\"pull-right clickable\" onclick=\"open_devtool()\">\n <script>\n let pkginfo = require('./package.json');\n document.write(pkginfo.version);\n </script>\n </span></p>\n </div>\n </footer>\n \n <script src=\"node_modules/jquery/dist/jquery.min.js\"></script>\n <script src=\"node_modules/bootstrap/dist/js/bootstrap.min.js\"></script>\n <script>\n var ipcRenderer = require('electron').ipcRenderer; \n function open_devtool() {\n ipcRenderer.send('show-console');\n }\n \n //debugging info\n console.log(process.versions);\n </script>\n </body>\n</html>\n</FILE>\n<FILE path=\"package.json\">\n{\n \"name\": \"kdinstall\",\n \"version\": \"1.0.2\",\n \"description\": \"IU Karst Desktop Installer\",\n \"main\": \"app.js\",\n \"scripts\": {\n \"start\": \"electron app\",\n \"postinstall\": \"typings install\",\n \"tsc\": \"tsc\",\n \"tsc:w\": \"tsc -w\",\n \"typings\": \"typings\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/soichih/kdinstall.git\"\n },\n \"author\": \"\",\n \"license\": \"ISC\",\n \"bugs\": {\n \"url\": \"https://github.com/soichih/kdinstall/issues\"\n },\n \"homepage\": \"https://github.com/soichih/kdinstall#readme\",\n \"dependencies\": {\n \"@angular/common\": \"2.0.0-rc.1\",\n \"@angular/compiler\": \"2.0.0-rc.1\",\n \"@angular/core\": \"2.0.0-rc.1\",\n \"@angular/http\": \"2.0.0-rc.1\",\n \"@angular/platform-browser\": \"2.0.0-rc.1\",\n \"@angular/platform-browser-dynamic\": \"2.0.0-rc.1\",\n \"@angular/router\": \"2.0.0-rc.1\",\n \"@angular/router-deprecated\": \"2.0.0-rc.1\",\n \"@angular/upgrade\": \"2.0.0-rc.1\",\n \"angular2-in-memory-web-api\": \"0.0.7\",\n \"angular2-toaster\": \"^0.3.0-rc.0\",\n \"async\": \"^2.0.0-rc.4\",\n \"bootstrap\": \"^3.3.6\",\n \"electron-sudo\": \"^3.0.5\",\n \"es6-shim\": \"^0.35.0\",\n \"font-awesome\": \"^4.6.1\",\n \"jquery\": \"^2.2.3\",\n \"moment\": \"^2.13.0\",\n \"ng2-bootstrap\": \"^1.0.16\",\n \"reflect-metadata\": \"^0.1.3\",\n \"request\": \"^2.72.0\",\n \"request-progress\": \"^2.0.1\",\n \"rxjs\": \"5.0.0-beta.6\",\n \"systemjs\": \"0.19.27\",\n \"thinlinc\": \"^1.0.6\",\n \"whereis\": \"^0.4.0\",\n \"zone.js\": \"^0.6.12\"\n },\n \"devDependencies\": {\n \"grunt\": \"^1.0.1\",\n \"grunt-electron-installer\": \"^2.1.0\"\n }\n}\n\n</FILE>\n<FILE path=\"tsconfig.json\">\n{\n \"compilerOptions\": {\n \"target\": \"es5\",\n \"module\": \"commonjs\",\n \"moduleResolution\": \"node\",\n \"sourceMap\": true,\n \"emitDecoratorMetadata\": true,\n \"experimentalDecorators\": true,\n \"removeComments\": false,\n \"noImplicitAny\": false\n },\n \"exclude\": [\n \"node_modules\",\n \"typings/main\",\n \"typings/main.d.ts\"\n ]\n}\n\n</FILE>\n<FILE path=\"typings.json\">\n{\n \"ambientDependencies\": {\n \"async\": \"registry:dt/async#1.4.2+20160501155344\",\n \"es6-shim\": \"registry:dt/es6-shim#0.31.2+20160317120654\",\n \"jasmine\": \"registry:dt/jasmine#2.2.0+20160412134438\",\n \"node\": \"registry:dt/node#4.0.0+20160509154515\"\n },\n \"dependencies\": {\n \"request\": \"registry:npm/request#2.69.0+20160428223725\"\n }\n}\n\n</FILE>\n<FILE path=\"app/app.html\">\n<toaster-container></toaster-container>\n<h1>Karst Desktop Client Installer</h1>\n<!--\n<ul>\n<li *ngFor=\"let name of names\">{{name}}</li>\n</ul>\n-->\n\n<div *ngIf=\"state != 'finished'\"> \n <p>This program will walk you through steps to install and configure Karst Desktop Client.</p>\n \n <div *ngIf=\"state == 'failed'\">\n <button class=\"btn btn-primary\" (click)=\"retry()\">Retry</button>\n </div>\n \n <div [hidden]=\"submitted\">\n <p>Please enter Karst username / password in order to install a new public key.</p>\n <form (ngSubmit)=\"submit()\" #configureForm=\"ngForm\">\n <div class=\"form-group\">\n <label for=\"name\">Username</label>\n <input type=\"text\" class=\"form-control\" #focus [(ngModel)]=\"form.username\" ngControl=\"name\" #name=\"ngForm\" required>\n <div [hidden]=\"name.valid || name.pristine\" class=\"alert alert-danger\">Please enter username</div>\n </div>\n <div class=\"form-group\">\n <label for=\"name\">Password</label>\n <input type=\"password\" class=\"form-control\" [(ngModel)]=\"form.password\" ngControl=\"password\" #password=\"ngForm\" required>\n <div [hidden]=\"password.valid || password.pristine\" class=\"alert alert-danger\">Please enter password</div>\n </div>\n <button type=\"submit\" class=\"btn btn-default\" [disabled]=\"!configureForm.form.valid\">Install</button>\n </form>\n </div>\n<!--\n<button *ngIf=\"state == 'start'\" class=\"btn btn-default\" (click)=\"start()\">Begin Install</button>\n-->\n<!--\n<button *ngIf=\"state != 'start'\" class=\"btn btn-danger\" (click)=\"stop()\">Stop</button> \n-->\n\n <br>\n \n <div class=\"panel panel-default\" *ngIf=\"state != 'start'\">\n <ul class=\"list-group\">\n <li class=\"list-group-item\">\n <div class=\"row\">\n <div class=\"col-sm-4\">\n Generate SSH Keys\n </div>\n <div class=\"col-sm-8\">\n <p *ngIf=\"state == 'genssh'\" class=\"help-block\">\n <i class=\"fa fa-cog fa-spin\" aria-hidden=\"true\"></i> {{genssh_status}}\n </p> \n <p *ngIf=\"genssh_error\" class=\"alert alert-danger\">{{genssh_error}}</p>\n <div *ngIf=\"gensshed\">\n <i class=\"fa fa-check\" aria-hidden=\"true\"></i>\n </div>\n </div>\n </div> \n </li>\n <li class=\"list-group-item\">\n <div class=\"row\">\n <div class=\"col-sm-4\">\n Download ThinLinc Client\n </div>\n <div class=\"col-sm-8\">\n <p *ngIf=\"state == 'download'\" class=\"help-block\">\n <i class=\"fa fa-cog fa-spin\" aria-hidden=\"true\"></i>\n Downloading ... {{download_path}}\n <progressbar type=\"success\" [value]=\"download_progress\"><b>{{download_progress.toFixed(0)}}%</b></progressbar>\n </p>\n <p *ngIf=\"download_error\" class=\"alert alert-danger\">{{download_error}}</p>\n <p *ngIf=\"downloaded\">\n <i class=\"fa fa-check\" aria-hidden=\"true\"></i>\n </p>\n </div>\n </div> \n </li>\n <li class=\"list-group-item\">\n <div class=\"row\">\n <div class=\"col-sm-4\">\n Install ThinLinc Client\n </div>\n <div class=\"col-sm-8\"> \n <p *ngIf=\"state == 'install'\" class=\"help-block\">\n <i class=\"fa fa-cog fa-spin\" aria-hidden=\"true\"></i> \n Installing ... (Please allow priviledged access)\n </p> \n <p *ngIf=\"install_error\" class=\"alert alert-danger\">{{install_error}}</p>\n <p *ngIf=\"installed\">\n <i class=\"fa fa-check\" aria-hidden=\"true\"></i>\n </p>\n </div>\n </div> \n </li>\n <li class=\"list-group-item\">\n <div class=\"row\">\n <div class=\"col-sm-4\">\n Configure ThinLinc\n </div>\n <div class=\"col-sm-8\">\n <p *ngIf=\"state == 'configure'\" class=\"help-block\">\n <i class=\"fa fa-cog fa-spin\" aria-hidden=\"true\"></i> Configuring\n </p> \n <p *ngIf=\"configure_error\" class=\"alert alert-danger\">{{configure_error}}</p>\n <div *ngIf=\"configured\">\n <i class=\"fa fa-check\" aria-hidden=\"true\"></i>\n </div> \n </div>\n </div> \n </li>\n </ul>\n </div><!--panel-->\n</div><!-- !finished -->\n\n<div *ngIf=\"state == 'finished'\">\n <h3>Installation Completed!</h3>\n <p>You are now ready to launch ThinLinc Client in order to access Karst Desktop</p>\n <button class=\"btn btn-default\" (click)=\"close()\">Close</button>\n <button class=\"btn btn-primary\" (click)=\"launch_tl()\">Launch Thinlinc Client</button>\n</div>\n\n</FILE>\n<FILE path=\"app/main.ts\">\n\nimport { enableProdMode } from '@angular/core'; \nimport { bootstrap } from '@angular/platform-browser-dynamic';\nimport { HTTP_PROVIDERS } from '@angular/http'; //used by SCAService\nimport { AppComponent } from './app.component';\n\nenableProdMode(); \nbootstrap(AppComponent, [HTTP_PROVIDERS]);\n</FILE>\n<FILE path=\"app/main.js\">\n\"use strict\";\nvar core_1 = require('@angular/core');\nvar platform_browser_dynamic_1 = require('@angular/platform-browser-dynamic');\nvar http_1 = require('@angular/http'); //used by SCAService\nvar app_component_1 = require('./app.component');\ncore_1.enableProdMode();\nplatform_browser_dynamic_1.bootstrap(app_component_1.AppComponent, [http_1.HTTP_PROVIDERS]);\n//# sourceMappingURL=main.js.map\n</FILE>"
}
] | null |
[
{
"role": "system",
"content": "You are an expert coding assistant specializing in Javascript GUI frameworks."
},
{
"role": "user",
"content": "Project Description: \n\nREADME:\n# electron-hero\nElectron-Hero app\n\n\nTask: Create the file structure."
},
{
"role": "assistant",
"content": "<FILE path=\"contextMenu.js\">\nvar currentEditableItem;\nvar oldText;\nvar currentListItem;\n\nconst {\n\tremote\n} = require('electron')\nconst {\n\tMenu,\n\tMenuItem\n} = remote\n\n\n\nfunction setupContextMenu(items) {\n\tconst contextMenu = new Menu()\n\n _.each(items, function(item){\n contextMenu.append(new MenuItem({\n \t\tlabel: item.repoName,\n \t\tclick() {\n $('#gitRepoUrl').val(item.repoUrl);\n \t\t}\n \t}))\n })\n\n\twindow.addEventListener('contextmenu', (e) => {\n\t\te.preventDefault();\n\t\tvar x = e.clientX;\n\t\tvar y = e.clientY;\n\t\tvar el = document.elementFromPoint(x, y);\n\t\tif ($(el).hasClass('gitRepoUrl')) {\n\t\t\tcurrentListItem = el;\n\t\t\tcontextMenu.popup({\n\t\t\t\twindow: remote.getCurrentWindow()\n\t\t\t})\n\t\t}\n\n\t}, false)\n\n}\n\n\n\n</FILE>\n<FILE path=\"preload.js\">\n// All of the Node.js APIs are available in the preload process.\n// It has the same sandbox as a Chrome extension.\nwindow.addEventListener('DOMContentLoaded', () => {\n const replaceText = (selector, text) => {\n const element = document.getElementById(selector)\n if (element) element.innerText = text\n }\n\n for (const type of ['chrome', 'node', 'electron']) {\n replaceText(`${type}-version`, process.versions[type])\n }\n})\n\n</FILE>\n<FILE path=\"my.js\">\nconst {\n\tdialog,\n\tBrowserWindow,\n} = require('electron').remote\n\n//let devHomeDirectory = path.join(__dirname , 'app_spaces_dev');\n\n\n// this is the path used for builds\nlet homeDirectory = path.join(app.getPath('documents'), 'electron_hero_apps');\n// this is the path used for development\n//let homeDirectory = path.join(__dirname, 'app_spaces');\n\n\n\nfunction appDropDownChange() {\n\tlet packageJson = path.join(homeDirectory, $('#customAppSpaces').val(), 'package.json')\n\tfs.readFile(packageJson, 'utf8', function(err, contents) {\n\n\t\ttry {\n\t\t\tcontents = JSON.parse(contents);\n\t\t\tif (contents && contents.repository && contents.repository.url) {\n\t\t\t\t$('#gitRepoUrl').val(contents.repository.url);\n\t\t\t} else {\n\t\t\t\t$('#gitRepoUrl').val('');\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t$('#gitRepoUrl').val('');\n\t\t}\n\n\t})\n}\n\n\nfunction handleClick(filename) {\n\tlet reply = ipc.sendSync('synMessage', filename);\n}\n\n// function downloadZipFile(info) {\n// \tlet reply = ipc.sendSync('downloadPackage', info);\n// }\n\nfunction getAppReference() {\n\t// let appRef = ipc.sendSync('getAppReference', '');\n\t// alert(appRef);\n\talert(app);\n}\n\n\nfunction downloadFile(filename) {\n\t// var req = request({\n\t// \tmethod:'GET',\n\t// \turi: filename\n\t// })\n\t// var out = fs.createWriteStream(path.join(__dirname,'downloads','package.zip'));\n\t// req.pipe(out);\n\t// req.on('end', function(){\n\t// \tconsole.log('all done');\n\t// \tvar appName = $('#gitRepoUrl').val().split('/').pop();\n\t// \tconsole.log(appName);\n\t// })\n}\n\nfunction doGitInstall() {\n\n\t// git.cwd(path.join(__dirname, 'app_spaces'))\n\tvar downloadUrl = $('#gitRepoUrl').val() + '/archive/master.zip';\n\tconsole.log(downloadUrl);\n\tdownloadFile(downloadUrl);\n\tvar info = {\n\t\tpackageName: $('#gitRepoUrl').val().split('/').pop(),\n\t\turl: downloadUrl\n\t}\n\tconsole.log(info);\n\tlet reply = ipc.sendSync('downloadPackage', info);\n\n\n\n\t// git.clone(repoPath, function(err, data) {\n\t// \tif (err) {\n\t// \t\talert(err);\n\t// \t} else {\n\t// \t\talert('App installed successfully')\n\t// \t}\n\t// })\n\n}\n\nfunction runAppSpace(space) {\n\t// var contents = fs.readFileSync(devHomeDirectory + $('#customAppSpaces').val() + '/mainWindow.js', 'utf8');\n\t// const mainWindow = new BrowserWindow(contents);\n\t// mainWindow.loadFile(devHomeDirectory + $('#customAppSpaces').val() + '/index.html')\n\tif (space === 'apps') {\n\t\tlet reply = ipc.sendSync('runAppSpace', path.join(homeDirectory, $('#customAppSpaces').val()));\n\t}\n\tif (space === 'devapps') {\n\t\tlet reply = ipc.sendSync('runAppSpace', path.join(devHomeDirectory, $('#customAppSpaces').val()));\n\t}\n\n}\n\nfunction openFinderWinow(mode) {\n\tif (mode === 'apps') {\n\t\trequire('electron').shell.openExternal('file://' + homeDirectory);\n\t}\n\tif (mode === 'devapps') {\n\t\trequire('electron').shell.openExternal('file://' + devHomeDirectory);\n\t}\n}\n\nfunction runDevApp() {\n\tvar devDir = devHomeDirectory + $('#customAppSpaces').val();\n\tconsole.log(devDir);\n\tlet reply = ipc.sendSync('runDevApp', devDir);\n}\n\nfunction deleteFolderRecursive(path) {\n\tif (fs.existsSync(path)) {\n\t\tfs.readdirSync(path).forEach((file, index) => {\n\t\t\tconst curPath = path.join(path, file);\n\t\t\tif (fs.lstatSync(curPath).isDirectory()) { // recurse\n\t\t\t\tdeleteFolderRecursive(curPath);\n\t\t\t} else { // delete file\n\t\t\t\tfs.unlinkSync(curPath);\n\t\t\t}\n\t\t});\n\t\tfs.rmdirSync(path);\n\t\treturn true;\n\t}\n}\n\nfunction selectCustomAppSpaceHome() {\n\n\tvar thisWindow = require('electron').remote.getCurrentWindow();\n\tvar path = dialog.showOpenDialogSync(thisWindow, {\n\t\tproperties: ['openFile', 'openDirectory', 'createDirectory']\n\t});\n\tif (path > '') {\n\t\tsavePreference('electron-hero-dev-directory', _.first(path));\n\t\t$('#customAppSpacesHome').val(_.first(path));\n\t\tdevHomeDirectory = _.first(path) + '/';\n\t}\n}\n\n\n\nfunction getSubDirectories(_path) {\n\tconsole.log(_path);\n\n\tvar dirs = [];\n\tvar info = fs.readdirSync(_path);\n\t_.each(info, function(item) {\n\t\tconsole.log('looking...');\n\t\tif (item.substr(0, 1) != '.') {\n\t\t\tif (path.extname(path.join(_path, item)) == '') {\n\t\t\t\tdirs.push(item);\n\t\t\t}\n\t\t}\n\t})\n\treturn dirs;\n}\n\nfunction getAppSpaces() {\n\tvar dirs = [];\n\tvar info = fs.readdirSync(devHomeDirectory);\n\t_.each(info, function(item) {\n\t\tif (item.substr(0, 1) != '.') {\n\t\t\tif (path.extname(path.join(devHomeDirectory, item)) == '') {\n\t\t\t\tdirs.push(item);\n\t\t\t}\n\t\t}\n\t})\n\treturn dirs;\n}\n\nfunction buildAppSpaceDropdown() {\n\n}\n\nfunction createAppSpace() {\n\tvar appSpaceName = $('#newAppSpaceName').val();\n\tlet dir = __dirname + devHomeDirectory + args;\n\tif (!fs.existsSync(dir)) {\n\t\tfs.mkdirSync(dir);\n\t}\n\tfs.readdir(__dirname + devHomeDirectory, function(err, files) {\n\t\tconsole.log(files);\n\t\tevent.returnValue = files;\n\t})\n}\n\nfunction deleteAppSpace() {\n\tvar appSpaceName = $('#customAppSpaces').val();\n\tvar path = path.join(__dirname, devHomeDirectory, appSpaceName);\n\tdeleteFolderRecursive(path);\n}\n\n// function installStarterApp() {\n// \tconst directory = devHomeDirectory;\n// \tlet startName = $('#startAppDropDown').val();\n// \tconst sourceDirectory = __dirname + '/package_dev_starters/' + startName;\n// \tconst path = directory;\n// \n// \tvar resp = deleteFolderRecursive(directory)\n// \n// \tncp.limit = 16;\n// \tncp(sourceDirectory, directory, function(err) {\n// \t\tif (err) {\n// \t\t\treturn console.error(err);\n// \t\t}\n// \t\tconsole.log('done!');\n// \t});\n// }\n\nconst ipc = require('electron').ipcRenderer\n</FILE>\n<FILE path=\"index.html\">\n<!DOCTYPE html>\n<html>\n\n<head>\n <title>Electron Hero</title>\n\n <!-- Stylesheets -->\n <link rel=\"stylesheet\" href=\"css/photon.css\">\n <link rel=\"stylesheet\" href=\"css/electron-hero.css\">\n <script src=\"components/utils/index.js\"></script>\n <script src=\"contextMenu.js\"></script>\n\n <script>\n\n window.$ = window.jQuery = require('jquery');\n const fs = require('fs');\n const path = require('path');\n const ncp = require('ncp');\n const shell = require('shelljs');\n const _ = require('lodash');\n const request = require('request');\n const app = require('electron').remote.app\n const { ipcRenderer } = require('electron')\n </script>\n <script src=\"my.js\" charset=\"utf-8\"></script>\n\n <style>\n .content-pane {\n margin: 20px;\n border-left: none;\n }\n </style>\n</head>\n\n<body>\n <div class=\"window\">\n <!-- Your app's content goes inside .window-content -->\n <div class=\"window-content\">\n <div class=\"pane-group\">\n <div class=\"pane content-pane\">\n\n <div class=\"form-group\">\n <label class=\"h2\">App Spaces</label>\n <div class=\"hint-text\">App Spaces are apps you have installed from a git repo and run as-is. If you need a new app space, use \"Show in Finder\", create a new directory and then CTRL-R in electron-hero.</div>\n <div>\n <select onchange=\"appDropDownChange()\" id='customAppSpaces' class='form-control form-control-relative'>\n <option value=''>Select Space</option>\n </select>\n <button class=\"btn btn-large btn-primary\" onclick=\"runAppSpace('apps')\">Run</button>\n <button class=\"btn btn-large btn-positive\" onclick=\"openFinderWinow('apps')\">Show in Finder</button>\n </div>\n <div class=\"hint-text\">To install a new app, enter the git url and click Install</div>\n <div>\n <input type=text id='gitRepoUrl' class='form-control form-control-relative gitRepoUrl' placeholder=\"Right click for samples available\" />\n <button class=\"btn btn-large btn-positive\" onclick=\"installNewApp()\">Install</button> \n </div>\n <br><br>\n <span id='installStatus'></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n</body>\n\n\n<script>\n $(document).ready(function() {\n refreshAppDropDown();\n ipcRenderer.on('updateStatus', function(event, args) {\n $('#installStatus').html(args.message);\n })\n $.ajax(\"https://api.github.com/orgs/electron-hero-apps/repos\")\n .done(function(data) {\n var resp = [];\n _.each(data, function(item) {\n resp.push({\n repoUrl: item.html_url,\n repoName: item.name\n })\n })\n setupContextMenu(_.orderBy(resp, ['repoName']));\n })\n });\n\n function refreshAppDropDown() {\n let reply;\n let appSpaceHome = ipc.sendSync('getAppSpaceHome');\n $('#customAppSpaces').empty();\n $('#customAppSpaces').append(`<option>Select Space</option>`);\n\n reply = getSubDirectories(appSpaceHome);\n _.each(reply, function(item) {\n if (item.substr(0, 1) != '.') {\n $('#customAppSpaces').append(`<option value=\"${item}\">${item}</option>`);\n }\n })\n }\n\n function installNewApp() {\n doGitInstall()\n }\n\n require('electron').ipcRenderer.on('installComplete', function(event, message) {\n console.log('event');\n refreshAppDropDown();\n });\n</script>\n\n</html>\n</FILE>\n<FILE path=\"prefs.json\">\n{\"electron-hero-dev-directory\":\"/Users/johnanderson/Documents/electron-hero-projects\"}\n</FILE>\n<FILE path=\"entitlements.plist\">\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n <dict>\n <key>com.apple.security.cs.allow-jit</key>\n <true/>\n <key>com.apple.security.cs.allow-unsigned-executable-memory</key>\n <true/>\n <key>com.apple.security.cs.debugger</key>\n <true/>\n </dict>\n</plist>\n</FILE>\n<FILE path=\"package.json\">\n{\n \"name\": \"ElectronHero\",\n \"version\": \"1.0.12\",\n \"description\": \"An experiment in efficiency\",\n \"main\": \"main.js\",\n \"scripts\": {\n \"start\": \"electron-forge start\",\n \"package\": \"electron-forge package\",\n \"make\": \"electron-forge make\"\n },\n \"repository\": \"https://github.com/electron-hero/electron-hero/\",\n \"keywords\": [\n \"Electron\",\n \"quick\",\n \"start\",\n \"tutorial\",\n \"demo\"\n ],\n \"author\": \"andersjj@yahoo.com\",\n \"license\": \"CC0-1.0\",\n \"devDependencies\": {\n \"@electron-forge/cli\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-deb\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-rpm\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-squirrel\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-zip\": \"^6.0.0-beta.52\",\n \"electron\": \"^9.2.0\"\n },\n \"dependencies\": {\n \"auth0-js\": \"^9.13.2\",\n \"auth0-lock\": \"^11.26.0\",\n \"decompress-zip\": \"^0.2.2\",\n \"desktop-idle\": \"^1.3.0\",\n \"electron-squirrel-startup\": \"^1.0.0\",\n \"electron-tree-view\": \"^1.1.0\",\n \"extract-zip\": \"^2.0.0\",\n \"http\": \"0.0.1-security\",\n \"https\": \"^1.0.0\",\n \"iohook\": \"^0.6.5\",\n \"jquery\": \"^3.5.0\",\n \"js-beautify\": \"^1.11.0\",\n \"keytar\": \"^6.0.1\",\n \"lodash\": \">=4.17.19\",\n \"moment\": \"^2.24.0\",\n \"ncp\": \"^2.0.0\",\n \"path\": \"^0.12.7\",\n \"request\": \"^2.88.2\",\n \"rimraf\": \"^3.0.2\",\n \"shelljs\": \"^0.8.3\",\n \"simple-git\": \"^1.132.0\",\n \"stream\": \"0.0.2\",\n \"update-electron-app\": \"^1.5.0\",\n \"url\": \"^0.11.0\",\n \"xml-formatter\": \"^2.0.1\"\n },\n \"config\": {\n \"forge\": {\n \"packagerConfig\": {\n \"osxSign\": {\n \"identity\": \"Developer ID Application: John ANDERSON (2FJU5Q8XK6)\",\n \"hardened-runtime\": true,\n \"entitlements\": \"entitlements.plist\",\n \"entitlements-inherit\": \"entitlements.plist\",\n \"signature-flags\": \"library\"\n },\n \"osxNotarize\": {\n \"appleId\": \"info@ti-browser.com\",\n \"appleIdPassword\": \"kxec-azii-sckp-xiqm\",\n \"ascProvider\": \"JohnANDERSON299474967\",\n \"hardenedRuntime\": true\n },\n \"ignore\": [\n \"app_spaces\"\n ],\n \"icon\": \"icons/app_icon.icns\"\n },\n \"makers\": [{\n \"name\": \"@electron-forge/maker-squirrel\",\n \"config\": {\n \"name\": \"electron_hero\"\n }\n },\n {\n \"name\": \"@electron-forge/maker-zip\",\n \"platforms\": [\n \"darwin\"\n ]\n },\n {\n \"name\": \"@electron-forge/maker-deb\",\n \"config\": {}\n },\n {\n \"name\": \"@electron-forge/maker-rpm\",\n \"config\": {}\n }\n ]\n }\n }\n}\n</FILE>\n<FILE path=\"renderer.js\">\n// This file is required by the index.html file and will\n// be executed in the renderer process for that window.\n// No Node.js APIs are available in this process because\n// `nodeIntegration` is turned off. Use `preload.js` to\n// selectively enable features needed in the rendering\n// process.\n\n</FILE>\n<FILE path=\"main.js\">\n// Modules to control application life and create native browser window\nconst {\n\tapp,\n\tBrowserWindow,\n\tdialog\n} = require('electron')\nconst path = require('path')\nconst request = require(\"request\");\nconst ipc = require('electron').ipcMain;\nconst ncp = require('ncp');\nconst rimraf = require(\"rimraf\");\n\nvar https = require('https');\nvar fs = require('fs');\nvar url = require('url');\nvar _ = require('lodash');\nvar moment = require('moment');\nvar Stream = require('stream').Transform;\nvar DecompressZip = require('decompress-zip');\nconst extract = require('extract-zip')\n\nvar mainWindow;\nvar devSpaceHome;\nvar packageName;\nvar dir;\n\n// this is used when building for publish\nvar appSpaceHome = path.join(app.getPath('documents'), 'electron_hero_apps');\n// this is used to point to the source files under source control\n//var appSpaceHome = path.join(__dirname, 'app_spaces');\n\n\nrequire('update-electron-app')();\n\nconsole.log('args');\nconsole.log(process.argv);\n\n\nlet homeRequirePath = __dirname + path.sep;\n\nipc.on('getRequirePath', (event, args) => {\n\tevent.returnValue = homeRequirePath;\n});\n\nipc.on('getAppSpaceHome', (event, args) => {\n\tevent.returnValue = appSpaceHome;\n});\n\nipc.on('getAppReference', (event, args) => {\n\tevent.returnValue = app;\n});\n\nipc.on('synMessage', (event, args) => {\n\tevent.returnValue = args;\n\tcreateDynamicWindow(args);\n});\n\nipc.on('downloadPackage', (event, args) => {\n\tevent.returnValue = 'ok';\n\tdownloadAndExtractZip(args);\n});\n\napp.on('window-all-closed', () => {\n\tapp.dock.hide();\n\tapp.quit();\n})\n\nipc.on('runDevApp', (event, args) => {\n\n\n\tconst dynamicWindow = new BrowserWindow({\n\t\twidth: 1600,\n\t\theight: 600,\n\t\twebPreferences: {\n\t\t\tnodeIntegration: true\n\t\t},\n\t\ticon: path.join(__dirname, 'icons', 'app_icon.icns')\n\n\t})\n\t// and load the index.html of the app.\n\tdynamicWindow.loadFile(args + '/index.html')\n\n\n});\n\n\nipc.on('runAppSpace', (event, args) => {\n\n\t//createDynamicWindow(args + '/index.html');\n\tvar windowInfo = JSON.parse(fs.readFileSync(path.join(args, 'mainWindow.json')));\n\tvar newWindow = new BrowserWindow(windowInfo);\n\tnewWindow.loadFile(path.join(args, 'index.html'));\n\tevent.returnValue = 'ok';\n\n});\n\n\n\n\nipc.on('setAppSpaceHome', (event, args) => {\n\tdevSpaceHome = args\n\treturn true;\n})\n\n\nfunction updateStatusMessage(message){\n\t//$('#installStatus').html(message);\n\tmainWindow.webContents.send('updateStatus', {\n\t\t'message':message\n\t})\n}\n\nfunction downloadAndExtractZip(args) {\n\tupdateStatusMessage('Checking install directory...')\n\tpackageName = args.packageName;\n\tvar url = args.url;\n\n\tdir = path.join(appSpaceHome, packageName + '');\n\tif (!fs.existsSync(dir)) {\n\t\tfs.mkdirSync(dir);\n\t}\n\n\tfs.readdir(dir, function(err, files) {\n\t\tif (err) {\n\t\t\tconsole.log(err);\n\t\t} else {\n\t\t\tif (files.length) {\n\t\t\t\tvar selection = dialog.showMessageBoxSync({\n\t\t\t\t\t'message': 'Warning',\n\t\t\t\t\t'detail': 'Directory is not empty. Cancel to abort, OK to install over existing files',\n\t\t\t\t\t'type': 'warning',\n\t\t\t\t\t'buttons': ['Cancel', 'OK'],\n\t\t\t\t\t'defaultId': 1\n\t\t\t\t})\n\t\t\t\tif (selection === 0) {\n\t\t\t\t\tupdateStatusMessage('')\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\trimraf(dir, function() {\n\t\t\t\t\t\tinstallPackage(args);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tinstallPackage(args);\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction installPackage(args) {\n\tupdateStatusMessage('Downloading package...')\n\n\tvar downloadDir = path.join(appSpaceHome, 'downloads');\n\tif (!fs.existsSync(downloadDir)) {\n\t\tfs.mkdirSync(downloadDir);\n\t};\n\t\n\ttry {\n\t\trequest(args.url)\n\t\t .pipe(fs.createWriteStream(path.join(appSpaceHome, 'downloads', 'package.zip')))\n\t\t .on('close', function () {\n\t\t console.log('File written!');\n\t\t\tdecompressZip(args);\n\t\t });\t\t\n\n\t} catch(err) {\n\t\tconsole.log(err.message);\n\t\tupdateStatusMessage('');\n\t\trimraf(downloadDir, function() {\n\t\t\trimraf(dir, function(){\n\t\t\t\tupdateStatusMessage('')\n\t\t\t\tdialog.showMessageBoxSync({\n\t\t\t\t\t'message': 'Download Error',\n\t\t\t\t\t'detail': err.message,\n\t\t\t\t\t'type': 'error'\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\t\n\t}\n}\n\nfunction decompressZip(args) {\n\tupdateStatusMessage('Extracting files...')\n\n\tpackageName = args.packageName;\n\tdir = path.join(appSpaceHome, \"downloads\");\n\n\tvar unzipper = new DecompressZip(path.join(dir, 'package.zip'));\n\n\tunzipper.on('error', function(err) {\n\t\tconsole.log(err);\n\t});\n\n\tunzipper.on('extract', function(log) {\n\n\t\tconsole.log('here in extract...')\n\t\tsetTimeout(cleanupAfterInstall,10);\n\t\t//fs.unlinkSync(path.join(dir,'package.zip'));\n\t\t//createDynamicWindow(path.join(dir,'index.html'));\n\t});\n\n\tunzipper.on('progress', function(fileIndex, fileCount) {\n\t\tconsole.log('Extracted file ' + (fileIndex + 1) + ' of ' + fileCount);\n\t\t//updateStatusMessage('Extracted file ' + (fileIndex + 1) + ' of ' + fileCount)\n\t});\n\n\n\tunzipper.extract({\n\t\tpath: dir,\n\t\tfilter: function(file) {\n\t\t\treturn file.type !== \"SymbolicLink\";\n\t\t}\n\t});\n\n}\n\nfunction cleanupAfterInstall() {\n\tupdateStatusMessage('Cleaning up files...');\n\tsourceDirectory = path.join(appSpaceHome, 'downloads', packageName + '-master');\n\tdirectory = path.join(appSpaceHome, packageName)\n\tncp.limit = 16;\n\tncp(sourceDirectory, directory, function(err) {\n\t\tif (err) {\n\t\t\treturn console.error(err);\n\t\t\tconsole.log(err);\n\t\t}\n\t\tvar resp = fs.unlinkSync(path.join(dir, 'package.zip'));\n\t\trimraf(dir, function() {\n\t\t\t//alert('App installed');\n\t\t\tupdateStatusMessage('');\n\t\t\tdialog.showMessageBoxSync({\n\t\t\t\t'message': 'App Installed',\n\t\t\t\t'detail': 'Select App from dropdown and hit Run',\n\t\t\t\t'type': 'info'\n\t\t\t})\n \t\t\tmainWindow.webContents.send('installComplete');\n\n\t\t});\n\t});\n}\n\n\nfunction openMainConsole() {\n\ttry {\n\t\tmainWindow = new BrowserWindow({\n\t\t\twidth: 700,\n\t\t\theight: 400,\n\t\t\tbackgroundColor: '#f0f0f0',\n\t\t\twebPreferences: {\n\t\t\t\tpreload: path.join(__dirname, 'preload.js')\n\t\t\t},\n\t\t\twebPreferences: {\n\t\t\t\tnodeIntegration: true\n\t\t\t},\n\t\t\t//icon: path.join(__dirname, \"icon.icns\")\n\t\t})\n\n\t\t// and load the index.html of the app.\n\t\tvar dir = appSpaceHome;\n\t\tif (!fs.existsSync(dir)) {\n\t\t\tfs.mkdirSync(dir);\n\t\t\tfs.mkdirSync(path.join(dir, 'downloads'));\n\t\t}\n\t\tmainWindow.loadFile('index.html')\n\t\tapp.dock.show();\n\t\t// Open the DevTools.\n\t\t// mainWindow.webContents.openDevTools()\n\t} catch (err) {\n\t\tconsole.log(err);\n\t}\n\t\n}\n\nfunction createWindow() {\n\t// Create the browser window.\n\tconst args = process.argv;\n\tif (args.length > 1 && args[1] != '.') {\n\t\tvar appName = args[1];\n\t\tif (fs.existsSync( path.join(appSpaceHome, appName, 'mainWindow.json'))) {\n\t\t\tvar windowInfo = JSON.parse(fs.readFileSync(path.join(appSpaceHome, appName, 'mainWindow.json')));\n\t\t\tvar newWindow = new BrowserWindow(windowInfo);\n\t\t\tnewWindow.loadFile(path.join(appSpaceHome, appName, 'index.html'));\t\t\t\n\t\t} else {\n\t\t\topenMainConsole();\n\t\t}\n\n\t} else {\n\t\topenMainConsole()\n\t}\n}\n\n\n\nfunction createDynamicWindow(htmlFilename) {\n\tconst dynamicWindow = new BrowserWindow({\n\t\twidth: 1600,\n\t\theight: 600,\n\t\t// webPreferences: {\n\t\t// \tpreload: path.join(__dirname, 'preload.js')\n\t\t// },\n\t\twebPreferences: {\n\t\t\tnodeIntegration: true\n\t\t}\n\t})\n\t// and load the index.html of the app.\n\tdynamicWindow.loadFile(htmlFilename)\n\n}\n\n\n\n\n\n// This method will be called when Electron has finished\n// initialization and is ready to create browser windows.\n// Some APIs can only be used after this event occurs.\napp.whenReady().then(createWindow)\n\n// Quit when all windows are closed.\napp.on('window-all-closed', function() {\n\t// On macOS it is common for applications and their menu bar\n\t// to stay active until the user quits explicitly with Cmd + Q\n\tif (process.platform !== 'darwin') app.quit()\n})\n\napp.on('activate', function() {\n\t// On macOS it's common to re-create a window in the app when the\n\t// dock icon is clicked and there are no other windows open.\n\tif (BrowserWindow.getAllWindows().length === 0) createWindow()\n})\n\n// In this file you can include the rest of your app's specific main process\n// code. You can also put them in separate files and require them here.\n</FILE>\n<FILE path=\"css/photon.css\">\n/*!\n * =====================================================\n * Photon v0.1.1\n * Copyright 2015 Connor Sears\n * Licensed under MIT (https://github.com/connors/proton/blob/master/LICENSE)\n *\n * v0.1.1 designed by @connors.\n * =====================================================\n */\n@charset \"UTF-8\";\n\naudio,\ncanvas,\nprogress,\nvideo {\n vertical-align: baseline;\n}\n\naudio:not([controls]) {\n display: none;\n}\n\na:active,\na:hover {\n outline: 0;\n}\n\nabbr[title] {\n border-bottom: 1px dotted;\n}\n\nb,\nstrong {\n font-weight: bold;\n}\n\ndfn {\n font-style: italic;\n}\n\nh1 {\n font-size: 2em;\n margin: 0.67em 0;\n}\n\nsmall {\n font-size: 80%;\n}\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsup {\n top: -0.5em;\n}\n\nsub {\n bottom: -0.25em;\n}\n\npre {\n overflow: auto;\n}\n\ncode,\nkbd,\npre,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n color: inherit;\n font: inherit;\n margin: 0;\n}\n\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\ninput[type=\"search\"] {\n -webkit-appearance: textfield;\n box-sizing: content-box;\n}\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\nfieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\nlegend {\n border: 0;\n padding: 0;\n}\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\ntd,\nth {\n padding: 0;\n}\n\n* {\n cursor: default;\n -webkit-user-drag: text;\n -webkit-user-select: none;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n\nhtml {\n height: 100%;\n width: 100%;\n overflow: hidden;\n}\n\nbody {\n height: 100%;\n padding: 0;\n margin: 0;\n font-family: system, -apple-system, \".SFNSDisplay-Regular\", \"Helvetica Neue\", Helvetica, \"Segoe UI\", sans-serif;\n font-size: 13px;\n line-height: 1.6;\n color: #333;\n background-color: transparent;\n}\n\nhr {\n margin: 15px 0;\n overflow: hidden;\n background: transparent;\n border: 0;\n border-bottom: 1px solid #ddd;\n}\n\nh1, h2, h3, h4, h5, h6 {\n margin-top: 20px;\n margin-bottom: 10px;\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\nh1 {\n font-size: 36px;\n}\n\nh2 {\n font-size: 30px;\n}\n\nh3 {\n font-size: 24px;\n}\n\nh4 {\n font-size: 18px;\n}\n\nh5 {\n font-size: 14px;\n}\n\nh6 {\n font-size: 12px;\n}\n\n.window {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n background-color: black;\n}\n\n.window-content {\n position: relative;\n overflow-y: auto;\n display: flex;\n flex: 1;\n}\n\n.selectable-text {\n cursor: text;\n -webkit-user-select: text;\n}\n\n.text-center {\n text-align: center;\n}\n\n.text-right {\n text-align: right;\n}\n\n.text-left {\n text-align: left;\n}\n\n.pull-left {\n float: left;\n}\n\n.pull-right {\n float: right;\n}\n\n.padded {\n padding: 10px;\n}\n\n.padded-less {\n padding: 5px;\n}\n\n.padded-more {\n padding: 20px;\n}\n\n.padded-vertically {\n padding-top: 10px;\n padding-bottom: 10px;\n}\n\n.padded-vertically-less {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n.padded-vertically-more {\n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n.padded-horizontally {\n padding-right: 10px;\n padding-left: 10px;\n}\n\n.padded-horizontally-less {\n padding-right: 5px;\n padding-left: 5px;\n}\n\n.padded-horizontally-more {\n padding-right: 20px;\n padding-left: 20px;\n}\n\n.padded-top {\n padding-top: 10px;\n}\n\n.padded-top-less {\n padding-top: 5px;\n}\n\n.padded-top-more {\n padding-top: 20px;\n}\n\n.padded-bottom {\n padding-bottom: 10px;\n}\n\n.padded-bottom-less {\n padding-bottom: 5px;\n}\n\n.padded-bottom-more {\n padding-bottom: 20px;\n}\n\n.sidebar {\n background-color: #f5f5f4;\n}\n\n.draggable {\n -webkit-app-region: drag;\n}\n\n.clearfix:before, .clearfix:after {\n display: table;\n content: \" \";\n}\n\n.clearfix:after {\n clear: both;\n}\n\n.btn {\n display: inline-block;\n padding: 3px 8px;\n margin-bottom: 0;\n font-size: 12px;\n line-height: 1.4;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n cursor: default;\n background-image: none;\n border: 1px solid transparent;\n border-radius: 4px;\n box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);\n -webkit-app-region: no-drag;\n}\n\n.btn:focus {\n outline: none;\n box-shadow: none;\n}\n\n.btn-mini {\n padding: 2px 6px;\n}\n\n.btn-large {\n padding: 6px 12px;\n}\n\n.btn-form {\n padding-right: 20px;\n padding-left: 20px;\n}\n\n.btn-default {\n color: #333;\n border-top-color: #c2c0c2;\n border-right-color: #c2c0c2;\n border-bottom-color: #a19fa1;\n border-left-color: #c2c0c2;\n background-color: #fcfcfc;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fcfcfc), color-stop(100%, #f1f1f1));\n background-image: -webkit-linear-gradient(top, #fcfcfc 0%, #f1f1f1 100%);\n background-image: linear-gradient(to bottom, #fcfcfc 0%, #f1f1f1 100%);\n}\n\n.btn-default:active {\n background-color: #ddd;\n background-image: none;\n}\n\n.btn-primary,\n.btn-positive,\n.btn-negative,\n.btn-warning {\n color: #fff;\n text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);\n}\n\n.btn-primary {\n border-color: #388df8;\n border-bottom-color: #0866dc;\n background-color: #6eb4f7;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6eb4f7), color-stop(100%, #1a82fb));\n background-image: -webkit-linear-gradient(top, #6eb4f7 0%, #1a82fb 100%);\n background-image: linear-gradient(to bottom, #6eb4f7 0%, #1a82fb 100%);\n}\n\n.btn-primary:active {\n background-color: #3e9bf4;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #3e9bf4), color-stop(100%, #0469de));\n background-image: -webkit-linear-gradient(top, #3e9bf4 0%, #0469de 100%);\n background-image: linear-gradient(to bottom, #3e9bf4 0%, #0469de 100%);\n}\n\n.btn-positive {\n border-color: #29a03b;\n border-bottom-color: #248b34;\n background-color: #5bd46d;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bd46d), color-stop(100%, #29a03b));\n background-image: -webkit-linear-gradient(top, #5bd46d 0%, #29a03b 100%);\n background-image: linear-gradient(to bottom, #5bd46d 0%, #29a03b 100%);\n}\n\n.btn-positive:active {\n background-color: #34c84a;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #34c84a), color-stop(100%, #248b34));\n background-image: -webkit-linear-gradient(top, #34c84a 0%, #248b34 100%);\n background-image: linear-gradient(to bottom, #34c84a 0%, #248b34 100%);\n}\n\n.btn-negative {\n border-color: #fb2f29;\n border-bottom-color: #fb1710;\n background-color: #fd918d;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fd918d), color-stop(100%, #fb2f29));\n background-image: -webkit-linear-gradient(top, #fd918d 0%, #fb2f29 100%);\n background-image: linear-gradient(to bottom, #fd918d 0%, #fb2f29 100%);\n}\n\n.btn-negative:active {\n background-color: #fc605b;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fc605b), color-stop(100%, #fb1710));\n background-image: -webkit-linear-gradient(top, #fc605b 0%, #fb1710 100%);\n background-image: linear-gradient(to bottom, #fc605b 0%, #fb1710 100%);\n}\n\n.btn-warning {\n border-color: #fcaa0e;\n border-bottom-color: #ee9d02;\n background-color: #fece72;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fece72), color-stop(100%, #fcaa0e));\n background-image: -webkit-linear-gradient(top, #fece72 0%, #fcaa0e 100%);\n background-image: linear-gradient(to bottom, #fece72 0%, #fcaa0e 100%);\n}\n\n.btn-warning:active {\n background-color: #fdbc40;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fdbc40), color-stop(100%, #ee9d02));\n background-image: -webkit-linear-gradient(top, #fdbc40 0%, #ee9d02 100%);\n background-image: linear-gradient(to bottom, #fdbc40 0%, #ee9d02 100%);\n}\n\n.btn .icon {\n float: left;\n width: 14px;\n height: 14px;\n margin-top: 1px;\n margin-bottom: 1px;\n color: #737475;\n font-size: 14px;\n line-height: 1;\n}\n\n.btn .icon-text {\n margin-right: 5px;\n}\n\n.btn-dropdown:after {\n font-family: \"photon-entypo\";\n margin-left: 5px;\n content: \"\";\n}\n\n.btn-group {\n position: relative;\n display: inline-block;\n vertical-align: middle;\n -webkit-app-region: no-drag;\n}\n\n.btn-group .btn {\n position: relative;\n float: left;\n}\n\n.btn-group .btn:focus, .btn-group .btn:active {\n z-index: 2;\n}\n\n.btn-group .btn.active {\n z-index: 3;\n}\n\n.btn-group .btn+.btn,\n.btn-group .btn+.btn-group,\n.btn-group .btn-group+.btn,\n.btn-group .btn-group+.btn-group {\n margin-left: -1px;\n}\n\n.btn-group>.btn:first-child {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.btn-group>.btn:last-child {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.btn-group>.btn:not(:first-child):not(:last-child) {\n border-radius: 0;\n}\n\n.btn-group .btn+.btn {\n border-left: 1px solid #c2c0c2;\n}\n\n.btn-group .btn+.btn.active {\n border-left: 0;\n}\n\n.btn-group .active {\n color: #fff;\n border: 1px solid transparent;\n background-color: #6d6c6d;\n background-image: none;\n}\n\n.btn-group .active .icon {\n color: #fff;\n}\n\n.toolbar {\n min-height: 22px;\n box-shadow: inset 0 1px 0 #f5f4f5;\n background-color: #e8e6e8;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #e8e6e8), color-stop(100%, #d1cfd1));\n background-image: -webkit-linear-gradient(top, #e8e6e8 0%, #d1cfd1 100%);\n background-image: linear-gradient(to bottom, #e8e6e8 0%, #d1cfd1 100%);\n}\n\n.toolbar:before, .toolbar:after {\n display: table;\n content: \" \";\n}\n\n.toolbar:after {\n clear: both;\n}\n\n.toolbar-header {\n border-bottom: 1px solid #c2c0c2;\n}\n\n.toolbar-header .title {\n margin-top: 1px;\n}\n\n.toolbar-footer {\n border-top: 1px solid #c2c0c2;\n -webkit-app-region: drag;\n}\n\n.title {\n margin: 0;\n font-size: 12px;\n font-weight: 400;\n text-align: center;\n color: #555;\n cursor: default;\n}\n\n.toolbar-borderless {\n border-top: 0;\n border-bottom: 0;\n}\n\n.toolbar-actions {\n margin-top: 4px;\n margin-bottom: 3px;\n padding-right: 3px;\n padding-left: 3px;\n padding-bottom: 3px;\n -webkit-app-region: drag;\n}\n\n.toolbar-actions:before, .toolbar-actions:after {\n display: table;\n content: \" \";\n}\n\n.toolbar-actions:after {\n clear: both;\n}\n\n.toolbar-actions>.btn,\n.toolbar-actions>.btn-group {\n margin-left: 4px;\n margin-right: 4px;\n}\n\nlabel {\n display: inline-block;\n font-size: 13px;\n margin-bottom: 5px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\ninput[type=\"search\"] {\n box-sizing: border-box;\n}\n\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n margin: 4px 0 0;\n line-height: normal;\n}\n\n.form-control {\n display: inline-block;\n width: 100%;\n min-height: 25px;\n padding: 5px 10px;\n font-size: 13px;\n line-height: 1.6;\n background-color: #fff;\n border: 1px solid #ddd;\n border-radius: 4px;\n outline: none;\n}\n\n.form-control:focus {\n border-color: #6db3fd;\n box-shadow: 3px 3px 0 #6db3fd, -3px -3px 0 #6db3fd, -3px 3px 0 #6db3fd, 3px -3px 0 #6db3fd;\n}\n\ntextarea {\n height: auto;\n}\n\n.form-group {\n margin-bottom: 10px;\n}\n\n.radio,\n.checkbox {\n position: relative;\n display: block;\n margin-top: 10px;\n margin-bottom: 10px;\n}\n\n.radio label,\n.checkbox label {\n padding-left: 20px;\n margin-bottom: 0;\n font-weight: normal;\n}\n\n.radio input[type=\"radio\"],\n.radio-inline input[type=\"radio\"],\n.checkbox input[type=\"checkbox\"],\n.checkbox-inline input[type=\"checkbox\"] {\n position: absolute;\n margin-left: -20px;\n margin-top: 4px;\n}\n\n.form-actions .btn {\n margin-right: 10px;\n}\n\n.form-actions .btn:last-child {\n margin-right: 0;\n}\n\n.pane-group {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: flex;\n}\n\n.pane {\n position: relative;\n overflow-y: auto;\n flex: 1;\n border-left: 1px solid #ddd;\n}\n\n.pane:first-child {\n border-left: 0;\n}\n\n.pane-sm {\n max-width: 220px;\n min-width: 150px;\n}\n\n.pane-mini {\n width: 80px;\n flex: none;\n}\n\n.pane-one-fourth {\n width: 25%;\n flex: none;\n}\n\n.pane-one-third {\n width: 33.3%;\n}\n\nimg {\n -webkit-user-drag: text;\n}\n\n.img-circle {\n border-radius: 50%;\n}\n\n.img-rounded {\n border-radius: 4px;\n}\n\n.list-group {\n width: 100%;\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n.list-group * {\n margin: 0;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.list-group-item {\n padding: 10px;\n font-size: 12px;\n color: #414142;\n border-top: 1px solid #ddd;\n}\n\n.list-group-item:first-child {\n border-top: 0;\n}\n\n.list-group-item.active, .list-group-item.selected {\n color: #fff;\n background-color: #116cd6;\n}\n\n.list-group-header {\n padding: 10px;\n}\n\n.media-object {\n margin-top: 3px;\n}\n\n.media-object.pull-left {\n margin-right: 10px;\n}\n\n.media-object.pull-right {\n margin-left: 10px;\n}\n\n.media-body {\n overflow: hidden;\n}\n\n.nav-group {\n font-size: 14px;\n}\n\n.nav-group-item {\n padding: 2px 10px 2px 25px;\n display: block;\n color: #333;\n text-decoration: none;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.nav-group-item:active, .nav-group-item.active {\n background-color: #dcdfe1;\n}\n\n.nav-group-item .icon {\n width: 19px;\n height: 18px;\n float: left;\n color: #737475;\n margin-top: -3px;\n margin-right: 7px;\n font-size: 18px;\n text-align: center;\n}\n\n.nav-group-title {\n margin: 0;\n padding: 10px 10px 2px;\n font-size: 12px;\n font-weight: 500;\n color: #666666;\n}\n\n@font-face {\n font-family: \"photon-entypo\";\n src: url(\"../fonts/photon-entypo.eot\");\n src: url(\"../fonts/photon-entypo.eot?#iefix\") format(\"eot\"), url(\"../fonts/photon-entypo.woff\") format(\"woff\"), url(\"../fonts/photon-entypo.ttf\") format(\"truetype\");\n font-weight: normal;\n font-style: normal;\n}\n\n.icon:before {\n position: relative;\n display: inline-block;\n font-family: \"photon-entypo\";\n speak: none;\n font-size: 100%;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.icon-note:before {\n content: '\\e800';\n}\n\n/* '' */\n.icon-note-beamed:before {\n content: '\\e801';\n}\n\n/* '' */\n.icon-music:before {\n content: '\\e802';\n}\n\n/* '' */\n.icon-search:before {\n content: '\\e803';\n}\n\n/* '' */\n.icon-flashlight:before {\n content: '\\e804';\n}\n\n/* '' */\n.icon-mail:before {\n content: '\\e805';\n}\n\n/* '' */\n.icon-heart:before {\n content: '\\e806';\n}\n\n/* '' */\n.icon-heart-empty:before {\n content: '\\e807';\n}\n\n/* '' */\n.icon-star:before {\n content: '\\e808';\n}\n\n/* '' */\n.icon-star-empty:before {\n content: '\\e809';\n}\n\n/* '' */\n.icon-user:before {\n content: '\\e80a';\n}\n\n/* '' */\n.icon-users:before {\n content: '\\e80b';\n}\n\n/* '' */\n.icon-user-add:before {\n content: '\\e80c';\n}\n\n/* '' */\n.icon-video:before {\n content: '\\e80d';\n}\n\n/* '' */\n.icon-picture:before {\n content: '\\e80e';\n}\n\n/* '' */\n.icon-camera:before {\n content: '\\e80f';\n}\n\n/* '' */\n.icon-layout:before {\n content: '\\e810';\n}\n\n/* '' */\n.icon-menu:before {\n content: '\\e811';\n}\n\n/* '' */\n.icon-check:before {\n content: '\\e812';\n}\n\n/* '' */\n.icon-cancel:before {\n content: '\\e813';\n}\n\n/* '' */\n.icon-cancel-circled:before {\n content: '\\e814';\n}\n\n/* '' */\n.icon-cancel-squared:before {\n content: '\\e815';\n}\n\n/* '' */\n.icon-plus:before {\n content: '\\e816';\n}\n\n/* '' */\n.icon-plus-circled:before {\n content: '\\e817';\n}\n\n/* '' */\n.icon-plus-squared:before {\n content: '\\e818';\n}\n\n/* '' */\n.icon-minus:before {\n content: '\\e819';\n}\n\n/* '' */\n.icon-minus-circled:before {\n content: '\\e81a';\n}\n\n/* '' */\n.icon-minus-squared:before {\n content: '\\e81b';\n}\n\n/* '' */\n.icon-help:before {\n content: '\\e81c';\n}\n\n/* '' */\n.icon-help-circled:before {\n content: '\\e81d';\n}\n\n/* '' */\n.icon-info:before {\n content: '\\e81e';\n}\n\n/* '' */\n.icon-info-circled:before {\n content: '\\e81f';\n}\n\n/* '' */\n.icon-back:before {\n content: '\\e820';\n}\n\n/* '' */\n.icon-home:before {\n content: '\\e821';\n}\n\n/* '' */\n.icon-link:before {\n content: '\\e822';\n}\n\n/* '' */\n.icon-attach:before {\n content: '\\e823';\n}\n\n/* '' */\n.icon-lock:before {\n content: '\\e824';\n}\n\n/* '' */\n.icon-lock-open:before {\n content: '\\e825';\n}\n\n/* '' */\n.icon-eye:before {\n content: '\\e826';\n}\n\n/* '' */\n.icon-tag:before {\n content: '\\e827';\n}\n\n/* '' */\n.icon-bookmark:before {\n content: '\\e828';\n}\n\n/* '' */\n.icon-bookmarks:before {\n content: '\\e829';\n}\n\n/* '' */\n.icon-flag:before {\n content: '\\e82a';\n}\n\n/* '' */\n.icon-thumbs-up:before {\n content: '\\e82b';\n}\n\n/* '' */\n.icon-thumbs-down:before {\n content: '\\e82c';\n}\n\n/* '' */\n.icon-download:before {\n content: '\\e82d';\n}\n\n/* '' */\n.icon-upload:before {\n content: '\\e82e';\n}\n\n/* '' */\n.icon-upload-cloud:before {\n content: '\\e82f';\n}\n\n/* '' */\n.icon-reply:before {\n content: '\\e830';\n}\n\n/* '' */\n.icon-reply-all:before {\n content: '\\e831';\n}\n\n/* '' */\n.icon-forward:before {\n content: '\\e832';\n}\n\n/* '' */\n.icon-quote:before {\n content: '\\e833';\n}\n\n/* '' */\n.icon-code:before {\n content: '\\e834';\n}\n\n/* '' */\n.icon-export:before {\n content: '\\e835';\n}\n\n/* '' */\n.icon-pencil:before {\n content: '\\e836';\n}\n\n/* '' */\n.icon-feather:before {\n content: '\\e837';\n}\n\n/* '' */\n.icon-print:before {\n content: '\\e838';\n}\n\n/* '' */\n.icon-retweet:before {\n content: '\\e839';\n}\n\n/* '' */\n.icon-keyboard:before {\n content: '\\e83a';\n}\n\n/* '' */\n.icon-comment:before {\n content: '\\e83b';\n}\n\n/* '' */\n.icon-chat:before {\n content: '\\e83c';\n}\n\n/* '' */\n.icon-bell:before {\n content: '\\e83d';\n}\n\n/* '' */\n.icon-attention:before {\n content: '\\e83e';\n}\n\n/* '' */\n.icon-alert:before {\n content: '\\e83f';\n}\n\n/* '' */\n.icon-vcard:before {\n content: '\\e840';\n}\n\n/* '' */\n.icon-address:before {\n content: '\\e841';\n}\n\n/* '' */\n.icon-location:before {\n content: '\\e842';\n}\n\n/* '' */\n.icon-map:before {\n content: '\\e843';\n}\n\n/* '' */\n.icon-direction:before {\n content: '\\e844';\n}\n\n/* '' */\n.icon-compass:before {\n content: '\\e845';\n}\n\n/* '' */\n.icon-cup:before {\n content: '\\e846';\n}\n\n/* '' */\n.icon-trash:before {\n content: '\\e847';\n}\n\n/* '' */\n.icon-doc:before {\n content: '\\e848';\n}\n\n/* '' */\n.icon-docs:before {\n content: '\\e849';\n}\n\n/* '' */\n.icon-doc-landscape:before {\n content: '\\e84a';\n}\n\n/* '' */\n.icon-doc-text:before {\n content: '\\e84b';\n}\n\n/* '' */\n.icon-doc-text-inv:before {\n content: '\\e84c';\n}\n\n/* '' */\n.icon-newspaper:before {\n content: '\\e84d';\n}\n\n/* '' */\n.icon-book-open:before {\n content: '\\e84e';\n}\n\n/* '' */\n.icon-book:before {\n content: '\\e84f';\n}\n\n/* '' */\n.icon-folder:before {\n content: '\\e850';\n}\n\n/* '' */\n.icon-archive:before {\n content: '\\e851';\n}\n\n/* '' */\n.icon-box:before {\n content: '\\e852';\n}\n\n/* '' */\n.icon-rss:before {\n content: '\\e853';\n}\n\n/* '' */\n.icon-phone:before {\n content: '\\e854';\n}\n\n/* '' */\n.icon-cog:before {\n content: '\\e855';\n}\n\n/* '' */\n.icon-tools:before {\n content: '\\e856';\n}\n\n/* '' */\n.icon-share:before {\n content: '\\e857';\n}\n\n/* '' */\n.icon-shareable:before {\n content: '\\e858';\n}\n\n/* '' */\n.icon-basket:before {\n content: '\\e859';\n}\n\n/* '' */\n.icon-bag:before {\n content: '\\e85a';\n}\n\n/* '' */\n.icon-calendar:before {\n content: '\\e85b';\n}\n\n/* '' */\n.icon-login:before {\n content: '\\e85c';\n}\n\n/* '' */\n.icon-logout:before {\n content: '\\e85d';\n}\n\n/* '' */\n.icon-mic:before {\n content: '\\e85e';\n}\n\n/* '' */\n.icon-mute:before {\n content: '\\e85f';\n}\n\n/* '' */\n.icon-sound:before {\n content: '\\e860';\n}\n\n/* '' */\n.icon-volume:before {\n content: '\\e861';\n}\n\n/* '' */\n.icon-clock:before {\n content: '\\e862';\n}\n\n/* '' */\n.icon-hourglass:before {\n content: '\\e863';\n}\n\n/* '' */\n.icon-lamp:before {\n content: '\\e864';\n}\n\n/* '' */\n.icon-light-down:before {\n content: '\\e865';\n}\n\n/* '' */\n.icon-light-up:before {\n content: '\\e866';\n}\n\n/* '' */\n.icon-adjust:before {\n content: '\\e867';\n}\n\n/* '' */\n.icon-block:before {\n content: '\\e868';\n}\n\n/* '' */\n.icon-resize-full:before {\n content: '\\e869';\n}\n\n/* '' */\n.icon-resize-small:before {\n content: '\\e86a';\n}\n\n/* '' */\n.icon-popup:before {\n content: '\\e86b';\n}\n\n/* '' */\n.icon-publish:before {\n content: '\\e86c';\n}\n\n/* '' */\n.icon-window:before {\n content: '\\e86d';\n}\n\n/* '' */\n.icon-arrow-combo:before {\n content: '\\e86e';\n}\n\n/* '' */\n.icon-down-circled:before {\n content: '\\e86f';\n}\n\n/* '' */\n.icon-left-circled:before {\n content: '\\e870';\n}\n\n/* '' */\n.icon-right-circled:before {\n content: '\\e871';\n}\n\n/* '' */\n.icon-up-circled:before {\n content: '\\e872';\n}\n\n/* '' */\n.icon-down-open:before {\n content: '\\e873';\n}\n\n/* '' */\n.icon-left-open:before {\n content: '\\e874';\n}\n\n/* '' */\n.icon-right-open:before {\n content: '\\e875';\n}\n\n/* '' */\n.icon-up-open:before {\n content: '\\e876';\n}\n\n/* '' */\n.icon-down-open-mini:before {\n content: '\\e877';\n}\n\n/* '' */\n.icon-left-open-mini:before {\n content: '\\e878';\n}\n\n/* '' */\n.icon-right-open-mini:before {\n content: '\\e879';\n}\n\n/* '' */\n.icon-up-open-mini:before {\n content: '\\e87a';\n}\n\n/* '' */\n.icon-down-open-big:before {\n content: '\\e87b';\n}\n\n/* '' */\n.icon-left-open-big:before {\n content: '\\e87c';\n}\n\n/* '' */\n.icon-right-open-big:before {\n content: '\\e87d';\n}\n\n/* '' */\n.icon-up-open-big:before {\n content: '\\e87e';\n}\n\n/* '' */\n.icon-down:before {\n content: '\\e87f';\n}\n\n/* '' */\n.icon-left:before {\n content: '\\e880';\n}\n\n/* '' */\n.icon-right:before {\n content: '\\e881';\n}\n\n/* '' */\n.icon-up:before {\n content: '\\e882';\n}\n\n/* '' */\n.icon-down-dir:before {\n content: '\\e883';\n}\n\n/* '' */\n.icon-left-dir:before {\n content: '\\e884';\n}\n\n/* '' */\n.icon-right-dir:before {\n content: '\\e885';\n}\n\n/* '' */\n.icon-up-dir:before {\n content: '\\e886';\n}\n\n/* '' */\n.icon-down-bold:before {\n content: '\\e887';\n}\n\n/* '' */\n.icon-left-bold:before {\n content: '\\e888';\n}\n\n/* '' */\n.icon-right-bold:before {\n content: '\\e889';\n}\n\n/* '' */\n.icon-up-bold:before {\n content: '\\e88a';\n}\n\n/* '' */\n.icon-down-thin:before {\n content: '\\e88b';\n}\n\n/* '' */\n.icon-left-thin:before {\n content: '\\e88c';\n}\n\n/* '' */\n.icon-right-thin:before {\n content: '\\e88d';\n}\n\n/* '' */\n.icon-up-thin:before {\n content: '\\e88e';\n}\n\n/* '' */\n.icon-ccw:before {\n content: '\\e88f';\n}\n\n/* '' */\n.icon-cw:before {\n content: '\\e890';\n}\n\n/* '' */\n.icon-arrows-ccw:before {\n content: '\\e891';\n}\n\n/* '' */\n.icon-level-down:before {\n content: '\\e892';\n}\n\n/* '' */\n.icon-level-up:before {\n content: '\\e893';\n}\n\n/* '' */\n.icon-shuffle:before {\n content: '\\e894';\n}\n\n/* '' */\n.icon-loop:before {\n content: '\\e895';\n}\n\n/* '' */\n.icon-switch:before {\n content: '\\e896';\n}\n\n/* '' */\n.icon-play:before {\n content: '\\e897';\n}\n\n/* '' */\n.icon-stop:before {\n content: '\\e898';\n}\n\n/* '' */\n.icon-pause:before {\n content: '\\e899';\n}\n\n/* '' */\n.icon-record:before {\n content: '\\e89a';\n}\n\n/* '' */\n.icon-to-end:before {\n content: '\\e89b';\n}\n\n/* '' */\n.icon-to-start:before {\n content: '\\e89c';\n}\n\n/* '' */\n.icon-fast-forward:before {\n content: '\\e89d';\n}\n\n/* '' */\n.icon-fast-backward:before {\n content: '\\e89e';\n}\n\n/* '' */\n.icon-progress-0:before {\n content: '\\e89f';\n}\n\n/* '' */\n.icon-progress-1:before {\n content: '\\e8a0';\n}\n\n/* '' */\n.icon-progress-2:before {\n content: '\\e8a1';\n}\n\n/* '' */\n.icon-progress-3:before {\n content: '\\e8a2';\n}\n\n/* '' */\n.icon-target:before {\n content: '\\e8a3';\n}\n\n/* '' */\n.icon-palette:before {\n content: '\\e8a4';\n}\n\n/* '' */\n.icon-list:before {\n content: '\\e8a5';\n}\n\n/* '' */\n.icon-list-add:before {\n content: '\\e8a6';\n}\n\n/* '' */\n.icon-signal:before {\n content: '\\e8a7';\n}\n\n/* '' */\n.icon-trophy:before {\n content: '\\e8a8';\n}\n\n/* '' */\n.icon-battery:before {\n content: '\\e8a9';\n}\n\n/* '' */\n.icon-back-in-time:before {\n content: '\\e8aa';\n}\n\n/* '' */\n.icon-monitor:before {\n content: '\\e8ab';\n}\n\n/* '' */\n.icon-mobile:before {\n content: '\\e8ac';\n}\n\n/* '' */\n.icon-network:before {\n content: '\\e8ad';\n}\n\n/* '' */\n.icon-cd:before {\n content: '\\e8ae';\n}\n\n/* '' */\n.icon-inbox:before {\n content: '\\e8af';\n}\n\n/* '' */\n.icon-install:before {\n content: '\\e8b0';\n}\n\n/* '' */\n.icon-globe:before {\n content: '\\e8b1';\n}\n\n/* '' */\n.icon-cloud:before {\n content: '\\e8b2';\n}\n\n/* '' */\n.icon-cloud-thunder:before {\n content: '\\e8b3';\n}\n\n/* '' */\n.icon-flash:before {\n content: '\\e8b4';\n}\n\n/* '' */\n.icon-moon:before {\n content: '\\e8b5';\n}\n\n/* '' */\n.icon-flight:before {\n content: '\\e8b6';\n}\n\n/* '' */\n.icon-paper-plane:before {\n content: '\\e8b7';\n}\n\n/* '' */\n.icon-leaf:before {\n content: '\\e8b8';\n}\n\n/* '' */\n.icon-lifebuoy:before {\n content: '\\e8b9';\n}\n\n/* '' */\n.icon-mouse:before {\n content: '\\e8ba';\n}\n\n/* '' */\n.icon-briefcase:before {\n content: '\\e8bb';\n}\n\n/* '' */\n.icon-suitcase:before {\n content: '\\e8bc';\n}\n\n/* '' */\n.icon-dot:before {\n content: '\\e8bd';\n}\n\n/* '' */\n.icon-dot-2:before {\n content: '\\e8be';\n}\n\n/* '' */\n.icon-dot-3:before {\n content: '\\e8bf';\n}\n\n/* '' */\n.icon-brush:before {\n content: '\\e8c0';\n}\n\n/* '' */\n.icon-magnet:before {\n content: '\\e8c1';\n}\n\n/* '' */\n.icon-infinity:before {\n content: '\\e8c2';\n}\n\n/* '' */\n.icon-erase:before {\n content: '\\e8c3';\n}\n\n/* '' */\n.icon-chart-pie:before {\n content: '\\e8c4';\n}\n\n/* '' */\n.icon-chart-line:before {\n content: '\\e8c5';\n}\n\n/* '' */\n.icon-chart-bar:before {\n content: '\\e8c6';\n}\n\n/* '' */\n.icon-chart-area:before {\n content: '\\e8c7';\n}\n\n/* '' */\n.icon-tape:before {\n content: '\\e8c8';\n}\n\n/* '' */\n.icon-graduation-cap:before {\n content: '\\e8c9';\n}\n\n/* '' */\n.icon-language:before {\n content: '\\e8ca';\n}\n\n/* '' */\n.icon-ticket:before {\n content: '\\e8cb';\n}\n\n/* '' */\n.icon-water:before {\n content: '\\e8cc';\n}\n\n/* '' */\n.icon-droplet:before {\n content: '\\e8cd';\n}\n\n/* '' */\n.icon-air:before {\n content: '\\e8ce';\n}\n\n/* '' */\n.icon-credit-card:before {\n content: '\\e8cf';\n}\n\n/* '' */\n.icon-floppy:before {\n content: '\\e8d0';\n}\n\n/* '' */\n.icon-clipboard:before {\n content: '\\e8d1';\n}\n\n/* '' */\n.icon-megaphone:before {\n content: '\\e8d2';\n}\n\n/* '' */\n.icon-database:before {\n content: '\\e8d3';\n}\n\n/* '' */\n.icon-drive:before {\n content: '\\e8d4';\n}\n\n/* '' */\n.icon-bucket:before {\n content: '\\e8d5';\n}\n\n/* '' */\n.icon-thermometer:before {\n content: '\\e8d6';\n}\n\n/* '' */\n.icon-key:before {\n content: '\\e8d7';\n}\n\n/* '' */\n.icon-flow-cascade:before {\n content: '\\e8d8';\n}\n\n/* '' */\n.icon-flow-branch:before {\n content: '\\e8d9';\n}\n\n/* '' */\n.icon-flow-tree:before {\n content: '\\e8da';\n}\n\n/* '' */\n.icon-flow-line:before {\n content: '\\e8db';\n}\n\n/* '' */\n.icon-flow-parallel:before {\n content: '\\e8dc';\n}\n\n/* '' */\n.icon-rocket:before {\n content: '\\e8dd';\n}\n\n/* '' */\n.icon-gauge:before {\n content: '\\e8de';\n}\n\n/* '' */\n.icon-traffic-cone:before {\n content: '\\e8df';\n}\n\n/* '' */\n.icon-cc:before {\n content: '\\e8e0';\n}\n\n/* '' */\n.icon-cc-by:before {\n content: '\\e8e1';\n}\n\n/* '' */\n.icon-cc-nc:before {\n content: '\\e8e2';\n}\n\n/* '' */\n.icon-cc-nc-eu:before {\n content: '\\e8e3';\n}\n\n/* '' */\n.icon-cc-nc-jp:before {\n content: '\\e8e4';\n}\n\n/* '' */\n.icon-cc-sa:before {\n content: '\\e8e5';\n}\n\n/* '' */\n.icon-cc-nd:before {\n content: '\\e8e6';\n}\n\n/* '' */\n.icon-cc-pd:before {\n content: '\\e8e7';\n}\n\n/* '' */\n.icon-cc-zero:before {\n content: '\\e8e8';\n}\n\n/* '' */\n.icon-cc-share:before {\n content: '\\e8e9';\n}\n\n/* '' */\n.icon-cc-remix:before {\n content: '\\e8ea';\n}\n\n/* '' */\n.icon-github:before {\n content: '\\e8eb';\n}\n\n/* '' */\n.icon-github-circled:before {\n content: '\\e8ec';\n}\n\n/* '' */\n.icon-flickr:before {\n content: '\\e8ed';\n}\n\n/* '' */\n.icon-flickr-circled:before {\n content: '\\e8ee';\n}\n\n/* '' */\n.icon-vimeo:before {\n content: '\\e8ef';\n}\n\n/* '' */\n.icon-vimeo-circled:before {\n content: '\\e8f0';\n}\n\n/* '' */\n.icon-twitter:before {\n content: '\\e8f1';\n}\n\n/* '' */\n.icon-twitter-circled:before {\n content: '\\e8f2';\n}\n\n/* '' */\n.icon-facebook:before {\n content: '\\e8f3';\n}\n\n/* '' */\n.icon-facebook-circled:before {\n content: '\\e8f4';\n}\n\n/* '' */\n.icon-facebook-squared:before {\n content: '\\e8f5';\n}\n\n/* '' */\n.icon-gplus:before {\n content: '\\e8f6';\n}\n\n/* '' */\n.icon-gplus-circled:before {\n content: '\\e8f7';\n}\n\n/* '' */\n.icon-pinterest:before {\n content: '\\e8f8';\n}\n\n/* '' */\n.icon-pinterest-circled:before {\n content: '\\e8f9';\n}\n\n/* '' */\n.icon-tumblr:before {\n content: '\\e8fa';\n}\n\n/* '' */\n.icon-tumblr-circled:before {\n content: '\\e8fb';\n}\n\n/* '' */\n.icon-linkedin:before {\n content: '\\e8fc';\n}\n\n/* '' */\n.icon-linkedin-circled:before {\n content: '\\e8fd';\n}\n\n/* '' */\n.icon-dribbble:before {\n content: '\\e8fe';\n}\n\n/* '' */\n.icon-dribbble-circled:before {\n content: '\\e8ff';\n}\n\n/* '' */\n.icon-stumbleupon:before {\n content: '\\e900';\n}\n\n/* '' */\n.icon-stumbleupon-circled:before {\n content: '\\e901';\n}\n\n/* '' */\n.icon-lastfm:before {\n content: '\\e902';\n}\n\n/* '' */\n.icon-lastfm-circled:before {\n content: '\\e903';\n}\n\n/* '' */\n.icon-rdio:before {\n content: '\\e904';\n}\n\n/* '' */\n.icon-rdio-circled:before {\n content: '\\e905';\n}\n\n/* '' */\n.icon-spotify:before {\n content: '\\e906';\n}\n\n/* '' */\n.icon-spotify-circled:before {\n content: '\\e907';\n}\n\n/* '' */\n.icon-qq:before {\n content: '\\e908';\n}\n\n/* '' */\n.icon-instagram:before {\n content: '\\e909';\n}\n\n/* '' */\n.icon-dropbox:before {\n content: '\\e90a';\n}\n\n/* '' */\n.icon-evernote:before {\n content: '\\e90b';\n}\n\n/* '' */\n.icon-flattr:before {\n content: '\\e90c';\n}\n\n/* '' */\n.icon-skype:before {\n content: '\\e90d';\n}\n\n/* '' */\n.icon-skype-circled:before {\n content: '\\e90e';\n}\n\n/* '' */\n.icon-renren:before {\n content: '\\e90f';\n}\n\n/* '' */\n.icon-sina-weibo:before {\n content: '\\e910';\n}\n\n/* '' */\n.icon-paypal:before {\n content: '\\e911';\n}\n\n/* '' */\n.icon-picasa:before {\n content: '\\e912';\n}\n\n/* '' */\n.icon-soundcloud:before {\n content: '\\e913';\n}\n\n/* '' */\n.icon-mixi:before {\n content: '\\e914';\n}\n\n/* '' */\n.icon-behance:before {\n content: '\\e915';\n}\n\n/* '' */\n.icon-google-circles:before {\n content: '\\e916';\n}\n\n/* '' */\n.icon-vkontakte:before {\n content: '\\e917';\n}\n\n/* '' */\n.icon-smashing:before {\n content: '\\e918';\n}\n\n/* '' */\n.icon-sweden:before {\n content: '\\e919';\n}\n\n/* '' */\n.icon-db-shape:before {\n content: '\\e91a';\n}\n\n/* '' */\n.icon-logo-db:before {\n content: '\\e91b';\n}\n\n/* '' */\ntable {\n width: 100%;\n border: 0;\n border-collapse: separate;\n font-size: 12px;\n text-align: left;\n}\n\nthead {\n background-color: #f5f5f4;\n}\n\ntbody {\n background-color: #fff;\n}\n\n.table-striped tr:nth-child(even) {\n background-color: #f5f5f4;\n}\n\ntr:active,\n.table-striped tr:active:nth-child(even) {\n color: #fff;\n background-color: #116cd6;\n}\n\nthead tr:active {\n color: #333;\n background-color: #f5f5f4;\n}\n\nth {\n font-weight: normal;\n border-right: 1px solid #ddd;\n border-bottom: 1px solid #ddd;\n}\n\nth,\ntd {\n padding: 2px 15px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\nth:last-child,\ntd:last-child {\n border-right: 0;\n}\n\n.tab-group {\n margin-top: -1px;\n display: flex;\n border-top: 1px solid #989698;\n border-bottom: 1px solid #989698;\n}\n\n.tab-item {\n position: relative;\n flex: 1;\n padding: 3px;\n font-size: 12px;\n text-align: center;\n border-left: 1px solid #989698;\n background-color: #b8b6b8;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #b8b6b8), color-stop(100%, #b0aeb0));\n background-image: -webkit-linear-gradient(top, #b8b6b8 0%, #b0aeb0 100%);\n background-image: linear-gradient(to bottom, #b8b6b8 0%, #b0aeb0 100%);\n}\n\n.tab-item:first-child {\n border-left: 0;\n}\n\n.tab-item.active {\n background-color: #d4d2d4;\n background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #d4d2d4), color-stop(100%, #cccacc));\n background-image: -webkit-linear-gradient(top, #d4d2d4 0%, #cccacc 100%);\n background-image: linear-gradient(to bottom, #d4d2d4 0%, #cccacc 100%);\n}\n\n.tab-item .icon-close-tab {\n position: absolute;\n top: 50%;\n left: 5px;\n width: 15px;\n height: 15px;\n font-size: 15px;\n line-height: 15px;\n text-align: center;\n color: #666;\n opacity: 0;\n transition: opacity .1s linear, background-color .1s linear;\n border-radius: 3px;\n transform: translateY(-50%);\n z-index: 10;\n}\n\n.tab-item:after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n content: \"\";\n background-color: rgba(0, 0, 0, 0.08);\n opacity: 0;\n transition: opacity .1s linear;\n z-index: 1;\n}\n\n.tab-item:hover:not(.active):after {\n opacity: 1;\n}\n\n.tab-item:hover .icon-close-tab {\n opacity: 1;\n}\n\n.tab-item .icon-close-tab:hover {\n background-color: rgba(0, 0, 0, 0.08);\n}\n\n.tab-item-fixed {\n flex: none;\n padding: 3px 10px;\n}\n</FILE>\n<FILE path=\"css/electron-hero.css\">\n.window-content {\n background-color: #f0f0f0;\n}\n\n.vertical-space {\n height: 20px;\n}\n\n.form-group {\n padding: 5px;\n margin-bottom: 20px;\n}\n\n.hint-text {\n color: #999;\n padding-top: 5px;\n padding-left: 10px;\n}\n\ninput:focus {\n outline: none;\n margin: 5px;\n}\n\nlabel {\n white-space: wrap;\n height: auto;\n padding: 0px;\n margin: 0px;\n margin-bottom: 0px;\n}\n\n.form-control {\n margin: 5px;\n padding: 5px;\n margin-right: 15px;\n width: 95%;\n}\n\n.h2 {\n font-size: 16px;\n}\n\n.form-control-relative {\n width: 60%;\n}\n</FILE>\n<FILE path=\"js/menu.js\">\nvar remote = require('remote')\nvar Menu = remote.require('menu')\nvar MenuItem = remote.require('menu-item')\n\n// Build our new menu\nvar menu = new Menu()\nmenu.append(new MenuItem({\n label: 'Delete',\n click: function() {\n // Trigger an alert when menu item is clicked\n alert('Deleted')\n }\n}))\nmenu.append(new MenuItem({\n label: 'More Info...',\n click: function() {\n // Trigger an alert when menu item is clicked\n alert('Here is more information')\n }\n}))\n\n// Add the listener\ndocument.addEventListener('DOMContentLoaded', function () {\n document.querySelector('.js-context-menu').addEventListener('click', function (event) {\n menu.popup(remote.getCurrentWindow());\n })\n})\n\n</FILE>\n<FILE path=\"components/resizable_grid/resizable.js\">\nvar _table;\nvar values_changed = false;\n\nfunction resizableGrid(table) {\n\t_table = table;\n\tvar row = table.getElementsByTagName('tr')[0],\n\t\tcols = row ? row.children : undefined;\n\tif (!cols) return;\n\n\ttable.style.overflow = 'hidden';\n\n\tvar tableHeight = table.offsetHeight;\n\n\tfor (var i = 0; i < cols.length; i++) {\n\t\tvar div = createDiv(tableHeight);\n\t\tcols[i].appendChild(div);\n\t\tcols[i].style.position = 'relative';\n\t\tsetListeners(div);\n\t}\n\n\tfunction setListeners(div) {\n\t\tvar pageX, curCol, nxtCol, curColWidth, nxtColWidth;\n\n\t\tdiv.addEventListener('mousedown', function(e) {\n\t\t\tcurCol = e.target.parentElement;\n\t\t\tnxtCol = curCol.nextElementSibling;\n\t\t\tpageX = e.pageX;\n\n\t\t\tvar padding = paddingDiff(curCol);\n\n\t\t\tcurColWidth = curCol.offsetWidth - padding;\n\t\t\tif (nxtCol)\n\t\t\t\tnxtColWidth = nxtCol.offsetWidth - padding;\n\t\t});\n\n\t\tdiv.addEventListener('mouseover', function(e) {\n\t\t\te.target.style.borderRight = '2px solid #0000ff';\n\t\t})\n\n\t\tdiv.addEventListener('mouseout', function(e) {\n\t\t\te.target.style.borderRight = '';\n\t\t})\n\n\t\tdocument.addEventListener('mousemove', function(e) {\n\t\t\tif (curCol) {\n\t\t\t\tvar diffX = e.pageX - pageX;\n\n\t\t\t\tif (nxtCol)\n\t\t\t\t\tnxtCol.style.width = (nxtColWidth - (diffX)) + 'px';\n\n\t\t\t\tcurCol.style.width = (curColWidth + diffX) + 'px';\n\t\t\t\tvalues_changed = true;\n\t\t\t}\n\t\t});\n\n\t\tdocument.addEventListener('mouseup', function(e) {\n\t\t\tif (values_changed) {\n\t\t\t\tgetColumnWidths();\n\t\t\t}\n\t\t\tcurCol = undefined;\n\t\t\tnxtCol = undefined;\n\t\t\tpageX = undefined;\n\t\t\tnxtColWidth = undefined;\n\t\t\tcurColWidth = undefined;\n\t\t});\n\t}\n\n\tfunction getColumnWidths() {\n\t\tvar row = _table.getElementsByTagName('tr')[0],\n\t\t\tcols = row ? row.children : undefined;\n\t\tif (!cols) return;\n\n\t\tfor (var i = 0; i < cols.length; i++) {\n\t\t\tconsole.log(cols[i].style.width);\n\t\t}\n\n\t\tvalues_changed = false;\n\t}\n\n\tfunction createDiv(height) {\n\t\tvar div = document.createElement('div');\n\t\tdiv.style.top = 0;\n\t\tdiv.style.right = 0;\n\t\tdiv.style.width = '5px';\n\t\tdiv.style.position = 'absolute';\n\t\tdiv.style.cursor = 'col-resize';\n\t\tdiv.style.userSelect = 'none';\n\t\tdiv.style.height = height + 'px';\n\t\treturn div;\n\t}\n\n\tfunction paddingDiff(col) {\n\n\t\tif (getStyleVal(col, 'box-sizing') == 'border-box') {\n\t\t\treturn 0;\n\t\t}\n\n\t\tvar padLeft = getStyleVal(col, 'padding-left');\n\t\tvar padRight = getStyleVal(col, 'padding-right');\n\t\treturn (parseInt(padLeft) + parseInt(padRight));\n\n\t}\n\n\tfunction getStyleVal(elm, css) {\n\t\treturn (window.getComputedStyle(elm, null).getPropertyValue(css))\n\t}\n};\n</FILE>\n<FILE path=\"components/resizable_grid/resizable.css\">\nBODY {\n background-color: #ddd;\n}\n\n* {\n box-sizing: border-box;\n}\n\ntable {\n border-collapse: collapse;\n background-color: white;\n}\n\nth {\n background-color: #c0e6f7;\n}\n\ntd, th {\n /* top, right, bottom, and left */\n padding: 2px 2px 2px 5px;\n text-align: left;\n}\n\ntable, th, td {\n color: #222;\n font-size: 13px;\n}\n\ntd {\n color: #666;\n}\n\nth, tr:not(:last-child)>td {\n border-bottom: 1px solid #ddd;\n}\n\ntd:not(:first-child) {\n border-left: 1px solid #ddd;\n}\n\n.columnSelector {\n border-right: 1px solid #0000f;\n}\n\ntable {\n border: 1px solid #999;\n}\n</FILE>\n<FILE path=\"components/utils/index.js\">\n\n\n\n\nfunction getPreferences() {\n\ttry {\n\t\tvar data = fs.readFileSync('prefs.json', 'utf8');\n\t\treturn JSON.parse(data);\n\t} catch (e) {\n\t\treturn {}\n\t}\n}\n\nfunction savePreferences(prefs) {\n\ttry {\n\t\tfs.writeFileSync('prefs.json', JSON.stringify(prefs));\n\t} catch (err) {\n\t\t// An error occurred\n\t\tconsole.error(err);\n\t}\n}\n\nfunction getPreference(key) {\n\tvar prefs = getPreferences();\n\treturn prefs[key];\n}\n\nfunction savePreference(key, value) {\n\tlet prefs = getPreferences();\n\tprefs[key] = value;\n\tsavePreferences(prefs);\n}\n</FILE>"
}
] | null |
[
{
"role": "system",
"content": "You are an expert coding assistant specializing in Javascript GUI frameworks."
},
{
"role": "user",
"content": "Instruction: update app drop down when new app is installed to prevent having to CTRL-R on console\n\nOld scripts:\n<FILE path=\"index.html\">\n<!DOCTYPE html>\n<html>\n\n<head>\n <title>Electron Hero</title>\n\n <!-- Stylesheets -->\n <link rel=\"stylesheet\" href=\"css/photon.css\">\n <link rel=\"stylesheet\" href=\"css/electron-hero.css\">\n <script src=\"components/utils/index.js\"></script>\n <script src=\"contextMenu.js\"></script>\n\n <script>\n\n window.$ = window.jQuery = require('jquery');\n const fs = require('fs');\n const path = require('path');\n const ncp = require('ncp');\n const shell = require('shelljs');\n const _ = require('lodash');\n const request = require('request');\n const app = require('electron').remote.app\n const { ipcRenderer } = require('electron')\n </script>\n <script src=\"my.js\" charset=\"utf-8\"></script>\n\n <style>\n .content-pane {\n margin: 20px;\n border-left: none;\n }\n </style>\n</head>\n\n<body>\n <div class=\"window\">\n <!-- Your app's content goes inside .window-content -->\n <div class=\"window-content\">\n <div class=\"pane-group\">\n <div class=\"pane content-pane\">\n\n <div class=\"form-group\">\n <label class=\"h2\">App Spaces</label>\n <div class=\"hint-text\">App Spaces are apps you have installed from a git repo and run as-is. If you need a new app space, use \"Show in Finder\", create a new directory and then CTRL-R in electron-hero.</div>\n <div>\n <select onchange=\"appDropDownChange()\" id='customAppSpaces' class='form-control form-control-relative'>\n <option value=''>Select Space</option>\n </select>\n <button class=\"btn btn-large btn-primary\" onclick=\"runAppSpace('apps')\">Run</button>\n <button class=\"btn btn-large btn-positive\" onclick=\"openFinderWinow('apps')\">Show in Finder</button>\n </div>\n <div class=\"hint-text\">To install a new app, enter the git url and click Install</div>\n <div>\n <input type=text id='gitRepoUrl' class='form-control form-control-relative gitRepoUrl' placeholder=\"Right click for samples available\" />\n <button class=\"btn btn-large btn-positive\" onclick=\"doGitInstall()\">Install</button> \n </div>\n <br><br>\n <span id='installStatus'></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n</body>\n\n\n<script>\n $(document).ready(function() {\n let reply;\n //let homeDirectory = path.join(app.getPath('documents'), 'electron_hero_apps');\n let appSpaceHome = ipc.sendSync('getAppSpaceHome');\n\n ipcRenderer.on('updateStatus', function(event, args) {\n $('#installStatus').html(args.message);\n })\n\n reply = getSubDirectories(appSpaceHome);\n _.each(reply, function(item) {\n if (item.substr(0, 1) != '.') {\n $('#customAppSpaces').append(`<option value=\"${item}\">${item}</option>`);\n }\n })\n\n $.ajax(\"https://api.github.com/orgs/electron-hero-apps/repos\")\n .done(function(data) {\n var resp = [];\n _.each(data, function(item) {\n resp.push({\n repoUrl: item.html_url,\n repoName: item.name\n })\n })\n setupContextMenu(_.orderBy(resp, ['repoName']));\n })\n });\n</script>\n\n</html>\n</FILE>\n<FILE path=\"main.js\">\n// Modules to control application life and create native browser window\nconst {\n\tapp,\n\tBrowserWindow,\n\tdialog\n} = require('electron')\nconst path = require('path')\nconst request = require(\"request\");\nconst ipc = require('electron').ipcMain;\nconst ncp = require('ncp');\nconst rimraf = require(\"rimraf\");\n\nvar https = require('https');\nvar fs = require('fs');\nvar url = require('url');\nvar _ = require('lodash');\nvar moment = require('moment');\nvar Stream = require('stream').Transform;\nvar DecompressZip = require('decompress-zip');\nconst extract = require('extract-zip')\n\nvar mainWindow;\nvar devSpaceHome;\nvar packageName;\nvar dir;\n\n// this is used when building for publish\nvar appSpaceHome = path.join(app.getPath('documents'), 'electron_hero_apps');\n// this is used to point to the source files under source control\n//var appSpaceHome = path.join(__dirname, 'app_spaces');\n\n\nrequire('update-electron-app')();\n\nconsole.log('args');\nconsole.log(process.argv);\n\n\nlet homeRequirePath = __dirname + path.sep;\n\nipc.on('getRequirePath', (event, args) => {\n\tevent.returnValue = homeRequirePath;\n});\n\nipc.on('getAppSpaceHome', (event, args) => {\n\tevent.returnValue = appSpaceHome;\n});\n\nipc.on('getAppReference', (event, args) => {\n\tevent.returnValue = app;\n});\n\nipc.on('synMessage', (event, args) => {\n\tevent.returnValue = args;\n\tcreateDynamicWindow(args);\n});\n\nipc.on('downloadPackage', (event, args) => {\n\tevent.returnValue = 'ok';\n\tdownloadAndExtractZip(args);\n});\n\napp.on('window-all-closed', () => {\n\tapp.dock.hide();\n\tapp.quit();\n})\n\nipc.on('runDevApp', (event, args) => {\n\n\n\tconst dynamicWindow = new BrowserWindow({\n\t\twidth: 1600,\n\t\theight: 600,\n\t\twebPreferences: {\n\t\t\tnodeIntegration: true\n\t\t},\n\t\ticon: path.join(__dirname, 'icons', 'app_icon.icns')\n\n\t})\n\t// and load the index.html of the app.\n\tdynamicWindow.loadFile(args + '/index.html')\n\n\n});\n\n\nipc.on('runAppSpace', (event, args) => {\n\n\t//createDynamicWindow(args + '/index.html');\n\tvar windowInfo = JSON.parse(fs.readFileSync(path.join(args, 'mainWindow.json')));\n\tvar newWindow = new BrowserWindow(windowInfo);\n\tnewWindow.loadFile(path.join(args, 'index.html'));\n\tevent.returnValue = 'ok';\n\n});\n\n\n\n\nipc.on('setAppSpaceHome', (event, args) => {\n\tdevSpaceHome = args\n\treturn true;\n})\n\n\nfunction updateStatusMessage(message){\n\t//$('#installStatus').html(message);\n\tmainWindow.webContents.send('updateStatus', {\n\t\t'message':message\n\t})\n}\n\nfunction downloadAndExtractZip(args) {\n\tupdateStatusMessage('Checking install directory...')\n\tpackageName = args.packageName;\n\tvar url = args.url;\n\n\tdir = path.join(appSpaceHome, packageName + '');\n\tif (!fs.existsSync(dir)) {\n\t\tfs.mkdirSync(dir);\n\t}\n\n\tfs.readdir(dir, function(err, files) {\n\t\tif (err) {\n\t\t\tconsole.log(err);\n\t\t} else {\n\t\t\tif (files.length) {\n\t\t\t\tvar selection = dialog.showMessageBoxSync({\n\t\t\t\t\t'message': 'Warning',\n\t\t\t\t\t'detail': 'Directory is not empty. Cancel to abort, OK to install over existing files',\n\t\t\t\t\t'type': 'warning',\n\t\t\t\t\t'buttons': ['Cancel', 'OK'],\n\t\t\t\t\t'defaultId': 1\n\t\t\t\t})\n\t\t\t\tif (selection === 0) {\n\t\t\t\t\tupdateStatusMessage('')\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\trimraf(dir, function() {\n\t\t\t\t\t\tinstallPackage(args);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tinstallPackage(args);\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction installPackage(args) {\n\tupdateStatusMessage('Downloading package...')\n\n\tvar downloadDir = path.join(appSpaceHome, 'downloads');\n\tif (!fs.existsSync(downloadDir)) {\n\t\tfs.mkdirSync(downloadDir);\n\t};\n\t\n\ttry {\n\t\trequest(args.url)\n\t\t .pipe(fs.createWriteStream(path.join(appSpaceHome, 'downloads', 'package.zip')))\n\t\t .on('close', function () {\n\t\t console.log('File written!');\n\t\t\tdecompressZip(args);\n\t\t });\t\t\n\n\t} catch(err) {\n\t\tconsole.log(err.message);\n\t\tupdateStatusMessage('');\n\t\trimraf(downloadDir, function() {\n\t\t\trimraf(dir, function(){\n\t\t\t\tupdateStatusMessage('')\n\t\t\t\tdialog.showMessageBoxSync({\n\t\t\t\t\t'message': 'Download Error',\n\t\t\t\t\t'detail': err.message,\n\t\t\t\t\t'type': 'error'\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\t\n\t}\n}\n\nfunction decompressZip(args) {\n\tupdateStatusMessage('Extracting files...')\n\n\tpackageName = args.packageName;\n\tdir = path.join(appSpaceHome, \"downloads\");\n\n\tvar unzipper = new DecompressZip(path.join(dir, 'package.zip'));\n\n\tunzipper.on('error', function(err) {\n\t\tconsole.log(err);\n\t});\n\n\tunzipper.on('extract', function(log) {\n\n\t\tconsole.log('here in extract...')\n\t\tsetTimeout(cleanupAfterInstall,10);\n\t\t//fs.unlinkSync(path.join(dir,'package.zip'));\n\t\t//createDynamicWindow(path.join(dir,'index.html'));\n\t});\n\n\tunzipper.on('progress', function(fileIndex, fileCount) {\n\t\tconsole.log('Extracted file ' + (fileIndex + 1) + ' of ' + fileCount);\n\t\t//updateStatusMessage('Extracted file ' + (fileIndex + 1) + ' of ' + fileCount)\n\t});\n\n\n\tunzipper.extract({\n\t\tpath: dir,\n\t\tfilter: function(file) {\n\t\t\treturn file.type !== \"SymbolicLink\";\n\t\t}\n\t});\n\n}\n\nfunction cleanupAfterInstall() {\n\tupdateStatusMessage('Cleaning up files...');\n\tsourceDirectory = path.join(appSpaceHome, 'downloads', packageName + '-master');\n\tdirectory = path.join(appSpaceHome, packageName)\n\tncp.limit = 16;\n\tncp(sourceDirectory, directory, function(err) {\n\t\tif (err) {\n\t\t\treturn console.error(err);\n\t\t\tconsole.log(err);\n\t\t}\n\t\tvar resp = fs.unlinkSync(path.join(dir, 'package.zip'));\n\t\trimraf(dir, function() {\n\t\t\t//alert('App installed');\n\t\t\tupdateStatusMessage('');\n\t\t\tdialog.showMessageBoxSync({\n\t\t\t\t'message': 'App Installed',\n\t\t\t\t'type': 'info'\n\t\t\t})\n\t\t});\n\t});\n}\n\n\nfunction openMainConsole() {\n\ttry {\n\t\tmainWindow = new BrowserWindow({\n\t\t\twidth: 700,\n\t\t\theight: 400,\n\t\t\tbackgroundColor: '#f0f0f0',\n\t\t\twebPreferences: {\n\t\t\t\tpreload: path.join(__dirname, 'preload.js')\n\t\t\t},\n\t\t\twebPreferences: {\n\t\t\t\tnodeIntegration: true\n\t\t\t},\n\t\t\t//icon: path.join(__dirname, \"icon.icns\")\n\t\t})\n\n\t\t// and load the index.html of the app.\n\t\tvar dir = appSpaceHome;\n\t\tif (!fs.existsSync(dir)) {\n\t\t\tfs.mkdirSync(dir);\n\t\t\tfs.mkdirSync(path.join(dir, 'downloads'));\n\t\t}\n\t\tmainWindow.loadFile('index.html')\n\t\tapp.dock.show();\n\t\t// Open the DevTools.\n\t\t// mainWindow.webContents.openDevTools()\n\t} catch (err) {\n\t\tconsole.log(err);\n\t}\n\t\n}\n\nfunction createWindow() {\n\t// Create the browser window.\n\tconst args = process.argv;\n\tif (args.length > 1 && args[1] != '.') {\n\t\tvar appName = args[1];\n\t\tif (fs.existsSync( path.join(appSpaceHome, appName, 'mainWindow.json'))) {\n\t\t\tvar windowInfo = JSON.parse(fs.readFileSync(path.join(appSpaceHome, appName, 'mainWindow.json')));\n\t\t\tvar newWindow = new BrowserWindow(windowInfo);\n\t\t\tnewWindow.loadFile(path.join(appSpaceHome, appName, 'index.html'));\t\t\t\n\t\t} else {\n\t\t\topenMainConsole();\n\t\t}\n\n\t} else {\n\t\topenMainConsole()\n\t}\n}\n\n\n\nfunction createDynamicWindow(htmlFilename) {\n\tconst dynamicWindow = new BrowserWindow({\n\t\twidth: 1600,\n\t\theight: 600,\n\t\t// webPreferences: {\n\t\t// \tpreload: path.join(__dirname, 'preload.js')\n\t\t// },\n\t\twebPreferences: {\n\t\t\tnodeIntegration: true\n\t\t}\n\t})\n\t// and load the index.html of the app.\n\tdynamicWindow.loadFile(htmlFilename)\n\n}\n\n\n\n\n\n// This method will be called when Electron has finished\n// initialization and is ready to create browser windows.\n// Some APIs can only be used after this event occurs.\napp.whenReady().then(createWindow)\n\n// Quit when all windows are closed.\napp.on('window-all-closed', function() {\n\t// On macOS it is common for applications and their menu bar\n\t// to stay active until the user quits explicitly with Cmd + Q\n\tif (process.platform !== 'darwin') app.quit()\n})\n\napp.on('activate', function() {\n\t// On macOS it's common to re-create a window in the app when the\n\t// dock icon is clicked and there are no other windows open.\n\tif (BrowserWindow.getAllWindows().length === 0) createWindow()\n})\n\n// In this file you can include the rest of your app's specific main process\n// code. You can also put them in separate files and require them here.\n</FILE>\n<FILE path=\"package.json\">\n{\n \"name\": \"ElectronHero\",\n \"version\": \"1.0.11\",\n \"description\": \"An experiment in efficiency\",\n \"main\": \"main.js\",\n \"scripts\": {\n \"start\": \"electron-forge start\",\n \"package\": \"electron-forge package\",\n \"make\": \"electron-forge make\"\n },\n \"repository\": \"https://github.com/electron-hero/electron-hero/\",\n \"keywords\": [\n \"Electron\",\n \"quick\",\n \"start\",\n \"tutorial\",\n \"demo\"\n ],\n \"author\": \"andersjj@yahoo.com\",\n \"license\": \"CC0-1.0\",\n \"devDependencies\": {\n \"@electron-forge/cli\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-deb\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-rpm\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-squirrel\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-zip\": \"^6.0.0-beta.52\",\n \"electron\": \"^9.2.0\"\n },\n \"dependencies\": {\n \"auth0-js\": \"^9.13.2\",\n \"auth0-lock\": \"^11.23.1\",\n \"decompress-zip\": \"^0.2.2\",\n \"desktop-idle\": \"^1.3.0\",\n \"electron-squirrel-startup\": \"^1.0.0\",\n \"electron-tree-view\": \"^1.1.0\",\n \"extract-zip\": \"^2.0.0\",\n \"http\": \"0.0.1-security\",\n \"https\": \"^1.0.0\",\n \"iohook\": \"^0.6.5\",\n \"jquery\": \"^3.5.0\",\n \"js-beautify\": \"^1.11.0\",\n \"keytar\": \"^6.0.1\",\n \"lodash\": \">=4.17.19\",\n \"moment\": \"^2.24.0\",\n \"ncp\": \"^2.0.0\",\n \"path\": \"^0.12.7\",\n \"request\": \"^2.88.2\",\n \"rimraf\": \"^3.0.2\",\n \"shelljs\": \"^0.8.3\",\n \"simple-git\": \"^1.132.0\",\n \"stream\": \"0.0.2\",\n \"update-electron-app\": \"^1.5.0\",\n \"url\": \"^0.11.0\",\n \"xml-formatter\": \"^2.0.1\"\n },\n \"config\": {\n \"forge\": {\n \"packagerConfig\": {\n \"osxSign\": {\n \"identity\": \"Developer ID Application: John ANDERSON (2FJU5Q8XK6)\",\n \"hardened-runtime\": true,\n \"entitlements\": \"entitlements.plist\",\n \"entitlements-inherit\": \"entitlements.plist\",\n \"signature-flags\": \"library\"\n },\n \"osxNotarize\": {\n \"appleId\": \"info@ti-browser.com\",\n \"appleIdPassword\": \"kxec-azii-sckp-xiqm\",\n \"ascProvider\": \"JohnANDERSON299474967\",\n \"hardenedRuntime\": true\n },\n \"ignore\": [\n \"app_spaces\"\n ],\n \"icon\": \"icons/app_icon.icns\"\n },\n \"makers\": [{\n \"name\": \"@electron-forge/maker-squirrel\",\n \"config\": {\n \"name\": \"electron_hero\"\n }\n },\n {\n \"name\": \"@electron-forge/maker-zip\",\n \"platforms\": [\n \"darwin\"\n ]\n },\n {\n \"name\": \"@electron-forge/maker-deb\",\n \"config\": {}\n },\n {\n \"name\": \"@electron-forge/maker-rpm\",\n \"config\": {}\n }\n ]\n }\n }\n}\n</FILE>"
},
{
"role": "assistant",
"content": "New content:\n<FILE path=\"index.html\">\n<!DOCTYPE html>\n<html>\n\n<head>\n <title>Electron Hero</title>\n\n <!-- Stylesheets -->\n <link rel=\"stylesheet\" href=\"css/photon.css\">\n <link rel=\"stylesheet\" href=\"css/electron-hero.css\">\n <script src=\"components/utils/index.js\"></script>\n <script src=\"contextMenu.js\"></script>\n\n <script>\n\n window.$ = window.jQuery = require('jquery');\n const fs = require('fs');\n const path = require('path');\n const ncp = require('ncp');\n const shell = require('shelljs');\n const _ = require('lodash');\n const request = require('request');\n const app = require('electron').remote.app\n const { ipcRenderer } = require('electron')\n </script>\n <script src=\"my.js\" charset=\"utf-8\"></script>\n\n <style>\n .content-pane {\n margin: 20px;\n border-left: none;\n }\n </style>\n</head>\n\n<body>\n <div class=\"window\">\n <!-- Your app's content goes inside .window-content -->\n <div class=\"window-content\">\n <div class=\"pane-group\">\n <div class=\"pane content-pane\">\n\n <div class=\"form-group\">\n <label class=\"h2\">App Spaces</label>\n <div class=\"hint-text\">App Spaces are apps you have installed from a git repo and run as-is. If you need a new app space, use \"Show in Finder\", create a new directory and then CTRL-R in electron-hero.</div>\n <div>\n <select onchange=\"appDropDownChange()\" id='customAppSpaces' class='form-control form-control-relative'>\n <option value=''>Select Space</option>\n </select>\n <button class=\"btn btn-large btn-primary\" onclick=\"runAppSpace('apps')\">Run</button>\n <button class=\"btn btn-large btn-positive\" onclick=\"openFinderWinow('apps')\">Show in Finder</button>\n </div>\n <div class=\"hint-text\">To install a new app, enter the git url and click Install</div>\n <div>\n <input type=text id='gitRepoUrl' class='form-control form-control-relative gitRepoUrl' placeholder=\"Right click for samples available\" />\n <button class=\"btn btn-large btn-positive\" onclick=\"installNewApp()\">Install</button> \n </div>\n <br><br>\n <span id='installStatus'></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n</body>\n\n\n<script>\n $(document).ready(function() {\n refreshAppDropDown();\n ipcRenderer.on('updateStatus', function(event, args) {\n $('#installStatus').html(args.message);\n })\n $.ajax(\"https://api.github.com/orgs/electron-hero-apps/repos\")\n .done(function(data) {\n var resp = [];\n _.each(data, function(item) {\n resp.push({\n repoUrl: item.html_url,\n repoName: item.name\n })\n })\n setupContextMenu(_.orderBy(resp, ['repoName']));\n })\n });\n\n function refreshAppDropDown() {\n let reply;\n let appSpaceHome = ipc.sendSync('getAppSpaceHome');\n $('#customAppSpaces').empty();\n $('#customAppSpaces').append(`<option>Select Space</option>`);\n\n reply = getSubDirectories(appSpaceHome);\n _.each(reply, function(item) {\n if (item.substr(0, 1) != '.') {\n $('#customAppSpaces').append(`<option value=\"${item}\">${item}</option>`);\n }\n })\n }\n\n function installNewApp() {\n doGitInstall()\n }\n\n require('electron').ipcRenderer.on('installComplete', function(event, message) {\n console.log('event');\n refreshAppDropDown();\n });\n</script>\n\n</html>\n</FILE>\n<FILE path=\"main.js\">\n// Modules to control application life and create native browser window\nconst {\n\tapp,\n\tBrowserWindow,\n\tdialog\n} = require('electron')\nconst path = require('path')\nconst request = require(\"request\");\nconst ipc = require('electron').ipcMain;\nconst ncp = require('ncp');\nconst rimraf = require(\"rimraf\");\n\nvar https = require('https');\nvar fs = require('fs');\nvar url = require('url');\nvar _ = require('lodash');\nvar moment = require('moment');\nvar Stream = require('stream').Transform;\nvar DecompressZip = require('decompress-zip');\nconst extract = require('extract-zip')\n\nvar mainWindow;\nvar devSpaceHome;\nvar packageName;\nvar dir;\n\n// this is used when building for publish\nvar appSpaceHome = path.join(app.getPath('documents'), 'electron_hero_apps');\n// this is used to point to the source files under source control\n//var appSpaceHome = path.join(__dirname, 'app_spaces');\n\n\nrequire('update-electron-app')();\n\nconsole.log('args');\nconsole.log(process.argv);\n\n\nlet homeRequirePath = __dirname + path.sep;\n\nipc.on('getRequirePath', (event, args) => {\n\tevent.returnValue = homeRequirePath;\n});\n\nipc.on('getAppSpaceHome', (event, args) => {\n\tevent.returnValue = appSpaceHome;\n});\n\nipc.on('getAppReference', (event, args) => {\n\tevent.returnValue = app;\n});\n\nipc.on('synMessage', (event, args) => {\n\tevent.returnValue = args;\n\tcreateDynamicWindow(args);\n});\n\nipc.on('downloadPackage', (event, args) => {\n\tevent.returnValue = 'ok';\n\tdownloadAndExtractZip(args);\n});\n\napp.on('window-all-closed', () => {\n\tapp.dock.hide();\n\tapp.quit();\n})\n\nipc.on('runDevApp', (event, args) => {\n\n\n\tconst dynamicWindow = new BrowserWindow({\n\t\twidth: 1600,\n\t\theight: 600,\n\t\twebPreferences: {\n\t\t\tnodeIntegration: true\n\t\t},\n\t\ticon: path.join(__dirname, 'icons', 'app_icon.icns')\n\n\t})\n\t// and load the index.html of the app.\n\tdynamicWindow.loadFile(args + '/index.html')\n\n\n});\n\n\nipc.on('runAppSpace', (event, args) => {\n\n\t//createDynamicWindow(args + '/index.html');\n\tvar windowInfo = JSON.parse(fs.readFileSync(path.join(args, 'mainWindow.json')));\n\tvar newWindow = new BrowserWindow(windowInfo);\n\tnewWindow.loadFile(path.join(args, 'index.html'));\n\tevent.returnValue = 'ok';\n\n});\n\n\n\n\nipc.on('setAppSpaceHome', (event, args) => {\n\tdevSpaceHome = args\n\treturn true;\n})\n\n\nfunction updateStatusMessage(message){\n\t//$('#installStatus').html(message);\n\tmainWindow.webContents.send('updateStatus', {\n\t\t'message':message\n\t})\n}\n\nfunction downloadAndExtractZip(args) {\n\tupdateStatusMessage('Checking install directory...')\n\tpackageName = args.packageName;\n\tvar url = args.url;\n\n\tdir = path.join(appSpaceHome, packageName + '');\n\tif (!fs.existsSync(dir)) {\n\t\tfs.mkdirSync(dir);\n\t}\n\n\tfs.readdir(dir, function(err, files) {\n\t\tif (err) {\n\t\t\tconsole.log(err);\n\t\t} else {\n\t\t\tif (files.length) {\n\t\t\t\tvar selection = dialog.showMessageBoxSync({\n\t\t\t\t\t'message': 'Warning',\n\t\t\t\t\t'detail': 'Directory is not empty. Cancel to abort, OK to install over existing files',\n\t\t\t\t\t'type': 'warning',\n\t\t\t\t\t'buttons': ['Cancel', 'OK'],\n\t\t\t\t\t'defaultId': 1\n\t\t\t\t})\n\t\t\t\tif (selection === 0) {\n\t\t\t\t\tupdateStatusMessage('')\n\t\t\t\t\treturn false;\n\t\t\t\t} else {\n\t\t\t\t\trimraf(dir, function() {\n\t\t\t\t\t\tinstallPackage(args);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tinstallPackage(args);\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction installPackage(args) {\n\tupdateStatusMessage('Downloading package...')\n\n\tvar downloadDir = path.join(appSpaceHome, 'downloads');\n\tif (!fs.existsSync(downloadDir)) {\n\t\tfs.mkdirSync(downloadDir);\n\t};\n\t\n\ttry {\n\t\trequest(args.url)\n\t\t .pipe(fs.createWriteStream(path.join(appSpaceHome, 'downloads', 'package.zip')))\n\t\t .on('close', function () {\n\t\t console.log('File written!');\n\t\t\tdecompressZip(args);\n\t\t });\t\t\n\n\t} catch(err) {\n\t\tconsole.log(err.message);\n\t\tupdateStatusMessage('');\n\t\trimraf(downloadDir, function() {\n\t\t\trimraf(dir, function(){\n\t\t\t\tupdateStatusMessage('')\n\t\t\t\tdialog.showMessageBoxSync({\n\t\t\t\t\t'message': 'Download Error',\n\t\t\t\t\t'detail': err.message,\n\t\t\t\t\t'type': 'error'\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\t\n\t}\n}\n\nfunction decompressZip(args) {\n\tupdateStatusMessage('Extracting files...')\n\n\tpackageName = args.packageName;\n\tdir = path.join(appSpaceHome, \"downloads\");\n\n\tvar unzipper = new DecompressZip(path.join(dir, 'package.zip'));\n\n\tunzipper.on('error', function(err) {\n\t\tconsole.log(err);\n\t});\n\n\tunzipper.on('extract', function(log) {\n\n\t\tconsole.log('here in extract...')\n\t\tsetTimeout(cleanupAfterInstall,10);\n\t\t//fs.unlinkSync(path.join(dir,'package.zip'));\n\t\t//createDynamicWindow(path.join(dir,'index.html'));\n\t});\n\n\tunzipper.on('progress', function(fileIndex, fileCount) {\n\t\tconsole.log('Extracted file ' + (fileIndex + 1) + ' of ' + fileCount);\n\t\t//updateStatusMessage('Extracted file ' + (fileIndex + 1) + ' of ' + fileCount)\n\t});\n\n\n\tunzipper.extract({\n\t\tpath: dir,\n\t\tfilter: function(file) {\n\t\t\treturn file.type !== \"SymbolicLink\";\n\t\t}\n\t});\n\n}\n\nfunction cleanupAfterInstall() {\n\tupdateStatusMessage('Cleaning up files...');\n\tsourceDirectory = path.join(appSpaceHome, 'downloads', packageName + '-master');\n\tdirectory = path.join(appSpaceHome, packageName)\n\tncp.limit = 16;\n\tncp(sourceDirectory, directory, function(err) {\n\t\tif (err) {\n\t\t\treturn console.error(err);\n\t\t\tconsole.log(err);\n\t\t}\n\t\tvar resp = fs.unlinkSync(path.join(dir, 'package.zip'));\n\t\trimraf(dir, function() {\n\t\t\t//alert('App installed');\n\t\t\tupdateStatusMessage('');\n\t\t\tdialog.showMessageBoxSync({\n\t\t\t\t'message': 'App Installed',\n\t\t\t\t'detail': 'Select App from dropdown and hit Run',\n\t\t\t\t'type': 'info'\n\t\t\t})\n \t\t\tmainWindow.webContents.send('installComplete');\n\n\t\t});\n\t});\n}\n\n\nfunction openMainConsole() {\n\ttry {\n\t\tmainWindow = new BrowserWindow({\n\t\t\twidth: 700,\n\t\t\theight: 400,\n\t\t\tbackgroundColor: '#f0f0f0',\n\t\t\twebPreferences: {\n\t\t\t\tpreload: path.join(__dirname, 'preload.js')\n\t\t\t},\n\t\t\twebPreferences: {\n\t\t\t\tnodeIntegration: true\n\t\t\t},\n\t\t\t//icon: path.join(__dirname, \"icon.icns\")\n\t\t})\n\n\t\t// and load the index.html of the app.\n\t\tvar dir = appSpaceHome;\n\t\tif (!fs.existsSync(dir)) {\n\t\t\tfs.mkdirSync(dir);\n\t\t\tfs.mkdirSync(path.join(dir, 'downloads'));\n\t\t}\n\t\tmainWindow.loadFile('index.html')\n\t\tapp.dock.show();\n\t\t// Open the DevTools.\n\t\t// mainWindow.webContents.openDevTools()\n\t} catch (err) {\n\t\tconsole.log(err);\n\t}\n\t\n}\n\nfunction createWindow() {\n\t// Create the browser window.\n\tconst args = process.argv;\n\tif (args.length > 1 && args[1] != '.') {\n\t\tvar appName = args[1];\n\t\tif (fs.existsSync( path.join(appSpaceHome, appName, 'mainWindow.json'))) {\n\t\t\tvar windowInfo = JSON.parse(fs.readFileSync(path.join(appSpaceHome, appName, 'mainWindow.json')));\n\t\t\tvar newWindow = new BrowserWindow(windowInfo);\n\t\t\tnewWindow.loadFile(path.join(appSpaceHome, appName, 'index.html'));\t\t\t\n\t\t} else {\n\t\t\topenMainConsole();\n\t\t}\n\n\t} else {\n\t\topenMainConsole()\n\t}\n}\n\n\n\nfunction createDynamicWindow(htmlFilename) {\n\tconst dynamicWindow = new BrowserWindow({\n\t\twidth: 1600,\n\t\theight: 600,\n\t\t// webPreferences: {\n\t\t// \tpreload: path.join(__dirname, 'preload.js')\n\t\t// },\n\t\twebPreferences: {\n\t\t\tnodeIntegration: true\n\t\t}\n\t})\n\t// and load the index.html of the app.\n\tdynamicWindow.loadFile(htmlFilename)\n\n}\n\n\n\n\n\n// This method will be called when Electron has finished\n// initialization and is ready to create browser windows.\n// Some APIs can only be used after this event occurs.\napp.whenReady().then(createWindow)\n\n// Quit when all windows are closed.\napp.on('window-all-closed', function() {\n\t// On macOS it is common for applications and their menu bar\n\t// to stay active until the user quits explicitly with Cmd + Q\n\tif (process.platform !== 'darwin') app.quit()\n})\n\napp.on('activate', function() {\n\t// On macOS it's common to re-create a window in the app when the\n\t// dock icon is clicked and there are no other windows open.\n\tif (BrowserWindow.getAllWindows().length === 0) createWindow()\n})\n\n// In this file you can include the rest of your app's specific main process\n// code. You can also put them in separate files and require them here.\n</FILE>\n<FILE path=\"package.json\">\n{\n \"name\": \"ElectronHero\",\n \"version\": \"1.0.12\",\n \"description\": \"An experiment in efficiency\",\n \"main\": \"main.js\",\n \"scripts\": {\n \"start\": \"electron-forge start\",\n \"package\": \"electron-forge package\",\n \"make\": \"electron-forge make\"\n },\n \"repository\": \"https://github.com/electron-hero/electron-hero/\",\n \"keywords\": [\n \"Electron\",\n \"quick\",\n \"start\",\n \"tutorial\",\n \"demo\"\n ],\n \"author\": \"andersjj@yahoo.com\",\n \"license\": \"CC0-1.0\",\n \"devDependencies\": {\n \"@electron-forge/cli\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-deb\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-rpm\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-squirrel\": \"^6.0.0-beta.52\",\n \"@electron-forge/maker-zip\": \"^6.0.0-beta.52\",\n \"electron\": \"^9.2.0\"\n },\n \"dependencies\": {\n \"auth0-js\": \"^9.13.2\",\n \"auth0-lock\": \"^11.23.1\",\n \"decompress-zip\": \"^0.2.2\",\n \"desktop-idle\": \"^1.3.0\",\n \"electron-squirrel-startup\": \"^1.0.0\",\n \"electron-tree-view\": \"^1.1.0\",\n \"extract-zip\": \"^2.0.0\",\n \"http\": \"0.0.1-security\",\n \"https\": \"^1.0.0\",\n \"iohook\": \"^0.6.5\",\n \"jquery\": \"^3.5.0\",\n \"js-beautify\": \"^1.11.0\",\n \"keytar\": \"^6.0.1\",\n \"lodash\": \">=4.17.19\",\n \"moment\": \"^2.24.0\",\n \"ncp\": \"^2.0.0\",\n \"path\": \"^0.12.7\",\n \"request\": \"^2.88.2\",\n \"rimraf\": \"^3.0.2\",\n \"shelljs\": \"^0.8.3\",\n \"simple-git\": \"^1.132.0\",\n \"stream\": \"0.0.2\",\n \"update-electron-app\": \"^1.5.0\",\n \"url\": \"^0.11.0\",\n \"xml-formatter\": \"^2.0.1\"\n },\n \"config\": {\n \"forge\": {\n \"packagerConfig\": {\n \"osxSign\": {\n \"identity\": \"Developer ID Application: John ANDERSON (2FJU5Q8XK6)\",\n \"hardened-runtime\": true,\n \"entitlements\": \"entitlements.plist\",\n \"entitlements-inherit\": \"entitlements.plist\",\n \"signature-flags\": \"library\"\n },\n \"osxNotarize\": {\n \"appleId\": \"info@ti-browser.com\",\n \"appleIdPassword\": \"kxec-azii-sckp-xiqm\",\n \"ascProvider\": \"JohnANDERSON299474967\",\n \"hardenedRuntime\": true\n },\n \"ignore\": [\n \"app_spaces\"\n ],\n \"icon\": \"icons/app_icon.icns\"\n },\n \"makers\": [{\n \"name\": \"@electron-forge/maker-squirrel\",\n \"config\": {\n \"name\": \"electron_hero\"\n }\n },\n {\n \"name\": \"@electron-forge/maker-zip\",\n \"platforms\": [\n \"darwin\"\n ]\n },\n {\n \"name\": \"@electron-forge/maker-deb\",\n \"config\": {}\n },\n {\n \"name\": \"@electron-forge/maker-rpm\",\n \"config\": {}\n }\n ]\n }\n }\n}\n</FILE>"
}
] | electron-hero/electron-hero |
[
{
"role": "system",
"content": "You are an expert coding assistant specializing in Javascript GUI frameworks."
},
{
"role": "user",
"content": "Project Description: \n\nREADME:\n<<<<<<< HEAD\n# electron-quick-start\n\n**Clone and run for a quick way to see an Electron in action.**\n\nThis is a minimal Electron application based on the [Quick Start Guide](http://electron.atom.io/docs/latest/tutorial/quick-start) within the Electron documentation.\n\n**Use this app along with the [Electron API Demos](http://electron.atom.io/#get-started) app for API code examples to help you get started.**\n\nA basic Electron application needs just these files:\n\n- `package.json` - Points to the app's main file and lists its details and dependencies.\n- `main.js` - Starts the app and creates a browser window to render HTML. This is the app's **main process**.\n- `index.html` - A web page to render. This is the app's **renderer process**.\n\nYou can learn more about each of these components within the [Quick Start Guide](http://electron.atom.io/docs/latest/tutorial/quick-start).\n\n## To Use\n\nTo clone and run this repository you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line:\n\n```bash\n# Clone this repository\ngit clone https://github.com/electron/electron-quick-start\n# Go into the repository\ncd electron-quick-start\n# Install dependencies and run the app\nnpm install && npm start\n```\n\nLearn more about Electron and its API in the [documentation](http://electron.atom.io/docs/latest).\n\n#### License [CC0 (Public Domain)](LICENSE.md)\n=======\n# splayer\n>>>>>>> 46b4f6a131eb3dc6d83682f384bedf0bb26330f6\n\n\nTask: Create the file structure."
},
{
"role": "assistant",
"content": "<FILE path=\"config.ini\">\n[audio]\ndefault=Schiit USB Audio Device Analog Stereo\n\n[mediaLibrary]\npath[]=/mnt/Flac\n\n</FILE>\n<FILE path=\"package.json\">\n{\n \"name\": \"electron-quick-start\",\n \"version\": \"1.0.0\",\n \"description\": \"A minimal Electron application\",\n \"main\": \"main.js\",\n \"scripts\": {\n \"start\": \"electron main.js\",\n \"test\": \"karma start karma.conf.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/beatusvir/splayer.git\"\n },\n \"keywords\": [\n \"Electron\",\n \"music\"\n ],\n \"author\": \"Ceps\",\n \"license\": \"CC0-1.0\",\n \"bugs\": {\n \"url\": \"https://github.com/beatusvir/splayer/issues\"\n },\n \"homepage\": \"https://github.com/beatusvir/splayer#readme\",\n \"eslintConfig\": {\n \"env\": {\n \"es6\": true\n }\n },\n \"devDependencies\": {\n \"electron-prebuilt\": \"^1.2.1\",\n \"eslint\": \"^2.11.0\",\n \"jasmine\": \"^2.4.1\",\n \"jasmine-core\": \"^2.4.1\",\n \"karma\": \"^0.13.22\",\n \"karma-chrome-launcher\": \"^1.0.1\",\n \"karma-firefox-launcher\": \"^1.0.0\",\n \"karma-jasmine\": \"^1.0.2\",\n \"karma-requirejs\": \"^1.0.0\",\n \"requirejs\": \"^2.2.0\"\n },\n \"dependencies\": {\n \"av\": \"^0.4.8\",\n \"electron-debug\": \"^1.0.0\",\n \"file-api\": \"^0.10.4\",\n \"flac.js\": \"^0.2.1\",\n \"groove\": \"https://github.com/andrewrk/node-groove/tarball/master\",\n \"ini\": \"^1.3.4\",\n \"mp3\": \"^0.1.0\"\n }\n}\n\n</FILE>\n<FILE path=\"renderer.js\">\n// This file is required by the index.html file and will\n// be executed in the renderer process for that window.\n// All of the Node.js APIs are available in this process.\n\n</FILE>\n<FILE path=\"main.js\">\nconst electron = require('electron')\nrequire('electron-debug')\nconst app = electron.app\nconst BrowserWindow = electron.BrowserWindow\nconst dialog = electron.dialog\nconst groove = require('groove')\nconst fs = require('fs')\nconst ini = require('ini')\n\nconst defaultConfig = app.getPath('home') + '/.config/splayer.conf'\n\n// Keep a global reference of the window object, if you don't, the window will\n// be closed automatically when the JavaScript object is garbage collected.\nlet mainWindow\nlet miniWindow\nlet settingsWindow\n\nglobal.songs = []\nglobal.folders = []\n\nfunction loadConfig(){\n try{\n console.log(defaultConfig)\n var config = ini.parse(fs.readFileSync(defaultConfig, 'utf-8'))\n }catch(err){\n switch(err.errno){\n case -2:\n console.log('File not found, creating it')\n initConfig()\n break;\n default:\n console.log(err)\n }\n }\n}\n\ninitConfig = () => {\n var config = {}\n groove.connectSoundBackend()\n var devices = groove.getDevices()\n var defaultDevice = devices.list[devices.defaultIndex]\n console.log(defaultDevice.name)\n\n config.audio = {}\n config.audio.default = defaultDevice.name\n fs.writeFileSync(defaultConfig, ini.stringify(config))\n}\n\nupdateFolders = (folders) => {\n var config = ini.parse(fs.readFileSync(defaultConfig, 'utf-8'))\n var paths = []\n for(let i = 0; i < folders.length; i++){\n paths.push(folders[i])\n }\n config.mediaLibrary = {}\n config.mediaLibrary.path = paths\n fs.writeFileSync(defaultConfig, ini.stringify(config))\n}\n\nfunction createWindow () {\n mainWindow = new BrowserWindow({\n width: 250,\n height: 250,\n frame: false,\n maximizable: false,\n center: true\n })\n mainWindow.setMenu(null)\n mainWindow.loadURL(`file://${__dirname}/client/app/viewPlayer/player.html`)\n mainWindow.openDevTools({ detach: true })\n\n mainWindow.on('closed', function () {\n mainWindow = null\n })\n mainWindow.on('move', function () {\n // let x = mainWindow.getBounds().x\n // let y = mainWindow.getBounds().y\n // Save position\n })\n}\n\nfunction createMiniWindow () {\n miniWindow = new BrowserWindow({\n width: 250,\n height: 75,\n frame: false,\n maximizable: false,\n center: true\n })\n miniWindow.setMenu(null)\n miniWindow.loadURL(`file://${__dirname}/client/app/viewMiniPlayer/mini-player.html`)\n miniWindow.openDevTools({ detach: true })\n\n miniWindow.on('closed', function () {\n miniWindow = null\n })\n}\n\nfunction createSettingsWindow () {\n settingsWindow = new BrowserWindow({\n width: 500,\n height: 500,\n frame: false,\n maximizable: false,\n center: true\n })\n settingsWindow.setMenu(null)\n settingsWindow.loadURL(`file://${__dirname}/client/app/viewSettings/settings.html`)\n settingsWindow.openDevTools({ detach: true })\n\n settingsWindow.on('closed', function () {\n settingsWindow = null\n })\n}\n\n// This method will be called when Electron has finished\n// initialization and is ready to create browser windows.\n// Some APIs can only be used after this event occurs.\napp.on('ready', function () {\n createWindow()\n loadConfig()\n})\n\n// Quit when all windows are closed.\napp.on('window-all-closed', function () {\n // On OS X it is common for applications and their menu bar\n // to stay active until the user quits explicitly with Cmd + Q\n if (process.platform !== 'darwin') {\n app.quit()\n }\n})\n\napp.on('activate', function () {\n // On OS X it's common to re-create a window in the app when the\n // dock icon is clicked and there are no other windows open.\n if (mainWindow === null) {\n createWindow()\n }\n})\n\n// In this file you can include the rest of your app's specific main process\n// code. You can also put them in separate files and require them here.\nconst ipcMain = electron.ipcMain\nipcMain.on('close-player', function (event, args) {\n app.quit()\n})\nipcMain.on('toggle-player', function () {\n var currentWindow = BrowserWindow.getFocusedWindow()\n if (currentWindow === mainWindow) {\n mainWindow.hide()\n createMiniWindow()\n } else if (currentWindow === miniWindow) {\n miniWindow.close()\n mainWindow.show()\n }\n})\nipcMain.on('show-settings', function () {\n mainWindow.hide()\n createSettingsWindow()\n})\nipcMain.on('close-settings', function () {\n mainWindow.show()\n settingsWindow.close()\n})\nipcMain.on('set-songs', function (event, songs) {\n global.songs = songs\n})\nipcMain.on('log', function (event, args) {\n console.log(args)\n})\n\nipcMain.on('show-file-dialog', (event, arg) => {\n dialog.showOpenDialog({\n properties: ['openFile', 'openDirectory', 'multiSelections']\n }, function (result) {\n global.folders = result\n updateFolders(result)\n event.sender.send('show-file-dialog-callback', result)\n })\n})\n\nipcMain.on('play-pause', function (event, songs) {\n try {\n groove.setLogging(groove.LOG_WARNING)\n // console.log('trying to play song: ' + global.songs[0])\n // var currentFile = fs.readFileSync(songs[0])\n // var currentFile = '/mnt/Music/Adele/19/Disc 1/Best For Last.mp3'\n var currentFile = 'BestForLast.mp3'\n groove.open(currentFile, (err, file) => {\n playFile(file)\n })\n } catch (err) {\n console.log('Error in catch')\n console.log(err)\n }\n})\n\nplayFile = (file) => {\n // console.log(file.metadata())\n\n var player = groove.createPlayer()\n var playlist = groove.createPlaylist()\n\n playlist.insert(file)\n // player.attach(playlist, (err) => {\n // if (err) throw err\n // })\n// console.log(groove.getDevices())\n}\nipcMain.on('previous', function () {})\nipcMain.on('next', function () {})\nipcMain.on('stop', function () {})\n\n</FILE>\n<FILE path=\"build/config.gypi\">\n# Do not edit. File was generated by node-gyp's \"configure\" step\n{\n \"target_defaults\": {\n \"cflags\": [],\n \"default_configuration\": \"Release\",\n \"defines\": [],\n \"include_dirs\": [],\n \"libraries\": []\n },\n \"variables\": {\n \"asan\": 0,\n \"host_arch\": \"x64\",\n \"icu_gyp_path\": \"tools/icu/icu-system.gyp\",\n \"icu_small\": \"false\",\n \"node_byteorder\": \"little\",\n \"node_enable_v8_vtunejit\": \"false\",\n \"node_install_npm\": \"false\",\n \"node_no_browser_globals\": \"false\",\n \"node_prefix\": \"/usr\",\n \"node_release_urlbase\": \"\",\n \"node_shared_cares\": \"false\",\n \"node_shared_http_parser\": \"true\",\n \"node_shared_libuv\": \"true\",\n \"node_shared_openssl\": \"true\",\n \"node_shared_zlib\": \"true\",\n \"node_tag\": \"\",\n \"node_use_dtrace\": \"false\",\n \"node_use_etw\": \"false\",\n \"node_use_lttng\": \"false\",\n \"node_use_openssl\": \"true\",\n \"node_use_perfctr\": \"false\",\n \"openssl_fips\": \"\",\n \"openssl_no_asm\": 0,\n \"target_arch\": \"x64\",\n \"uv_parent_path\": \"/deps/uv/\",\n \"uv_use_dtrace\": \"false\",\n \"v8_enable_gdbjit\": 0,\n \"v8_enable_i18n_support\": 1,\n \"v8_no_strict_aliasing\": 1,\n \"v8_optimized_debug\": 0,\n \"v8_random_seed\": 0,\n \"v8_use_snapshot\": \"true\",\n \"want_separate_host_toolset\": 0,\n \"nodedir\": \"/home/ceps/.node-gyp/6.2.1\",\n \"copy_dev_lib\": \"true\",\n \"standalone_static_library\": 1\n }\n}\n\n</FILE>\n<FILE path=\"client/README.md\">\n# angular-seed — the seed for AngularJS apps\n\nThis project is an application skeleton for a typical [AngularJS](http://angularjs.org/) web app.\nYou can use it to quickly bootstrap your angular webapp projects and dev environment for these\nprojects.\n\nThe seed contains a sample AngularJS application and is preconfigured to install the Angular\nframework and a bunch of development and testing tools for instant web development gratification.\n\nThe seed app doesn't do much, just shows how to wire two controllers and views together.\n\n\n## Getting Started\n\nTo get you started you can simply clone the angular-seed repository and install the dependencies:\n\n### Prerequisites\n\nYou need git to clone the angular-seed repository. You can get git from\n[http://git-scm.com/](http://git-scm.com/).\n\nWe also use a number of node.js tools to initialize and test angular-seed. You must have node.js and\nits package manager (npm) installed. You can get them from [http://nodejs.org/](http://nodejs.org/).\n\n### Clone angular-seed\n\nClone the angular-seed repository using [git][git]:\n\n```\ngit clone https://github.com/angular/angular-seed.git\ncd angular-seed\n```\n\nIf you just want to start a new project without the angular-seed commit history then you can do:\n\n```bash\ngit clone --depth=1 https://github.com/angular/angular-seed.git <your-project-name>\n```\n\nThe `depth=1` tells git to only pull down one commit worth of historical data.\n\n### Install Dependencies\n\nWe have two kinds of dependencies in this project: tools and angular framework code. The tools help\nus manage and test the application.\n\n* We get the tools we depend upon via `npm`, the [node package manager][npm].\n* We get the angular code via `bower`, a [client-side code package manager][bower].\n\nWe have preconfigured `npm` to automatically run `bower` so we can simply do:\n\n```\nnpm install\n```\n\nBehind the scenes this will also call `bower install`. You should find that you have two new\nfolders in your project.\n\n* `node_modules` - contains the npm packages for the tools we need\n* `app/bower_components` - contains the angular framework files\n\n*Note that the `bower_components` folder would normally be installed in the root folder but\nangular-seed changes this location through the `.bowerrc` file. Putting it in the app folder makes\nit easier to serve the files by a webserver.*\n\n### Run the Application\n\nWe have preconfigured the project with a simple development web server. The simplest way to start\nthis server is:\n\n```\nnpm start\n```\n\nNow browse to the app at `http://localhost:8000/index.html`.\n\n\n\n## Directory Layout\n\n```\napp/ --> all of the source files for the application\n app.css --> default stylesheet\n components/ --> all app specific modules\n version/ --> version related components\n version.js --> version module declaration and basic \"version\" value service\n version_test.js --> \"version\" value service tests\n version-directive.js --> custom directive that returns the current app version\n version-directive_test.js --> version directive tests\n interpolate-filter.js --> custom interpolation filter\n interpolate-filter_test.js --> interpolate filter tests\n view1/ --> the view1 view template and logic\n view1.html --> the partial template\n view1.js --> the controller logic\n view1_test.js --> tests of the controller\n view2/ --> the view2 view template and logic\n view2.html --> the partial template\n view2.js --> the controller logic\n view2_test.js --> tests of the controller\n app.js --> main application module\n index.html --> app layout file (the main html template file of the app)\n index-async.html --> just like index.html, but loads js files asynchronously\nkarma.conf.js --> config file for running unit tests with Karma\ne2e-tests/ --> end-to-end tests\n protractor-conf.js --> Protractor config file\n scenarios.js --> end-to-end scenarios to be run by Protractor\n```\n\n## Testing\n\nThere are two kinds of tests in the angular-seed application: Unit tests and End to End tests.\n\n### Running Unit Tests\n\nThe angular-seed app comes preconfigured with unit tests. These are written in\n[Jasmine][jasmine], which we run with the [Karma Test Runner][karma]. We provide a Karma\nconfiguration file to run them.\n\n* the configuration is found at `karma.conf.js`\n* the unit tests are found next to the code they are testing and are named as `..._test.js`.\n\nThe easiest way to run the unit tests is to use the supplied npm script:\n\n```\nnpm test\n```\n\nThis script will start the Karma test runner to execute the unit tests. Moreover, Karma will sit and\nwatch the source and test files for changes and then re-run the tests whenever any of them change.\nThis is the recommended strategy; if your unit tests are being run every time you save a file then\nyou receive instant feedback on any changes that break the expected code functionality.\n\nYou can also ask Karma to do a single run of the tests and then exit. This is useful if you want to\ncheck that a particular version of the code is operating as expected. The project contains a\npredefined script to do this:\n\n```\nnpm run test-single-run\n```\n\n\n### End to end testing\n\nThe angular-seed app comes with end-to-end tests, again written in [Jasmine][jasmine]. These tests\nare run with the [Protractor][protractor] End-to-End test runner. It uses native events and has\nspecial features for Angular applications.\n\n* the configuration is found at `e2e-tests/protractor-conf.js`\n* the end-to-end tests are found in `e2e-tests/scenarios.js`\n\nProtractor simulates interaction with our web app and verifies that the application responds\ncorrectly. Therefore, our web server needs to be serving up the application, so that Protractor\ncan interact with it.\n\n```\nnpm start\n```\n\nIn addition, since Protractor is built upon WebDriver we need to install this. The angular-seed\nproject comes with a predefined script to do this:\n\n```\nnpm run update-webdriver\n```\n\nThis will download and install the latest version of the stand-alone WebDriver tool.\n\nOnce you have ensured that the development web server hosting our application is up and running\nand WebDriver is updated, you can run the end-to-end tests using the supplied npm script:\n\n```\nnpm run protractor\n```\n\nThis script will execute the end-to-end tests against the application being hosted on the\ndevelopment server.\n\n\n## Updating Angular\n\nPreviously we recommended that you merge in changes to angular-seed into your own fork of the project.\nNow that the angular framework library code and tools are acquired through package managers (npm and\nbower) you can use these tools instead to update the dependencies.\n\nYou can update the tool dependencies by running:\n\n```\nnpm update\n```\n\nThis will find the latest versions that match the version ranges specified in the `package.json` file.\n\nYou can update the Angular dependencies by running:\n\n```\nbower update\n```\n\nThis will find the latest versions that match the version ranges specified in the `bower.json` file.\n\n\n## Loading Angular Asynchronously\n\nThe angular-seed project supports loading the framework and application scripts asynchronously. The\nspecial `index-async.html` is designed to support this style of loading. For it to work you must\ninject a piece of Angular JavaScript into the HTML page. The project has a predefined script to help\ndo this.\n\n```\nnpm run update-index-async\n```\n\nThis will copy the contents of the `angular-loader.js` library file into the `index-async.html` page.\nYou can run this every time you update the version of Angular that you are using.\n\n\n## Serving the Application Files\n\nWhile angular is client-side-only technology and it's possible to create angular webapps that\ndon't require a backend server at all, we recommend serving the project files using a local\nwebserver during development to avoid issues with security restrictions (sandbox) in browsers. The\nsandbox implementation varies between browsers, but quite often prevents things like cookies, xhr,\netc to function properly when an html page is opened via `file://` scheme instead of `http://`.\n\n\n### Running the App during Development\n\nThe angular-seed project comes preconfigured with a local development webserver. It is a node.js\ntool called [http-server][http-server]. You can start this webserver with `npm start` but you may choose to\ninstall the tool globally:\n\n```\nsudo npm install -g http-server\n```\n\nThen you can start your own development web server to serve static files from a folder by\nrunning:\n\n```\nhttp-server -a localhost -p 8000\n```\n\nAlternatively, you can choose to configure your own webserver, such as apache or nginx. Just\nconfigure your server to serve the files under the `app/` directory.\n\n\n### Running the App in Production\n\nThis really depends on how complex your app is and the overall infrastructure of your system, but\nthe general rule is that all you need in production are all the files under the `app/` directory.\nEverything else should be omitted.\n\nAngular apps are really just a bunch of static html, css and js files that just need to be hosted\nsomewhere they can be accessed by browsers.\n\nIf your Angular app is talking to the backend server via xhr or other means, you need to figure\nout what is the best way to host the static files to comply with the same origin policy if\napplicable. Usually this is done by hosting the files by the backend server or through\nreverse-proxying the backend server(s) and webserver(s).\n\n\n## Continuous Integration\n\n### Travis CI\n\n[Travis CI][travis] is a continuous integration service, which can monitor GitHub for new commits\nto your repository and execute scripts such as building the app or running tests. The angular-seed\nproject contains a Travis configuration file, `.travis.yml`, which will cause Travis to run your\ntests when you push to GitHub.\n\nYou will need to enable the integration between Travis and GitHub. See the Travis website for more\ninstruction on how to do this.\n\n### CloudBees\n\nCloudBees have provided a CI/deployment setup:\n\n<a href=\"https://grandcentral.cloudbees.com/?CB_clickstart=https://raw.github.com/CloudBees-community/angular-js-clickstart/master/clickstart.json\">\n<img src=\"https://d3ko533tu1ozfq.cloudfront.net/clickstart/deployInstantly.png\"/></a>\n\nIf you run this, you will get a cloned version of this repo to start working on in a private git repo,\nalong with a CI service (in Jenkins) hosted that will run unit and end to end tests in both Firefox and Chrome.\n\n\n## Contact\n\nFor more information on AngularJS please check out http://angularjs.org/\n\n[git]: http://git-scm.com/\n[bower]: http://bower.io\n[npm]: https://www.npmjs.org/\n[node]: http://nodejs.org\n[protractor]: https://github.com/angular/protractor\n[jasmine]: http://jasmine.github.io\n[karma]: http://karma-runner.github.io\n[travis]: https://travis-ci.org/\n[http-server]: https://github.com/nodeapps/http-server\n\n</FILE>\n<FILE path=\"client/package.json\">\n{\n \"name\": \"angular-seed\",\n \"private\": true,\n \"version\": \"0.0.0\",\n \"description\": \"A starter project for AngularJS\",\n \"repository\": \"https://github.com/angular/angular-seed\",\n \"license\": \"MIT\",\n \"devDependencies\": {\n \"bower\": \"^1.7.7\",\n \"http-server\": \"^0.9.0\",\n \"jasmine-core\": \"^2.4.1\",\n \"karma\": \"^0.13.22\",\n \"karma-chrome-launcher\": \"^0.2.3\",\n \"karma-firefox-launcher\": \"^0.1.7\",\n \"karma-jasmine\": \"^0.3.8\",\n \"karma-junit-reporter\": \"^0.4.1\",\n \"karma-requirejs\": \"^1.0.0\",\n \"protractor\": \"^3.2.2\",\n \"requirejs\": \"^2.2.0\",\n \"shelljs\": \"^0.6.0\"\n },\n \"scripts\": {\n \"postinstall\": \"bower install\",\n \"prestart\": \"npm install\",\n \"start\": \"http-server -a localhost -p 8000 -c-1 ./app\",\n \"pretest\": \"npm install\",\n \"test\": \"karma start karma.conf.js\",\n \"test-single-run\": \"karma start karma.conf.js --single-run\",\n \"preupdate-webdriver\": \"npm install\",\n \"update-webdriver\": \"webdriver-manager update\",\n \"preprotractor\": \"npm run update-webdriver\",\n \"protractor\": \"protractor e2e-tests/protractor.conf.js\",\n \"update-index-async\": \"node -e \\\"require('shelljs/global'); sed('-i', /\\\\/\\\\/@@NG_LOADER_START@@[\\\\s\\\\S]*\\\\/\\\\/@@NG_LOADER_END@@/, '//@@NG_LOADER_START@@\\\\n' + sed(/sourceMappingURL=angular-loader.min.js.map/,'sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map','app/bower_components/angular-loader/angular-loader.min.js') + '\\\\n//@@NG_LOADER_END@@', 'app/index-async.html');\\\"\"\n }\n}\n\n</FILE>\n<FILE path=\"client/app/app.js\">\n'use strict';\n\n// Declare app level module which depends on views, and components\nvar app = angular.module('sPlayer', [])\n</FILE>\n<FILE path=\"client/app/viewPlayer/player.js\">\n//require('../../renderer.js')\napp.controller('PlayerController', ['$rootScope','$scope', 'AppService', 'SettingsService', function ($rootScope, $scope, AppService, SettingsService) {\n\n}])\n</FILE>\n<FILE path=\"client/app/viewPlayer/player.css\">\nbody {\n margin: 0;\n padding: 0;\n width: 250px;\n height: 250px;\n display: flex;\n flex-direction: column;\n align-content: center;\n align-items: center;\n -webkit-app-region: drag;\n font-family: sans-serif;\n}\n\nplaying {\n margin-top: auto;\n}\n\n.playing {\n width: 246px;\n display: flex;\n flex-direction: row;\n font-family: Arial;\n margin-top: auto;\n font-size: 0.8em;\n overflow: hidden;\n align-items: flex-end;\n padding: 0 2px 0 2px;\n}\n\ni {\n -webkit-app-region: no-drag;\n}\n\ni.clickable {\n -webkit-app-region: no-drag;\n opacity: 0.3;\n -webkit-transition: opacity 0.2s ease-in-out;\n -moz-transition: opacity 0.2s ease-in-out;\n transition: opacity 0.2s ease-in-out;\n -o-transition: opacity 0.2s ease-in-out;\n}\n\ni.clickable:hover {\n cursor: pointer;\n opacity: 0.75;\n}\n\n.background {\n position: fixed;\n z-index: -1;\n top: 0;\n left: 0;\n height: 250px;\n width: 250px;\n}\n\n.background img{\n height: 100%;\n width: 100%;\n}\n\n.playing .song, .playing .artist-album, .playing .timer {\n margin: 0;\n}\n\n.playing .song{\n line-height: 1.1em;\n max-height: 1em;\n text-overflow: ellipsis;\n overflow: hidden;\n color: white;\n text-shadow: 1px 1px 2px #666;\n}\n\n.playing .artist-album{\n color: #dfdfdf;\n text-shadow: 0 0 1px #333;\n line-height: 1.1em;\n max-height: 1em;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.playing .timer{\n color: #dfdfdf;\n text-shadow: 0 0 1px #333;\n line-height: 1em;\n max-height: 1em;\n /* Compensate border */\n margin: 0 2px 0 5px;\n}\n\n.controls{\n width: 250px;\n margin-top: 10px;\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n}\n\n</FILE>\n<FILE path=\"client/app/viewPlayer/player_test.js\">\n\n</FILE>\n<FILE path=\"client/app/viewPlayer/player.html\">\n<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"UTF-8\">\n <title>sPlayer</title>\n <link rel=\"stylesheet\" href=\"./player.css\">\n <link rel=\"stylesheet\" href=\"../bower_components/font-awesome/css/font-awesome.min.css\">\n <link rel=\"stylesheet\" href=\"../bower_components/html5-boilerplate/dist/css/normalize.css\">\n <link rel=\"stylesheet\" href=\"../bower_components/html5-boilerplate/dist/css/main.css\">\n <script src=\"../bower_components/html5-boilerplate/dist/js/vendor/modernizr-2.8.3.min.js\"></script>\n</head>\n\n<body ng-app=\"sPlayer\" ng-controller=\"PlayerController\">\n <div class=\"background\">\n <img src=\"../images/nocover.jpg\" alt=\"Cover\">\n </div>\n\n <tool-bar></tool-bar>\n <playing></playing>\n <play-controls view=\"normal\"></play-controls>\n\n <script src=\"../bower_components/angular/angular.js\"></script>\n <script src=\"../bower_components/angular-route/angular-route.js\"></script>\n <script src=\"../app.js\"></script>\n\n <script src=\"../components/version/version.js\"></script>\n <script src=\"../components/version/version-directive.js\"></script>\n <script src=\"../components/version/interpolate-filter.js\"></script>\n <script src=\"../components/playControls/play-controls.component.js\"></script>\n <script src=\"../components/toolBar/tool-bar.component.js\"></script>\n <script src=\"../components/playing/playing.component.js\"></script>\n\n <script src=\"../services/app-service.js\"></script>\n <script src=\"../services/settings-service.js\"></script>\n <script src=\"./player.js\"></script>\n</body>\n\n</html>\n</FILE>\n<FILE path=\"client/app/components/playing/playing.html\">\n <div class=\"playing\">\n <div class=\"track-info\">\n <h1 class=\"song\">Blackened</h1>\n <h3 class=\"artist-album\">Metallica / Black Album</h3>\n </div>\n <h3 class=\"timer\"><span class=\"current-time\">01:32</span> / <span class=\"total-time\">3:50</span></h3>\n </div>\n</FILE>\n<FILE path=\"client/app/components/playControls/play-controls.html\">\n<div class=\"controls\">\n <i class=\"fa fa-backward clickable\" ng-click=\"$ctrl.previous()\" aria-hidden=\"true\" alt=\"Previous Song\" title=\"Previous Song\"></i>\n <i class=\"fa fa-play clickable\" ng-click=\"$ctrl.play()\" aria-hidden=\"true\" alt=\"Play / Pause\" title=\"Play / Pause\"></i>\n <i class=\"fa fa-stop clickable\" ng-click=\"$ctrl.stop()\" aria-hidden=\"true\" alt=\"Stop\" title=\"Stop\"></i>\n <i class=\"fa fa-forward clickable\" ng-click=\"$ctrl.next()\" aria-hidden=\"true\" alt=\"Next Song\" title=\"Next Song\"></i>\n</div>\n</FILE>\n<FILE path=\"client/app/components/toolBar/tool-bar.css\">\n.tools{\n width: 246px;\n display: flex;\n flex-direction: row;\n padding: 0 2px 0 2px;\n}\n\n.tools i:first-child{\n margin-right: auto;\n}\n\n.tools i{\n opacity: 0.75;\n cursor: pointer;\n color: #c9c9c9;\n border: none;\n background-color: transparent;\n}\n\n.tools i:last-child{\n margin-left: 5px;\n}\n</FILE>\n<FILE path=\"client/app/components/toolBar/tool-bar.html\">\n<link rel=\"stylesheet\" href=\"../components/toolBar/tool-bar.css\">\n<div class=\"tools\">\n <i id=\"show-settings\" class=\"fa fa-cog clickable\" ng-click=\"$ctrl.showSettings()\" aria-hidden=\"true\" alt=\"Show Settings\" title=\"Show Settings\"></i>\n <i id=\"toggle-player\" class=\"fa fa-chevron-down clickable\" ng-click=\"$ctrl.togglePlayer()\" aria-hidden=\"true\" alt=\"Toggle Player Display\" title=\"Toggle Player Display\"></i>\n <i id=\"close-player\" class=\"fa fa-times clickable\" ng-click=\"$ctrl.closePlayer()\" aria-hidden=\"true\" alt=\"Close Player\" title=\"Close Player\"></i>\n</div>\n</FILE>\n<FILE path=\"client/app/components/version/interpolate-filter.js\">\n'use strict';\n\nangular.module('myApp.version.interpolate-filter', [])\n\n.filter('interpolate', ['version', function(version) {\n return function(text) {\n return String(text).replace(/\\%VERSION\\%/mg, version);\n };\n}]);\n\n</FILE>\n<FILE path=\"client/app/components/version/version_test.js\">\n'use strict';\n\ndescribe('myApp.version module', function() {\n beforeEach(module('myApp.version'));\n\n describe('version service', function() {\n it('should return current version', inject(function(version) {\n expect(version).toEqual('0.1');\n }));\n });\n});\n\n</FILE>\n<FILE path=\"client/app/components/version/version.js\">\n'use strict';\n\nangular.module('myApp.version', [\n 'myApp.version.interpolate-filter',\n 'myApp.version.version-directive'\n])\n\n.value('version', '0.1');\n\n</FILE>\n<FILE path=\"client/app/components/version/version-directive.js\">\n'use strict';\n\nangular.module('myApp.version.version-directive', [])\n\n.directive('appVersion', ['version', function(version) {\n return function(scope, elm, attrs) {\n elm.text(version);\n };\n}]);\n\n</FILE>\n<FILE path=\"client/app/components/version/version-directive_test.js\">\n'use strict';\n\ndescribe('myApp.version module', function() {\n beforeEach(module('myApp.version'));\n\n describe('app-version directive', function() {\n it('should print current version', function() {\n module(function($provide) {\n $provide.value('version', 'TEST_VER');\n });\n inject(function($compile, $rootScope) {\n var element = $compile('<span app-version></span>')($rootScope);\n expect(element.text()).toEqual('TEST_VER');\n });\n });\n });\n});\n\n</FILE>\n<FILE path=\"client/app/components/version/interpolate-filter_test.js\">\n'use strict';\n\ndescribe('myApp.version module', function() {\n beforeEach(module('myApp.version'));\n\n describe('interpolate filter', function() {\n beforeEach(module(function($provide) {\n $provide.value('version', 'TEST_VER');\n }));\n\n it('should replace VERSION', inject(function(interpolateFilter) {\n expect(interpolateFilter('before %VERSION% after')).toEqual('before TEST_VER after');\n }));\n });\n});\n\n</FILE>\n<FILE path=\"client/app/services/settings-service.js\">\napp.service('SettingsService', ['AppService', function(AppService){\n this.setSongs = function(newSongs){\n AppService.setSongs(newSongs)\n }\n\n this.getSongs = function(){\n return AppService.getSongs()\n }\n}])\n</FILE>\n<FILE path=\"client/app/services/app-service.js\">\n'use strict'\n\nlet ipcRenderer = require('electron').ipcRenderer\nlet remote = require('electron').remote\n\napp.factory('AppService', ['$rootScope', function ($rootScope) {\n ipcRenderer.on('show-file-dialog-callback', (event, args) => {\n $rootScope.folders = args\n $rootScope.$emit('folders-changed', args)\n })\n return {\n showSettings: () => {\n ipcRenderer.send('show-settings')\n },\n closeSettings: () => {\n ipcRenderer.send('close-settings')\n },\n closePlayer: () => {\n ipcRenderer.send('close-player')\n },\n togglePlayer: () => {\n ipcRenderer.send('toggle-player')\n },\n play: (song) => {\n ipcRenderer.send('play-pause', song)\n },\n log: (message) => {\n ipcRenderer.send('log', message)\n },setSongs: (songs) => {\n ipcRenderer.send('set-songs', songs)\n },\n getSongs: () => {\n return remote.getGlobal('songs')\n },\n showFileDialog: () => {\n ipcRenderer.send('show-file-dialog')\n }\n }\n}])\n\n</FILE>\n<FILE path=\"client/app/viewSettings/settings.css\">\nbody {\n width: 500px;\n height: 500px;\n margin: 0;\n padding: 0;\n font-family: sans-serif;\n -webkit-app-region: drag;\n}\n\n.tools{\n display: flex;\n flex-direction: row;\n width: 496px;\n padding: 0 2px 0 2px;\n height: 60px;\n}\n\nbutton {\n -webkit-app-region: no-drag;\n background-color: inherit;\n border: none;\n}\n\ninput[type=\"checkbox\"] {\n -webkit-app-region: no-drag;\n}\n\nbutton:hover {\n cursor: pointer;\n background-color: #efefef;\n text-shadow: 0 0 1px #aaa;\n}\n\nbutton:focus {\n outline: none;\n}\n\n.tools button {\n margin-left: auto;\n width: 100px;\n}\n\n.items {\n display: flex;\n flex-direction: row;\n margin: 0;\n padding: 0;\n border-bottom: 1px solid #eee;\n}\n\n.items li{\n -webkit-transition: all 0.5s ease;\n -moz-transition: all 0.5s ease;\n transition: all 0.5s ease;\n}\n\n.item-selected {\n border-bottom: 5px solid cyan;\n}\n\nli {\n -webkit-app-region: no-drag;\n list-style: none;\n padding: 20px 20px 15px 20px;\n border-bottom: 5px solid transparent;\n}\n\nli:hover {\n cursor: pointer;\n background-color: #efefef;\n text-shadow: 0 0 1px #aaa;\n}\n\n.items-content{\n border-bottom: 1px solid #eee;\n padding: 20px 20px 0 20px;\n font-size: 0.8em;\n min-height: 359px;\n}\n\n#library-content {\n display: flex;\n flex-direction: column;\n}\n\n#library-content article{\n /*border-bottom: 1px solid #efefef;*/\n padding-bottom: 20px;\n}\n\n.folders {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n}\n\n.folders-list {\n margin: 0;\n padding: 0;\n border: 1px solid #aaa;\n display: flex;\n flex-direction: column;\n width: 350px;\n height: 180px;\n overflow: hidden;\n -webkit-app-region: no-drag;\n}\n\n.folders-list li{\n overflow: hidden;\n text-overflow: ellipsis;\n padding: 5px;\n margin: 1px;\n line-height: 2em;\n height: 2em;\n}\n\n.selected {\n background-color: #efefef;\n}\n\n.folders-buttons{\n display: flex;\n flex-direction: column;\n}\n\n.folders-buttons button{\n padding: 10px;\n background-color: #efefef;\n margin-bottom: 10px;\n}\n\n.folders-buttons button:first-child:hover{\n background-color: cyan;\n}\n\n.folders-buttons button:last-child:hover{\n background-color: maroon;\n text-shadow: none;\n color: white;\n}\n\n#total-songs {\n color: #aaa;\n width: 350px;\n text-align: right;\n}\n\n#library-options {\n display: flex;\n flex-direction: column;\n}\n\n#library-options button {\n margin-top: 10px;\n padding: 5px;\n width: 150px;\n background-color: #efefef;\n}\n\n#library-options button:hover {\n background-color: cyan;\n}\n\n</FILE>\n<FILE path=\"client/app/viewSettings/settings.js\">\n'strict mode'\nconst fs = require('fs')\n\napp.controller('SettingsController', ['$rootScope','$scope', 'AppService', 'SettingsService', function ($rootScope, $scope, AppService, SettingsService) {\n $scope.extensions = ['MP3', 'FLAC']\n $scope.totalFiles = 0\n $scope.songs = SettingsService.getSongs()\n\n $scope.showContent = function (element) {\n let id = element.target.id\n let items = document.querySelectorAll('.items li')\n for (let i = 0; i < items.length; i++) {\n document.querySelector('#' + items[i].id + '-content').style.display = 'none'\n document.querySelector('#' + items[i].id).style.borderBottom = '5px solid transparent'\n }\n document.querySelector('#' + id + '-content').style.display = 'block'\n document.querySelector('#' + id).style.borderBottom = '5px solid cyan'\n }\n\n $rootScope.$on('folders-changed', (event, folders) => {\n addFolders(folders)\n })\n\n $scope.closeSettings = function () {\n AppService.closeSettings()\n }\n\n $scope.showFileDialog = function () {\n AppService.showFileDialog()\n }\n\n\n\n $scope.removeFolder = function () {\n var items = document.querySelectorAll('.folders-list li.selected')\n if (items.length <= 0) {\n alert('You need to select a folder from the left in order to remove it!')\n return\n }\n if (confirm('Are you sure you want to deleted all selected folders?')) {\n for (let i = items.length - 1; i >= 0; i--) {\n if (items[i].className == 'selected') {\n document.querySelector('.folders-list').removeChild(items[i])\n }\n }\n var itemsLeft = document.querySelectorAll('.folders-list li')\n $scope.songs = []\n SettingsService.setSongs($scope.songs)\n\n for (let i = 0; i < itemsLeft.length; i++) {\n var currentItem = document.getElementById(itemsLeft[i].id)\n processFolder(currentItem.innerHTML)\n }\n }\n }\n\n function toggleSelected (id) {\n var currentItem = document.getElementById(id)\n if (currentItem.className == 'selected') {\n currentItem.className = ''\n } else {\n currentItem.className = 'selected'\n }\n }\n\n function addFolders (folders) {\n var folderList = document.querySelector('.folders-list')\n for (let i = 0; i < folders.length; i++) {\n let newItem = document.createElement('li')\n newItem.innerHTML = folders[i]\n newItem.id = 'folder-' + i\n newItem.setAttribute('title', folders[i])\n newItem.addEventListener('click', function () {\n toggleSelected(newItem.id)\n })\n folderList.appendChild(newItem)\n }\n updateSongs(folders)\n }\n\n function updateSongs (folders) {\n for (let i = 0; i < folders.length; i++) {\n processFolder(folders[i])\n }\n }\n\n function processFolder (folder) {\n var folderSeparator = ''\n if (folder.indexOf('/') >= 0) {\n folderSeparator = '/'\n } else {\n folderSeparator = '\\\\'\n }\n var files = fs.readdir(folder, function (err, files) {\n for (var index in files) {\n try {\n var currentFile = folder + folderSeparator + files[index]\n if (fs.lstatSync(currentFile).isDirectory()) {\n processFolder(currentFile)\n } else {\n if ($scope.extensions.indexOf(getExtension(currentFile).toUpperCase()) >= 0) {\n $scope.songs.push(currentFile)\n }\n }\n $scope.$apply()\n } catch (err) {\n AppService.log(err.message)\n }\n }\n SettingsService.setSongs($scope.songs)\n })\n }\n\n function getExtension (file) {\n return file.substr(file.lastIndexOf('.') + 1).trim()\n }\n}])\n\n</FILE>\n<FILE path=\"client/app/viewSettings/settings_test.js\">\ndescribe('Calculator', function() {\n\n beforeEach(module('sPlayer'))\n\n\tit('should create extensions', inject(function($controller){\n var scope = {}\n var ctrl = $controller('SettingsController', {$scope: scope})\n\n expect(scope.extensions.length).toBe(2)\n\n }))\n\n})\n\n</FILE>\n<FILE path=\"client/app/viewSettings/settings.html\">\n<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"UTF-8\">\n <title>Settings</title>\n <link rel=\"stylesheet\" href=\"./settings.css\">\n</head>\n\n<body ng-app=\"sPlayer\" ng-controller=\"SettingsController\">\n <ul class=\"items\" ng-click=\"showContent($event)\">\n <li id=\"library\" class=\"item-selected\">Library</li>\n <li id=\"playlist\">Playlist</li>\n <li id=\"audio\">Audio</li>\n </ul>\n <div class=\"items-content\">\n <div id=\"library-content\">\n <article>\n <p>Add or remove folders to your library</p>\n <div class=\"folders\">\n <ul class=\"folders-list\">\n </ul>\n <div class=\"folders-buttons\">\n <button id=\"buttonAdd\" ng-click=\"showFileDialog()\">Add</button>\n <button id=\"buttonRemove\" ng-click=\"removeFolder()\">Remove</button>\n </div>\n </div>\n </article>\n <article id=\"total-songs\">\n Total songs ({{ songs.length }})\n </article>\n <article id=\"library-options\">\n <div>\n <input type=\"checkbox\"> Monitor library folders\n </div>\n <button id=\"buttonReScan\" title=\"Update library\">Re-Scan folders</button>\n </article>\n </div>\n <div id=\"audio-content\" style=\"display: none;\">\n <p>Audio</p>\n Lorem ipsum dolor sit amet, consectetur adipisicing elit. Exercitationem tenetur, quidem. Doloremque delectus, accusantium\n quos. Mollitia, similique, iusto. Est minima earum adipisci quam numquam sed. Officiis, placeat excepturi tenetur voluptates!\n </div>\n <div id=\"playlist-content\" style=\"display: none;\">\n <ul class=\"albums\">\n <li>\n Album / Some artist\n <ul class=\"songs\">\n <li>\n Some song\n </li>\n </ul>\n </li>\n </ul>\n </div>\n </div>\n <div class=\"tools\">\n <button ng-click=\"closeSettings()\">Close</button>\n </div>\n <script src=\"../bower_components/angular/angular.js\"></script>\n <script src=\"../bower_components/angular-route/angular-route.js\"></script>\n <script src=\"../app.js\"></script>\n <script src=\"../components/version/version.js\"></script>\n <script src=\"../components/version/version-directive.js\"></script>\n <script src=\"../components/version/interpolate-filter.js\"></script>\n\n <script src=\"../services/app-service.js\"></script>\n <script src=\"../services/settings-service.js\"></script>\n <script src=\"settings.js\"></script>\n</body>\n\n</html>\n\n</FILE>\n<FILE path=\"client/app/viewMiniPlayer/mini-player.js\">\n//require('../../renderer.js')\napp.controller('MiniPlayerController', ['$scope', function ($scope) {\n\n\n}])\n\n</FILE>\n<FILE path=\"client/app/viewMiniPlayer/mini-player_test.js\">\n\n</FILE>\n<FILE path=\"client/app/viewMiniPlayer/mini-player.html\">\n<!DOCTYPE html>\n<html>\n\n<head>\n <meta charset=\"UTF-8\">\n <title>sPlayer</title>\n <link rel=\"stylesheet\" href=\"mini-player.css\">\n <link rel=\"stylesheet\" href=\"http://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css\">\n</head>\n\n<body ng-app=\"sPlayer\" ng-controller=\"MiniPlayerController\">\n <div class=\"background\">\n <img src=\"../images/nocover.jpg\" alt=\"Cover\">\n </div>\n\n <tool-bar></tool-bar>\n <playing></playing>\n <play-controls view=\"mini\"></play-controls>\n\n <script src=\"../bower_components/angular/angular.js\"></script>\n <script src=\"../bower_components/angular-route/angular-route.js\"></script>\n <script src=\"../app.js\"></script>\n <script src=\"../components/version/version.js\"></script>\n <script src=\"../components/version/version-directive.js\"></script>\n <script src=\"../components/version/interpolate-filter.js\"></script>\n\n <script src=\"../components/playControls/play-controls.component.js\"></script>\n <script src=\"../components/toolBar/tool-bar.component.js\"></script>\n <script src=\"../components/playing/playing.component.js\"></script>\n\n <script src=\"./mini-player.js\"></script>\n</body>\n\n</html>\n\n</FILE>\n<FILE path=\"client/app/viewMiniPlayer/mini-player.css\">\nbody{\n margin: 0;\n padding: 0;\n width: 250px;\n height: 75px;\n display: flex;\n flex-direction: column;\n align-content: center;\n align-items: center;\n -webkit-app-region: drag;\n font-family: sans-serif;\n}\n\ni {\n -webkit-app-region: no-drag;\n}\n\ni.clickable {\n -webkit-app-region: no-drag;\n opacity: 0.3;\n -webkit-transition: opacity 0.2s ease-in-out;\n -moz-transition: opacity 0.2s ease-in-out;\n -o-transition: opacity 0.2s ease-in-out;\n transition: opacity 0.2s ease-in-out;\n}\n\ni.clickable:hover {\n cursor: pointer;\n opacity: 0.75;\n}\n\n.background {\n position: fixed;\n z-index: -1;\n top: 0;\n left: 0;\n height: 75px;\n width: 250px;\n}\n\n.background img{\n height: 75px;\n width: 75px;\n}\n\n.playing {\n width: 169px;\n margin-left: 77px;\n display: flex;\n flex-direction: row;\n font-family: Arial;\n margin-top: auto;\n font-size: 0.6em;\n overflow: hidden;\n align-items: flex-end;\n padding: 0 2px 0 2px;\n}\n\n.playing .song, .playing .artist-album, .playing .timer {\n margin: 0;\n}\n\n.playing .song{\n line-height: 1.1em;\n max-height: 1em;\n text-overflow: ellipsis;\n overflow: hidden;\n color: white;\n text-shadow: 1px 1px 2px #666;\n}\n\n.playing .artist-album{\n color: #dfdfdf;\n text-shadow: 0 0 1px #333;\n line-height: 1.1em;\n max-height: 1em;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.playing .timer{\n color: #dfdfdf;\n text-shadow: 0 0 1px #333;\n line-height: 1em;\n max-height: 1em;\n /* Compensate border */\n margin: 0 2px 0 5px;\n}\n\n.controls{\n width: 175px;\n margin-left: 75px;\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n margin-top: 10px;\n}\n\n</FILE>\n<FILE path=\"client/e2e-tests/scenarios.js\">\n'use strict';\n\n/* https://github.com/angular/protractor/blob/master/docs/toc.md */\n\ndescribe('my app', function() {\n\n\n it('should automatically redirect to /view1 when location hash/fragment is empty', function() {\n browser.get('index.html');\n expect(browser.getLocationAbsUrl()).toMatch(\"/view1\");\n });\n\n\n describe('view1', function() {\n\n beforeEach(function() {\n browser.get('index.html#!/view1');\n });\n\n\n it('should render view1 when user navigates to /view1', function() {\n expect(element.all(by.css('[ng-view] p')).first().getText()).\n toMatch(/partial for view 1/);\n });\n\n });\n\n\n describe('view2', function() {\n\n beforeEach(function() {\n browser.get('index.html#!/view2');\n });\n\n\n it('should render view2 when user navigates to /view2', function() {\n expect(element.all(by.css('[ng-view] p')).first().getText()).\n toMatch(/partial for view 2/);\n });\n\n });\n});\n\n</FILE>"
}
] | null |
[
{
"role": "system",
"content": "You are an expert coding assistant specializing in Javascript GUI frameworks."
},
{
"role": "user",
"content": "Project Description: \n\nREADME:\n# Alaun\nA simple Google Play Music standalone app with Discord integration\n\nWhen not playing:\n\n\n\nWhen playing a song:\n\n\n\n\n## Installation\n\n### Via Git\n```bash\ngit clone https://github.com/afroraydude/alaun\n\ncd alaun\n\nnpm install\n\nnpm start\n```\n\n## Building to executable\nWindows:\n```powershell\n$env:ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES = 'true'\n\nelectron-builder --win\n```\n\nLinux:\n```bash\n#!/bin/bash\nexport ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true\n\nelectron-builder -l\n```\n\n## Credits\nPlay button icon made by Appzgear\n\nTask: Create the file structure."
},
{
"role": "assistant",
"content": "<FILE path=\"shortcutRegister.js\">\n// Import required scripts\nconst { globalShortcut } = require('electron')\n\n// Create global shortcuts for use when app is not focused\nconst registerShortcuts = (mainWindow) => {\n globalShortcut.register('MediaNextTrack', () => {\n mainWindow.webContents.executeJavaScript('window.skip()')\n })\n globalShortcut.register('MediaPreviousTrack', () => {\n mainWindow.webContents.executeJavaScript('window.rewind()')\n })\n globalShortcut.register('MediaStop', () => {\n mainWindow.webContents.executeJavaScript('window.playPause()')\n })\n globalShortcut.register('MediaPlayPause', () => {\n mainWindow.webContents.executeJavaScript('window.playPause()')\n })\n}\n\nmodule.exports = registerShortcuts\n\n</FILE>\n<FILE path=\"discordRPC.js\">\n// Import required scripts\nconst DiscordRPC = require('discord-rpc')\nconst { ipcMain } = require('electron')\n\nlet rpc\n\n// Set Discord Rich Presence activity\nasync function setActivity (state, details) {\n if (!rpc) {\n return\n }\n\n const startTimestamp = new Date()\n\n rpc.setActivity({\n details: details,\n state: state,\n startTimestamp,\n largeImageKey: 'default-icon',\n largeImageText: 'App Running',\n smallImageKey: (state === 'In song') ? 'play-button' : 'default-icon', // only use play button if song is playing\n smallImageText: 'App Running',\n instance: false\n })\n}\n\n// Startup Discord system\nconst init = () => {\n\n // Discord API client ID\n const clientId = '544286545440669734'\n\n // Intialize up Discord Rich Presence connection object\n DiscordRPC.register(clientId)\n rpc = new DiscordRPC.Client({ transport: 'ipc' })\n\n // When connected, set activity\n rpc.on('ready', () => {\n setActivity('Idle', 'Nothing Playing')\n })\n \n // Connect to local Discord instance\n rpc.login({ clientId }).catch(console.error)\n\n // Used for communication with the Browser Window\n ipcMain.on('rpc-request', function (event, type, arg) {\n let title = arg.replace(' - Google Play Music', '') // Remove 'Google Play Music' from title\n let titleSplit = title.split('-') // Get sections of new title\n if (titleSplit.length > 1) {\n setActivity('In song', title) // Show what song the user is playing\n } else setActivity('In menu') // Show that the user is between songs/not playing music\n }) \n}\n\nmodule.exports = init\n\n</FILE>\n<FILE path=\"package.json\">\n{\n \"name\": \"Alaun\",\n \"version\": \"0.0.1\",\n \"description\": \"A Google Play Music standalone app with Discord support\",\n \"main\": \"main.js\",\n \"scripts\": {\n \"start\": \"electron .\"\n },\n \"repository\": \"https://github.com/afroraydude/alaun\",\n \"keywords\": [\n \"Electron\",\n \"Google\",\n \"Play\",\n \"Music\",\n \"Discord\"\n ],\n \"author\": \"GitHub\",\n \"license\": \"Apache-2.0\",\n \"devDependencies\": {\n \"electron\": \"^4.0.3\",\n \"electron-builder\": \"^20.38.5\"\n },\n \"dependencies\": {\n \"discord-rpc\": \"^3.0.1\",\n \"dotenv\": \"^6.2.0\"\n },\n \"build\": {\n \"appId\": \"com.afroraydude.alaun\",\n \"productName\": \"Alaun\",\n \"copyright\": \"Copyright © 2019 afroraydude\",\n \"files\": [\"**/*\", \"build/icon.*\"]\n }\n}\n\n</FILE>\n<FILE path=\"renderer.js\">\nconst { ipcRenderer } = require('electron')\n\nfunction sendTitleUpdate (title) {\n ipcRenderer.send('rpc-request', 'rpc', title)\n}\n\nwindow.sendTitleUpdate = sendTitleUpdate\n\n</FILE>\n<FILE path=\"inject.js\">\nvar target = document.querySelector('title')\n\n// create an observer instance\nvar observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n window.sendTitleUpdate(mutation.target.innerHTML)\n })\n})\n\n// configuration of the observer:\nvar config = { attributes: true, childList: true, characterData: true }\n\n// pass in the target node, as well as the observer options\nobserver.observe(target, config)\n\n// Function to handle playing/pausing\nfunction PlayPause() {\n var button = document.getElementById('player-bar-play-pause')\n button.click()\n}\n\n// function to handle rewinding\nfunction Rewind() {\n var button = document.getElementById('player-bar-rewind')\n button.click()\n}\n\n// function to handle skipping\nfunction Skip() {\n var button = document.getElementById('player-bar-forward')\n button.click()\n}\n\n// Attach the above functions to the browser window\nwindow.playPause = PlayPause\nwindow.rewind = Rewind\nwindow.skip = Skip\n\n</FILE>\n<FILE path=\"main.js\">\n// Import required scripts\nconst { app, BrowserWindow, globalShortcut, Menu, MenuItem, Tray } = require('electron')\nconst path = require('path')\nconst fs = require('fs')\nrequire('dotenv').config()\nconst shorcutReigster = require('./shortcutRegister')\nconst discordRPC = require('./discordRPC')\n\n// Create Main Window object\nlet mainWindow\n\n// Create and register new menu\nconst menu = new Menu()\n\n// For use with window closing\nlet playerIsShowing = false\nlet playerIsQuiting = false\n\n// Initialize Main Window\nfunction createWindow () {\n mainWindow = new BrowserWindow({ \n width: 1280,\n height: 720,\n webPreferences: {\n preload: path.join(__dirname, 'renderer.js'), // Used for IPC/Communication with main process\n nodeIntegration: false, // Don't let the website touch the user's PC!!!!!!!\n sandbox: true, // Put the app into a sandbox (more security)\n contextIsolation: false // Allow the preload script to touch the Electron/NodeJS libs\n }\n })\n\n // Go to Google Play Music's website\n mainWindow.loadURL('http://play.google.com/music/listen')\n\n // Only open the dev tools automatically if the app is in dev mode\n if (process.env.isDev) mainWindow.webContents.openDevTools()\n\n // The app is definately showing now\n playerIsShowing = true\n\n // Handle closing event\n mainWindow.on('close', (e) => {\n console.log(playerIsQuiting)\n if (playerIsQuiting) {\n e.returnValue = playerIsQuiting\n } else {\n mainWindow.hide()\n playerIsShowing = false\n }\n })\n\n // Kill everything when closed\n mainWindow.on('closed', () => {\n mainWindow = null\n })\n\n // When app fully loaded, inject our custom script\n mainWindow.webContents.once('dom-ready', () => {\n const inject = fs.readFileSync(path.join(__dirname, 'inject.js'), { encoding: 'utf8' }) // Our custom script\n mainWindow.webContents.executeJavaScript(inject) // Inject\n })\n}\n\napp.on('ready', () => {\n createWindow() // Initialize window\n const fileMenu = new Menu() // Create a submenu\n fileMenu.append(new MenuItem({\n label: 'Play/Pause',\n accelerator: 'MediaPlayPause',\n click: () => {\n console.log('MediaPlayPause')\n mainWindow.webContents.executeJavaScript('window.playPause()')\n }\n }))\n fileMenu.append(new MenuItem({\n label: 'Next Track',\n accelerator: 'MediaNextTrack',\n click: () => {\n mainWindow.webContents.executeJavaScript('window.skip()')\n }\n }))\n fileMenu.append(new MenuItem({\n label: 'Previous Track',\n accelerator: 'MediaPreviousTrack',\n click: () => {\n mainWindow.webContents.executeJavaScript('window.rewind()')\n }\n }))\n fileMenu.append(new MenuItem({\n label: 'Toggle Player Window',\n click: () => {\n if (playerIsShowing) mainWindow.hide()\n else mainWindow.show()\n playerIsShowing = !playerIsShowing\n }\n }))\n fileMenu.append(new MenuItem({\n label: 'Close',\n accelerator: 'CmdOrCtrl+Q',\n click: () => {\n playerIsQuiting = true\n mainWindow.close()\n app.quit()\n }\n }))\n\n // Add submenu to menu\n menu.append(new MenuItem({\n label: 'File',\n submenu: fileMenu\n }))\n\n // Create System Tray item\n let trayIcon = path.join(__dirname, 'icon.tray.png')\n let tray = new Tray(trayIcon)\n tray.setContextMenu(fileMenu)\n\n // Register our custom menu as the app's menu\n Menu.setApplicationMenu(menu)\n\n // Load shortcuts\n shorcutReigster(mainWindow)\n\n // Boot up Discord Rich Presence integration\n discordRPC()\n})\n\n// Close app if all windows closed\napp.on('window-all-closed', function () {\n if (process.platform !== 'darwin') {\n app.quit()\n }\n})\n\napp.on('activate', function () {\n if (mainWindow === null) {\n createWindow()\n }\n})\n\n// Unregister all shortcuts if the app is done\napp.on('will-quit', () => {\n globalShortcut.unregisterAll()\n})\n</FILE>"
}
] | null |
[{"role":"system","content":"You are an expert coding assistant specializing in Javascript GUI frame(...TRUNCATED) | null |
[{"role":"system","content":"You are an expert coding assistant specializing in Javascript GUI frame(...TRUNCATED) | null |
[{"role":"system","content":"You are an expert coding assistant specializing in Javascript GUI frame(...TRUNCATED) | nickduskey/electron-messages |
[{"role":"system","content":"You are an expert coding assistant specializing in Javascript GUI frame(...TRUNCATED) | null |
[{"role":"system","content":"You are an expert coding assistant specializing in Javascript GUI frame(...TRUNCATED) | null |
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 67