diff --git a/README.md b/README.md index 0fc3222..5b76e5c 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ # Electron Sample Apps This repository contains Electron sample apps to illustrate the usage of -[Electron APIs](https://github.com/atom/electron/tree/master/docs). +[Electron APIs](https://github.com/electron/electron/tree/master/docs). These sample apps are migrated from [nw-sample-apps](https://github.com/zcbenz/nw-sample-apps), [chrome-app-sample](https://github.com/GoogleChrome/chrome-app-samples) and [chromium extensions examples](https://code.google.com/p/chromium/codesearch#chromium/src/chrome/common/extensions/docs/examples/&sq=package:chromium&type=cs). -All the sample test on v0.30.2. +All samples are test on Electron v1.1.1. ## How to run apps -1. Install Electron via `npm install -g electron-prebuilt`. +1. Install Electron via `npm install -g electron-prebuilt@1.1.1`. 2. Run the sample via `electron /`. If you want to know more about Electron app's development, please refer to the -[official docs](https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md). +[official docs](https://github.com/electron/electron/blob/master/docs/tutorial/quick-start.md). ## License diff --git a/camera/main.js b/camera/main.js index 502e73c..c03e732 100644 --- a/camera/main.js +++ b/camera/main.js @@ -1,33 +1,27 @@ -var app = require('app'); // Module to control application life. -var BrowserWindow = require('browser-window'); // Module to create native browser window. - -// Report crashes to our server. -require('crash-reporter').start(); - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow = null; - -// Quit when all windows are closed. -app.on('window-all-closed', function() { - if (process.platform != 'darwin') - app.quit(); -}); - -// This method will be called when Electron has done everything -// initialization and ready for creating browser windows. -app.on('ready', function() { - // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600}); - - // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - - // Emitted when the window is closed. - mainWindow.on('closed', function() { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - mainWindow = null; - }); -}); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + if (process.platform != 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width: 800, height: 600}); + + // and load the index.html of the app. + mainWindow.loadURL('file://' + __dirname + '/index.html'); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); diff --git a/camera/package.json b/camera/package.json index cb592ae..76b55c3 100644 --- a/camera/package.json +++ b/camera/package.json @@ -1,5 +1,5 @@ { "name" : "camera-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/client-certificate/main.js b/client-certificate/main.js index ddd210d..da3b2c0 100644 --- a/client-certificate/main.js +++ b/client-certificate/main.js @@ -1,21 +1,20 @@ -var app = require('app'); -var BrowserWindow = require('browser-window'); - -var mainWindow = null; - -app.on('window-all-closed', function() { - if (process.platform != 'darwin') - app.quit(); -}); - -//app.commandLine.appendSwitch('client-certificate', - //'X:\\workspace\\client-certificates\\ssl\\client.crt'); - -app.on('ready', function() { - mainWindow = new BrowserWindow({ - 'width': 800, - 'height': 600, - }); - - mainWindow.loadUrl('https://localhost:5000'); -}); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; + +app.on('window-all-closed', function() { + if (process.platform != 'darwin') + app.quit(); +}); + +//app.commandLine.appendSwitch('client-certificate', + //'path/to/client-certificates/ssl/client.crt'); + +app.on('ready', function() { + mainWindow = new BrowserWindow({ + 'width': 800, + 'height': 600, + }); + + mainWindow.loadURL('https://localhost:5000'); +}); diff --git a/client-certificate/package.json b/client-certificate/package.json index cf40f45..c7b7a9c 100644 --- a/client-certificate/package.json +++ b/client-certificate/package.json @@ -1,5 +1,5 @@ -{ - "name" : "client-certificate-demo", - "version" : "0.1.0", - "main" : "main.js" -} +{ + "name" : "client-certificate-demo", + "version" : "1.1.0", + "main" : "main.js" +} diff --git a/client-certificate/server.js b/client-certificate/server.js index 98700b6..8fb469e 100644 --- a/client-certificate/server.js +++ b/client-certificate/server.js @@ -1,21 +1,21 @@ -var https = require('https'); -var fs = require('fs'); - -var options = { - key: fs.readFileSync('ssl/server.key'), - cert: fs.readFileSync('ssl/server.crt'), - ca: fs.readFileSync('ssl/rootCA.crt'), - requestCert: true, - rejectUnauthorized: false -}; - -https.createServer(options, function (req, res) { - console.log('Receive a request.'); - if (req.client.authorized) { - res.writeHead(200); - res.end('approved\n'); - } else { - res.writeHead(401); - res.end('denied\n'); - } -}).listen(5000); +const https = require('https'); +const fs = require('fs'); + +const options = { + key: fs.readFileSync('ssl/server.key'), + cert: fs.readFileSync('ssl/server.crt'), + ca: fs.readFileSync('ssl/rootCA.crt'), + requestCert: true, + rejectUnauthorized: false +}; + +https.createServer(options, function (req, res) { + console.log('Receive a request.'); + if (req.client.authorized) { + res.writeHead(200); + res.end('approved\n'); + } else { + res.writeHead(401); + res.end('denied\n'); + } +}).listen(5000); diff --git a/cookies/main.js b/cookies/main.js index 305931b..ac4ae1b 100644 --- a/cookies/main.js +++ b/cookies/main.js @@ -1,9 +1,9 @@ -var app = require('app'); -var BrowserWindow = require('browser-window'); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; -var mainWindow = null; app.on('ready', function() { mainWindow = new BrowserWindow({width: 400, height: 360}); - mainWindow.loadUrl('file://' + __dirname + '/manager.html'); + mainWindow.loadURL('file://' + __dirname + '/manager.html'); }); diff --git a/cookies/manager.js b/cookies/manager.js index dbb9a3e..4790b71 100644 --- a/cookies/manager.js +++ b/cookies/manager.js @@ -1,4 +1,4 @@ -var win = require('remote').getCurrentWindow(); +const ses = require('electron').remote.getCurrentWebContents().session; // A simple Timer class. function Timer() { @@ -108,16 +108,15 @@ function removeAll() { }); }); cache.reset(); - var count = all_cookies.length; var timer = new Timer(); - for (var i = 0; i < count; i++) { - removeCookie(all_cookies[i]); + for (let cookie of all_cookies) { + removeCookie(cookie); } timer.reset(); - win.webContents.session.cookies.get({}, function(cookies) { - for (var i in cookies) { - cache.add(cookies[i]); - removeCookie(cookies[i]); + ses.cookies.get({}, function(cookies) { + for (let cookie in cookies) { + cache.add(cookie); + removeCookie(cookie); } }); } @@ -125,10 +124,9 @@ function removeAll() { function removeCookie(cookie) { var url = "http" + (cookie.secure ? "s" : "") + "://" + cookie.domain + cookie.path; - win.webContents.session.cookies.remove({"url": url, "name": cookie.name}, - function(error) { - if (error) throw error; - update(cookie); + ses.cookies.remove(url, cookie.name, function(error) { + if (error) throw error; + update(cookie); }); } @@ -225,12 +223,12 @@ function update(cookie) { function onload() { focusFilter(); var timer = new Timer(); - win.webContents.session.cookies.get({}, function(error, cookies) { + ses.cookies.get({}, function(error, cookies) { if (error) throw error; console.log(cookies); start = new Date(); - for (var i in cookies) { - cache.add(cookies[i]); + for (let cookie of cookies) { + cache.add(cookie); } timer.reset(); reloadCookieTable(); diff --git a/cookies/package.json b/cookies/package.json index 6b94498..2b0fe46 100644 --- a/cookies/package.json +++ b/cookies/package.json @@ -1,5 +1,5 @@ { "name" : "cookies-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/cookies/readme.md b/cookies/readme.md index 6583762..b62cdde 100644 --- a/cookies/readme.md +++ b/cookies/readme.md @@ -1,12 +1,13 @@ # Cookies -A sample app allows you to manipulate your cookies data using [cookies]( -https://github.com/atom/electron/blob/master/docs/api/browser-window.md#sessioncookies) API. +A sample app allows you to manipulate your cookies data using [cookies][1] API. ## APIs -[Session.cookies](https://github.com/atom/electron/blob/master/docs/api/browser-window.md#sessioncookies) +[Session.cookies][1] ## Screenshot ![screenshot](/cookies/screenshot/screenshot.png) + +[1]: https://github.com/electron/electron/blob/master/docs/api/session.md#sescookies diff --git a/crash-report/app.js b/crash-report/app.js index fbc2768..05318c2 100644 --- a/crash-report/app.js +++ b/crash-report/app.js @@ -1,6 +1,6 @@ -var crashReporter = require('crash-reporter'); +const {crashReporter} = require('electron'); -crashReporter.start({submitUrl: 'http://127.0.0.1:9999'}); +crashReporter.start({submitURL: 'http://127.0.0.1:9999', companyName: 'sample'}); function showCrashReporter(report) { return "" + report.date + "" + @@ -15,8 +15,8 @@ window.onload = function() { "\n"; var div = document.getElementById("crash_reporters"); - for (var i = 0; i < reporters.length; ++i) { - table += showCrashReporter(reporters[i]); + for (let reporter of reporters) { + table += showCrashReporter(reporter); } div.innerHTML = table; document.getElementById('crash').onclick = function() { diff --git a/crash-report/main.js b/crash-report/main.js index ecf4fab..ee002a1 100644 --- a/crash-report/main.js +++ b/crash-report/main.js @@ -1,26 +1,25 @@ -var app = require('app'); -var BrowserWindow = require('browser-window'); -var http = require('http'); -var crashReporter = require('crash-reporter'); -crashReporter.start({submitUrl: 'http://127.0.0.1:9999'}); - -function getRandomInt(min, max) { - return Math.floor(Math.random() * (max - min)) + min; -} - -// Crash-report collection server -var server = http.createServer(function(req, res) { - // Handle the uploaded crash report from client here - // ... - // Response the crash report id on server to client. - res.end(getRandomInt(1000, 9999).toString()); -}); - -var mainWindow = null; -app.on('ready', function() { - server.listen(9999, '127.0.0.1', function () { - mainWindow = new BrowserWindow({width: 800, height: 600}); - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - mainWindow.toggleDevTools(); - }); -}); +const {app, BrowserWindow, crashReporter} = require('electron'); +const http = require('http'); + +crashReporter.start({submitURL: 'http://127.0.0.1:9999', companyName: 'sample'}); + +function getRandomInt(min, max) { + return Math.floor(Math.random() * (max - min)) + min; +} + +// Crash-report collection server +var server = http.createServer(function(req, res) { + // Handle the uploaded crash report from client here + // ... + // Response the crash report id on server to client. + res.end(getRandomInt(1000, 9999).toString()); +}); + +var mainWindow = null; +app.on('ready', function() { + server.listen(9999, '127.0.0.1', function () { + mainWindow = new BrowserWindow({width: 800, height: 600}); + mainWindow.loadURL('file://' + __dirname + '/index.html'); + mainWindow.toggleDevTools(); + }); +}); diff --git a/crash-report/package.json b/crash-report/package.json index 46af520..ea9e0a1 100644 --- a/crash-report/package.json +++ b/crash-report/package.json @@ -1,5 +1,5 @@ { "name" : "crash-report-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/desktop-capture/app.js b/desktop-capture/app.js index 7d5507d..bed1ffa 100644 --- a/desktop-capture/app.js +++ b/desktop-capture/app.js @@ -12,10 +12,10 @@ // limitations under the License. // Author: Dongseong Hwang (dongseong.hwang@intel.com) -var desktopCapturer = require('desktop-capturer'); +const {desktopCapturer} = require('electron'); -var desktopSharing = false; -var localStream = null; +let desktopSharing = false; +let localStream; function refresh() { $('select').imagepicker({ @@ -28,15 +28,15 @@ function addSource(source) { value: source.id.replace(":", ""), text: source.name })); - $('select option[value="' + source.id.replace(":", "") + '"]').attr('data-img-src', source.thumbnail.toDataUrl()); + $('select option[value="' + source.id.replace(":", "") + '"]').attr('data-img-src', source.thumbnail.toDataURL()); refresh(); } function showSources() { desktopCapturer.getSources({ types:['window', 'screen'] }, function(error, sources) { - for (var i = 0; i < sources.length; ++i) { - console.log("Name: " + sources[i].name); - addSource(sources[i]); + for (let source of sources) { + console.log("Name: " + source.name); + addSource(source); } }); } diff --git a/desktop-capture/main.js b/desktop-capture/main.js index 1944f5f..480fa6a 100644 --- a/desktop-capture/main.js +++ b/desktop-capture/main.js @@ -1,21 +1,20 @@ -var app = require('app'); -var BrowserWindow = require('browser-window'); +const {app, BrowserWindow} = require('electron'); -var mainWindow = null; +let mainWindow; -app.on('window-all-closed', function() { +app.on('window-all-closed', () => { if (process.platform != 'darwin') app.quit(); }); app.setPath("userData", __dirname + "/saved_recordings"); -app.on('ready', function() { +app.on('ready', () => { mainWindow = new BrowserWindow({width: 800, height: 600}); mainWindow.loadURL('file://' + __dirname + '/index.html'); - mainWindow.on('closed', function() { + mainWindow.on('closed', () => { mainWindow = null; }); }); diff --git a/desktop-capture/package.json b/desktop-capture/package.json index d833f33..b652680 100644 --- a/desktop-capture/package.json +++ b/desktop-capture/package.json @@ -1,5 +1,5 @@ { "name" : "desktop-capture-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/desktop-capture/readme.md b/desktop-capture/readme.md index 1f39298..892ef32 100644 --- a/desktop-capture/readme.md +++ b/desktop-capture/readme.md @@ -7,10 +7,6 @@ A sample app allows you to choose which screen or window to be captured with [desktopCapturer](https://github.com/atom/electron/blob/master/docs/api/desktop-capturer.md) -## Required minimum version - -v0.36.0 - ## Screenshot ![screenshot](https://cloud.githubusercontent.com/assets/2557445/10268326/993e4f9a-6ae7-11e5-8fd1-a24b9800b9ce.gif) diff --git a/file-explorer/main.js b/file-explorer/main.js index 502e73c..c03e732 100644 --- a/file-explorer/main.js +++ b/file-explorer/main.js @@ -1,33 +1,27 @@ -var app = require('app'); // Module to control application life. -var BrowserWindow = require('browser-window'); // Module to create native browser window. - -// Report crashes to our server. -require('crash-reporter').start(); - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow = null; - -// Quit when all windows are closed. -app.on('window-all-closed', function() { - if (process.platform != 'darwin') - app.quit(); -}); - -// This method will be called when Electron has done everything -// initialization and ready for creating browser windows. -app.on('ready', function() { - // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600}); - - // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - - // Emitted when the window is closed. - mainWindow.on('closed', function() { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - mainWindow = null; - }); -}); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + if (process.platform != 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width: 800, height: 600}); + + // and load the index.html of the app. + mainWindow.loadURL('file://' + __dirname + '/index.html'); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); diff --git a/file-explorer/package.json b/file-explorer/package.json index 4745f9d..8eac164 100644 --- a/file-explorer/package.json +++ b/file-explorer/package.json @@ -1,5 +1,5 @@ { "name" : "file-explorer-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/file-explorer/script.js b/file-explorer/script.js index 681a8c4..eefeaf2 100644 --- a/file-explorer/script.js +++ b/file-explorer/script.js @@ -1,86 +1,83 @@ -global.$ = $; - -var remote = require('remote'); -var Menu = remote.require('menu'); -var BrowserWindow = remote.require('browser-window'); -var MenuItem = remote.require('menu-item'); -var shell = require('shell'); - -var abar = require('address_bar'); -var folder_view = require('folder_view'); - -// append default actions to menu for OSX -var initMenu = function () { - try { - var nativeMenuBar = new Menu(); - if (process.platform == "darwin") { - nativeMenuBar.createMacBuiltin && nativeMenuBar.createMacBuiltin("FileExplorer"); - } - } catch (error) { - console.error(error); - setTimeout(function () { throw error }, 1); - } -}; - -var aboutWindow = null; -var App = { - // show "about" window - about: function () { - var params = {toolbar: false, resizable: false, show: true, height: 150, width: 400}; - aboutWindow = new BrowserWindow(params); - aboutWindow.loadUrl('file://' + __dirname + '/about.html'); - }, - - // change folder for sidebar links - cd: function (anchor) { - anchor = $(anchor); - - $('#sidebar li').removeClass('active'); - $('#sidebar i').removeClass('icon-white'); - - anchor.closest('li').addClass('active'); - anchor.find('i').addClass('icon-white'); - - this.setPath(anchor.attr('nw-path')); - }, - - // set path for file explorer - setPath: function (path) { - if (path.indexOf('~') == 0) { - path = path.replace('~', process.env['HOME']); - } - this.folder.open(path); - this.addressbar.set(path); - } -}; - -$(document).ready(function() { - initMenu(); - - var folder = new folder_view.Folder($('#files')); - var addressbar = new abar.AddressBar($('#addressbar')); - - folder.open(process.cwd()); - addressbar.set(process.cwd()); - - App.folder = folder; - App.addressbar = addressbar; - - folder.on('navigate', function(dir, mime) { - if (mime.type == 'folder') { - addressbar.enter(mime); - } else { - shell.openItem(mime.path); - } - }); - - addressbar.on('navigate', function(dir) { - folder.open(dir); - }); - - // sidebar favorites - $('[nw-path]').bind('click', function (event) { - event.preventDefault(); - App.cd(this); - }); -}); +global.$ = $; + +const {remote} = require('electron'); +const {Menu, BrowserWindow, MenuItem, shell} = remote; + +var abar = require('address_bar'); +var folder_view = require('folder_view'); + +// append default actions to menu for OSX +var initMenu = function () { + try { + var nativeMenuBar = new Menu(); + if (process.platform == "darwin") { + nativeMenuBar.createMacBuiltin && nativeMenuBar.createMacBuiltin("FileExplorer"); + } + } catch (error) { + console.error(error); + setTimeout(function () { throw error }, 1); + } +}; + +var aboutWindow = null; +var App = { + // show "about" window + about: function () { + var params = {toolbar: false, resizable: false, show: true, height: 150, width: 400}; + aboutWindow = new BrowserWindow(params); + aboutWindow.loadURL('file://' + __dirname + '/about.html'); + }, + + // change folder for sidebar links + cd: function (anchor) { + anchor = $(anchor); + + $('#sidebar li').removeClass('active'); + $('#sidebar i').removeClass('icon-white'); + + anchor.closest('li').addClass('active'); + anchor.find('i').addClass('icon-white'); + + this.setPath(anchor.attr('nw-path')); + }, + + // set path for file explorer + setPath: function (path) { + if (path.indexOf('~') == 0) { + path = path.replace('~', process.env['HOME']); + } + this.folder.open(path); + this.addressbar.set(path); + } +}; + +$(document).ready(function() { + initMenu(); + + var folder = new folder_view.Folder($('#files')); + var addressbar = new abar.AddressBar($('#addressbar')); + + folder.open(process.cwd()); + addressbar.set(process.cwd()); + + App.folder = folder; + App.addressbar = addressbar; + + folder.on('navigate', function(dir, mime) { + if (mime.type == 'folder') { + addressbar.enter(mime); + } else { + shell.openItem(mime.path); + } + }); + + addressbar.on('navigate', function(dir) { + folder.open(dir); + }); + + // sidebar favorites + $('[nw-path]').bind('click', function (event) { + event.preventDefault(); + App.cd(this); + }); +}); diff --git a/frameless-window/frameless_window.js b/frameless-window/frameless_window.js index 1ea8d5c..eac1646 100644 --- a/frameless-window/frameless_window.js +++ b/frameless-window/frameless_window.js @@ -1,92 +1,90 @@ -function updateCheckbox() { - var top_checkbox = document.getElementById("top-box"); - var bottom_checkbox = document.getElementById("bottom-box"); - var left_checkbox = document.getElementById("left-box"); - var right_checkbox = document.getElementById("right-box"); - if (top_checkbox.checked || bottom_checkbox.checked) { - left_checkbox.disabled = true; - right_checkbox.disabled = true; - } else if (left_checkbox.checked || right_checkbox.checked) { - top_checkbox.disabled = true; - bottom_checkbox.disabled = true; - } else { - left_checkbox.disabled = false; - right_checkbox.disabled = false; - top_checkbox.disabled = false; - bottom_checkbox.disabled = false; - } -} - -function initCheckbox(checkboxId, titlebar_name, titlebar_icon_url, titlebar_text) { - var elem = document.getElementById(checkboxId); - if (!elem) - return; - elem.onclick = function() { - if (document.getElementById(checkboxId).checked) - addTitlebar(titlebar_name, titlebar_icon_url, titlebar_text); - else - removeTitlebar(titlebar_name); - focusTitlebars(true); - - updateContentStyle(); - updateCheckbox(); - } -} - -window.onfocus = function() { - console.log("focus"); - focusTitlebars(true); -} - -window.onblur = function() { - console.log("blur"); - focusTitlebars(false); -} - -window.onresize = function() { - updateContentStyle(); -} - -window.onload = function() { - initCheckbox("top-box", "top-titlebar", "top-titlebar.png", "Top Titlebar"); - initCheckbox("bottom-box", "bottom-titlebar", "bottom-titlebar.png", "Bottom Titlebar"); - initCheckbox("left-box", "left-titlebar", "left-titlebar.png", "Left Titlebar"); - initCheckbox("right-box", "right-titlebar", "right-titlebar.png", "Right Titlebar"); - - - - var remote = require('remote'); - var BrowserWindow = remote.require('browser-window'); - var win = BrowserWindow.getFocusedWindow(); - - document.getElementById("close-window-button").onclick = function() { - win.close(); - } - document.getElementById("minimize-window-button").onclick = function() { - win.minimize(); - } - document.getElementById("maximize-window-button").onclick = function() { - win.maximize(); - } - document.getElementById("unmaximize-window-button").onclick = function() { - win.unmaximize(); - } - document.getElementById("toggle-window-button").onclick = function() { - win.setFullScreen(!(win.isFullScreen())); - } - document.getElementById("maxmin-window-button").onclick = function() { - win.isMaximized() ? win.unmaximize() : win.maximize(); - } - - document.getElementById("min").onclick = function() { - win.minimize(); - } - document.getElementById("max").onclick = function() { - win.isMaximized() ? win.unmaximize() : win.maximize(); - } - document.getElementById("exit").onclick = function() { - win.close(); - } - - updateContentStyle(); -} +function updateCheckbox() { + var top_checkbox = document.getElementById("top-box"); + var bottom_checkbox = document.getElementById("bottom-box"); + var left_checkbox = document.getElementById("left-box"); + var right_checkbox = document.getElementById("right-box"); + if (top_checkbox.checked || bottom_checkbox.checked) { + left_checkbox.disabled = true; + right_checkbox.disabled = true; + } else if (left_checkbox.checked || right_checkbox.checked) { + top_checkbox.disabled = true; + bottom_checkbox.disabled = true; + } else { + left_checkbox.disabled = false; + right_checkbox.disabled = false; + top_checkbox.disabled = false; + bottom_checkbox.disabled = false; + } +} + +function initCheckbox(checkboxId, titlebar_name, titlebar_icon_url, titlebar_text) { + var elem = document.getElementById(checkboxId); + if (!elem) + return; + elem.onclick = function() { + if (document.getElementById(checkboxId).checked) + addTitlebar(titlebar_name, titlebar_icon_url, titlebar_text); + else + removeTitlebar(titlebar_name); + focusTitlebars(true); + + updateContentStyle(); + updateCheckbox(); + } +} + +window.onfocus = function() { + console.log("focus"); + focusTitlebars(true); +} + +window.onblur = function() { + console.log("blur"); + focusTitlebars(false); +} + +window.onresize = function() { + updateContentStyle(); +} + +window.onload = function() { + initCheckbox("top-box", "top-titlebar", "top-titlebar.png", "Top Titlebar"); + initCheckbox("bottom-box", "bottom-titlebar", "bottom-titlebar.png", "Bottom Titlebar"); + initCheckbox("left-box", "left-titlebar", "left-titlebar.png", "Left Titlebar"); + initCheckbox("right-box", "right-titlebar", "right-titlebar.png", "Right Titlebar"); + + const {remote} = require('electron'); + const {BrowserWindow} = remote; + const win = BrowserWindow.getFocusedWindow(); + + document.getElementById("close-window-button").onclick = function() { + win.close(); + } + document.getElementById("minimize-window-button").onclick = function() { + win.minimize(); + } + document.getElementById("maximize-window-button").onclick = function() { + win.maximize(); + } + document.getElementById("unmaximize-window-button").onclick = function() { + win.unmaximize(); + } + document.getElementById("toggle-window-button").onclick = function() { + win.setFullScreen(!(win.isFullScreen())); + } + document.getElementById("maxmin-window-button").onclick = function() { + win.isMaximized() ? win.unmaximize() : win.maximize(); + } + + document.getElementById("min").onclick = function() { + win.minimize(); + } + document.getElementById("max").onclick = function() { + win.isMaximized() ? win.unmaximize() : win.maximize(); + } + document.getElementById("exit").onclick = function() { + win.close(); + } + + updateContentStyle(); +} diff --git a/frameless-window/main.js b/frameless-window/main.js index b4c8765..f2d2e02 100644 --- a/frameless-window/main.js +++ b/frameless-window/main.js @@ -1,12 +1,6 @@ -var app = require('app'); // Module to control application life. -var BrowserWindow = require('browser-window'); // Module to create native browser window. +const {app, BrowserWindow} = require('electron'); -// Report crashes to our server. -require('crash-reporter').start(); - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow = null; +let mainWindow; // Quit when all windows are closed. app.on('window-all-closed', function() { @@ -20,7 +14,7 @@ app.on('ready', function() { mainWindow = new BrowserWindow({width: 360, height: 300, frame: false}); // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); + mainWindow.loadURL('file://' + __dirname + '/index.html'); // Emitted when the window is closed. mainWindow.on('closed', function() { diff --git a/frameless-window/package.json b/frameless-window/package.json index 79a0e6f..a8f3336 100644 --- a/frameless-window/package.json +++ b/frameless-window/package.json @@ -1,5 +1,5 @@ { "name" : "frameless-window-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/helloworld-sharedobj/index.html b/helloworld-sharedobj/index.html index 210aec6..7ffc6f1 100644 --- a/helloworld-sharedobj/index.html +++ b/helloworld-sharedobj/index.html @@ -1,6 +1,6 @@

This demos how to get a myvar from main.js to index.html

diff --git a/helloworld-sharedobj/main.js b/helloworld-sharedobj/main.js index ba7f3dd..55c3950 100644 --- a/helloworld-sharedobj/main.js +++ b/helloworld-sharedobj/main.js @@ -1,17 +1,14 @@ -'use strict'; +const {app, BrowserWindow} = require('electron'); -var app = require('app'); -var BrowserWindow = require('browser-window'); - -var mainWindow = null; +let mainWindow; global.sharedObj = {myvar: "hellofrommainjs"}; app.on('ready', function() { - mainWindow = new BrowserWindow({ - height: 600, - width: 800 - }); + mainWindow = new BrowserWindow({ + height: 600, + width: 800 + }); - mainWindow.loadURL('file://' + __dirname + '/index.html'); + mainWindow.loadURL('file://' + __dirname + '/index.html'); }); diff --git a/helloworld-sharedobj/package.json b/helloworld-sharedobj/package.json index 5d07dfa..378a4cd 100644 --- a/helloworld-sharedobj/package.json +++ b/helloworld-sharedobj/package.json @@ -1,5 +1,5 @@ { "name": "helloworld-sharedobj", - "version": "0.0.1", + "version": "1.0.1", "main": "main.js" } diff --git a/helloworld/main.js b/helloworld/main.js index b871dd9..bf54491 100644 --- a/helloworld/main.js +++ b/helloworld/main.js @@ -1,15 +1,12 @@ -'use strict'; +const {app, BrowserWindow} = require('electron'); -var app = require('app'); -var BrowserWindow = require('browser-window'); +let mainWindow; -var mainWindow = null; +app.on('ready', () => { + mainWindow = new BrowserWindow({ + height: 600, + width: 800 + }); -app.on('ready', function() { - mainWindow = new BrowserWindow({ - height: 600, - width: 800 - }); - - mainWindow.loadURL('file://' + __dirname + '/index.html'); + mainWindow.loadURL('file://' + __dirname + '/index.html'); }); diff --git a/helloworld/package.json b/helloworld/package.json index 90947d2..73a5a6c 100644 --- a/helloworld/package.json +++ b/helloworld/package.json @@ -1,5 +1,5 @@ { "name": "helloworld", - "version": "0.0.1", + "version": "1.0.1", "main": "main.js" } diff --git a/menus/index.html b/menus/index.html index 00420ab..0c40f2f 100644 --- a/menus/index.html +++ b/menus/index.html @@ -1,21 +1,23 @@ - + + + +

Right click the webpage to show the menu.

diff --git a/menus/main.js b/menus/main.js index 15f7d65..aac80cc 100644 --- a/menus/main.js +++ b/menus/main.js @@ -1,121 +1,117 @@ -var app = require('app'); // Module to control application life. -var BrowserWindow = require('browser-window'); // Module to create native browser window. -var Menu = require('menu'); - -// Report crashes to our server. -require('crash-reporter').start(); - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow = null; - -// Quit when all windows are closed. -app.on('window-all-closed', function() { - if (process.platform != 'darwin') - app.quit(); -}); - -// This method will be called when Electron has done everything -// initialization and ready for creating browser windows. -app.on('ready', function() { - // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600}); - - // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - - var application_menu = [ - { - label: 'menu1', - submenu: [ - { - label: 'Undo', - accelerator: 'CmdOrCtrl+Z', - role: 'undo' - }, - { - label: 'Open', - accelerator: 'CmdOrCtrl+O', - click: function() { - require('electron').dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]}); - } - }, - { - label: 'submenu1', - submenu: [ - { - label: 'item1', - accelerator: 'CmdOrCtrl+A', - click: function() { - mainWindow.openDevTools(); - } - }, - { - label: 'item2', - accelerator: 'CmdOrCtrl+B', - click: function() { - mainWindow.closeDevTools(); - } - } - ] - } - ] - } - ]; - if (process.platform == 'darwin') { - var name = require('electron').app.getName(); - application_menu.unshift({ - label: name, - submenu: [ - { - label: 'About ' + name, - role: 'about' - }, - { - type: 'separator' - }, - { - label: 'Services', - role: 'services', - submenu: [] - }, - { - type: 'separator' - }, - { - label: 'Hide ' + name, - accelerator: 'Command+H', - role: 'hide' - }, - { - label: 'Hide Others', - accelerator: 'Command+Shift+H', - role: 'hideothers' - }, - { - label: 'Show All', - role: 'unhide' - }, - { - type: 'separator' - }, - { - label: 'Quit', - accelerator: 'Command+Q', - click: function() { app.quit(); } - }, - ] - }); - } - - menu = Menu.buildFromTemplate(application_menu); - Menu.setApplicationMenu(menu); - - // Emitted when the window is closed. - mainWindow.on('closed', function() { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - mainWindow = null; - }); -}); +const electron = require('electron'); +const {app, BrowserWindow, Menu} = require('electron'); + +// Keep a global reference of the window object, if you don't, the window will +// be closed automatically when the javascript object is GCed. +let mainWindow; + +// Quit when all windows are closed. +app.on('window-all-closed', () => { + if (process.platform != 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width: 800, height: 600}); + + // and load the index.html of the app. + mainWindow.loadURL('file://' + __dirname + '/index.html'); + + var application_menu = [ + { + label: 'menu1', + submenu: [ + { + label: 'Undo', + accelerator: 'CmdOrCtrl+Z', + role: 'undo' + }, + { + label: 'Open', + accelerator: 'CmdOrCtrl+O', + click: () => { + electron.dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]}); + } + }, + { + label: 'submenu1', + submenu: [ + { + label: 'item1', + accelerator: 'CmdOrCtrl+A', + click: () => { + mainWindow.openDevTools(); + } + }, + { + label: 'item2', + accelerator: 'CmdOrCtrl+B', + click: () => { + mainWindow.closeDevTools(); + } + } + ] + } + ] + } + ]; + if (process.platform == 'darwin') { + const name = app.getName(); + application_menu.unshift({ + label: name, + submenu: [ + { + label: 'About ' + name, + role: 'about' + }, + { + type: 'separator' + }, + { + label: 'Services', + role: 'services', + submenu: [] + }, + { + type: 'separator' + }, + { + label: 'Hide ' + name, + accelerator: 'Command+H', + role: 'hide' + }, + { + label: 'Hide Others', + accelerator: 'Command+Shift+H', + role: 'hideothers' + }, + { + label: 'Show All', + role: 'unhide' + }, + { + type: 'separator' + }, + { + label: 'Quit', + accelerator: 'Command+Q', + click: () => { app.quit(); } + }, + ] + }); + } + + menu = Menu.buildFromTemplate(application_menu); + Menu.setApplicationMenu(menu); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); diff --git a/menus/package.json b/menus/package.json index bd54241..681991f 100644 --- a/menus/package.json +++ b/menus/package.json @@ -1,5 +1,5 @@ { "name" : "menus-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/mini-code-edit/package.json b/mini-code-edit/package.json deleted file mode 100644 index da34935..0000000 --- a/mini-code-edit/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name" : "mini-code-edit", - "version" : "0.1.0", - "main" : "main.js" -} diff --git a/mini-code-edit/README.md b/mini-code-editor/README.md similarity index 100% rename from mini-code-edit/README.md rename to mini-code-editor/README.md diff --git a/mini-code-edit/assets/icon-128.png b/mini-code-editor/assets/icon-128.png similarity index 100% rename from mini-code-edit/assets/icon-128.png rename to mini-code-editor/assets/icon-128.png diff --git a/mini-code-edit/assets/screenshot-640x400.png b/mini-code-editor/assets/screenshot-640x400.png similarity index 100% rename from mini-code-edit/assets/screenshot-640x400.png rename to mini-code-editor/assets/screenshot-640x400.png diff --git a/mini-code-edit/assets/tile-440x280.png b/mini-code-editor/assets/tile-440x280.png similarity index 100% rename from mini-code-edit/assets/tile-440x280.png rename to mini-code-editor/assets/tile-440x280.png diff --git a/mini-code-edit/cm/LICENSE b/mini-code-editor/cm/LICENSE similarity index 100% rename from mini-code-edit/cm/LICENSE rename to mini-code-editor/cm/LICENSE diff --git a/mini-code-edit/cm/README.md b/mini-code-editor/cm/README.md similarity index 100% rename from mini-code-edit/cm/README.md rename to mini-code-editor/cm/README.md diff --git a/mini-code-edit/cm/demo/activeline.html b/mini-code-editor/cm/demo/activeline.html similarity index 100% rename from mini-code-edit/cm/demo/activeline.html rename to mini-code-editor/cm/demo/activeline.html diff --git a/mini-code-edit/cm/demo/changemode.html b/mini-code-editor/cm/demo/changemode.html similarity index 100% rename from mini-code-edit/cm/demo/changemode.html rename to mini-code-editor/cm/demo/changemode.html diff --git a/mini-code-edit/cm/demo/closetag.html b/mini-code-editor/cm/demo/closetag.html similarity index 100% rename from mini-code-edit/cm/demo/closetag.html rename to mini-code-editor/cm/demo/closetag.html diff --git a/mini-code-edit/cm/demo/complete.html b/mini-code-editor/cm/demo/complete.html similarity index 100% rename from mini-code-edit/cm/demo/complete.html rename to mini-code-editor/cm/demo/complete.html diff --git a/mini-code-edit/cm/demo/emacs.html b/mini-code-editor/cm/demo/emacs.html similarity index 100% rename from mini-code-edit/cm/demo/emacs.html rename to mini-code-editor/cm/demo/emacs.html diff --git a/mini-code-edit/cm/demo/folding.html b/mini-code-editor/cm/demo/folding.html similarity index 100% rename from mini-code-edit/cm/demo/folding.html rename to mini-code-editor/cm/demo/folding.html diff --git a/mini-code-edit/cm/demo/formatting.html b/mini-code-editor/cm/demo/formatting.html similarity index 100% rename from mini-code-edit/cm/demo/formatting.html rename to mini-code-editor/cm/demo/formatting.html diff --git a/mini-code-edit/cm/demo/fullscreen.html b/mini-code-editor/cm/demo/fullscreen.html similarity index 100% rename from mini-code-edit/cm/demo/fullscreen.html rename to mini-code-editor/cm/demo/fullscreen.html diff --git a/mini-code-edit/cm/demo/loadmode.html b/mini-code-editor/cm/demo/loadmode.html similarity index 100% rename from mini-code-edit/cm/demo/loadmode.html rename to mini-code-editor/cm/demo/loadmode.html diff --git a/mini-code-edit/cm/demo/marker.html b/mini-code-editor/cm/demo/marker.html similarity index 100% rename from mini-code-edit/cm/demo/marker.html rename to mini-code-editor/cm/demo/marker.html diff --git a/mini-code-edit/cm/demo/matchhighlighter.html b/mini-code-editor/cm/demo/matchhighlighter.html similarity index 100% rename from mini-code-edit/cm/demo/matchhighlighter.html rename to mini-code-editor/cm/demo/matchhighlighter.html diff --git a/mini-code-edit/cm/demo/mustache.html b/mini-code-editor/cm/demo/mustache.html similarity index 100% rename from mini-code-edit/cm/demo/mustache.html rename to mini-code-editor/cm/demo/mustache.html diff --git a/mini-code-edit/cm/demo/preview.html b/mini-code-editor/cm/demo/preview.html similarity index 100% rename from mini-code-edit/cm/demo/preview.html rename to mini-code-editor/cm/demo/preview.html diff --git a/mini-code-edit/cm/demo/resize.html b/mini-code-editor/cm/demo/resize.html similarity index 100% rename from mini-code-edit/cm/demo/resize.html rename to mini-code-editor/cm/demo/resize.html diff --git a/mini-code-edit/cm/demo/runmode.html b/mini-code-editor/cm/demo/runmode.html similarity index 100% rename from mini-code-edit/cm/demo/runmode.html rename to mini-code-editor/cm/demo/runmode.html diff --git a/mini-code-edit/cm/demo/search.html b/mini-code-editor/cm/demo/search.html similarity index 100% rename from mini-code-edit/cm/demo/search.html rename to mini-code-editor/cm/demo/search.html diff --git a/mini-code-edit/cm/demo/theme.html b/mini-code-editor/cm/demo/theme.html similarity index 100% rename from mini-code-edit/cm/demo/theme.html rename to mini-code-editor/cm/demo/theme.html diff --git a/mini-code-edit/cm/demo/vim.html b/mini-code-editor/cm/demo/vim.html similarity index 100% rename from mini-code-edit/cm/demo/vim.html rename to mini-code-editor/cm/demo/vim.html diff --git a/mini-code-edit/cm/demo/visibletabs.html b/mini-code-editor/cm/demo/visibletabs.html similarity index 100% rename from mini-code-edit/cm/demo/visibletabs.html rename to mini-code-editor/cm/demo/visibletabs.html diff --git a/mini-code-edit/cm/doc/baboon.png b/mini-code-editor/cm/doc/baboon.png similarity index 100% rename from mini-code-edit/cm/doc/baboon.png rename to mini-code-editor/cm/doc/baboon.png diff --git a/mini-code-edit/cm/doc/baboon_vector.svg b/mini-code-editor/cm/doc/baboon_vector.svg similarity index 100% rename from mini-code-edit/cm/doc/baboon_vector.svg rename to mini-code-editor/cm/doc/baboon_vector.svg diff --git a/mini-code-edit/cm/doc/compress.html b/mini-code-editor/cm/doc/compress.html similarity index 100% rename from mini-code-edit/cm/doc/compress.html rename to mini-code-editor/cm/doc/compress.html diff --git a/mini-code-edit/cm/doc/docs.css b/mini-code-editor/cm/doc/docs.css similarity index 100% rename from mini-code-edit/cm/doc/docs.css rename to mini-code-editor/cm/doc/docs.css diff --git a/mini-code-edit/cm/doc/internals.html b/mini-code-editor/cm/doc/internals.html similarity index 100% rename from mini-code-edit/cm/doc/internals.html rename to mini-code-editor/cm/doc/internals.html diff --git a/mini-code-edit/cm/doc/manual.html b/mini-code-editor/cm/doc/manual.html similarity index 100% rename from mini-code-edit/cm/doc/manual.html rename to mini-code-editor/cm/doc/manual.html diff --git a/mini-code-edit/cm/doc/oldrelease.html b/mini-code-editor/cm/doc/oldrelease.html similarity index 100% rename from mini-code-edit/cm/doc/oldrelease.html rename to mini-code-editor/cm/doc/oldrelease.html diff --git a/mini-code-edit/cm/doc/reporting.html b/mini-code-editor/cm/doc/reporting.html similarity index 100% rename from mini-code-edit/cm/doc/reporting.html rename to mini-code-editor/cm/doc/reporting.html diff --git a/mini-code-edit/cm/doc/upgrade_v2.2.html b/mini-code-editor/cm/doc/upgrade_v2.2.html similarity index 100% rename from mini-code-edit/cm/doc/upgrade_v2.2.html rename to mini-code-editor/cm/doc/upgrade_v2.2.html diff --git a/mini-code-edit/cm/index.html b/mini-code-editor/cm/index.html similarity index 100% rename from mini-code-edit/cm/index.html rename to mini-code-editor/cm/index.html diff --git a/mini-code-edit/cm/keymap/emacs.js b/mini-code-editor/cm/keymap/emacs.js similarity index 100% rename from mini-code-edit/cm/keymap/emacs.js rename to mini-code-editor/cm/keymap/emacs.js diff --git a/mini-code-edit/cm/keymap/vim.js b/mini-code-editor/cm/keymap/vim.js similarity index 100% rename from mini-code-edit/cm/keymap/vim.js rename to mini-code-editor/cm/keymap/vim.js diff --git a/mini-code-edit/cm/lib/codemirror.css b/mini-code-editor/cm/lib/codemirror.css similarity index 100% rename from mini-code-edit/cm/lib/codemirror.css rename to mini-code-editor/cm/lib/codemirror.css diff --git a/mini-code-edit/cm/lib/codemirror.js b/mini-code-editor/cm/lib/codemirror.js similarity index 100% rename from mini-code-edit/cm/lib/codemirror.js rename to mini-code-editor/cm/lib/codemirror.js diff --git a/mini-code-edit/cm/lib/util/closetag.js b/mini-code-editor/cm/lib/util/closetag.js similarity index 100% rename from mini-code-edit/cm/lib/util/closetag.js rename to mini-code-editor/cm/lib/util/closetag.js diff --git a/mini-code-edit/cm/lib/util/dialog.css b/mini-code-editor/cm/lib/util/dialog.css similarity index 100% rename from mini-code-edit/cm/lib/util/dialog.css rename to mini-code-editor/cm/lib/util/dialog.css diff --git a/mini-code-edit/cm/lib/util/dialog.js b/mini-code-editor/cm/lib/util/dialog.js similarity index 100% rename from mini-code-edit/cm/lib/util/dialog.js rename to mini-code-editor/cm/lib/util/dialog.js diff --git a/mini-code-edit/cm/lib/util/foldcode.js b/mini-code-editor/cm/lib/util/foldcode.js similarity index 100% rename from mini-code-edit/cm/lib/util/foldcode.js rename to mini-code-editor/cm/lib/util/foldcode.js diff --git a/mini-code-edit/cm/lib/util/formatting.js b/mini-code-editor/cm/lib/util/formatting.js similarity index 100% rename from mini-code-edit/cm/lib/util/formatting.js rename to mini-code-editor/cm/lib/util/formatting.js diff --git a/mini-code-edit/cm/lib/util/javascript-hint.js b/mini-code-editor/cm/lib/util/javascript-hint.js similarity index 100% rename from mini-code-edit/cm/lib/util/javascript-hint.js rename to mini-code-editor/cm/lib/util/javascript-hint.js diff --git a/mini-code-edit/cm/lib/util/loadmode.js b/mini-code-editor/cm/lib/util/loadmode.js similarity index 100% rename from mini-code-edit/cm/lib/util/loadmode.js rename to mini-code-editor/cm/lib/util/loadmode.js diff --git a/mini-code-edit/cm/lib/util/match-highlighter.js b/mini-code-editor/cm/lib/util/match-highlighter.js similarity index 100% rename from mini-code-edit/cm/lib/util/match-highlighter.js rename to mini-code-editor/cm/lib/util/match-highlighter.js diff --git a/mini-code-edit/cm/lib/util/overlay.js b/mini-code-editor/cm/lib/util/overlay.js similarity index 100% rename from mini-code-edit/cm/lib/util/overlay.js rename to mini-code-editor/cm/lib/util/overlay.js diff --git a/mini-code-edit/cm/lib/util/runmode.js b/mini-code-editor/cm/lib/util/runmode.js similarity index 100% rename from mini-code-edit/cm/lib/util/runmode.js rename to mini-code-editor/cm/lib/util/runmode.js diff --git a/mini-code-edit/cm/lib/util/search.js b/mini-code-editor/cm/lib/util/search.js similarity index 100% rename from mini-code-edit/cm/lib/util/search.js rename to mini-code-editor/cm/lib/util/search.js diff --git a/mini-code-edit/cm/lib/util/searchcursor.js b/mini-code-editor/cm/lib/util/searchcursor.js similarity index 100% rename from mini-code-edit/cm/lib/util/searchcursor.js rename to mini-code-editor/cm/lib/util/searchcursor.js diff --git a/mini-code-edit/cm/lib/util/simple-hint.css b/mini-code-editor/cm/lib/util/simple-hint.css similarity index 100% rename from mini-code-edit/cm/lib/util/simple-hint.css rename to mini-code-editor/cm/lib/util/simple-hint.css diff --git a/mini-code-edit/cm/lib/util/simple-hint.js b/mini-code-editor/cm/lib/util/simple-hint.js similarity index 100% rename from mini-code-edit/cm/lib/util/simple-hint.js rename to mini-code-editor/cm/lib/util/simple-hint.js diff --git a/mini-code-edit/cm/mode/clike/clike.js b/mini-code-editor/cm/mode/clike/clike.js similarity index 100% rename from mini-code-edit/cm/mode/clike/clike.js rename to mini-code-editor/cm/mode/clike/clike.js diff --git a/mini-code-edit/cm/mode/clike/index.html b/mini-code-editor/cm/mode/clike/index.html similarity index 100% rename from mini-code-edit/cm/mode/clike/index.html rename to mini-code-editor/cm/mode/clike/index.html diff --git a/mini-code-edit/cm/mode/clojure/clojure.js b/mini-code-editor/cm/mode/clojure/clojure.js similarity index 100% rename from mini-code-edit/cm/mode/clojure/clojure.js rename to mini-code-editor/cm/mode/clojure/clojure.js diff --git a/mini-code-edit/cm/mode/clojure/index.html b/mini-code-editor/cm/mode/clojure/index.html similarity index 100% rename from mini-code-edit/cm/mode/clojure/index.html rename to mini-code-editor/cm/mode/clojure/index.html diff --git a/mini-code-edit/cm/mode/coffeescript/LICENSE b/mini-code-editor/cm/mode/coffeescript/LICENSE similarity index 100% rename from mini-code-edit/cm/mode/coffeescript/LICENSE rename to mini-code-editor/cm/mode/coffeescript/LICENSE diff --git a/mini-code-edit/cm/mode/coffeescript/coffeescript.js b/mini-code-editor/cm/mode/coffeescript/coffeescript.js similarity index 100% rename from mini-code-edit/cm/mode/coffeescript/coffeescript.js rename to mini-code-editor/cm/mode/coffeescript/coffeescript.js diff --git a/mini-code-edit/cm/mode/coffeescript/index.html b/mini-code-editor/cm/mode/coffeescript/index.html similarity index 100% rename from mini-code-edit/cm/mode/coffeescript/index.html rename to mini-code-editor/cm/mode/coffeescript/index.html diff --git a/mini-code-edit/cm/mode/css/css.js b/mini-code-editor/cm/mode/css/css.js similarity index 100% rename from mini-code-edit/cm/mode/css/css.js rename to mini-code-editor/cm/mode/css/css.js diff --git a/mini-code-edit/cm/mode/css/index.html b/mini-code-editor/cm/mode/css/index.html similarity index 100% rename from mini-code-edit/cm/mode/css/index.html rename to mini-code-editor/cm/mode/css/index.html diff --git a/mini-code-edit/cm/mode/diff/diff.js b/mini-code-editor/cm/mode/diff/diff.js similarity index 100% rename from mini-code-edit/cm/mode/diff/diff.js rename to mini-code-editor/cm/mode/diff/diff.js diff --git a/mini-code-edit/cm/mode/diff/index.html b/mini-code-editor/cm/mode/diff/index.html similarity index 100% rename from mini-code-edit/cm/mode/diff/index.html rename to mini-code-editor/cm/mode/diff/index.html diff --git a/mini-code-edit/cm/mode/ecl/ecl.js b/mini-code-editor/cm/mode/ecl/ecl.js similarity index 100% rename from mini-code-edit/cm/mode/ecl/ecl.js rename to mini-code-editor/cm/mode/ecl/ecl.js diff --git a/mini-code-edit/cm/mode/ecl/index.html b/mini-code-editor/cm/mode/ecl/index.html similarity index 100% rename from mini-code-edit/cm/mode/ecl/index.html rename to mini-code-editor/cm/mode/ecl/index.html diff --git a/mini-code-edit/cm/mode/erlang/erlang.js b/mini-code-editor/cm/mode/erlang/erlang.js similarity index 100% rename from mini-code-edit/cm/mode/erlang/erlang.js rename to mini-code-editor/cm/mode/erlang/erlang.js diff --git a/mini-code-edit/cm/mode/erlang/index.html b/mini-code-editor/cm/mode/erlang/index.html similarity index 100% rename from mini-code-edit/cm/mode/erlang/index.html rename to mini-code-editor/cm/mode/erlang/index.html diff --git a/mini-code-edit/cm/mode/gfm/gfm.js b/mini-code-editor/cm/mode/gfm/gfm.js similarity index 100% rename from mini-code-edit/cm/mode/gfm/gfm.js rename to mini-code-editor/cm/mode/gfm/gfm.js diff --git a/mini-code-edit/cm/mode/gfm/index.html b/mini-code-editor/cm/mode/gfm/index.html similarity index 100% rename from mini-code-edit/cm/mode/gfm/index.html rename to mini-code-editor/cm/mode/gfm/index.html diff --git a/mini-code-edit/cm/mode/go/go.js b/mini-code-editor/cm/mode/go/go.js similarity index 100% rename from mini-code-edit/cm/mode/go/go.js rename to mini-code-editor/cm/mode/go/go.js diff --git a/mini-code-edit/cm/mode/go/index.html b/mini-code-editor/cm/mode/go/index.html similarity index 100% rename from mini-code-edit/cm/mode/go/index.html rename to mini-code-editor/cm/mode/go/index.html diff --git a/mini-code-edit/cm/mode/groovy/groovy.js b/mini-code-editor/cm/mode/groovy/groovy.js similarity index 100% rename from mini-code-edit/cm/mode/groovy/groovy.js rename to mini-code-editor/cm/mode/groovy/groovy.js diff --git a/mini-code-edit/cm/mode/groovy/index.html b/mini-code-editor/cm/mode/groovy/index.html similarity index 100% rename from mini-code-edit/cm/mode/groovy/index.html rename to mini-code-editor/cm/mode/groovy/index.html diff --git a/mini-code-edit/cm/mode/haskell/haskell.js b/mini-code-editor/cm/mode/haskell/haskell.js similarity index 100% rename from mini-code-edit/cm/mode/haskell/haskell.js rename to mini-code-editor/cm/mode/haskell/haskell.js diff --git a/mini-code-edit/cm/mode/haskell/index.html b/mini-code-editor/cm/mode/haskell/index.html similarity index 100% rename from mini-code-edit/cm/mode/haskell/index.html rename to mini-code-editor/cm/mode/haskell/index.html diff --git a/mini-code-edit/cm/mode/htmlembedded/htmlembedded.js b/mini-code-editor/cm/mode/htmlembedded/htmlembedded.js similarity index 100% rename from mini-code-edit/cm/mode/htmlembedded/htmlembedded.js rename to mini-code-editor/cm/mode/htmlembedded/htmlembedded.js diff --git a/mini-code-edit/cm/mode/htmlembedded/index.html b/mini-code-editor/cm/mode/htmlembedded/index.html similarity index 100% rename from mini-code-edit/cm/mode/htmlembedded/index.html rename to mini-code-editor/cm/mode/htmlembedded/index.html diff --git a/mini-code-edit/cm/mode/htmlmixed/htmlmixed.js b/mini-code-editor/cm/mode/htmlmixed/htmlmixed.js similarity index 100% rename from mini-code-edit/cm/mode/htmlmixed/htmlmixed.js rename to mini-code-editor/cm/mode/htmlmixed/htmlmixed.js diff --git a/mini-code-edit/cm/mode/htmlmixed/index.html b/mini-code-editor/cm/mode/htmlmixed/index.html similarity index 100% rename from mini-code-edit/cm/mode/htmlmixed/index.html rename to mini-code-editor/cm/mode/htmlmixed/index.html diff --git a/mini-code-edit/cm/mode/javascript/index.html b/mini-code-editor/cm/mode/javascript/index.html similarity index 100% rename from mini-code-edit/cm/mode/javascript/index.html rename to mini-code-editor/cm/mode/javascript/index.html diff --git a/mini-code-edit/cm/mode/javascript/javascript.js b/mini-code-editor/cm/mode/javascript/javascript.js similarity index 100% rename from mini-code-edit/cm/mode/javascript/javascript.js rename to mini-code-editor/cm/mode/javascript/javascript.js diff --git a/mini-code-edit/cm/mode/jinja2/index.html b/mini-code-editor/cm/mode/jinja2/index.html similarity index 100% rename from mini-code-edit/cm/mode/jinja2/index.html rename to mini-code-editor/cm/mode/jinja2/index.html diff --git a/mini-code-edit/cm/mode/jinja2/jinja2.js b/mini-code-editor/cm/mode/jinja2/jinja2.js similarity index 100% rename from mini-code-edit/cm/mode/jinja2/jinja2.js rename to mini-code-editor/cm/mode/jinja2/jinja2.js diff --git a/mini-code-edit/cm/mode/less/index.html b/mini-code-editor/cm/mode/less/index.html similarity index 100% rename from mini-code-edit/cm/mode/less/index.html rename to mini-code-editor/cm/mode/less/index.html diff --git a/mini-code-edit/cm/mode/less/less.js b/mini-code-editor/cm/mode/less/less.js similarity index 100% rename from mini-code-edit/cm/mode/less/less.js rename to mini-code-editor/cm/mode/less/less.js diff --git a/mini-code-edit/cm/mode/lua/index.html b/mini-code-editor/cm/mode/lua/index.html similarity index 100% rename from mini-code-edit/cm/mode/lua/index.html rename to mini-code-editor/cm/mode/lua/index.html diff --git a/mini-code-edit/cm/mode/lua/lua.js b/mini-code-editor/cm/mode/lua/lua.js similarity index 100% rename from mini-code-edit/cm/mode/lua/lua.js rename to mini-code-editor/cm/mode/lua/lua.js diff --git a/mini-code-edit/cm/mode/markdown/index.html b/mini-code-editor/cm/mode/markdown/index.html similarity index 100% rename from mini-code-edit/cm/mode/markdown/index.html rename to mini-code-editor/cm/mode/markdown/index.html diff --git a/mini-code-edit/cm/mode/markdown/markdown.js b/mini-code-editor/cm/mode/markdown/markdown.js similarity index 100% rename from mini-code-edit/cm/mode/markdown/markdown.js rename to mini-code-editor/cm/mode/markdown/markdown.js diff --git a/mini-code-edit/cm/mode/mysql/index.html b/mini-code-editor/cm/mode/mysql/index.html similarity index 100% rename from mini-code-edit/cm/mode/mysql/index.html rename to mini-code-editor/cm/mode/mysql/index.html diff --git a/mini-code-edit/cm/mode/mysql/mysql.js b/mini-code-editor/cm/mode/mysql/mysql.js similarity index 100% rename from mini-code-edit/cm/mode/mysql/mysql.js rename to mini-code-editor/cm/mode/mysql/mysql.js diff --git a/mini-code-edit/cm/mode/ntriples/index.html b/mini-code-editor/cm/mode/ntriples/index.html similarity index 100% rename from mini-code-edit/cm/mode/ntriples/index.html rename to mini-code-editor/cm/mode/ntriples/index.html diff --git a/mini-code-edit/cm/mode/ntriples/ntriples.js b/mini-code-editor/cm/mode/ntriples/ntriples.js similarity index 100% rename from mini-code-edit/cm/mode/ntriples/ntriples.js rename to mini-code-editor/cm/mode/ntriples/ntriples.js diff --git a/mini-code-edit/cm/mode/pascal/LICENSE b/mini-code-editor/cm/mode/pascal/LICENSE similarity index 100% rename from mini-code-edit/cm/mode/pascal/LICENSE rename to mini-code-editor/cm/mode/pascal/LICENSE diff --git a/mini-code-edit/cm/mode/pascal/index.html b/mini-code-editor/cm/mode/pascal/index.html similarity index 100% rename from mini-code-edit/cm/mode/pascal/index.html rename to mini-code-editor/cm/mode/pascal/index.html diff --git a/mini-code-edit/cm/mode/pascal/pascal.js b/mini-code-editor/cm/mode/pascal/pascal.js similarity index 100% rename from mini-code-edit/cm/mode/pascal/pascal.js rename to mini-code-editor/cm/mode/pascal/pascal.js diff --git a/mini-code-edit/cm/mode/perl/LICENSE b/mini-code-editor/cm/mode/perl/LICENSE similarity index 100% rename from mini-code-edit/cm/mode/perl/LICENSE rename to mini-code-editor/cm/mode/perl/LICENSE diff --git a/mini-code-edit/cm/mode/perl/index.html b/mini-code-editor/cm/mode/perl/index.html similarity index 100% rename from mini-code-edit/cm/mode/perl/index.html rename to mini-code-editor/cm/mode/perl/index.html diff --git a/mini-code-edit/cm/mode/perl/perl.js b/mini-code-editor/cm/mode/perl/perl.js similarity index 100% rename from mini-code-edit/cm/mode/perl/perl.js rename to mini-code-editor/cm/mode/perl/perl.js diff --git a/mini-code-edit/cm/mode/php/index.html b/mini-code-editor/cm/mode/php/index.html similarity index 100% rename from mini-code-edit/cm/mode/php/index.html rename to mini-code-editor/cm/mode/php/index.html diff --git a/mini-code-edit/cm/mode/php/php.js b/mini-code-editor/cm/mode/php/php.js similarity index 100% rename from mini-code-edit/cm/mode/php/php.js rename to mini-code-editor/cm/mode/php/php.js diff --git a/mini-code-edit/cm/mode/pig/index.html b/mini-code-editor/cm/mode/pig/index.html similarity index 100% rename from mini-code-edit/cm/mode/pig/index.html rename to mini-code-editor/cm/mode/pig/index.html diff --git a/mini-code-edit/cm/mode/pig/pig.js b/mini-code-editor/cm/mode/pig/pig.js similarity index 100% rename from mini-code-edit/cm/mode/pig/pig.js rename to mini-code-editor/cm/mode/pig/pig.js diff --git a/mini-code-edit/cm/mode/plsql/index.html b/mini-code-editor/cm/mode/plsql/index.html similarity index 100% rename from mini-code-edit/cm/mode/plsql/index.html rename to mini-code-editor/cm/mode/plsql/index.html diff --git a/mini-code-edit/cm/mode/plsql/plsql.js b/mini-code-editor/cm/mode/plsql/plsql.js similarity index 100% rename from mini-code-edit/cm/mode/plsql/plsql.js rename to mini-code-editor/cm/mode/plsql/plsql.js diff --git a/mini-code-edit/cm/mode/properties/index.html b/mini-code-editor/cm/mode/properties/index.html similarity index 100% rename from mini-code-edit/cm/mode/properties/index.html rename to mini-code-editor/cm/mode/properties/index.html diff --git a/mini-code-edit/cm/mode/properties/properties.js b/mini-code-editor/cm/mode/properties/properties.js similarity index 100% rename from mini-code-edit/cm/mode/properties/properties.js rename to mini-code-editor/cm/mode/properties/properties.js diff --git a/mini-code-edit/cm/mode/python/LICENSE.txt b/mini-code-editor/cm/mode/python/LICENSE.txt similarity index 100% rename from mini-code-edit/cm/mode/python/LICENSE.txt rename to mini-code-editor/cm/mode/python/LICENSE.txt diff --git a/mini-code-edit/cm/mode/python/index.html b/mini-code-editor/cm/mode/python/index.html similarity index 100% rename from mini-code-edit/cm/mode/python/index.html rename to mini-code-editor/cm/mode/python/index.html diff --git a/mini-code-edit/cm/mode/python/python.js b/mini-code-editor/cm/mode/python/python.js similarity index 100% rename from mini-code-edit/cm/mode/python/python.js rename to mini-code-editor/cm/mode/python/python.js diff --git a/mini-code-edit/cm/mode/r/LICENSE b/mini-code-editor/cm/mode/r/LICENSE similarity index 100% rename from mini-code-edit/cm/mode/r/LICENSE rename to mini-code-editor/cm/mode/r/LICENSE diff --git a/mini-code-edit/cm/mode/r/index.html b/mini-code-editor/cm/mode/r/index.html similarity index 100% rename from mini-code-edit/cm/mode/r/index.html rename to mini-code-editor/cm/mode/r/index.html diff --git a/mini-code-edit/cm/mode/r/r.js b/mini-code-editor/cm/mode/r/r.js similarity index 100% rename from mini-code-edit/cm/mode/r/r.js rename to mini-code-editor/cm/mode/r/r.js diff --git a/mini-code-edit/cm/mode/rpm/changes/changes.js b/mini-code-editor/cm/mode/rpm/changes/changes.js similarity index 100% rename from mini-code-edit/cm/mode/rpm/changes/changes.js rename to mini-code-editor/cm/mode/rpm/changes/changes.js diff --git a/mini-code-edit/cm/mode/rpm/changes/index.html b/mini-code-editor/cm/mode/rpm/changes/index.html similarity index 100% rename from mini-code-edit/cm/mode/rpm/changes/index.html rename to mini-code-editor/cm/mode/rpm/changes/index.html diff --git a/mini-code-edit/cm/mode/rpm/spec/index.html b/mini-code-editor/cm/mode/rpm/spec/index.html similarity index 100% rename from mini-code-edit/cm/mode/rpm/spec/index.html rename to mini-code-editor/cm/mode/rpm/spec/index.html diff --git a/mini-code-edit/cm/mode/rpm/spec/spec.css b/mini-code-editor/cm/mode/rpm/spec/spec.css similarity index 100% rename from mini-code-edit/cm/mode/rpm/spec/spec.css rename to mini-code-editor/cm/mode/rpm/spec/spec.css diff --git a/mini-code-edit/cm/mode/rpm/spec/spec.js b/mini-code-editor/cm/mode/rpm/spec/spec.js similarity index 100% rename from mini-code-edit/cm/mode/rpm/spec/spec.js rename to mini-code-editor/cm/mode/rpm/spec/spec.js diff --git a/mini-code-edit/cm/mode/rst/index.html b/mini-code-editor/cm/mode/rst/index.html similarity index 100% rename from mini-code-edit/cm/mode/rst/index.html rename to mini-code-editor/cm/mode/rst/index.html diff --git a/mini-code-edit/cm/mode/rst/rst.js b/mini-code-editor/cm/mode/rst/rst.js similarity index 100% rename from mini-code-edit/cm/mode/rst/rst.js rename to mini-code-editor/cm/mode/rst/rst.js diff --git a/mini-code-edit/cm/mode/ruby/LICENSE b/mini-code-editor/cm/mode/ruby/LICENSE similarity index 100% rename from mini-code-edit/cm/mode/ruby/LICENSE rename to mini-code-editor/cm/mode/ruby/LICENSE diff --git a/mini-code-edit/cm/mode/ruby/index.html b/mini-code-editor/cm/mode/ruby/index.html similarity index 100% rename from mini-code-edit/cm/mode/ruby/index.html rename to mini-code-editor/cm/mode/ruby/index.html diff --git a/mini-code-edit/cm/mode/ruby/ruby.js b/mini-code-editor/cm/mode/ruby/ruby.js similarity index 100% rename from mini-code-edit/cm/mode/ruby/ruby.js rename to mini-code-editor/cm/mode/ruby/ruby.js diff --git a/mini-code-edit/cm/mode/rust/index.html b/mini-code-editor/cm/mode/rust/index.html similarity index 100% rename from mini-code-edit/cm/mode/rust/index.html rename to mini-code-editor/cm/mode/rust/index.html diff --git a/mini-code-edit/cm/mode/rust/rust.js b/mini-code-editor/cm/mode/rust/rust.js similarity index 100% rename from mini-code-edit/cm/mode/rust/rust.js rename to mini-code-editor/cm/mode/rust/rust.js diff --git a/mini-code-edit/cm/mode/scheme/index.html b/mini-code-editor/cm/mode/scheme/index.html similarity index 100% rename from mini-code-edit/cm/mode/scheme/index.html rename to mini-code-editor/cm/mode/scheme/index.html diff --git a/mini-code-edit/cm/mode/scheme/scheme.js b/mini-code-editor/cm/mode/scheme/scheme.js similarity index 100% rename from mini-code-edit/cm/mode/scheme/scheme.js rename to mini-code-editor/cm/mode/scheme/scheme.js diff --git a/mini-code-edit/cm/mode/shell/index.html b/mini-code-editor/cm/mode/shell/index.html similarity index 100% rename from mini-code-edit/cm/mode/shell/index.html rename to mini-code-editor/cm/mode/shell/index.html diff --git a/mini-code-edit/cm/mode/shell/shell.js b/mini-code-editor/cm/mode/shell/shell.js similarity index 100% rename from mini-code-edit/cm/mode/shell/shell.js rename to mini-code-editor/cm/mode/shell/shell.js diff --git a/mini-code-edit/cm/mode/smalltalk/index.html b/mini-code-editor/cm/mode/smalltalk/index.html similarity index 100% rename from mini-code-edit/cm/mode/smalltalk/index.html rename to mini-code-editor/cm/mode/smalltalk/index.html diff --git a/mini-code-edit/cm/mode/smalltalk/smalltalk.js b/mini-code-editor/cm/mode/smalltalk/smalltalk.js similarity index 100% rename from mini-code-edit/cm/mode/smalltalk/smalltalk.js rename to mini-code-editor/cm/mode/smalltalk/smalltalk.js diff --git a/mini-code-edit/cm/mode/smarty/index.html b/mini-code-editor/cm/mode/smarty/index.html similarity index 100% rename from mini-code-edit/cm/mode/smarty/index.html rename to mini-code-editor/cm/mode/smarty/index.html diff --git a/mini-code-edit/cm/mode/smarty/smarty.js b/mini-code-editor/cm/mode/smarty/smarty.js similarity index 100% rename from mini-code-edit/cm/mode/smarty/smarty.js rename to mini-code-editor/cm/mode/smarty/smarty.js diff --git a/mini-code-edit/cm/mode/sparql/index.html b/mini-code-editor/cm/mode/sparql/index.html similarity index 100% rename from mini-code-edit/cm/mode/sparql/index.html rename to mini-code-editor/cm/mode/sparql/index.html diff --git a/mini-code-edit/cm/mode/sparql/sparql.js b/mini-code-editor/cm/mode/sparql/sparql.js similarity index 100% rename from mini-code-edit/cm/mode/sparql/sparql.js rename to mini-code-editor/cm/mode/sparql/sparql.js diff --git a/mini-code-edit/cm/mode/stex/index.html b/mini-code-editor/cm/mode/stex/index.html similarity index 100% rename from mini-code-edit/cm/mode/stex/index.html rename to mini-code-editor/cm/mode/stex/index.html diff --git a/mini-code-edit/cm/mode/stex/stex.js b/mini-code-editor/cm/mode/stex/stex.js similarity index 100% rename from mini-code-edit/cm/mode/stex/stex.js rename to mini-code-editor/cm/mode/stex/stex.js diff --git a/mini-code-edit/cm/mode/stex/test.html b/mini-code-editor/cm/mode/stex/test.html similarity index 100% rename from mini-code-edit/cm/mode/stex/test.html rename to mini-code-editor/cm/mode/stex/test.html diff --git a/mini-code-edit/cm/mode/tiddlywiki/index.html b/mini-code-editor/cm/mode/tiddlywiki/index.html similarity index 100% rename from mini-code-edit/cm/mode/tiddlywiki/index.html rename to mini-code-editor/cm/mode/tiddlywiki/index.html diff --git a/mini-code-edit/cm/mode/tiddlywiki/tiddlywiki.css b/mini-code-editor/cm/mode/tiddlywiki/tiddlywiki.css similarity index 100% rename from mini-code-edit/cm/mode/tiddlywiki/tiddlywiki.css rename to mini-code-editor/cm/mode/tiddlywiki/tiddlywiki.css diff --git a/mini-code-edit/cm/mode/tiddlywiki/tiddlywiki.js b/mini-code-editor/cm/mode/tiddlywiki/tiddlywiki.js similarity index 100% rename from mini-code-edit/cm/mode/tiddlywiki/tiddlywiki.js rename to mini-code-editor/cm/mode/tiddlywiki/tiddlywiki.js diff --git a/mini-code-edit/cm/mode/tiki/index.html b/mini-code-editor/cm/mode/tiki/index.html similarity index 100% rename from mini-code-edit/cm/mode/tiki/index.html rename to mini-code-editor/cm/mode/tiki/index.html diff --git a/mini-code-edit/cm/mode/tiki/tiki.css b/mini-code-editor/cm/mode/tiki/tiki.css similarity index 100% rename from mini-code-edit/cm/mode/tiki/tiki.css rename to mini-code-editor/cm/mode/tiki/tiki.css diff --git a/mini-code-edit/cm/mode/tiki/tiki.js b/mini-code-editor/cm/mode/tiki/tiki.js similarity index 100% rename from mini-code-edit/cm/mode/tiki/tiki.js rename to mini-code-editor/cm/mode/tiki/tiki.js diff --git a/mini-code-edit/cm/mode/vbscript/index.html b/mini-code-editor/cm/mode/vbscript/index.html similarity index 100% rename from mini-code-edit/cm/mode/vbscript/index.html rename to mini-code-editor/cm/mode/vbscript/index.html diff --git a/mini-code-edit/cm/mode/vbscript/vbscript.js b/mini-code-editor/cm/mode/vbscript/vbscript.js similarity index 100% rename from mini-code-edit/cm/mode/vbscript/vbscript.js rename to mini-code-editor/cm/mode/vbscript/vbscript.js diff --git a/mini-code-edit/cm/mode/velocity/index.html b/mini-code-editor/cm/mode/velocity/index.html similarity index 100% rename from mini-code-edit/cm/mode/velocity/index.html rename to mini-code-editor/cm/mode/velocity/index.html diff --git a/mini-code-edit/cm/mode/velocity/velocity.js b/mini-code-editor/cm/mode/velocity/velocity.js similarity index 100% rename from mini-code-edit/cm/mode/velocity/velocity.js rename to mini-code-editor/cm/mode/velocity/velocity.js diff --git a/mini-code-edit/cm/mode/verilog/index.html b/mini-code-editor/cm/mode/verilog/index.html similarity index 100% rename from mini-code-edit/cm/mode/verilog/index.html rename to mini-code-editor/cm/mode/verilog/index.html diff --git a/mini-code-edit/cm/mode/verilog/verilog.js b/mini-code-editor/cm/mode/verilog/verilog.js similarity index 100% rename from mini-code-edit/cm/mode/verilog/verilog.js rename to mini-code-editor/cm/mode/verilog/verilog.js diff --git a/mini-code-edit/cm/mode/xml/index.html b/mini-code-editor/cm/mode/xml/index.html similarity index 100% rename from mini-code-edit/cm/mode/xml/index.html rename to mini-code-editor/cm/mode/xml/index.html diff --git a/mini-code-edit/cm/mode/xml/xml.js b/mini-code-editor/cm/mode/xml/xml.js similarity index 100% rename from mini-code-edit/cm/mode/xml/xml.js rename to mini-code-editor/cm/mode/xml/xml.js diff --git a/mini-code-edit/cm/mode/xquery/LICENSE b/mini-code-editor/cm/mode/xquery/LICENSE similarity index 100% rename from mini-code-edit/cm/mode/xquery/LICENSE rename to mini-code-editor/cm/mode/xquery/LICENSE diff --git a/mini-code-edit/cm/mode/xquery/index.html b/mini-code-editor/cm/mode/xquery/index.html similarity index 100% rename from mini-code-edit/cm/mode/xquery/index.html rename to mini-code-editor/cm/mode/xquery/index.html diff --git a/mini-code-edit/cm/mode/xquery/test/index.html b/mini-code-editor/cm/mode/xquery/test/index.html similarity index 100% rename from mini-code-edit/cm/mode/xquery/test/index.html rename to mini-code-editor/cm/mode/xquery/test/index.html diff --git a/mini-code-edit/cm/mode/xquery/test/testBase.js b/mini-code-editor/cm/mode/xquery/test/testBase.js similarity index 100% rename from mini-code-edit/cm/mode/xquery/test/testBase.js rename to mini-code-editor/cm/mode/xquery/test/testBase.js diff --git a/mini-code-edit/cm/mode/xquery/test/testEmptySequenceKeyword.js b/mini-code-editor/cm/mode/xquery/test/testEmptySequenceKeyword.js similarity index 100% rename from mini-code-edit/cm/mode/xquery/test/testEmptySequenceKeyword.js rename to mini-code-editor/cm/mode/xquery/test/testEmptySequenceKeyword.js diff --git a/mini-code-edit/cm/mode/xquery/test/testMultiAttr.js b/mini-code-editor/cm/mode/xquery/test/testMultiAttr.js similarity index 100% rename from mini-code-edit/cm/mode/xquery/test/testMultiAttr.js rename to mini-code-editor/cm/mode/xquery/test/testMultiAttr.js diff --git a/mini-code-edit/cm/mode/xquery/test/testNamespaces.js b/mini-code-editor/cm/mode/xquery/test/testNamespaces.js similarity index 100% rename from mini-code-edit/cm/mode/xquery/test/testNamespaces.js rename to mini-code-editor/cm/mode/xquery/test/testNamespaces.js diff --git a/mini-code-edit/cm/mode/xquery/test/testProcessingInstructions.js b/mini-code-editor/cm/mode/xquery/test/testProcessingInstructions.js similarity index 100% rename from mini-code-edit/cm/mode/xquery/test/testProcessingInstructions.js rename to mini-code-editor/cm/mode/xquery/test/testProcessingInstructions.js diff --git a/mini-code-edit/cm/mode/xquery/test/testQuotes.js b/mini-code-editor/cm/mode/xquery/test/testQuotes.js similarity index 100% rename from mini-code-edit/cm/mode/xquery/test/testQuotes.js rename to mini-code-editor/cm/mode/xquery/test/testQuotes.js diff --git a/mini-code-edit/cm/mode/xquery/xquery.js b/mini-code-editor/cm/mode/xquery/xquery.js similarity index 100% rename from mini-code-edit/cm/mode/xquery/xquery.js rename to mini-code-editor/cm/mode/xquery/xquery.js diff --git a/mini-code-edit/cm/mode/yaml/index.html b/mini-code-editor/cm/mode/yaml/index.html similarity index 100% rename from mini-code-edit/cm/mode/yaml/index.html rename to mini-code-editor/cm/mode/yaml/index.html diff --git a/mini-code-edit/cm/mode/yaml/yaml.js b/mini-code-editor/cm/mode/yaml/yaml.js similarity index 100% rename from mini-code-edit/cm/mode/yaml/yaml.js rename to mini-code-editor/cm/mode/yaml/yaml.js diff --git a/mini-code-edit/cm/test/index.html b/mini-code-editor/cm/test/index.html similarity index 100% rename from mini-code-edit/cm/test/index.html rename to mini-code-editor/cm/test/index.html diff --git a/mini-code-edit/cm/test/mode_test.css b/mini-code-editor/cm/test/mode_test.css similarity index 100% rename from mini-code-edit/cm/test/mode_test.css rename to mini-code-editor/cm/test/mode_test.css diff --git a/mini-code-edit/cm/test/mode_test.js b/mini-code-editor/cm/test/mode_test.js similarity index 100% rename from mini-code-edit/cm/test/mode_test.js rename to mini-code-editor/cm/test/mode_test.js diff --git a/mini-code-edit/cm/test/test.js b/mini-code-editor/cm/test/test.js similarity index 100% rename from mini-code-edit/cm/test/test.js rename to mini-code-editor/cm/test/test.js diff --git a/mini-code-edit/cm/theme/ambiance.css b/mini-code-editor/cm/theme/ambiance.css similarity index 100% rename from mini-code-edit/cm/theme/ambiance.css rename to mini-code-editor/cm/theme/ambiance.css diff --git a/mini-code-edit/cm/theme/blackboard.css b/mini-code-editor/cm/theme/blackboard.css similarity index 100% rename from mini-code-edit/cm/theme/blackboard.css rename to mini-code-editor/cm/theme/blackboard.css diff --git a/mini-code-edit/cm/theme/cobalt.css b/mini-code-editor/cm/theme/cobalt.css similarity index 100% rename from mini-code-edit/cm/theme/cobalt.css rename to mini-code-editor/cm/theme/cobalt.css diff --git a/mini-code-edit/cm/theme/eclipse.css b/mini-code-editor/cm/theme/eclipse.css similarity index 100% rename from mini-code-edit/cm/theme/eclipse.css rename to mini-code-editor/cm/theme/eclipse.css diff --git a/mini-code-edit/cm/theme/elegant.css b/mini-code-editor/cm/theme/elegant.css similarity index 100% rename from mini-code-edit/cm/theme/elegant.css rename to mini-code-editor/cm/theme/elegant.css diff --git a/mini-code-edit/cm/theme/erlang-dark.css b/mini-code-editor/cm/theme/erlang-dark.css similarity index 100% rename from mini-code-edit/cm/theme/erlang-dark.css rename to mini-code-editor/cm/theme/erlang-dark.css diff --git a/mini-code-edit/cm/theme/lesser-dark.css b/mini-code-editor/cm/theme/lesser-dark.css similarity index 100% rename from mini-code-edit/cm/theme/lesser-dark.css rename to mini-code-editor/cm/theme/lesser-dark.css diff --git a/mini-code-edit/cm/theme/monokai.css b/mini-code-editor/cm/theme/monokai.css similarity index 100% rename from mini-code-edit/cm/theme/monokai.css rename to mini-code-editor/cm/theme/monokai.css diff --git a/mini-code-edit/cm/theme/neat.css b/mini-code-editor/cm/theme/neat.css similarity index 100% rename from mini-code-edit/cm/theme/neat.css rename to mini-code-editor/cm/theme/neat.css diff --git a/mini-code-edit/cm/theme/night.css b/mini-code-editor/cm/theme/night.css similarity index 100% rename from mini-code-edit/cm/theme/night.css rename to mini-code-editor/cm/theme/night.css diff --git a/mini-code-edit/cm/theme/rubyblue.css b/mini-code-editor/cm/theme/rubyblue.css similarity index 100% rename from mini-code-edit/cm/theme/rubyblue.css rename to mini-code-editor/cm/theme/rubyblue.css diff --git a/mini-code-edit/cm/theme/xq-dark.css b/mini-code-editor/cm/theme/xq-dark.css similarity index 100% rename from mini-code-edit/cm/theme/xq-dark.css rename to mini-code-editor/cm/theme/xq-dark.css diff --git a/mini-code-edit/editor.js b/mini-code-editor/editor.js similarity index 95% rename from mini-code-edit/editor.js rename to mini-code-editor/editor.js index a530551..838f9d9 100644 --- a/mini-code-edit/editor.js +++ b/mini-code-editor/editor.js @@ -4,12 +4,9 @@ var menu; var fileEntry; var hasWriteAccess; -var remote = require('remote'); -var Menu = remote.require('menu'); -var MenuItem = remote.require('menu-item'); -var dialog = remote.require('dialog'); -var fs = require("fs"); -var clipboard = require('clipboard'); +const {remote, clipboard} = require('electron'); +const {Menu, MenuItem, dialog } = remote; +const fs = require("fs"); function handleDocumentChange(title) { var mode = "javascript"; diff --git a/mini-code-edit/img/128x128/file_edit.png b/mini-code-editor/img/128x128/file_edit.png similarity index 100% rename from mini-code-edit/img/128x128/file_edit.png rename to mini-code-editor/img/128x128/file_edit.png diff --git a/mini-code-edit/img/16x16/diskette.png b/mini-code-editor/img/16x16/diskette.png similarity index 100% rename from mini-code-edit/img/16x16/diskette.png rename to mini-code-editor/img/16x16/diskette.png diff --git a/mini-code-edit/img/16x16/file.png b/mini-code-editor/img/16x16/file.png similarity index 100% rename from mini-code-edit/img/16x16/file.png rename to mini-code-editor/img/16x16/file.png diff --git a/mini-code-edit/img/16x16/file_add.png b/mini-code-editor/img/16x16/file_add.png similarity index 100% rename from mini-code-edit/img/16x16/file_add.png rename to mini-code-editor/img/16x16/file_add.png diff --git a/mini-code-edit/img/16x16/file_edit.png b/mini-code-editor/img/16x16/file_edit.png similarity index 100% rename from mini-code-edit/img/16x16/file_edit.png rename to mini-code-editor/img/16x16/file_edit.png diff --git a/mini-code-edit/img/32x32/diskette.png b/mini-code-editor/img/32x32/diskette.png similarity index 100% rename from mini-code-edit/img/32x32/diskette.png rename to mini-code-editor/img/32x32/diskette.png diff --git a/mini-code-edit/img/32x32/file.png b/mini-code-editor/img/32x32/file.png similarity index 100% rename from mini-code-edit/img/32x32/file.png rename to mini-code-editor/img/32x32/file.png diff --git a/mini-code-edit/img/32x32/file_add.png b/mini-code-editor/img/32x32/file_add.png similarity index 100% rename from mini-code-edit/img/32x32/file_add.png rename to mini-code-editor/img/32x32/file_add.png diff --git a/mini-code-edit/img/32x32/file_edit.png b/mini-code-editor/img/32x32/file_edit.png similarity index 100% rename from mini-code-edit/img/32x32/file_edit.png rename to mini-code-editor/img/32x32/file_edit.png diff --git a/mini-code-edit/img/48x48/file_edit.png b/mini-code-editor/img/48x48/file_edit.png similarity index 100% rename from mini-code-edit/img/48x48/file_edit.png rename to mini-code-editor/img/48x48/file_edit.png diff --git a/mini-code-edit/img/64x64/file_edit.png b/mini-code-editor/img/64x64/file_edit.png similarity index 100% rename from mini-code-edit/img/64x64/file_edit.png rename to mini-code-editor/img/64x64/file_edit.png diff --git a/mini-code-edit/img/README.txt b/mini-code-editor/img/README.txt similarity index 100% rename from mini-code-edit/img/README.txt rename to mini-code-editor/img/README.txt diff --git a/mini-code-edit/index.html b/mini-code-editor/index.html similarity index 100% rename from mini-code-edit/index.html rename to mini-code-editor/index.html diff --git a/mini-code-edit/main.js b/mini-code-editor/main.js similarity index 60% rename from mini-code-edit/main.js rename to mini-code-editor/main.js index 502e73c..c03e732 100644 --- a/mini-code-edit/main.js +++ b/mini-code-editor/main.js @@ -1,33 +1,27 @@ -var app = require('app'); // Module to control application life. -var BrowserWindow = require('browser-window'); // Module to create native browser window. - -// Report crashes to our server. -require('crash-reporter').start(); - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow = null; - -// Quit when all windows are closed. -app.on('window-all-closed', function() { - if (process.platform != 'darwin') - app.quit(); -}); - -// This method will be called when Electron has done everything -// initialization and ready for creating browser windows. -app.on('ready', function() { - // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600}); - - // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - - // Emitted when the window is closed. - mainWindow.on('closed', function() { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - mainWindow = null; - }); -}); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + if (process.platform != 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width: 800, height: 600}); + + // and load the index.html of the app. + mainWindow.loadURL('file://' + __dirname + '/index.html'); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); diff --git a/mini-code-editor/package.json b/mini-code-editor/package.json new file mode 100644 index 0000000..9740b03 --- /dev/null +++ b/mini-code-editor/package.json @@ -0,0 +1,5 @@ +{ + "name" : "mini-code-editor", + "version" : "1.1.0", + "main" : "main.js" +} diff --git a/mini-code-edit/screenshot/screenshot.png b/mini-code-editor/screenshot/screenshot.png similarity index 100% rename from mini-code-edit/screenshot/screenshot.png rename to mini-code-editor/screenshot/screenshot.png diff --git a/mini-code-edit/style.css b/mini-code-editor/style.css similarity index 100% rename from mini-code-edit/style.css rename to mini-code-editor/style.css diff --git a/mini-code-edit/zepto.min.js b/mini-code-editor/zepto.min.js similarity index 100% rename from mini-code-edit/zepto.min.js rename to mini-code-editor/zepto.min.js diff --git a/mp3-encoder/README.md b/mp3-encoder/README.md index ff4cd7e..1fe9846 100644 --- a/mp3-encoder/README.md +++ b/mp3-encoder/README.md @@ -1,5 +1,4 @@ -MP3 Encoder -=============== +# MP3 Encoder -Dummy app to test electron using an external process, coffee-script -and backbone on both windows and OSX +Dummy app to test electron using an external process, coffee-script +and backbone on both windows and OSX. diff --git a/mp3-encoder/main.js b/mp3-encoder/main.js index 502e73c..c03e732 100644 --- a/mp3-encoder/main.js +++ b/mp3-encoder/main.js @@ -1,33 +1,27 @@ -var app = require('app'); // Module to control application life. -var BrowserWindow = require('browser-window'); // Module to create native browser window. - -// Report crashes to our server. -require('crash-reporter').start(); - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow = null; - -// Quit when all windows are closed. -app.on('window-all-closed', function() { - if (process.platform != 'darwin') - app.quit(); -}); - -// This method will be called when Electron has done everything -// initialization and ready for creating browser windows. -app.on('ready', function() { - // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600}); - - // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - - // Emitted when the window is closed. - mainWindow.on('closed', function() { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - mainWindow = null; - }); -}); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + if (process.platform != 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width: 800, height: 600}); + + // and load the index.html of the app. + mainWindow.loadURL('file://' + __dirname + '/index.html'); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); diff --git a/mp3-encoder/package.json b/mp3-encoder/package.json index dd0f597..a43756f 100644 --- a/mp3-encoder/package.json +++ b/mp3-encoder/package.json @@ -1,5 +1,5 @@ { "name" : "mp3-encoder-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/notifications/main.js b/notifications/main.js index dbdb12d..05fcc56 100644 --- a/notifications/main.js +++ b/notifications/main.js @@ -1,8 +1,8 @@ -var app = require('app'); -var BrowserWindow = require('browser-window'); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; -var mainWindow = null; app.on('ready', function() { mainWindow = new BrowserWindow({width: 800, height: 600}); - mainWindow.loadUrl('file://' + __dirname + '/window.html'); + mainWindow.loadURL('file://' + __dirname + '/window.html'); }); diff --git a/notifications/package.json b/notifications/package.json index 3879f51..e7e6366 100644 --- a/notifications/package.json +++ b/notifications/package.json @@ -1,5 +1,5 @@ { "name" : "notification-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/notifications/slack_icon.png b/notifications/slack_icon.png new file mode 100644 index 0000000..fee4e4a Binary files /dev/null and b/notifications/slack_icon.png differ diff --git a/pepper-flash-plugin/main.js b/pepper-flash-plugin/main.js index ce79fc9..e6b0e11 100644 --- a/pepper-flash-plugin/main.js +++ b/pepper-flash-plugin/main.js @@ -1,15 +1,14 @@ -var app = require('app'); -var path = require('path'); -var BrowserWindow = require('browser-window'); +const {app, BrowserWindow} = require('electron'); +const path = require('path'); -var mainWindow = null; +let mainWindow; app.on('window-all-closed', function() { if (process.platform != 'darwin') app.quit(); }); -var ppapi_flash_path = null; +let ppapi_flash_path; // Specify flash path. // On Windows, it might be /path/to/pepflashplayer.dll @@ -34,5 +33,5 @@ app.on('ready', function() { 'height': 600, 'web-preferences': {'plugins': true} }); - mainWindow.loadUrl('http://www.adobe.com/software/flash/about/'); + mainWindow.loadURL('http://www.adobe.com/software/flash/about/'); }); diff --git a/pepper-flash-plugin/package.json b/pepper-flash-plugin/package.json index 54276c4..70a6d4b 100644 --- a/pepper-flash-plugin/package.json +++ b/pepper-flash-plugin/package.json @@ -1,5 +1,5 @@ -{ - "name" : "pepper-flash-plugin-sample", - "version" : "0.1.0", - "main" : "main.js" -} +{ + "name" : "pepper-flash-plugin-sample", + "version" : "1.1.0", + "main" : "main.js" +} diff --git a/pepper-flash-plugin/readme.md b/pepper-flash-plugin/readme.md index 37c91b9..6fb13c6 100644 --- a/pepper-flash-plugin/readme.md +++ b/pepper-flash-plugin/readme.md @@ -1,7 +1,7 @@ # Pepper-Flash-Plugin Sample A sample shows Pepper Flash Plugin usage in Electron. More details can be found -at https://github.com/atom/electron/blob/master/docs/tutorial/using-pepper-flash-plugin.md. +at https://github.com/electron/electron/blob/master/docs/tutorial/using-pepper-flash-plugin.md. ## Run steps @@ -15,7 +15,7 @@ If it succees, you can view `You have version X.X.X.X installed` in the sample p ## Ways to find pepper flash plugin 1. Copy from Chrome Browser: you can find the plugin(`Adobe Flash Player`) location -by navigating `chrome:://plugins` in Chrome Browser. +by navigating `chrome://plugins` in Chrome Browser. 2. Manually install Adobe Flash Player from https://get.adobe.com/flashplayer/otherversions/. Then you can find plugin in the installed directory, ie. On Windows, the directory @@ -29,7 +29,6 @@ This means you mixing up the architectures. You need to make the architecture of flash plugin consitent with Electron you run, e.g., load 32-bit flash plugin in 32-bit Electron. - ## Screenshot ![screenshot](/pepper-flash-plugin/screenshot/screenshot.png) diff --git a/power-save-blocker/main.js b/power-save-blocker/main.js index 4942066..9a20593 100644 --- a/power-save-blocker/main.js +++ b/power-save-blocker/main.js @@ -1,56 +1,52 @@ -var app = require('app'); -var Tray = require('tray'); -var Menu = require('menu'); -var path = require('path'); -var powerSaveBlocker = require('power-save-blocker'); -var BrowserWindow = require('browser-window'); - -var appIcon = null; -var win = null; -var disabledIconPath = path.join(__dirname, 'images', 'night-19.png'); -var appSuspensionIconPath = path.join(__dirname, 'images', 'sunset-19.png'); -var displaySleepIconPath = path.join(__dirname, 'images', 'day-19.png'); - -app.on('ready', function(){ - win = new BrowserWindow({show: false}); - appIcon = new Tray(disabledIconPath); - var blocker_id = null; - var contextMenu = Menu.buildFromTemplate([ - { - label: 'Prevent app suspension', - type: 'radio', - icon: appSuspensionIconPath, - click: function() { - if (blocker_id) - powerSaveBlocker.stop(blocker_id); - blocker_id = powerSaveBlocker.start('prevent-app-suspension'); - } - }, - { - label: 'Prevent display sleep', - type: 'radio', - icon: displaySleepIconPath, - click: function() { - if (blocker_id) - powerSaveBlocker.stop(blocker_id); - blocker_id = powerSaveBlocker.start('prevent-display-sleep'); - } - }, - { - label: 'Disable', - type: 'radio', - icon: disabledIconPath, - checked: true, - click: function() { - if (blocker_id) - powerSaveBlocker.stop(blocker_id); - } - }, - { label: 'Quit', - accelerator: 'Command+Q', - selector: 'terminate:', - } - ]); - appIcon.setToolTip('Keep system awake'); - appIcon.setContextMenu(contextMenu); -}); +const {app, Tray, Menu, powerSaveBlocker, BrowserWindow} = require('electron'); +const path = require('path'); + +let appIcon; +let win; +const disabledIconPath = path.join(__dirname, 'images', 'night-19.png'); +const appSuspensionIconPath = path.join(__dirname, 'images', 'sunset-19.png'); +const displaySleepIconPath = path.join(__dirname, 'images', 'day-19.png'); + +app.on('ready', function(){ + win = new BrowserWindow({show: false}); + appIcon = new Tray(disabledIconPath); + let blocker_id = null; + var contextMenu = Menu.buildFromTemplate([ + { + label: 'Prevent app suspension', + type: 'radio', + icon: appSuspensionIconPath, + click: function() { + if (blocker_id) + powerSaveBlocker.stop(blocker_id); + blocker_id = powerSaveBlocker.start('prevent-app-suspension'); + } + }, + { + label: 'Prevent display sleep', + type: 'radio', + icon: displaySleepIconPath, + click: function() { + if (blocker_id) + powerSaveBlocker.stop(blocker_id); + blocker_id = powerSaveBlocker.start('prevent-display-sleep'); + } + }, + { + label: 'Disable', + type: 'radio', + icon: disabledIconPath, + checked: true, + click: function() { + if (blocker_id) + powerSaveBlocker.stop(blocker_id); + } + }, + { label: 'Quit', + accelerator: 'Command+Q', + selector: 'terminate:', + } + ]); + appIcon.setToolTip('Keep system awake'); + appIcon.setContextMenu(contextMenu); +}); diff --git a/power-save-blocker/package.json b/power-save-blocker/package.json index 58c3ff0..f283562 100644 --- a/power-save-blocker/package.json +++ b/power-save-blocker/package.json @@ -1,5 +1,5 @@ { "name" : "power-save-blocker-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/power-save-blocker/readme.md b/power-save-blocker/readme.md index 2291359..d00762d 100644 --- a/power-save-blocker/readme.md +++ b/power-save-blocker/readme.md @@ -4,7 +4,7 @@ A tray sample reprevents the display from sleep. ## APIs -[power-save-blocker](https://github.com/atom/electron/blob/master/docs/api/power-save-blocker.md) +[power-save-blocker](https://github.com/electron/electron/blob/master/docs/api/power-save-blocker.md) ## Screenshot diff --git a/printing/main.js b/printing/main.js index ff8a0f8..e132636 100644 --- a/printing/main.js +++ b/printing/main.js @@ -1,15 +1,14 @@ -var app = require('app'); -var BrowserWindow = require('browser-window'); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; -var mainWindow = null; app.on('ready', function() { mainWindow = new BrowserWindow({x:100, y:100, width: 400, height: 420}); - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - mainWindow.on('close', function() { - var windows = BrowserWindow.getAllWindows(); - for (var i = 0; i < windows.length; ++i) { - if (windows[i] != mainWindow) - windows[i].close(); + mainWindow.loadURL('file://' + __dirname + '/index.html'); + mainWindow.on('close', () => { + for (let window of BrowserWindow.getAllWindows()) { + if (window != mainWindow) + window.close(); } }) }); diff --git a/printing/package.json b/printing/package.json index d738273..a2513d4 100644 --- a/printing/package.json +++ b/printing/package.json @@ -1,5 +1,5 @@ { "name" : "printing-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/printing/print.js b/printing/print.js index a6f2b0a..1a494b7 100644 --- a/printing/print.js +++ b/printing/print.js @@ -1,12 +1,9 @@ -var remote = require('remote'); -var shell = remote.require('shell'); -var fs = require('fs'); +const {remote} = require('electron'); +const {BrowserWindow, dialog, shell} = remote; +const fs = require('fs'); -var BrowserWindow = remote.require('browser-window'); -var dialog = remote.require('dialog'); - -var print_win = null; -var save_pdf_path = null; +let print_win; +let save_pdf_path; function getPDFPrintSettings() { var option = { @@ -35,7 +32,7 @@ function getPDFPrintSettings() { function print() { if (print_win) - print_win.print(); + print_win.webContents.print(); } function savePDF() { @@ -45,7 +42,7 @@ function savePDF() { } dialog.showSaveDialog(print_win, {}, function(file_path) { if (file_path) { - print_win.printToPDF(getPDFPrintSettings(), function(err, data) { + print_win.webContents.printToPDF(getPDFPrintSettings(), function(err, data) { if (err) { dialog.showErrorBox('Error', err); return; @@ -74,7 +71,7 @@ function viewPDF() { document.addEventListener('DOMContentLoaded', function() { print_win = new BrowserWindow({'auto-hide-menu-bar':true}); - print_win.loadUrl('file://' + __dirname + '/print.html'); + print_win.loadURL('file://' + __dirname + '/print.html'); print_win.show(); print_win.webContents.on('did-finish-load', function() { diff --git a/spellchecking/README.md b/spell-check/README.md similarity index 100% rename from spellchecking/README.md rename to spell-check/README.md diff --git a/spellchecking/app.css b/spell-check/app.css similarity index 100% rename from spellchecking/app.css rename to spell-check/app.css diff --git a/spell-check/app.js b/spell-check/app.js new file mode 100644 index 0000000..a569265 --- /dev/null +++ b/spell-check/app.js @@ -0,0 +1,13 @@ +// initialize spell checking +const checker = require('spellchecker'); + +const {remote} = require('electron'); +const {webFrame} = remote; + +webFrame.setSpellCheckProvider("en-US", true, { + spellCheck: function(text) { + console.log("Spellchecker called on "+text); + return !checker.isMisspelled(text); + } +}); + diff --git a/spellchecking/index.html b/spell-check/index.html similarity index 100% rename from spellchecking/index.html rename to spell-check/index.html diff --git a/spellchecking/main.js b/spell-check/main.js similarity index 60% rename from spellchecking/main.js rename to spell-check/main.js index 502e73c..c03e732 100644 --- a/spellchecking/main.js +++ b/spell-check/main.js @@ -1,33 +1,27 @@ -var app = require('app'); // Module to control application life. -var BrowserWindow = require('browser-window'); // Module to create native browser window. - -// Report crashes to our server. -require('crash-reporter').start(); - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow = null; - -// Quit when all windows are closed. -app.on('window-all-closed', function() { - if (process.platform != 'darwin') - app.quit(); -}); - -// This method will be called when Electron has done everything -// initialization and ready for creating browser windows. -app.on('ready', function() { - // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600}); - - // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - - // Emitted when the window is closed. - mainWindow.on('closed', function() { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - mainWindow = null; - }); -}); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + if (process.platform != 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width: 800, height: 600}); + + // and load the index.html of the app. + mainWindow.loadURL('file://' + __dirname + '/index.html'); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); diff --git a/spellchecking/package.json b/spell-check/package.json similarity index 83% rename from spellchecking/package.json rename to spell-check/package.json index f25303f..f51c1f9 100644 --- a/spellchecking/package.json +++ b/spell-check/package.json @@ -1,6 +1,6 @@ { "name" : "spellchecker-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js", "dependencies": { "spellchecker": "2.2.0" diff --git a/spellchecking/app.js b/spellchecking/app.js deleted file mode 100644 index f7bf2a4..0000000 --- a/spellchecking/app.js +++ /dev/null @@ -1,10 +0,0 @@ - -// initialize spell checking -checker = require('spellchecker'); -require('web-frame').setSpellCheckProvider("en-US", true, { - spellCheck: function(text) { - console.log("Spellchecker called on "+text); - return !checker.isMisspelled(text); - } -}); - diff --git a/tray/main.js b/tray/main.js index f9c00d1..b1a36ac 100644 --- a/tray/main.js +++ b/tray/main.js @@ -1,47 +1,44 @@ -var app = require('app'); -var Tray = require('tray'); -var Menu = require('menu'); -var path = require('path'); -var BrowserWindow = require('browser-window'); - -var iconPath = path.join(__dirname, 'icon.png'); -var appIcon = null; -var win = null; - -app.on('ready', function(){ - win = new BrowserWindow({show: false}); - appIcon = new Tray(iconPath); - var contextMenu = Menu.buildFromTemplate([ - { - label: 'Item1', - type: 'radio', - icon: iconPath - }, - { - label: 'Item2', - submenu: [ - { label: 'submenu1' }, - { label: 'submenu2' } - ] - }, - { - label: 'Item3', - type: 'radio', - checked: true - }, - { - label: 'Toggle DevTools', - accelerator: 'Alt+Command+I', - click: function() { - win.show(); - win.toggleDevTools(); - } - }, - { label: 'Quit', - accelerator: 'Command+Q', - selector: 'terminate:', - } - ]); - appIcon.setToolTip('This is my application.'); - appIcon.setContextMenu(contextMenu); -}); +const {app, Tray, Menu, BrowserWindow} = require('electron'); +const path = require('path'); + +const iconPath = path.join(__dirname, 'icon.png'); +let appIcon = null; +let win = null; + +app.on('ready', function(){ + win = new BrowserWindow({show: false}); + appIcon = new Tray(iconPath); + var contextMenu = Menu.buildFromTemplate([ + { + label: 'Item1', + type: 'radio', + icon: iconPath + }, + { + label: 'Item2', + submenu: [ + { label: 'submenu1' }, + { label: 'submenu2' } + ] + }, + { + label: 'Item3', + type: 'radio', + checked: true + }, + { + label: 'Toggle DevTools', + accelerator: 'Alt+Command+I', + click: function() { + win.show(); + win.toggleDevTools(); + } + }, + { label: 'Quit', + accelerator: 'Command+Q', + selector: 'terminate:', + } + ]); + appIcon.setToolTip('This is my application.'); + appIcon.setContextMenu(contextMenu); +}); diff --git a/tray/package.json b/tray/package.json index 1dedb6b..7114df2 100644 --- a/tray/package.json +++ b/tray/package.json @@ -1,5 +1,5 @@ { "name" : "tray-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/webgl/main.js b/webgl/main.js index 28d3ca2..3ba3405 100644 --- a/webgl/main.js +++ b/webgl/main.js @@ -1,33 +1,27 @@ -var app = require('app'); // Module to control application life. -var BrowserWindow = require('browser-window'); // Module to create native browser window. - -// Report crashes to our server. -require('crash-reporter').start(); - -// Keep a global reference of the window object, if you don't, the window will -// be closed automatically when the javascript object is GCed. -var mainWindow = null; - -// Quit when all windows are closed. -app.on('window-all-closed', function() { - if (process.platform != 'darwin') - app.quit(); -}); - -// This method will be called when Electron has done everything -// initialization and ready for creating browser windows. -app.on('ready', function() { - // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600, frame:false}); - - // and load the index.html of the app. - mainWindow.loadUrl('file://' + __dirname + '/index.html'); - - // Emitted when the window is closed. - mainWindow.on('closed', function() { - // Dereference the window object, usually you would store windows - // in an array if your app supports multi windows, this is the time - // when you should delete the corresponding element. - mainWindow = null; - }); -}); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; + +// Quit when all windows are closed. +app.on('window-all-closed', function() { + if (process.platform != 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', function() { + // Create the browser window. + mainWindow = new BrowserWindow({width: 800, height: 600, frame:false}); + + // and load the index.html of the app. + mainWindow.loadURL('file://' + __dirname + '/index.html'); + + // Emitted when the window is closed. + mainWindow.on('closed', function() { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); diff --git a/webgl/package.json b/webgl/package.json index 31c8621..4ea34ba 100644 --- a/webgl/package.json +++ b/webgl/package.json @@ -1,5 +1,5 @@ { "name" : "webgl-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" } diff --git a/webview/browser/browser.js b/webview/browser/browser.js index 855e298..467e55d 100644 --- a/webview/browser/browser.js +++ b/webview/browser/browser.js @@ -244,7 +244,7 @@ function handleKeyDown(event) { function handleLoadCommit() { resetExitedState(); var webview = document.querySelector('webview'); - document.querySelector('#location').value = webview.getUrl(); + document.querySelector('#location').value = webview.getURL(); document.querySelector('#back').disabled = !webview.canGoBack(); document.querySelector('#forward').disabled = !webview.canGoForward(); closeBoxes(); diff --git a/webview/browser/main.js b/webview/browser/main.js index d39f109..73f91aa 100644 --- a/webview/browser/main.js +++ b/webview/browser/main.js @@ -1,13 +1,13 @@ -var app = require('app'); -var BrowserWindow = require('browser-window'); +const {app, BrowserWindow} = require('electron'); + +let mainWindow; -var mainWindow = null; app.on('window-all-closed', function() { app.quit(); }); app.on('ready', function() { mainWindow = new BrowserWindow({width: 1024, height: 768 }); - mainWindow.loadUrl('file://' + __dirname + '/browser.html'); + mainWindow.loadURL('file://' + __dirname + '/browser.html'); mainWindow.openDevTools(); }); diff --git a/webview/browser/package.json b/webview/browser/package.json index 1d1931c..493b634 100644 --- a/webview/browser/package.json +++ b/webview/browser/package.json @@ -1,5 +1,5 @@ { "name": "Browser Sample", - "version": "1.0", + "version": "1.1.0", "main": "main.js" }