├── .gitignore ├── LICENSE ├── LICENSE.chrome-app-samples ├── LICENSE.chromium ├── README.md ├── camera ├── app.css ├── app.js ├── index.html ├── jquery.js ├── main.js └── package.json ├── client-certificate ├── main.js ├── package.json ├── readme.md ├── server.js └── ssl │ └── setup.sh ├── cookies ├── main.js ├── manager.html ├── manager.js ├── package.json ├── readme.md └── screenshot │ └── screenshot.png ├── crash-report ├── app.js ├── index.html ├── main.js └── package.json ├── desktop-capture ├── app.js ├── desktop.png ├── image-picker.css ├── image-picker.min.js ├── index.html ├── jquery.js ├── main.js ├── package.json └── readme.md ├── file-explorer ├── README.md ├── about.html ├── bootstrap │ ├── css │ │ ├── bootstrap-responsive.css │ │ ├── bootstrap-responsive.min.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ ├── img │ │ ├── glyphicons-halflings-white.png │ │ └── glyphicons-halflings.png │ └── js │ │ ├── bootstrap.js │ │ └── bootstrap.min.js ├── icons │ ├── blank.png │ ├── compressed.png │ ├── css.png │ ├── developer.png │ ├── excel.png │ ├── fireworks.png │ ├── flash.png │ ├── folder.png │ ├── html.png │ ├── illustrator.png │ ├── image.png │ ├── keynote.png │ ├── movie.png │ ├── music.png │ ├── numbers.png │ ├── pages.png │ ├── pdf.png │ ├── photoshop.png │ ├── powerpoint.png │ ├── text.png │ └── word.png ├── images │ └── htmlbg.png ├── index.html ├── js │ └── jquery-1.7.2.js ├── main.js ├── node_modules │ ├── address_bar.js │ ├── folder_view.js │ ├── jade │ │ ├── index.js │ │ ├── lib │ │ │ ├── compiler.js │ │ │ ├── doctypes.js │ │ │ ├── filters.js │ │ │ ├── index.js │ │ │ ├── inline-tags.js │ │ │ ├── jade.js │ │ │ ├── lexer.js │ │ │ ├── nodes │ │ │ │ ├── attrs.js │ │ │ │ ├── block-comment.js │ │ │ │ ├── block.js │ │ │ │ ├── case.js │ │ │ │ ├── code.js │ │ │ │ ├── comment.js │ │ │ │ ├── doctype.js │ │ │ │ ├── each.js │ │ │ │ ├── filter.js │ │ │ │ ├── index.js │ │ │ │ ├── literal.js │ │ │ │ ├── mixin.js │ │ │ │ ├── node.js │ │ │ │ ├── tag.js │ │ │ │ └── text.js │ │ │ ├── parser.js │ │ │ ├── runtime.js │ │ │ ├── self-closing.js │ │ │ └── utils.js │ │ └── package.json │ ├── mime.js │ └── underscore.js ├── package.json ├── screenshot │ └── screenshot.png ├── script.js └── style.css ├── frameless-window ├── README.md ├── bottom-titlebar.png ├── button_close.png ├── button_close_hover.png ├── frameless_window.js ├── icon_128.png ├── index.html ├── left-titlebar.png ├── main.js ├── package.json ├── right-titlebar.png ├── screenshot │ └── screenshot.png ├── style.css ├── titlebar.js └── top-titlebar.png ├── helloworld-sharedobj ├── index.html ├── main.js └── package.json ├── helloworld ├── index.html ├── main.js └── package.json ├── menus ├── README.md ├── index.html ├── main.js ├── package.json └── script.js ├── mini-code-editor ├── README.md ├── assets │ ├── icon-128.png │ ├── screenshot-640x400.png │ └── tile-440x280.png ├── cm │ ├── LICENSE │ ├── README.md │ ├── demo │ │ ├── activeline.html │ │ ├── changemode.html │ │ ├── closetag.html │ │ ├── complete.html │ │ ├── emacs.html │ │ ├── folding.html │ │ ├── formatting.html │ │ ├── fullscreen.html │ │ ├── loadmode.html │ │ ├── marker.html │ │ ├── matchhighlighter.html │ │ ├── mustache.html │ │ ├── preview.html │ │ ├── resize.html │ │ ├── runmode.html │ │ ├── search.html │ │ ├── theme.html │ │ ├── vim.html │ │ └── visibletabs.html │ ├── doc │ │ ├── baboon.png │ │ ├── baboon_vector.svg │ │ ├── compress.html │ │ ├── docs.css │ │ ├── internals.html │ │ ├── manual.html │ │ ├── oldrelease.html │ │ ├── reporting.html │ │ └── upgrade_v2.2.html │ ├── index.html │ ├── keymap │ │ ├── emacs.js │ │ └── vim.js │ ├── lib │ │ ├── codemirror.css │ │ ├── codemirror.js │ │ └── util │ │ │ ├── closetag.js │ │ │ ├── dialog.css │ │ │ ├── dialog.js │ │ │ ├── foldcode.js │ │ │ ├── formatting.js │ │ │ ├── javascript-hint.js │ │ │ ├── loadmode.js │ │ │ ├── match-highlighter.js │ │ │ ├── overlay.js │ │ │ ├── runmode.js │ │ │ ├── search.js │ │ │ ├── searchcursor.js │ │ │ ├── simple-hint.css │ │ │ └── simple-hint.js │ ├── mode │ │ ├── clike │ │ │ ├── clike.js │ │ │ └── index.html │ │ ├── clojure │ │ │ ├── clojure.js │ │ │ └── index.html │ │ ├── coffeescript │ │ │ ├── LICENSE │ │ │ ├── coffeescript.js │ │ │ └── index.html │ │ ├── css │ │ │ ├── css.js │ │ │ └── index.html │ │ ├── diff │ │ │ ├── diff.js │ │ │ └── index.html │ │ ├── ecl │ │ │ ├── ecl.js │ │ │ └── index.html │ │ ├── erlang │ │ │ ├── erlang.js │ │ │ └── index.html │ │ ├── gfm │ │ │ ├── gfm.js │ │ │ └── index.html │ │ ├── go │ │ │ ├── go.js │ │ │ └── index.html │ │ ├── groovy │ │ │ ├── groovy.js │ │ │ └── index.html │ │ ├── haskell │ │ │ ├── haskell.js │ │ │ └── index.html │ │ ├── htmlembedded │ │ │ ├── htmlembedded.js │ │ │ └── index.html │ │ ├── htmlmixed │ │ │ ├── htmlmixed.js │ │ │ └── index.html │ │ ├── javascript │ │ │ ├── index.html │ │ │ └── javascript.js │ │ ├── jinja2 │ │ │ ├── index.html │ │ │ └── jinja2.js │ │ ├── less │ │ │ ├── index.html │ │ │ └── less.js │ │ ├── lua │ │ │ ├── index.html │ │ │ └── lua.js │ │ ├── markdown │ │ │ ├── index.html │ │ │ └── markdown.js │ │ ├── mysql │ │ │ ├── index.html │ │ │ └── mysql.js │ │ ├── ntriples │ │ │ ├── index.html │ │ │ └── ntriples.js │ │ ├── pascal │ │ │ ├── LICENSE │ │ │ ├── index.html │ │ │ └── pascal.js │ │ ├── perl │ │ │ ├── LICENSE │ │ │ ├── index.html │ │ │ └── perl.js │ │ ├── php │ │ │ ├── index.html │ │ │ └── php.js │ │ ├── pig │ │ │ ├── index.html │ │ │ └── pig.js │ │ ├── plsql │ │ │ ├── index.html │ │ │ └── plsql.js │ │ ├── properties │ │ │ ├── index.html │ │ │ └── properties.js │ │ ├── python │ │ │ ├── LICENSE.txt │ │ │ ├── index.html │ │ │ └── python.js │ │ ├── r │ │ │ ├── LICENSE │ │ │ ├── index.html │ │ │ └── r.js │ │ ├── rpm │ │ │ ├── changes │ │ │ │ ├── changes.js │ │ │ │ └── index.html │ │ │ └── spec │ │ │ │ ├── index.html │ │ │ │ ├── spec.css │ │ │ │ └── spec.js │ │ ├── rst │ │ │ ├── index.html │ │ │ └── rst.js │ │ ├── ruby │ │ │ ├── LICENSE │ │ │ ├── index.html │ │ │ └── ruby.js │ │ ├── rust │ │ │ ├── index.html │ │ │ └── rust.js │ │ ├── scheme │ │ │ ├── index.html │ │ │ └── scheme.js │ │ ├── shell │ │ │ ├── index.html │ │ │ └── shell.js │ │ ├── smalltalk │ │ │ ├── index.html │ │ │ └── smalltalk.js │ │ ├── smarty │ │ │ ├── index.html │ │ │ └── smarty.js │ │ ├── sparql │ │ │ ├── index.html │ │ │ └── sparql.js │ │ ├── stex │ │ │ ├── index.html │ │ │ ├── stex.js │ │ │ └── test.html │ │ ├── tiddlywiki │ │ │ ├── index.html │ │ │ ├── tiddlywiki.css │ │ │ └── tiddlywiki.js │ │ ├── tiki │ │ │ ├── index.html │ │ │ ├── tiki.css │ │ │ └── tiki.js │ │ ├── vbscript │ │ │ ├── index.html │ │ │ └── vbscript.js │ │ ├── velocity │ │ │ ├── index.html │ │ │ └── velocity.js │ │ ├── verilog │ │ │ ├── index.html │ │ │ └── verilog.js │ │ ├── xml │ │ │ ├── index.html │ │ │ └── xml.js │ │ ├── xquery │ │ │ ├── LICENSE │ │ │ ├── index.html │ │ │ ├── test │ │ │ │ ├── index.html │ │ │ │ ├── testBase.js │ │ │ │ ├── testEmptySequenceKeyword.js │ │ │ │ ├── testMultiAttr.js │ │ │ │ ├── testNamespaces.js │ │ │ │ ├── testProcessingInstructions.js │ │ │ │ └── testQuotes.js │ │ │ └── xquery.js │ │ └── yaml │ │ │ ├── index.html │ │ │ └── yaml.js │ ├── test │ │ ├── index.html │ │ ├── mode_test.css │ │ ├── mode_test.js │ │ └── test.js │ └── theme │ │ ├── ambiance.css │ │ ├── blackboard.css │ │ ├── cobalt.css │ │ ├── eclipse.css │ │ ├── elegant.css │ │ ├── erlang-dark.css │ │ ├── lesser-dark.css │ │ ├── monokai.css │ │ ├── neat.css │ │ ├── night.css │ │ ├── rubyblue.css │ │ └── xq-dark.css ├── editor.js ├── img │ ├── 128x128 │ │ └── file_edit.png │ ├── 16x16 │ │ ├── diskette.png │ │ ├── file.png │ │ ├── file_add.png │ │ └── file_edit.png │ ├── 32x32 │ │ ├── diskette.png │ │ ├── file.png │ │ ├── file_add.png │ │ └── file_edit.png │ ├── 48x48 │ │ └── file_edit.png │ ├── 64x64 │ │ └── file_edit.png │ └── README.txt ├── index.html ├── main.js ├── package.json ├── screenshot │ └── screenshot.png ├── style.css └── zepto.min.js ├── mp3-encoder ├── Cakefile ├── README.md ├── index.html ├── lib │ └── main.js ├── main.js ├── package.json ├── src │ ├── main.coffee │ ├── utils │ │ └── encoder.coffee │ └── views │ │ └── form.coffee └── vendor │ ├── bin │ ├── osx │ │ └── shineenc │ └── win32 │ │ ├── libshine-1.dll │ │ └── shineenc.exe │ └── js │ ├── backbone.js │ ├── jquery.js │ └── underscore.js ├── notifications ├── icon.png ├── main.js ├── package.json ├── readme.md ├── screenshot │ ├── screenshot1.png │ └── screenshot2.png ├── slack_icon.png ├── window.html └── window.js ├── pepper-flash-plugin ├── main.js ├── package.json ├── readme.md └── screenshot │ └── screenshot.png ├── power-save-blocker ├── images │ ├── day-19.png │ ├── night-19.png │ └── sunset-19.png ├── main.js ├── package.json ├── readme.md └── screenshot │ └── screenshot.png ├── printing ├── index.html ├── main.js ├── package.json ├── print.html ├── print.js ├── readme.md └── screenshot │ └── screenshot.png ├── service-worker └── mock-response │ ├── index.html │ ├── main.js │ ├── package.json │ ├── readme.md │ ├── screenshot │ ├── register.png │ └── response.png │ └── service-worker.js ├── spell-check ├── README.md ├── app.css ├── app.js ├── index.html ├── main.js └── package.json ├── tray ├── icon.png ├── main.js └── package.json ├── webgl ├── README.md ├── icon_128.png ├── img │ ├── button_close.png │ └── button_close_hover.png ├── index.html ├── js │ ├── Detector.js │ ├── showlogo3d.js │ └── three.min.js ├── main.js ├── obj │ └── html5rocks.js ├── package.json └── styles │ └── main.css └── webview └── browser ├── README.md ├── browser.css ├── browser.html ├── browser.js ├── main.js ├── package.json └── screenshot └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE.chromium: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are 5 | // met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above 10 | // copyright notice, this list of conditions and the following disclaimer 11 | // in the documentation and/or other materials provided with the 12 | // distribution. 13 | // * Neither the name of Google Inc. nor the names of its 14 | // contributors may be used to endorse or promote products derived from 15 | // this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Electron Sample Apps 2 | 3 | This repository contains Electron sample apps to illustrate the usage of 4 | [Electron APIs](https://github.com/electron/electron/tree/master/docs). 5 | 6 | These sample apps are migrated from [nw-sample-apps](https://github.com/zcbenz/nw-sample-apps), 7 | [chrome-app-sample](https://github.com/GoogleChrome/chrome-app-samples) and 8 | [chromium extensions examples](https://code.google.com/p/chromium/codesearch#chromium/src/chrome/common/extensions/docs/examples/&sq=package:chromium&type=cs). 9 | 10 | All samples are test on Electron v1.6.11. 11 | 12 | ## How to run apps 13 | 14 | 1. Install Electron via `npm install -g electron`. 15 | 16 | 2. Run the sample via `electron /`. 17 | 18 | If you want to know more about Electron app's development, please refer to the 19 | [official docs](https://github.com/electron/electron/blob/master/docs/tutorial/quick-start.md). 20 | 21 | ## License 22 | 23 | electron-sample-apps is published under the Apache v2 license. See `LICENSE` for details. 24 | 25 | ## Donation 26 | 27 | If this project helps you out, you can give me a cup of coffee :) 28 | 29 | [![paypal](https://img.shields.io/badge/donate-paypal-brightgreen.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZVNVLSK6P6JRG) 30 | -------------------------------------------------------------------------------- /camera/app.css: -------------------------------------------------------------------------------- 1 | html, body, video { 2 | height: 100%; 3 | width: 100%; 4 | margin: 0; 5 | } 6 | 7 | video { 8 | display: block; 9 | } 10 | -------------------------------------------------------------------------------- /camera/app.js: -------------------------------------------------------------------------------- 1 | navigator.mediaDevices.getUserMedia({video: true}) 2 | .then(function(stream) { 3 | document.getElementById('camera').srcObject = stream; 4 | }).catch(function() { 5 | alert('could not connect stream'); 6 | }); 7 | -------------------------------------------------------------------------------- /camera/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Camera Test 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /camera/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | // Quit when all windows are closed. 6 | app.on('window-all-closed', function() { 7 | if (process.platform != 'darwin') 8 | app.quit(); 9 | }); 10 | 11 | // This method will be called when Electron has done everything 12 | // initialization and ready for creating browser windows. 13 | app.on('ready', function() { 14 | // Create the browser window. 15 | mainWindow = new BrowserWindow({width: 800, height: 600, webPreferences: {nodeIntegration: true}}); 16 | 17 | // and load the index.html of the app. 18 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 19 | 20 | // Emitted when the window is closed. 21 | mainWindow.on('closed', function() { 22 | // Dereference the window object, usually you would store windows 23 | // in an array if your app supports multi windows, this is the time 24 | // when you should delete the corresponding element. 25 | mainWindow = null; 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /camera/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "camera-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /client-certificate/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | app.on('window-all-closed', function() { 6 | if (process.platform != 'darwin') 7 | app.quit(); 8 | }); 9 | 10 | //app.commandLine.appendSwitch('client-certificate', 11 | //'path/to/client-certificates/ssl/client.crt'); 12 | 13 | app.on('ready', function() { 14 | mainWindow = new BrowserWindow({ 15 | 'width': 800, 16 | 'height': 600, 17 | webPreferences: { 18 | nodeIntegration: true} 19 | }); 20 | 21 | mainWindow.loadURL('https://localhost:5000'); 22 | }); 23 | -------------------------------------------------------------------------------- /client-certificate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "client-certificate-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /client-certificate/readme.md: -------------------------------------------------------------------------------- 1 | # Client-Certificate Sample 2 | 3 | A sample shows `client-certificate` usage in Electron. In this sample, we launch 4 | a https server, and create our own Server/Client Certificates with a local CA. 5 | 6 | 7 | ## How to run 8 | 9 | 1. Generate all the required PEM formate files by running `./ssl/setup.sh` script. 10 | One the script is done, all the generated files are under `ssl/` folder. 11 | 12 | 2. Import `rootCA.crt` and `client.p12` to your system. 13 | 14 | 3. Run `node server.js` to launch a https server `https://localhost:5000`. 15 | 16 | 4. Run the app in electron, and you will view a `approved` in the webpage. 17 | 18 | 19 | ## More 20 | 21 | If you visit `https://localhost:5000` in Chrome, the Chrome browser will prompt up 22 | a window to let users to select the CA certificates, which is a default browser behavior. 23 | 24 | Unlike browser, Electron will use the first matched certificate by default. 25 | 26 | The `--client-certificate` switch command doesn't work if there are no matched certificates 27 | in OS, the bug is tracked in [atom/electron#1956](https://github.com/atom/electron/issues/1956). 28 | And the switch only supports no-password protected PEM format file. In this sample, 29 | the file is `client.crt`. 30 | -------------------------------------------------------------------------------- /client-certificate/server.js: -------------------------------------------------------------------------------- 1 | const https = require('https'); 2 | const fs = require('fs'); 3 | 4 | const options = { 5 | key: fs.readFileSync('ssl/server.key'), 6 | cert: fs.readFileSync('ssl/server.crt'), 7 | ca: fs.readFileSync('ssl/rootCA.crt'), 8 | requestCert: true, 9 | rejectUnauthorized: false 10 | }; 11 | 12 | https.createServer(options, function (req, res) { 13 | console.log('Receive a request.'); 14 | if (req.client.authorized) { 15 | res.writeHead(200); 16 | res.end('approved\n'); 17 | } else { 18 | res.writeHead(401); 19 | res.end('denied\n'); 20 | } 21 | }).listen(5000); 22 | -------------------------------------------------------------------------------- /client-certificate/ssl/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # From https://github.com/thojansen/client-certificates/blob/master/ssl/setup.sh 4 | # create rootCA certificate 5 | openssl genrsa -out rootCA.key 2048 6 | openssl req -x509 -new -nodes -key rootCA.key -days 1024 -out rootCA.crt -subj "/C=DE/ST=Germany/L=Walldorf/O=SAP SE/OU=Tools/CN=rootCA" 7 | 8 | # create server key and certificate 9 | openssl genrsa -out server.key 2048 10 | openssl req -new -key server.key -out server.csr -subj "/C=DE/ST=Germany/L=Walldorf/O=SAP SE/OU=Tools/CN=localhost" 11 | openssl x509 -req -in server.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out server.crt -days 500 12 | 13 | # create client key and certificate 14 | openssl genrsa -out client.key 2048 15 | openssl req -new -key client.key -out client.csr -subj "/C=DE/ST=Germany/L=Walldorf/O=SAP SE/OU=Tools/CN=client" 16 | openssl x509 -req -in client.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out client.crt -days 500 17 | 18 | # generate client.p12 file which can be easily imported to OS. 19 | openssl pkcs12 -export -inkey client.key -in client.crt -name client -out client.p12 20 | 21 | # generate a non-encrypt pem file with key and crt files, from p12 files 22 | #openssl pkcs12 -in client.p12 -out client.pem -nodes -clcerts 23 | -------------------------------------------------------------------------------- /cookies/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | app.on('ready', function() { 6 | mainWindow = new BrowserWindow({width: 400, height: 360, webPreferences: {nodeIntegration: true}}); 7 | mainWindow.loadURL('file://' + __dirname + '/manager.html'); 8 | }); 9 | 10 | -------------------------------------------------------------------------------- /cookies/manager.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22 | 23 | 24 | 25 |

Cookies! ... Nom Nom Nom...

26 | 27 |
28 | Filter: 29 | 30 |
31 |
32 |
33 | Showing of cookie domains. 34 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /cookies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "cookies-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /cookies/readme.md: -------------------------------------------------------------------------------- 1 | # Cookies 2 | 3 | A sample app allows you to manipulate your cookies data using [cookies][1] API. 4 | 5 | ## APIs 6 | 7 | [Session.cookies][1] 8 | 9 | ## Screenshot 10 | 11 | ![screenshot](/cookies/screenshot/screenshot.png) 12 | 13 | [1]: https://github.com/electron/electron/blob/master/docs/api/session.md#sescookies 14 | -------------------------------------------------------------------------------- /cookies/screenshot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/cookies/screenshot/screenshot.png -------------------------------------------------------------------------------- /crash-report/app.js: -------------------------------------------------------------------------------- 1 | const {crashReporter} = require('electron'); 2 | 3 | crashReporter.start({submitURL: 'http://127.0.0.1:9999', companyName: 'sample'}); 4 | 5 | function showCrashReporter(report) { 6 | return "" + 7 | ""; 8 | } 9 | 10 | window.onload = function() { 11 | var reporters = crashReporter.getUploadedReports(); 12 | var table = "
Name#Cookies
" + report.date + "" + report.id + "
\n" + 13 | "" + 14 | "" + 15 | "\n"; 16 | 17 | var div = document.getElementById("crash_reporters"); 18 | for (let reporter of reporters) { 19 | table += showCrashReporter(reporter); 20 | } 21 | div.innerHTML = table; 22 | document.getElementById('crash').onclick = function() { 23 | process.crash(); 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /crash-report/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Crash Report 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /crash-report/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow, crashReporter} = require('electron'); 2 | const http = require('http'); 3 | 4 | crashReporter.start({submitURL: 'http://127.0.0.1:9999', companyName: 'sample'}); 5 | 6 | function getRandomInt(min, max) { 7 | return Math.floor(Math.random() * (max - min)) + min; 8 | } 9 | 10 | // Crash-report collection server 11 | var server = http.createServer(function(req, res) { 12 | // Handle the uploaded crash report from client here 13 | // ... 14 | // Response the crash report id on server to client. 15 | res.end(getRandomInt(1000, 9999).toString()); 16 | }); 17 | 18 | var mainWindow = null; 19 | app.on('ready', function() { 20 | server.listen(9999, '127.0.0.1', function () { 21 | mainWindow = new BrowserWindow({width: 800, height: 600, webPreferences: {nodeIntegration: true}}); 22 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 23 | mainWindow.toggleDevTools(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /crash-report/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "crash-report-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /desktop-capture/desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/desktop-capture/desktop.png -------------------------------------------------------------------------------- /desktop-capture/image-picker.css: -------------------------------------------------------------------------------- 1 | ul.thumbnails.image_picker_selector { 2 | overflow: auto; 3 | list-style-image: none; 4 | list-style-position: outside; 5 | list-style-type: none; 6 | padding: 0px; 7 | margin: 0px; } 8 | ul.thumbnails.image_picker_selector ul { 9 | overflow: auto; 10 | list-style-image: none; 11 | list-style-position: outside; 12 | list-style-type: none; 13 | padding: 0px; 14 | margin: 0px; } 15 | ul.thumbnails.image_picker_selector li.group_title { 16 | float: none; } 17 | ul.thumbnails.image_picker_selector li { 18 | margin: 0px 12px 12px 0px; 19 | float: left; } 20 | ul.thumbnails.image_picker_selector li .thumbnail { 21 | padding: 6px; 22 | border: 1px solid #dddddd; 23 | -webkit-user-select: none; 24 | -moz-user-select: none; 25 | -ms-user-select: none; } 26 | ul.thumbnails.image_picker_selector li .thumbnail img { 27 | -webkit-user-drag: none; } 28 | ul.thumbnails.image_picker_selector li .thumbnail.selected { 29 | background: #0088cc; } 30 | -------------------------------------------------------------------------------- /desktop-capture/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 52 | 53 | 54 | 56 | 57 |

58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /desktop-capture/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | app.on('window-all-closed', () => { 6 | if (process.platform != 'darwin') 7 | app.quit(); 8 | }); 9 | 10 | app.setPath("userData", __dirname + "/saved_recordings"); 11 | 12 | app.on('ready', () => { 13 | mainWindow = new BrowserWindow({width: 800, height: 600, webPreferences: {nodeIntegration: true, contextIsolation: false}}); 14 | 15 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 16 | 17 | mainWindow.on('closed', () => { 18 | mainWindow = null; 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /desktop-capture/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "desktop-capture-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /desktop-capture/readme.md: -------------------------------------------------------------------------------- 1 | # Desktop Capturer 2 | 3 | A sample app allows you to choose which screen or window to be captured with 4 | `getUserMedia` API. 5 | 6 | ## APIs 7 | 8 | [desktopCapturer](https://github.com/atom/electron/blob/master/docs/api/desktop-capturer.md) 9 | 10 | ## Screenshot 11 | 12 | ![screenshot](https://cloud.githubusercontent.com/assets/2557445/10268326/993e4f9a-6ae7-11e5-8fd1-a24b9800b9ce.gif) 13 | -------------------------------------------------------------------------------- /file-explorer/README.md: -------------------------------------------------------------------------------- 1 | # File Explorer 2 | 3 | A simple file explorer implemented with node.js modules, you can navigate through 4 | folders and open files. 5 | 6 | ## APIs 7 | 8 | * [fs module](http://nodejs.org/api/fs.html) 9 | * [events module](http://nodejs.org/api/events.html) 10 | * [path module](http://nodejs.org/api/path.html) 11 | * [util module](http://nodejs.org/api/util.html) 12 | * [child_process module](http://nodejs.org/api/child_process.html) 13 | 14 | ## Screenshot 15 | 16 | ![screenshot](/file-explorer/screenshot/screenshot.png) 17 | -------------------------------------------------------------------------------- /file-explorer/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | about FileExpolorer 4 | 15 | 16 | 17 | 26 | 27 | 28 |
29 |

FileExpolorer sample app

30 | https://github.com/hokein/electron-sample-apps 31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /file-explorer/bootstrap/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/bootstrap/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /file-explorer/bootstrap/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/bootstrap/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /file-explorer/icons/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/blank.png -------------------------------------------------------------------------------- /file-explorer/icons/compressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/compressed.png -------------------------------------------------------------------------------- /file-explorer/icons/css.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/css.png -------------------------------------------------------------------------------- /file-explorer/icons/developer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/developer.png -------------------------------------------------------------------------------- /file-explorer/icons/excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/excel.png -------------------------------------------------------------------------------- /file-explorer/icons/fireworks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/fireworks.png -------------------------------------------------------------------------------- /file-explorer/icons/flash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/flash.png -------------------------------------------------------------------------------- /file-explorer/icons/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/folder.png -------------------------------------------------------------------------------- /file-explorer/icons/html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/html.png -------------------------------------------------------------------------------- /file-explorer/icons/illustrator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/illustrator.png -------------------------------------------------------------------------------- /file-explorer/icons/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/image.png -------------------------------------------------------------------------------- /file-explorer/icons/keynote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/keynote.png -------------------------------------------------------------------------------- /file-explorer/icons/movie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/movie.png -------------------------------------------------------------------------------- /file-explorer/icons/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/music.png -------------------------------------------------------------------------------- /file-explorer/icons/numbers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/numbers.png -------------------------------------------------------------------------------- /file-explorer/icons/pages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/pages.png -------------------------------------------------------------------------------- /file-explorer/icons/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/pdf.png -------------------------------------------------------------------------------- /file-explorer/icons/photoshop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/photoshop.png -------------------------------------------------------------------------------- /file-explorer/icons/powerpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/powerpoint.png -------------------------------------------------------------------------------- /file-explorer/icons/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/text.png -------------------------------------------------------------------------------- /file-explorer/icons/word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/icons/word.png -------------------------------------------------------------------------------- /file-explorer/images/htmlbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/images/htmlbg.png -------------------------------------------------------------------------------- /file-explorer/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | File Explorer 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 35 |
36 | 37 |
38 |
39 | 40 |
41 |
42 |
    43 |
    44 |
    45 |
    46 | 47 | 48 | -------------------------------------------------------------------------------- /file-explorer/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | // Quit when all windows are closed. 6 | app.on('window-all-closed', function() { 7 | if (process.platform != 'darwin') 8 | app.quit(); 9 | }); 10 | 11 | // This method will be called when Electron has done everything 12 | // initialization and ready for creating browser windows. 13 | app.on('ready', function() { 14 | // Create the browser window. 15 | mainWindow = new BrowserWindow({width: 800, height: 600, webPreferences: {nodeIntegration: true, enableRemoteModule: true}}); 16 | 17 | // and load the index.html of the app. 18 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 19 | 20 | // Emitted when the window is closed. 21 | mainWindow.on('closed', function() { 22 | // Dereference the window object, usually you would store windows 23 | // in an array if your app supports multi windows, this is the time 24 | // when you should delete the corresponding element. 25 | mainWindow = null; 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /file-explorer/node_modules/folder_view.js: -------------------------------------------------------------------------------- 1 | var events = require('events'); 2 | var fs = require('fs'); 3 | var path = require('path'); 4 | var jade = require('jade'); 5 | var util = require('util'); 6 | var mime = require('mime'); 7 | 8 | // Template engine 9 | var gen_files_view = jade.compile([ 10 | '- each file in files', 11 | ' .file(data-path="#{file.path}")', 12 | ' .icon', 13 | ' img(src="icons/#{file.type}.png")', 14 | ' .name #{file.name}', 15 | ].join('\n')); 16 | 17 | // Our type 18 | function Folder(jquery_element) { 19 | events.EventEmitter.call(this); 20 | this.element = jquery_element; 21 | 22 | var self = this; 23 | // Click on blank 24 | this.element.parent().on('click', function() { 25 | self.element.children('.focus').removeClass('focus'); 26 | }); 27 | // Click on file 28 | this.element.delegate('.file', 'click', function(e) { 29 | self.element.children('.focus').removeClass('focus'); 30 | $(this).addClass('focus'); 31 | e.stopPropagation(); 32 | }); 33 | // Double click on file 34 | this.element.delegate('.file', 'dblclick', function() { 35 | var file_path = $(this).attr('data-path'); 36 | self.emit('navigate', file_path, mime.stat(file_path)); 37 | }); 38 | } 39 | 40 | util.inherits(Folder, events.EventEmitter); 41 | 42 | Folder.prototype.open = function(dir) { 43 | var self = this; 44 | fs.readdir(dir, function(error, files) { 45 | if (error) { 46 | console.log(error); 47 | window.alert(error); 48 | return; 49 | } 50 | 51 | for (var i = 0; i < files.length; ++i) { 52 | files[i] = mime.stat(path.join(dir, files[i])); 53 | } 54 | 55 | self.element.html(gen_files_view({ files: files })); 56 | }); 57 | } 58 | 59 | exports.Folder = Folder; 60 | -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = process.env.JADE_COV 3 | ? require('./lib-cov/jade') 4 | : require('./lib/jade'); -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/doctypes.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - doctypes 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | module.exports = { 9 | '5': '' 10 | , 'default': '' 11 | , 'xml': '' 12 | , 'transitional': '' 13 | , 'strict': '' 14 | , 'frameset': '' 15 | , '1.1': '' 16 | , 'basic': '' 17 | , 'mobile': '' 18 | }; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/inline-tags.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - inline tags 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | module.exports = [ 9 | 'a' 10 | , 'abbr' 11 | , 'acronym' 12 | , 'b' 13 | , 'br' 14 | , 'code' 15 | , 'em' 16 | , 'font' 17 | , 'i' 18 | , 'img' 19 | , 'ins' 20 | , 'kbd' 21 | , 'map' 22 | , 'samp' 23 | , 'small' 24 | , 'span' 25 | , 'strong' 26 | , 'sub' 27 | , 'sup' 28 | ]; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/attrs.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Attrs 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'), 13 | Block = require('./block'); 14 | 15 | /** 16 | * Initialize a `Attrs` node. 17 | * 18 | * @api public 19 | */ 20 | 21 | var Attrs = module.exports = function Attrs() { 22 | this.attrs = []; 23 | }; 24 | 25 | /** 26 | * Inherit from `Node`. 27 | */ 28 | 29 | Attrs.prototype.__proto__ = Node.prototype; 30 | 31 | /** 32 | * Set attribute `name` to `val`, keep in mind these become 33 | * part of a raw js object literal, so to quote a value you must 34 | * '"quote me"', otherwise or example 'user.name' is literal JavaScript. 35 | * 36 | * @param {String} name 37 | * @param {String} val 38 | * @param {Boolean} escaped 39 | * @return {Tag} for chaining 40 | * @api public 41 | */ 42 | 43 | Attrs.prototype.setAttribute = function(name, val, escaped){ 44 | this.attrs.push({ name: name, val: val, escaped: escaped }); 45 | return this; 46 | }; 47 | 48 | /** 49 | * Remove attribute `name` when present. 50 | * 51 | * @param {String} name 52 | * @api public 53 | */ 54 | 55 | Attrs.prototype.removeAttribute = function(name){ 56 | for (var i = 0, len = this.attrs.length; i < len; ++i) { 57 | if (this.attrs[i] && this.attrs[i].name == name) { 58 | delete this.attrs[i]; 59 | } 60 | } 61 | }; 62 | 63 | /** 64 | * Get attribute value by `name`. 65 | * 66 | * @param {String} name 67 | * @return {String} 68 | * @api public 69 | */ 70 | 71 | Attrs.prototype.getAttribute = function(name){ 72 | for (var i = 0, len = this.attrs.length; i < len; ++i) { 73 | if (this.attrs[i] && this.attrs[i].name == name) { 74 | return this.attrs[i].val; 75 | } 76 | } 77 | }; 78 | -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/block-comment.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - BlockComment 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'); 13 | 14 | /** 15 | * Initialize a `BlockComment` with the given `block`. 16 | * 17 | * @param {String} val 18 | * @param {Block} block 19 | * @param {Boolean} buffer 20 | * @api public 21 | */ 22 | 23 | var BlockComment = module.exports = function BlockComment(val, block, buffer) { 24 | this.block = block; 25 | this.val = val; 26 | this.buffer = buffer; 27 | }; 28 | 29 | /** 30 | * Inherit from `Node`. 31 | */ 32 | 33 | BlockComment.prototype.__proto__ = Node.prototype; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/case.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Case 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'); 13 | 14 | /** 15 | * Initialize a new `Case` with `expr`. 16 | * 17 | * @param {String} expr 18 | * @api public 19 | */ 20 | 21 | var Case = exports = module.exports = function Case(expr, block){ 22 | this.expr = expr; 23 | this.block = block; 24 | }; 25 | 26 | /** 27 | * Inherit from `Node`. 28 | */ 29 | 30 | Case.prototype.__proto__ = Node.prototype; 31 | 32 | var When = exports.When = function When(expr, block){ 33 | this.expr = expr; 34 | this.block = block; 35 | this.debug = false; 36 | }; 37 | 38 | /** 39 | * Inherit from `Node`. 40 | */ 41 | 42 | When.prototype.__proto__ = Node.prototype; 43 | 44 | -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/code.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Code 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'); 13 | 14 | /** 15 | * Initialize a `Code` node with the given code `val`. 16 | * Code may also be optionally buffered and escaped. 17 | * 18 | * @param {String} val 19 | * @param {Boolean} buffer 20 | * @param {Boolean} escape 21 | * @api public 22 | */ 23 | 24 | var Code = module.exports = function Code(val, buffer, escape) { 25 | this.val = val; 26 | this.buffer = buffer; 27 | this.escape = escape; 28 | if (val.match(/^ *else/)) this.debug = false; 29 | }; 30 | 31 | /** 32 | * Inherit from `Node`. 33 | */ 34 | 35 | Code.prototype.__proto__ = Node.prototype; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/comment.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Comment 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'); 13 | 14 | /** 15 | * Initialize a `Comment` with the given `val`, optionally `buffer`, 16 | * otherwise the comment may render in the output. 17 | * 18 | * @param {String} val 19 | * @param {Boolean} buffer 20 | * @api public 21 | */ 22 | 23 | var Comment = module.exports = function Comment(val, buffer) { 24 | this.val = val; 25 | this.buffer = buffer; 26 | }; 27 | 28 | /** 29 | * Inherit from `Node`. 30 | */ 31 | 32 | Comment.prototype.__proto__ = Node.prototype; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/doctype.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Doctype 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'); 13 | 14 | /** 15 | * Initialize a `Doctype` with the given `val`. 16 | * 17 | * @param {String} val 18 | * @api public 19 | */ 20 | 21 | var Doctype = module.exports = function Doctype(val) { 22 | this.val = val; 23 | }; 24 | 25 | /** 26 | * Inherit from `Node`. 27 | */ 28 | 29 | Doctype.prototype.__proto__ = Node.prototype; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/each.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Each 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'); 13 | 14 | /** 15 | * Initialize an `Each` node, representing iteration 16 | * 17 | * @param {String} obj 18 | * @param {String} val 19 | * @param {String} key 20 | * @param {Block} block 21 | * @api public 22 | */ 23 | 24 | var Each = module.exports = function Each(obj, val, key, block) { 25 | this.obj = obj; 26 | this.val = val; 27 | this.key = key; 28 | this.block = block; 29 | }; 30 | 31 | /** 32 | * Inherit from `Node`. 33 | */ 34 | 35 | Each.prototype.__proto__ = Node.prototype; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/filter.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Filter 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node') 13 | , Block = require('./block'); 14 | 15 | /** 16 | * Initialize a `Filter` node with the given 17 | * filter `name` and `block`. 18 | * 19 | * @param {String} name 20 | * @param {Block|Node} block 21 | * @api public 22 | */ 23 | 24 | var Filter = module.exports = function Filter(name, block, attrs) { 25 | this.name = name; 26 | this.block = block; 27 | this.attrs = attrs; 28 | this.isASTFilter = !block.nodes.every(function(node){ return node.isText }); 29 | }; 30 | 31 | /** 32 | * Inherit from `Node`. 33 | */ 34 | 35 | Filter.prototype.__proto__ = Node.prototype; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/index.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | exports.Node = require('./node'); 9 | exports.Tag = require('./tag'); 10 | exports.Code = require('./code'); 11 | exports.Each = require('./each'); 12 | exports.Case = require('./case'); 13 | exports.Text = require('./text'); 14 | exports.Block = require('./block'); 15 | exports.Mixin = require('./mixin'); 16 | exports.Filter = require('./filter'); 17 | exports.Comment = require('./comment'); 18 | exports.Literal = require('./literal'); 19 | exports.BlockComment = require('./block-comment'); 20 | exports.Doctype = require('./doctype'); 21 | -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/literal.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Literal 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'); 13 | 14 | /** 15 | * Initialize a `Literal` node with the given `str. 16 | * 17 | * @param {String} str 18 | * @api public 19 | */ 20 | 21 | var Literal = module.exports = function Literal(str) { 22 | this.str = str 23 | .replace(/\\/g, "\\\\") 24 | .replace(/\n|\r\n/g, "\\n") 25 | .replace(/'/g, "\\'"); 26 | }; 27 | 28 | /** 29 | * Inherit from `Node`. 30 | */ 31 | 32 | Literal.prototype.__proto__ = Node.prototype; 33 | -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/mixin.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Mixin 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Attrs = require('./attrs'); 13 | 14 | /** 15 | * Initialize a new `Mixin` with `name` and `block`. 16 | * 17 | * @param {String} name 18 | * @param {String} args 19 | * @param {Block} block 20 | * @api public 21 | */ 22 | 23 | var Mixin = module.exports = function Mixin(name, args, block, call){ 24 | this.name = name; 25 | this.args = args; 26 | this.block = block; 27 | this.attrs = []; 28 | this.call = call; 29 | }; 30 | 31 | /** 32 | * Inherit from `Attrs`. 33 | */ 34 | 35 | Mixin.prototype.__proto__ = Attrs.prototype; 36 | 37 | -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/node.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Node 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Initialize a `Node`. 10 | * 11 | * @api public 12 | */ 13 | 14 | var Node = module.exports = function Node(){}; 15 | 16 | /** 17 | * Clone this node (return itself) 18 | * 19 | * @return {Node} 20 | * @api private 21 | */ 22 | 23 | Node.prototype.clone = function(){ 24 | return this; 25 | }; 26 | -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/nodes/text.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - nodes - Text 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | var Node = require('./node'); 13 | 14 | /** 15 | * Initialize a `Text` node with optional `line`. 16 | * 17 | * @param {String} line 18 | * @api public 19 | */ 20 | 21 | var Text = module.exports = function Text(line) { 22 | this.val = ''; 23 | if ('string' == typeof line) this.val = line; 24 | }; 25 | 26 | /** 27 | * Inherit from `Node`. 28 | */ 29 | 30 | Text.prototype.__proto__ = Node.prototype; 31 | 32 | /** 33 | * Flag as text. 34 | */ 35 | 36 | Text.prototype.isText = true; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/self-closing.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - self closing tags 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | module.exports = [ 9 | 'meta' 10 | , 'img' 11 | , 'link' 12 | , 'input' 13 | , 'source' 14 | , 'area' 15 | , 'base' 16 | , 'col' 17 | , 'br' 18 | , 'hr' 19 | ]; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/lib/utils.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Jade - utils 4 | * Copyright(c) 2010 TJ Holowaychuk 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Convert interpolation in the given string to JavaScript. 10 | * 11 | * @param {String} str 12 | * @return {String} 13 | * @api private 14 | */ 15 | 16 | var interpolate = exports.interpolate = function(str){ 17 | return str.replace(/(\\)?([#!]){(.*?)}/g, function(str, escape, flag, code){ 18 | return escape 19 | ? str 20 | : "' + " 21 | + ('!' == flag ? '' : 'escape') 22 | + "((interp = " + code.replace(/\\'/g, "'") 23 | + ") == null ? '' : interp) + '"; 24 | }); 25 | }; 26 | 27 | /** 28 | * Escape single quotes in `str`. 29 | * 30 | * @param {String} str 31 | * @return {String} 32 | * @api private 33 | */ 34 | 35 | var escape = exports.escape = function(str) { 36 | return str.replace(/'/g, "\\'"); 37 | }; 38 | 39 | /** 40 | * Interpolate, and escape the given `str`. 41 | * 42 | * @param {String} str 43 | * @return {String} 44 | * @api private 45 | */ 46 | 47 | exports.text = function(str){ 48 | return interpolate(escape(str)); 49 | }; -------------------------------------------------------------------------------- /file-explorer/node_modules/jade/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jade", 3 | "description": "Jade template engine", 4 | "version": "0.27.2", 5 | "author": "TJ Holowaychuk ", 6 | "repository": "git://github.com/visionmedia/jade", 7 | "main": "./index.js", 8 | "bin": { "jade": "./bin/jade" }, 9 | "man": "./jade.1", 10 | "dependencies": { 11 | "commander": "0.6.1", 12 | "mkdirp": "0.3.0" 13 | }, 14 | "devDependencies": { 15 | "mocha": "*", 16 | "markdown": "*", 17 | "stylus": "*", 18 | "uubench": "*", 19 | "should": "*", 20 | "less": "*", 21 | "uglify-js": "*" 22 | }, 23 | "component": { 24 | "scripts": { 25 | "jade": "runtime.js" 26 | } 27 | }, 28 | "scripts" : { "prepublish" : "npm prune" } 29 | } 30 | -------------------------------------------------------------------------------- /file-explorer/node_modules/mime.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var _ = require('underscore'); 4 | 5 | var map = { 6 | 'compressed': ['zip', 'rar', 'gz', '7z'], 7 | 'text': ['txt', 'md', ''], 8 | 'image': ['jpg', 'jpge', 'png', 'gif', 'bmp'], 9 | 'pdf': ['pdf'], 10 | 'css': ['css'], 11 | 'html': ['html'], 12 | 'word': ['doc', 'docx'], 13 | 'powerpoint': ['ppt', 'pptx'], 14 | 'movie': ['mkv', 'avi', 'rmvb'], 15 | }; 16 | 17 | var cached = {}; 18 | 19 | exports.stat = function(filepath) { 20 | var result = { 21 | name: path.basename(filepath), 22 | path: filepath, 23 | }; 24 | 25 | try { 26 | var stat = fs.statSync(filepath); 27 | if (stat.isDirectory()) { 28 | result.type = 'folder'; 29 | } else { 30 | var ext = path.extname(filepath).substr(1); 31 | result.type = cached[ext]; 32 | if (!result.type) { 33 | for (var key in map) { 34 | if (_.include(map[key], ext)) { 35 | cached[ext] = result.type = key; 36 | break; 37 | } 38 | } 39 | 40 | if (!result.type) 41 | result.type = 'blank'; 42 | } 43 | } 44 | } catch (e) { 45 | window.alert(e); 46 | } 47 | 48 | return result; 49 | } 50 | -------------------------------------------------------------------------------- /file-explorer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "file-explorer-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /file-explorer/screenshot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/file-explorer/screenshot/screenshot.png -------------------------------------------------------------------------------- /file-explorer/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | -webkit-user-select: none; 3 | } 4 | 5 | body { 6 | background-image: url('images/htmlbg.png') 7 | } 8 | 9 | .files { 10 | padding: 0; 11 | margin: 0; 12 | } 13 | 14 | .file { 15 | padding: 2px; 16 | margin: 2px; 17 | width: 80px; 18 | display: inline-block; 19 | 20 | text-align: center; 21 | vertical-align: top; 22 | } 23 | 24 | .file.focus { 25 | background-color: #08C; 26 | -webkit-border-radius: 4px; 27 | } 28 | 29 | .file .name { 30 | width: 80px; 31 | word-wrap: break-word; 32 | } 33 | 34 | .file.focus .name { 35 | color: white; 36 | } 37 | 38 | .file .icon { 39 | margin: auto; 40 | margin-top: 0; 41 | width: 60px; 42 | } 43 | 44 | .file.focus .icon { 45 | -webkit-filter: invert(20%); 46 | } 47 | -------------------------------------------------------------------------------- /frameless-window/README.md: -------------------------------------------------------------------------------- 1 | # Frameless window 2 | 3 | A sample application to showcase how you can use `"frame": false` windows to allow total customization of the window's real state. At beginning, the window is open with no titlebar. As long as you check one of the titlebars, it is added to the appropriate position. Notice that the added titlebars are the only parts of the window that allows dragging. This is achieved through a special CSS property applied to what is draggable or non-draggable (by default, the whole window is not draggable): `-webkit-app-region: drag|no-drag;` 4 | 5 | 6 | ## APIs 7 | 8 | * [BrowserWindow](https://github.com/atom/electron/blob/master/docs/api/browser-window.md) 9 | * [Frameless Window](https://github.com/atom/electron/blob/master/docs/api/frameless-window.md) 10 | 11 | ## Screenshot 12 | 13 | ![screenshot](/frameless-window/screenshot/screenshot.png) 14 | -------------------------------------------------------------------------------- /frameless-window/bottom-titlebar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/frameless-window/bottom-titlebar.png -------------------------------------------------------------------------------- /frameless-window/button_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/frameless-window/button_close.png -------------------------------------------------------------------------------- /frameless-window/button_close_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/frameless-window/button_close_hover.png -------------------------------------------------------------------------------- /frameless-window/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/frameless-window/icon_128.png -------------------------------------------------------------------------------- /frameless-window/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Frameless Window 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
    16 | 17 |
    18 | 19 | Select the titlebar to enable:
    20 | Top Titlebar
    21 | Bottom Titlebar
    22 | Left Titlebar
    23 | Right Titlebar
    24 |
    25 | 26 | 27 | 28 | 29 | 30 | 31 |
    32 | 33 | 34 | 35 | 36 | 37 |
    38 | 39 |
    40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /frameless-window/left-titlebar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/frameless-window/left-titlebar.png -------------------------------------------------------------------------------- /frameless-window/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | // Quit when all windows are closed. 6 | app.on('window-all-closed', function() { 7 | app.quit(); 8 | }); 9 | 10 | // This method will be called when Electron has done everything 11 | // initialization and ready for creating browser windows. 12 | app.on('ready', function() { 13 | // Create the browser window. 14 | mainWindow = new BrowserWindow({width: 360, height: 300, frame: false, webPreferences: {nodeIntegration: true}}); 15 | 16 | // and load the index.html of the app. 17 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 18 | 19 | // Emitted when the window is closed. 20 | mainWindow.on('closed', function() { 21 | // Dereference the window object, usually you would store windows 22 | // in an array if your app supports multi windows, this is the time 23 | // when you should delete the corresponding element. 24 | mainWindow = null; 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /frameless-window/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "frameless-window-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /frameless-window/right-titlebar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/frameless-window/right-titlebar.png -------------------------------------------------------------------------------- /frameless-window/screenshot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/frameless-window/screenshot/screenshot.png -------------------------------------------------------------------------------- /frameless-window/top-titlebar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/frameless-window/top-titlebar.png -------------------------------------------------------------------------------- /helloworld-sharedobj/index.html: -------------------------------------------------------------------------------- 1 |

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

    2 | 3 | 7 | -------------------------------------------------------------------------------- /helloworld-sharedobj/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | global.sharedObj = {myvar: "hellofrommainjs"}; 6 | 7 | app.on('ready', function() { 8 | mainWindow = new BrowserWindow({ 9 | height: 600, 10 | width: 800, 11 | webPreferences: { 12 | nodeIntegration: true 13 | } 14 | }); 15 | 16 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 17 | }); 18 | -------------------------------------------------------------------------------- /helloworld-sharedobj/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "helloworld-sharedobj", 3 | "version": "1.0.1", 4 | "main": "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /helloworld/index.html: -------------------------------------------------------------------------------- 1 |

    Hello World!

    2 | -------------------------------------------------------------------------------- /helloworld/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | app.on('ready', () => { 6 | mainWindow = new BrowserWindow({ 7 | height: 600, 8 | width: 800, 9 | webPreferences: { 10 | nodeIntegration: true 11 | } 12 | }); 13 | 14 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 15 | }); 16 | -------------------------------------------------------------------------------- /helloworld/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "helloworld", 3 | "version": "1.0.1", 4 | "main": "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /menus/README.md: -------------------------------------------------------------------------------- 1 | # Menus 2 | 3 | This is a basic demo that demonstrates the flexibility of electron's Menus 4 | API, there aree three menus bound to three areas in the page. 5 | 6 | 7 | ## APIs 8 | 9 | * [Menu](https://github.com/atom/electron/blob/master/docs/api/menu.md) 10 | * [MenuItem](https://github.com/atom/electron/blob/master/docs/api/menu-item.md) 11 | -------------------------------------------------------------------------------- /menus/index.html: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 |

    Right click the webpage to show the menu.

    24 | -------------------------------------------------------------------------------- /menus/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "menus-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /mini-code-editor/README.md: -------------------------------------------------------------------------------- 1 | # Mini code editor 2 | 3 | A non-trivial sample with basic features of a code editor, like syntax detection and syntax highlight. If also uses the extended FileSystem API that allows a user to select files from the disk so the app can read and write to that file. 4 | 5 | 6 | ## APIs 7 | 8 | * [BrowserWindow](https://github.com/atom/electron/blob/master/docs/api/browser-window.md) 9 | * [Menu](https://github.com/atom/electron/blob/master/docs/api/menu.md) 10 | * [MenuItem](https://github.com/atom/electron/blob/master/docs/api/menu-item.md) 11 | * [Clipboard](https://github.com/atom/electron/blob/master/docs/api/clipboard.md) 12 | * [fs module](http://nodejs.org/api/fs.html) 13 | 14 | ## Screenshot 15 | 16 | ![screenshot](/mini-code-editor/screenshot/screenshot.png) 17 | -------------------------------------------------------------------------------- /mini-code-editor/assets/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/assets/icon-128.png -------------------------------------------------------------------------------- /mini-code-editor/assets/screenshot-640x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/assets/screenshot-640x400.png -------------------------------------------------------------------------------- /mini-code-editor/assets/tile-440x280.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/assets/tile-440x280.png -------------------------------------------------------------------------------- /mini-code-editor/cm/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 by Marijn Haverbeke 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | Please note that some subdirectories of the CodeMirror distribution 22 | include their own LICENSE files, and are released under different 23 | licences. 24 | -------------------------------------------------------------------------------- /mini-code-editor/cm/README.md: -------------------------------------------------------------------------------- 1 | # CodeMirror 2 2 | 3 | CodeMirror 2 is a rewrite of [CodeMirror 4 | 1](http://github.com/marijnh/CodeMirror). The docs live 5 | [here](http://codemirror.net/doc/manual.html), and the project page is 6 | [http://codemirror.net/](http://codemirror.net/). 7 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/changemode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Mode-Changing Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

    CodeMirror: Mode-Changing demo

    17 | 18 |
    25 | 26 |

    On changes to the content of the above editor, a (crude) script 27 | tries to auto-detect the language used, and switches the editor to 28 | either JavaScript or Scheme mode based on that.

    29 | 30 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/emacs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Emacs bindings demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

    CodeMirror: Emacs bindings demo

    17 | 18 |
    33 | 34 |

    The emacs keybindings are enabled by 35 | including keymap/emacs.js and setting 36 | the keyMap option to "emacs". Because 37 | CodeMirror's internal API is quite different from Emacs, they are only 38 | a loose approximation of actual emacs bindings, though.

    39 | 40 |

    Also note that a lot of browsers disallow certain keys from being 41 | captured. For example, Chrome blocks both Ctrl-W and Ctrl-N, with the 42 | result that idiomatic use of Emacs keys will constantly close your tab 43 | or open a new window.

    44 | 45 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/loadmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Lazy Mode Loading Demo 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 |

    CodeMirror: Lazy Mode Loading

    16 | 17 |
    22 |

    23 | 24 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/marker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Breakpoint Demo 5 | 6 | 7 | 8 | 9 | 10 | 19 | 20 | 21 |

    CodeMirror: Breakpoint demo

    22 | 23 |
    35 | 36 |

    Click the line-number gutter to add or remove 'breakpoints'.

    37 | 38 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/matchhighlighter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Match Highlighter Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 |

    CodeMirror: Match Highlighter Demo

    20 | 21 |
    24 | 25 | 33 | 34 |

    Highlight matches of selected text on select

    35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/mustache.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Overlay Parser Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 |

    CodeMirror: Overlay Parser Demo

    18 | 19 |
    30 | 31 | 49 | 50 |

    Demonstration of a mode that parses HTML, highlighting 51 | the Mustache templating 52 | directives inside of it by using the code 53 | in overlay.js. View 54 | source to see the 15 lines of code needed to accomplish this.

    55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/resize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Autoresize Demo 5 | 6 | 7 | 8 | 9 | 10 | 21 | 22 | 23 |

    CodeMirror: Autoresize demo

    24 | 25 |
    32 | 33 |

    By setting a few CSS properties, CodeMirror can be made to 34 | automatically resize to fit its content.

    35 | 36 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/vim.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Vim bindings demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

    CodeMirror: Vim bindings demo

    17 | 18 |
    33 | 34 |

    The vim keybindings are enabled by 35 | including keymap/vim.js and setting 36 | the keyMap option to "vim". Because 37 | CodeMirror's internal API is quite different from Vim, they are only 38 | a loose approximation of actual vim bindings, though.

    39 | 40 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /mini-code-editor/cm/demo/visibletabs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Visible tabs demo 5 | 6 | 7 | 8 | 9 | 10 | 24 | 25 | 26 |

    CodeMirror: Visible tabs demo

    27 | 28 |
    43 | 44 |

    Tabs inside the editor are spans with the 45 | class cm-tab, and can be styled. This demo uses 46 | an :after pseudo-class CSS hack that will not work on old 47 | browsers. You can use a more conservative technique like a background 48 | image as an alternative.

    49 | 50 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /mini-code-editor/cm/doc/baboon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/cm/doc/baboon.png -------------------------------------------------------------------------------- /mini-code-editor/cm/keymap/emacs.js: -------------------------------------------------------------------------------- 1 | // TODO number prefixes 2 | (function() { 3 | // Really primitive kill-ring implementation. 4 | var killRing = []; 5 | function addToRing(str) { 6 | killRing.push(str); 7 | if (killRing.length > 50) killRing.shift(); 8 | } 9 | function getFromRing() { return killRing[killRing.length - 1] || ""; } 10 | function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); } 11 | 12 | CodeMirror.keyMap.emacs = { 13 | "Ctrl-X": function(cm) {cm.setOption("keyMap", "emacs-Ctrl-X");}, 14 | "Ctrl-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");}, 15 | "Ctrl-Alt-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");}, 16 | "Alt-W": function(cm) {addToRing(cm.getSelection());}, 17 | "Ctrl-Y": function(cm) {cm.replaceSelection(getFromRing());}, 18 | "Alt-Y": function(cm) {cm.replaceSelection(popFromRing());}, 19 | "Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd", 20 | "Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace", 21 | "Ctrl-Z": "undo", "Cmd-Z": "undo", "Alt-/": "autocomplete", 22 | fallthrough: ["basic", "emacsy"] 23 | }; 24 | 25 | CodeMirror.keyMap["emacs-Ctrl-X"] = { 26 | "Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close", 27 | auto: "emacs", nofallthrough: true 28 | }; 29 | })(); 30 | -------------------------------------------------------------------------------- /mini-code-editor/cm/lib/util/dialog.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-dialog { 2 | position: relative; 3 | } 4 | 5 | .CodeMirror-dialog > div { 6 | position: absolute; 7 | top: 0; left: 0; right: 0; 8 | background: white; 9 | border-bottom: 1px solid #eee; 10 | z-index: 15; 11 | padding: .1em .8em; 12 | overflow: hidden; 13 | color: #333; 14 | } 15 | 16 | .CodeMirror-dialog input { 17 | border: none; 18 | outline: none; 19 | background: transparent; 20 | width: 20em; 21 | color: inherit; 22 | font-family: monospace; 23 | } 24 | -------------------------------------------------------------------------------- /mini-code-editor/cm/lib/util/loadmode.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; 3 | 4 | var loading = {}; 5 | function splitCallback(cont, n) { 6 | var countDown = n; 7 | return function() { if (--countDown == 0) cont(); } 8 | } 9 | function ensureDeps(mode, cont) { 10 | var deps = CodeMirror.modes[mode].dependencies; 11 | if (!deps) return cont(); 12 | var missing = []; 13 | for (var i = 0; i < deps.length; ++i) { 14 | if (!CodeMirror.modes.hasOwnProperty(deps[i])) 15 | missing.push(deps[i]); 16 | } 17 | if (!missing.length) return cont(); 18 | var split = splitCallback(cont, missing.length); 19 | for (var i = 0; i < missing.length; ++i) 20 | CodeMirror.requireMode(missing[i], split); 21 | } 22 | 23 | CodeMirror.requireMode = function(mode, cont) { 24 | if (typeof mode != "string") mode = mode.name; 25 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); 26 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); 27 | 28 | var script = document.createElement("script"); 29 | script.src = CodeMirror.modeURL.replace(/%N/g, mode); 30 | var others = document.getElementsByTagName("script")[0]; 31 | others.parentNode.insertBefore(script, others); 32 | var list = loading[mode] = [cont]; 33 | var count = 0, poll = setInterval(function() { 34 | if (++count > 100) return clearInterval(poll); 35 | if (CodeMirror.modes.hasOwnProperty(mode)) { 36 | clearInterval(poll); 37 | loading[mode] = null; 38 | ensureDeps(mode, function() { 39 | for (var i = 0; i < list.length; ++i) list[i](); 40 | }); 41 | } 42 | }, 200); 43 | }; 44 | 45 | CodeMirror.autoLoadMode = function(instance, mode) { 46 | if (!CodeMirror.modes.hasOwnProperty(mode)) 47 | CodeMirror.requireMode(mode, function() { 48 | instance.setOption("mode", instance.getOption("mode")); 49 | }); 50 | }; 51 | }()); 52 | -------------------------------------------------------------------------------- /mini-code-editor/cm/lib/util/match-highlighter.js: -------------------------------------------------------------------------------- 1 | // Define match-highlighter commands. Depends on searchcursor.js 2 | // Use by attaching the following function call to the onCursorActivity event: 3 | //myCodeMirror.matchHighlight(minChars); 4 | // And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html) 5 | 6 | (function() { 7 | var DEFAULT_MIN_CHARS = 2; 8 | 9 | function MatchHighlightState() { 10 | this.marked = []; 11 | } 12 | function getMatchHighlightState(cm) { 13 | return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState()); 14 | } 15 | 16 | function clearMarks(cm) { 17 | var state = getMatchHighlightState(cm); 18 | for (var i = 0; i < state.marked.length; ++i) 19 | state.marked[i].clear(); 20 | state.marked = []; 21 | } 22 | 23 | function markDocument(cm, className, minChars) { 24 | clearMarks(cm); 25 | minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS); 26 | if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) { 27 | var state = getMatchHighlightState(cm); 28 | var query = cm.getSelection(); 29 | cm.operation(function() { 30 | if (cm.lineCount() < 2000) { // This is too expensive on big documents. 31 | for (var cursor = cm.getSearchCursor(query); cursor.findNext();) { 32 | //Only apply matchhighlight to the matches other than the one actually selected 33 | if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch)) 34 | state.marked.push(cm.markText(cursor.from(), cursor.to(), className)); 35 | } 36 | } 37 | }); 38 | } 39 | } 40 | 41 | CodeMirror.defineExtension("matchHighlight", function(className, minChars) { 42 | markDocument(this, className, minChars); 43 | }); 44 | })(); 45 | -------------------------------------------------------------------------------- /mini-code-editor/cm/lib/util/overlay.js: -------------------------------------------------------------------------------- 1 | // Utility function that allows modes to be combined. The mode given 2 | // as the base argument takes care of most of the normal mode 3 | // functionality, but a second (typically simple) mode is used, which 4 | // can override the style of text. Both modes get to parse all of the 5 | // text, but when both assign a non-null style to a piece of code, the 6 | // overlay wins, unless the combine argument was true, in which case 7 | // the styles are combined. 8 | 9 | CodeMirror.overlayParser = function(base, overlay, combine) { 10 | return { 11 | startState: function() { 12 | return { 13 | base: CodeMirror.startState(base), 14 | overlay: CodeMirror.startState(overlay), 15 | basePos: 0, baseCur: null, 16 | overlayPos: 0, overlayCur: null 17 | }; 18 | }, 19 | copyState: function(state) { 20 | return { 21 | base: CodeMirror.copyState(base, state.base), 22 | overlay: CodeMirror.copyState(overlay, state.overlay), 23 | basePos: state.basePos, baseCur: null, 24 | overlayPos: state.overlayPos, overlayCur: null 25 | }; 26 | }, 27 | 28 | token: function(stream, state) { 29 | if (stream.start == state.basePos) { 30 | state.baseCur = base.token(stream, state.base); 31 | state.basePos = stream.pos; 32 | } 33 | if (stream.start == state.overlayPos) { 34 | stream.pos = stream.start; 35 | state.overlayCur = overlay.token(stream, state.overlay); 36 | state.overlayPos = stream.pos; 37 | } 38 | stream.pos = Math.min(state.basePos, state.overlayPos); 39 | if (stream.eol()) state.basePos = state.overlayPos = 0; 40 | 41 | if (state.overlayCur == null) return state.baseCur; 42 | if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur; 43 | else return state.overlayCur; 44 | }, 45 | 46 | indent: base.indent && function(state, textAfter) { 47 | return base.indent(state.base, textAfter); 48 | }, 49 | electricChars: base.electricChars 50 | }; 51 | }; 52 | -------------------------------------------------------------------------------- /mini-code-editor/cm/lib/util/runmode.js: -------------------------------------------------------------------------------- 1 | CodeMirror.runMode = function(string, modespec, callback, options) { 2 | var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); 3 | var isNode = callback.nodeType == 1; 4 | var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; 5 | if (isNode) { 6 | var node = callback, accum = [], col = 0; 7 | callback = function(text, style) { 8 | if (text == "\n") { 9 | accum.push("
    "); 10 | col = 0; 11 | return; 12 | } 13 | var escaped = ""; 14 | // HTML-escape and replace tabs 15 | for (var pos = 0;;) { 16 | var idx = text.indexOf("\t", pos); 17 | if (idx == -1) { 18 | escaped += CodeMirror.htmlEscape(text.slice(pos)); 19 | col += text.length - pos; 20 | break; 21 | } else { 22 | col += idx - pos; 23 | escaped += CodeMirror.htmlEscape(text.slice(pos, idx)); 24 | var size = tabSize - col % tabSize; 25 | col += size; 26 | for (var i = 0; i < size; ++i) escaped += " "; 27 | pos = idx + 1; 28 | } 29 | } 30 | 31 | if (style) 32 | accum.push("" + escaped + ""); 33 | else 34 | accum.push(escaped); 35 | } 36 | } 37 | var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); 38 | for (var i = 0, e = lines.length; i < e; ++i) { 39 | if (i) callback("\n"); 40 | var stream = new CodeMirror.StringStream(lines[i]); 41 | while (!stream.eol()) { 42 | var style = mode.token(stream, state); 43 | callback(stream.current(), style, i, stream.start); 44 | stream.start = stream.pos; 45 | } 46 | } 47 | if (isNode) 48 | node.innerHTML = accum.join(""); 49 | }; 50 | -------------------------------------------------------------------------------- /mini-code-editor/cm/lib/util/simple-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-completions { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 6 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 7 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 8 | } 9 | .CodeMirror-completions select { 10 | background: #fafafa; 11 | outline: none; 12 | border: none; 13 | padding: 0; 14 | margin: 0; 15 | font-family: monospace; 16 | } 17 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/coffeescript/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2011 Jeff Pickhardt 4 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: CSS mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: CSS mode

    13 |
    48 | 51 | 52 |

    MIME types defined: text/css.

    53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/diff/diff.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("diff", function() { 2 | 3 | var TOKEN_NAMES = { 4 | '+': 'tag', 5 | '-': 'string', 6 | '@': 'meta' 7 | }; 8 | 9 | return { 10 | token: function(stream) { 11 | var tw_pos = stream.string.search(/[\t ]+?$/); 12 | 13 | if (!stream.sol() || tw_pos === 0) { 14 | stream.skipToEnd(); 15 | return ("error " + ( 16 | TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, ''); 17 | } 18 | 19 | var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd(); 20 | 21 | if (tw_pos === -1) { 22 | stream.skipToEnd(); 23 | } else { 24 | stream.pos = tw_pos; 25 | } 26 | 27 | return token_name; 28 | } 29 | }; 30 | }); 31 | 32 | CodeMirror.defineMIME("text/x-diff", "diff"); 33 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/ecl/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | CodeMirror: ECL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: ECL mode

    13 |
    31 | 37 | 38 |

    Based on CodeMirror's clike mode. For more information see HPCC Systems web site.

    39 |

    MIME types defined: text/x-ecl.

    40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/erlang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Erlang mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

    CodeMirror: Erlang mode

    14 | 15 |
    50 | 51 | 58 | 59 |

    MIME types defined: text/x-erlang.

    60 | 61 | 62 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/gfm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: GFM mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

    CodeMirror: GFM mode

    17 | 18 | 19 |
    36 | 37 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/go/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Go mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

    CodeMirror: Go mode

    14 | 15 |
    58 | 59 | 69 | 70 |

    MIME type: text/x-go

    71 | 72 | 73 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/groovy/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Groovy mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Groovy mode

    13 | 14 |
    60 | 61 | 68 | 69 |

    MIME types defined: text/x-groovy

    70 | 71 | 72 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/haskell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Haskell mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

    CodeMirror: Haskell mode

    14 | 15 |
    49 | 50 | 57 | 58 |

    MIME types defined: text/x-haskell.

    59 | 60 | 61 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/htmlembedded/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Html Embedded Scripts mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

    CodeMirror: Html Embedded Scripts mode

    17 | 18 |
    30 | 31 | 42 | 43 |

    Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on 44 | JavaScript, CSS and XML.
    Other dependancies include those of the scriping language chosen.

    45 | 46 |

    MIME types defined: application/x-aspx (ASP.NET), 47 | application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

    48 | 49 | 50 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/htmlmixed/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: HTML mixed mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

    CodeMirror: HTML mixed mode

    16 |
    40 | 43 | 44 |

    The HTML mixed mode depends on the XML, JavaScript, and CSS modes.

    45 | 46 |

    MIME types defined: text/html 47 | (redefined, only takes effect if you load this parser after the 48 | XML parser).

    49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/jinja2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Jinja2 mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Jinja2 mode

    13 |
    31 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/jinja2/jinja2.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("jinja2", function(config, parserConf) { 2 | var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false", 3 | "loop", "none", "self", "super", "if", "as", "not", "and", 4 | "else", "import", "with", "without", "context"]; 5 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); 6 | 7 | function tokenBase (stream, state) { 8 | var ch = stream.next(); 9 | if (ch == "{") { 10 | if (ch = stream.eat(/\{|%|#/)) { 11 | stream.eat("-"); 12 | state.tokenize = inTag(ch); 13 | return "tag"; 14 | } 15 | } 16 | } 17 | function inTag (close) { 18 | if (close == "{") { 19 | close = "}"; 20 | } 21 | return function (stream, state) { 22 | var ch = stream.next(); 23 | if ((ch == close || (ch == "-" && stream.eat(close))) 24 | && stream.eat("}")) { 25 | state.tokenize = tokenBase; 26 | return "tag"; 27 | } 28 | if (stream.match(keywords)) { 29 | return "keyword"; 30 | } 31 | return close == "#" ? "comment" : "string"; 32 | }; 33 | } 34 | return { 35 | startState: function () { 36 | return {tokenize: tokenBase}; 37 | }, 38 | token: function (stream, state) { 39 | return state.tokenize(stream, state); 40 | } 41 | }; 42 | }); 43 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/lua/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Lua mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

    CodeMirror: Lua mode

    14 |
    55 | 62 | 63 |

    Loosely based on Franciszek 64 | Wawrzak's CodeMirror 65 | 1 mode. One configuration parameter is 66 | supported, specials, to which you can provide an 67 | array of strings to have those identifiers highlighted with 68 | the lua-special style.

    69 |

    MIME types defined: text/x-lua.

    70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/mysql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: MySQL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: MySQL mode

    13 |
    30 | 37 | 38 |

    MIME types defined: text/x-mysql.

    39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/ntriples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: NTriples mode 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |

    CodeMirror: NTriples mode

    17 |
    18 | 25 | 26 | 27 | 30 |

    MIME types defined: text/n-triples.

    31 | 32 | 33 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/pascal/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 souceLair 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/pascal/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Pascal mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Pascal mode

    13 | 14 |
    37 | 38 | 45 | 46 |

    MIME types defined: text/x-pascal.

    47 | 48 | 49 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/perl/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by Sabaca under the MIT license. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/perl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Perl mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Perl mode

    13 | 14 |
    52 | 53 | 59 | 60 |

    MIME types defined: text/x-perl.

    61 | 62 | 63 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/php/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: PHP mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

    CodeMirror: PHP mode

    17 | 18 |
    29 | 30 | 41 | 42 |

    Simple HTML/PHP mode based on 43 | the C-like mode. Depends on XML, 44 | JavaScript, CSS, and C-like modes.

    45 | 46 |

    MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

    47 | 48 | 49 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/pig/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Pig Latin mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Pig Latin mode

    13 | 14 |
    26 | 27 | 35 | 36 |

    37 | Simple mode that handles Pig Latin language. 38 |

    39 | 40 |

    MIME type defined: text/x-pig 41 | (PIG code) 42 | 43 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/plsql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Oracle PL/SQL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Oracle PL/SQL mode

    13 | 14 |
    46 | 47 | 55 | 56 |

    57 | Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course). 58 |

    59 | 60 |

    MIME type defined: text/x-plsql 61 | (PLSQL code) 62 | 63 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/properties/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Properties files mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Properties files mode

    13 |
    32 | 35 | 36 |

    MIME types defined: text/x-properties, 37 | text/x-ini.

    38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/properties/properties.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("properties", function() { 2 | return { 3 | token: function(stream, state) { 4 | var sol = stream.sol() || state.afterSection; 5 | var eol = stream.eol(); 6 | 7 | state.afterSection = false; 8 | 9 | if (sol) { 10 | if (state.nextMultiline) { 11 | state.inMultiline = true; 12 | state.nextMultiline = false; 13 | } else { 14 | state.position = "def"; 15 | } 16 | } 17 | 18 | if (eol && ! state.nextMultiline) { 19 | state.inMultiline = false; 20 | state.position = "def"; 21 | } 22 | 23 | if (sol) { 24 | while(stream.eatSpace()); 25 | } 26 | 27 | var ch = stream.next(); 28 | 29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { 30 | state.position = "comment"; 31 | stream.skipToEnd(); 32 | return "comment"; 33 | } else if (sol && ch === "[") { 34 | state.afterSection = true; 35 | stream.skipTo("]"); stream.eat("]"); 36 | return "header"; 37 | } else if (ch === "=" || ch === ":") { 38 | state.position = "quote"; 39 | return null; 40 | } else if (ch === "\\" && state.position === "quote") { 41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 42 | // Multiline value 43 | state.nextMultiline = true; 44 | } 45 | } 46 | 47 | return state.position; 48 | }, 49 | 50 | startState: function() { 51 | return { 52 | position : "def", // Current position, "def", "quote" or "comment" 53 | nextMultiline : false, // Is the next line multiline value 54 | inMultiline : false, // Is the current line a multiline value 55 | afterSection : false // Did we just open a section 56 | }; 57 | } 58 | 59 | }; 60 | }); 61 | 62 | CodeMirror.defineMIME("text/x-properties", "properties"); 63 | CodeMirror.defineMIME("text/x-ini", "properties"); 64 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/python/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Timothy Farrell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/r/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Ubalo, Inc nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/rpm/changes/changes.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("changes", function(config, modeConfig) { 2 | var headerSeperator = /^-+$/; 3 | var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; 4 | var simpleEmail = /^[\w+.-]+@[\w.-]+/; 5 | 6 | return { 7 | token: function(stream) { 8 | if (stream.sol()) { 9 | if (stream.match(headerSeperator)) { return 'tag'; } 10 | if (stream.match(headerLine)) { return 'tag'; } 11 | } 12 | if (stream.match(simpleEmail)) { return 'string'; } 13 | stream.next(); 14 | return null; 15 | } 16 | }; 17 | }); 18 | 19 | CodeMirror.defineMIME("text/x-rpm-changes", "changes"); 20 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/rpm/changes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: RPM changes mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: RPM changes mode

    13 | 14 |
    41 | 50 | 51 |

    MIME types defined: text/x-rpm-changes.

    52 | 53 | 54 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/rpm/spec/spec.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;} 2 | .cm-s-default span.cm-macro {color: #b218b2;} 3 | .cm-s-default span.cm-section {color: green; font-weight: bold;} 4 | .cm-s-default span.cm-script {color: red;} 5 | .cm-s-default span.cm-issue {color: yellow;} 6 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/ruby/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Ubalo, Inc. nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/rust/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Rust mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Rust mode

    13 | 14 |
    37 | 38 | 45 | 46 |

    MIME types defined: text/x-rustsrc.

    47 | 48 | 49 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/shell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Shell mode 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 |

    CodeMirror: Shell mode

    16 | 17 | 41 | 42 | 49 | 50 |

    MIME types defined: text/x-sh.

    51 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/smalltalk/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Smalltalk mode 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |

    CodeMirror: Smalltalk mode

    17 | 18 |
    41 | 42 | 50 | 51 |

    Simple Smalltalk mode.

    52 | 53 |

    MIME types defined: text/x-stsrc.

    54 | 55 | 56 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/sparql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: SPARQL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: SPARQL mode

    13 |
    29 | 36 | 37 |

    MIME types defined: application/x-sparql-query.

    38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/tiddlywiki/tiddlywiki.css: -------------------------------------------------------------------------------- 1 | span.cm-underlined { 2 | text-decoration: underline; 3 | } 4 | span.cm-strikethrough { 5 | text-decoration: line-through; 6 | } 7 | span.cm-brace { 8 | color: #170; 9 | font-weight: bold; 10 | } 11 | span.cm-table { 12 | color: blue; 13 | font-weight: bold; 14 | } 15 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/tiki/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Tiki wiki mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: Tiki wiki mode

    13 | 14 |
    71 | 72 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/tiki/tiki.css: -------------------------------------------------------------------------------- 1 | .cm-tw-syntaxerror { 2 | color: #FFFFFF; 3 | background-color: #990000; 4 | } 5 | 6 | .cm-tw-deleted { 7 | text-decoration: line-through; 8 | } 9 | 10 | .cm-tw-header5 { 11 | font-weight: bold; 12 | } 13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ 14 | padding-left: 10px; 15 | } 16 | 17 | .cm-tw-box { 18 | border-top-width: 0px ! important; 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: inherit; 22 | } 23 | 24 | .cm-tw-underline { 25 | text-decoration: underline; 26 | } -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/vbscript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: VBScript mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: VBScript mode

    13 | 14 |
    31 | 32 | 38 | 39 |

    MIME types defined: text/vbscript.

    40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/vbscript/vbscript.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("vbscript", function() { 2 | var regexVBScriptKeyword = /^(?:Call|Case|CDate|Clear|CInt|CLng|Const|CStr|Description|Dim|Do|Each|Else|ElseIf|End|Err|Error|Exit|False|For|Function|If|LCase|Loop|LTrim|Next|Nothing|Now|Number|On|Preserve|Quit|ReDim|Resume|RTrim|Select|Set|Sub|Then|To|Trim|True|UBound|UCase|Until|VbCr|VbCrLf|VbLf|VbTab)$/im; 3 | 4 | return { 5 | token: function(stream) { 6 | if (stream.eatSpace()) return null; 7 | var ch = stream.next(); 8 | if (ch == "'") { 9 | stream.skipToEnd(); 10 | return "comment"; 11 | } 12 | if (ch == '"') { 13 | stream.skipTo('"'); 14 | return "string"; 15 | } 16 | 17 | if (/\w/.test(ch)) { 18 | stream.eatWhile(/\w/); 19 | if (regexVBScriptKeyword.test(stream.current())) return "keyword"; 20 | } 21 | return null; 22 | } 23 | }; 24 | }); 25 | 26 | CodeMirror.defineMIME("text/vbscript", "vbscript"); 27 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/xml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: XML mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: XML mode

    13 |
    25 | 31 |

    The XML mode supports two configuration parameters:

    32 |
    33 |
    htmlMode (boolean)
    34 |
    This switches the mode to parse HTML instead of XML. This 35 | means attributes do not have to be quoted, and some elements 36 | (such as br) do not require a closing tag.
    37 |
    alignCDATA (boolean)
    38 |
    Setting this to true will force the opening tag of CDATA 39 | blocks to not be indented.
    40 |
    41 | 42 |

    MIME types defined: application/xml, text/html.

    43 | 44 | 45 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/xquery/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by MarkLogic Corporation 2 | Author: Mike Brevoort 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/xquery/test/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

    XQuery CodeMirror Mode

    21 |

    22 |

    23 |
      24 |
    25 |
    26 | 27 | 28 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/xquery/test/testEmptySequenceKeyword.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | module("testEmptySequenceKeyword"); 3 | test("testEmptySequenceKeyword", function() { 4 | expect(1); 5 | 6 | var input = '"foo" instance of empty-sequence()'; 7 | var expected = '"foo" instance of empty-sequence()'; 8 | 9 | $("#sandbox").html(''); 10 | var editor = CodeMirror.fromTextArea($("#editor")[0]); 11 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; 12 | 13 | equal(result, expected); 14 | $("#editor").html(""); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/xquery/test/testMultiAttr.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | module("testMultiAttr"); 3 | test("test1", function() { 4 | expect(1); 5 | 6 | var expected = '<p a1="foo" a2="bar">hello world</p>'; 7 | 8 | $("#sandbox").html(''); 9 | $("#editor").html('

    hello world

    '); 10 | var editor = CodeMirror.fromTextArea($("#editor")[0]); 11 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; 12 | 13 | equal(result, expected); 14 | $("#editor").html(""); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/xquery/test/testProcessingInstructions.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | module("testProcessingInstructions"); 3 | test("testProcessingInstructions", function() { 4 | expect(1); 5 | 6 | var input = 'data() instance of xs:string'; 7 | var expected = 'data(<?target content?>) instance of xs:string'; 8 | 9 | $("#sandbox").html(''); 10 | var editor = CodeMirror.fromTextArea($("#editor")[0]); 11 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; 12 | 13 | equal(result, expected); 14 | $("#editor").html(""); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/xquery/test/testQuotes.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | module("testQuoteEscape"); 3 | test("testQuoteEscapeDouble", function() { 4 | expect(1); 5 | 6 | var input = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"\ 7 | let $keysfolder := concat($rootfolder, "keys\\")\ 8 | return\ 9 | $keysfolder'; 10 | var expected = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"let $keysfolder := concat($rootfolder, "keys\\")return$keysfolder'; 11 | 12 | $("#sandbox").html(''); 13 | var editor = CodeMirror.fromTextArea($("#editor")[0]); 14 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; 15 | 16 | equal(result, expected); 17 | $("#editor").html(""); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /mini-code-editor/cm/mode/yaml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: YAML mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    CodeMirror: YAML mode

    13 |
    60 | 63 | 64 |

    MIME types defined: text/x-yaml.

    65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /mini-code-editor/cm/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Test Suite 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |

    CodeMirror: Test Suite

    17 | 18 |

    A limited set of programmatic sanity tests for CodeMirror.

    19 | 20 |
    
    21 | 
    22 |     
    25 | 
    26 |     
    27 |   
    28 | 
    29 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/test/mode_test.css:
    --------------------------------------------------------------------------------
     1 | .mt-output .mt-token {
     2 |   border: 1px solid #ddd;
     3 |   white-space: pre;
     4 |   font-family: "Consolas", monospace;
     5 |   text-align: center;
     6 | }
     7 | 
     8 | .mt-output .mt-style {
     9 |   font-size: x-small;
    10 | }
    11 | 
    12 | .mt-test {
    13 |   border-left: 10px solid #fff;
    14 | }
    15 | 
    16 | .mt-pass {
    17 |   border-left: 10px solid #cfc;
    18 | }
    19 | 
    20 | .mt-fail {
    21 |   border-left: 10px solid #fcc;
    22 | }
    23 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/blackboard.css:
    --------------------------------------------------------------------------------
     1 | /* Port of TextMate's Blackboard theme */
     2 | 
     3 | .cm-s-blackboard { background: #0C1021; color: #F8F8F8; }
     4 | .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
     5 | .cm-s-blackboard .CodeMirror-gutter { background: #0C1021; border-right: 0; }
     6 | .cm-s-blackboard .CodeMirror-gutter-text { color: #888; }
     7 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
     8 | 
     9 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; }
    10 | .cm-s-blackboard .cm-atom { color: #D8FA3C; }
    11 | .cm-s-blackboard .cm-number { color: #D8FA3C; }
    12 | .cm-s-blackboard .cm-def { color: #8DA6CE; }
    13 | .cm-s-blackboard .cm-variable { color: #FF6400; }
    14 | .cm-s-blackboard .cm-operator { color: #FBDE2D;}
    15 | .cm-s-blackboard .cm-comment { color: #AEAEAE; }
    16 | .cm-s-blackboard .cm-string { color: #61CE3C; }
    17 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; }
    18 | .cm-s-blackboard .cm-meta { color: #D8FA3C; }
    19 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
    20 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; }
    21 | .cm-s-blackboard .cm-tag { color: #8DA6CE; }
    22 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; }
    23 | .cm-s-blackboard .cm-header { color: #FF6400; }
    24 | .cm-s-blackboard .cm-hr { color: #AEAEAE; }
    25 | .cm-s-blackboard .cm-link { color: #8DA6CE; }
    26 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/cobalt.css:
    --------------------------------------------------------------------------------
     1 | .cm-s-cobalt { background: #002240; color: white; }
     2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
     3 | .cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
     4 | .cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
     5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
     6 | 
     7 | .cm-s-cobalt span.cm-comment { color: #08f; }
     8 | .cm-s-cobalt span.cm-atom { color: #845dc4; }
     9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
    10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; }
    11 | .cm-s-cobalt span.cm-string { color: #3ad900; }
    12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; }
    13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
    14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
    15 | .cm-s-cobalt span.cm-error { color: #9d1e15; }
    16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
    17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
    18 | .cm-s-cobalt span.cm-link { color: #845dc4; }
    19 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/eclipse.css:
    --------------------------------------------------------------------------------
     1 | .cm-s-eclipse span.cm-meta {color: #FF1717;}
     2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
     3 | .cm-s-eclipse span.cm-atom {color: #219;}
     4 | .cm-s-eclipse span.cm-number {color: #164;}
     5 | .cm-s-eclipse span.cm-def {color: #00f;}
     6 | .cm-s-eclipse span.cm-variable {color: black;}
     7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
     8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
     9 | .cm-s-eclipse span.cm-property {color: black;}
    10 | .cm-s-eclipse span.cm-operator {color: black;}
    11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;}
    12 | .cm-s-eclipse span.cm-string {color: #2A00FF;}
    13 | .cm-s-eclipse span.cm-string-2 {color: #f50;}
    14 | .cm-s-eclipse span.cm-error {color: #f00;}
    15 | .cm-s-eclipse span.cm-qualifier {color: #555;}
    16 | .cm-s-eclipse span.cm-builtin {color: #30a;}
    17 | .cm-s-eclipse span.cm-bracket {color: #cc7;}
    18 | .cm-s-eclipse span.cm-tag {color: #170;}
    19 | .cm-s-eclipse span.cm-attribute {color: #00c;}
    20 | .cm-s-eclipse span.cm-link {color: #219;}
    21 | 
    22 | .cm-s-eclipse .CodeMirror-matchingbracket {
    23 | 	border:1px solid grey;
    24 | 	color:black !important;;
    25 | }
    26 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/elegant.css:
    --------------------------------------------------------------------------------
     1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
     2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}
     3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}
     4 | .cm-s-elegant span.cm-variable {color: black;}
     5 | .cm-s-elegant span.cm-variable-2 {color: #b11;}
     6 | .cm-s-elegant span.cm-qualifier {color: #555;}
     7 | .cm-s-elegant span.cm-keyword {color: #730;}
     8 | .cm-s-elegant span.cm-builtin {color: #30a;}
     9 | .cm-s-elegant span.cm-error {background-color: #fdd;}
    10 | .cm-s-elegant span.cm-link {color: #762;}
    11 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/erlang-dark.css:
    --------------------------------------------------------------------------------
     1 | .cm-s-erlang-dark { background: #002240; color: white; }
     2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
     3 | .cm-s-erlang-dark .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
     4 | .cm-s-erlang-dark .CodeMirror-gutter-text { color: #d0d0d0; }
     5 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
     6 | 
     7 | .cm-s-erlang-dark span.cm-atom       { color: #845dc4; }
     8 | .cm-s-erlang-dark span.cm-attribute  { color: #ff80e1; }
     9 | .cm-s-erlang-dark span.cm-bracket    { color: #ff9d00; }
    10 | .cm-s-erlang-dark span.cm-builtin    { color: #eeaaaa; }
    11 | .cm-s-erlang-dark span.cm-comment    { color: #7777ff; }
    12 | .cm-s-erlang-dark span.cm-def        { color: #ee77aa; }
    13 | .cm-s-erlang-dark span.cm-error      { color: #9d1e15; }
    14 | .cm-s-erlang-dark span.cm-keyword    { color: #ffee80; }
    15 | .cm-s-erlang-dark span.cm-meta       { color: #50fefe; }
    16 | .cm-s-erlang-dark span.cm-number     { color: #ffd0d0; }
    17 | .cm-s-erlang-dark span.cm-operator   { color: #dd1111; }
    18 | .cm-s-erlang-dark span.cm-string     { color: #3ad900; }
    19 | .cm-s-erlang-dark span.cm-tag        { color: #9effff; }
    20 | .cm-s-erlang-dark span.cm-variable   { color: #50fe50; }
    21 | .cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; }
    22 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/monokai.css:
    --------------------------------------------------------------------------------
     1 | /* Based on Sublime Text's Monokai theme */
     2 | 
     3 | .cm-s-monokai {background: #272822; color: #f8f8f2;}
     4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
     5 | .cm-s-monokai .CodeMirror-gutter {background: #272822; border-right: 0px;}
     6 | .cm-s-monokai .CodeMirror-gutter-text {color: #d0d0d0;}
     7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
     8 | 
     9 | .cm-s-monokai span.cm-comment {color: #75715e;}
    10 | .cm-s-monokai span.cm-atom {color: #ae81ff;}
    11 | .cm-s-monokai span.cm-number {color: #ae81ff;}
    12 | 
    13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;}
    14 | .cm-s-monokai span.cm-keyword {color: #f92672;}
    15 | .cm-s-monokai span.cm-string {color: #e6db74;}
    16 | 
    17 | .cm-s-monokai span.cm-variable {color: #a6e22e;}
    18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;}
    19 | .cm-s-monokai span.cm-def {color: #fd971f;}
    20 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}
    21 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;}
    22 | .cm-s-monokai span.cm-tag {color: #f92672;}
    23 | .cm-s-monokai span.cm-link {color: #ae81ff;}
    24 | 
    25 | .cm-s-monokai .CodeMirror-matchingbracket {
    26 |   text-decoration: underline;
    27 |   color: white !important;
    28 | }
    29 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/neat.css:
    --------------------------------------------------------------------------------
     1 | .cm-s-neat span.cm-comment { color: #a86; }
     2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; }
     3 | .cm-s-neat span.cm-string { color: #a22; }
     4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; }
     5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; }
     6 | .cm-s-neat span.cm-variable { color: black; }
     7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
     8 | .cm-s-neat span.cm-meta {color: #555;}
     9 | .cm-s-neat span.cm-link { color: #3a3; }
    10 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/night.css:
    --------------------------------------------------------------------------------
     1 | /* Loosely based on the Midnight Textmate theme */
     2 | 
     3 | .cm-s-night { background: #0a001f; color: #f8f8f8; }
     4 | .cm-s-night div.CodeMirror-selected { background: #a8f !important; }
     5 | .cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
     6 | .cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
     7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
     8 | 
     9 | .cm-s-night span.cm-comment { color: #6900a1; }
    10 | .cm-s-night span.cm-atom { color: #845dc4; }
    11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
    12 | .cm-s-night span.cm-keyword { color: #599eff; }
    13 | .cm-s-night span.cm-string { color: #37f14a; }
    14 | .cm-s-night span.cm-meta { color: #7678e2; }
    15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
    16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
    17 | .cm-s-night span.cm-error { color: #9d1e15; }
    18 | .cm-s-night span.cm-bracket { color: #8da6ce; }
    19 | .cm-s-night span.cm-comment { color: #6900a1; }
    20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
    21 | .cm-s-night span.cm-link { color: #845dc4; }
    22 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/cm/theme/rubyblue.css:
    --------------------------------------------------------------------------------
     1 | .cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; }	/* - customized editor font - */
     2 | 
     3 | .cm-s-rubyblue { background: #112435; color: white; }
     4 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
     5 | .cm-s-rubyblue .CodeMirror-gutter { background: #1F4661; border-right: 7px solid #3E7087; min-width:2.5em; }
     6 | .cm-s-rubyblue .CodeMirror-gutter-text { color: white; }
     7 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
     8 | 
     9 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
    10 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; }
    11 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }
    12 | .cm-s-rubyblue span.cm-keyword { color: #F0F; }
    13 | .cm-s-rubyblue span.cm-string { color: #F08047; }
    14 | .cm-s-rubyblue span.cm-meta { color: #F0F; }
    15 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
    16 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }
    17 | .cm-s-rubyblue span.cm-error { color: #AF2018; }
    18 | .cm-s-rubyblue span.cm-bracket { color: #F0F; }
    19 | .cm-s-rubyblue span.cm-link { color: #F4C20B; }
    20 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
    21 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }
    22 | 
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/128x128/file_edit.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/128x128/file_edit.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/16x16/diskette.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/16x16/diskette.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/16x16/file.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/16x16/file.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/16x16/file_add.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/16x16/file_add.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/16x16/file_edit.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/16x16/file_edit.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/32x32/diskette.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/32x32/diskette.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/32x32/file.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/32x32/file.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/32x32/file_add.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/32x32/file_add.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/32x32/file_edit.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/32x32/file_edit.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/48x48/file_edit.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/48x48/file_edit.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/64x64/file_edit.png:
    --------------------------------------------------------------------------------
    https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/img/64x64/file_edit.png
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/img/README.txt:
    --------------------------------------------------------------------------------
    1 | Icons from http://www.smashingmagazine.com/2008/09/02/simplicio-a-free-icon-set/
    
    
    --------------------------------------------------------------------------------
    /mini-code-editor/index.html:
    --------------------------------------------------------------------------------
     1 | 
     2 | 
     3 | 
     4 | Mini Code Editor
     5 | 
     6 | 
     7 | 
     8 | 
     9 | 
    10 | 
    11 | 
    12 | 
    13 | 
    14 | 
    15 | 
    16 | 
    17 | 
    18 | 
    19 | 
    20 | 
    21 | 22 | 23 | 24 |
    25 | 26 |
    27 | 28 |
    29 | 30 | 31 |
    32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /mini-code-editor/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | // Quit when all windows are closed. 6 | app.on('window-all-closed', function() { 7 | if (process.platform != 'darwin') 8 | app.quit(); 9 | }); 10 | 11 | // This method will be called when Electron has done everything 12 | // initialization and ready for creating browser windows. 13 | app.on('ready', function() { 14 | // Create the browser window. 15 | mainWindow = new BrowserWindow({width: 800, height: 600, webPreferences: {nodeIntegration: true, enableRemoteModule: true}}); 16 | 17 | // and load the index.html of the app. 18 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 19 | 20 | // Emitted when the window is closed. 21 | mainWindow.on('closed', function() { 22 | // Dereference the window object, usually you would store windows 23 | // in an array if your app supports multi windows, this is the time 24 | // when you should delete the corresponding element. 25 | mainWindow = null; 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /mini-code-editor/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "mini-code-editor", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /mini-code-editor/screenshot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mini-code-editor/screenshot/screenshot.png -------------------------------------------------------------------------------- /mini-code-editor/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | margin-top: 5px; 5 | overflow: hidden; 6 | } 7 | 8 | button { 9 | margin: 0; 10 | } 11 | 12 | .CodeMirror { 13 | margin: 0; 14 | padding: 0; 15 | } 16 | 17 | .CodeMirror-scroll { 18 | height: auto; 19 | overflow-y: hidden; 20 | overflow-x: auto; 21 | } 22 | 23 | #editor { 24 | position: absolute; 25 | top: 37px; 26 | bottom: 24px; 27 | left: 0; 28 | right: 0; 29 | background: #262626; 30 | } 31 | 32 | .info { 33 | font-family: monospace; 34 | white-space: nowrap; 35 | position: absolute; 36 | bottom: 0; 37 | background: #eee; 38 | padding: 2px; 39 | height: 20px; 40 | left: 0; 41 | right: 0; 42 | } 43 | 44 | .info label { 45 | font-weight: bold; 46 | } 47 | 48 | .buttons { 49 | padding: 2px; 50 | height: 25px; 51 | } 52 | -------------------------------------------------------------------------------- /mp3-encoder/Cakefile: -------------------------------------------------------------------------------- 1 | {spawn, exec} = require "child_process" 2 | 3 | task 'build', 'Compile coffee scripts into plain Javascript files', -> 4 | child = exec "coffee -c -j lib/main.js src/*.coffee src/**/*.coffee", (err, stdout, stderr) -> 5 | if err? 6 | console.error "Error :" 7 | console.dir err 8 | console.log stdout 9 | console.error stderr 10 | else 11 | console.log "Done!" 12 | -------------------------------------------------------------------------------- /mp3-encoder/README.md: -------------------------------------------------------------------------------- 1 | # MP3 Encoder 2 | 3 | Dummy app to test electron using an external process, coffee-script 4 | and backbone on both windows and OSX. 5 | -------------------------------------------------------------------------------- /mp3-encoder/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | MP3 Encoder 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 15 |

    Dummy MP3 encoder

    16 |

    Pick up a .wav file

    17 |
    18 |
    19 | 20 | 21 | -------------------------------------------------------------------------------- /mp3-encoder/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | // Quit when all windows are closed. 6 | app.on('window-all-closed', function() { 7 | if (process.platform != 'darwin') 8 | app.quit(); 9 | }); 10 | 11 | // This method will be called when Electron has done everything 12 | // initialization and ready for creating browser windows. 13 | app.on('ready', function() { 14 | // Create the browser window. 15 | mainWindow = new BrowserWindow({width: 800, height: 600, webPreferences: {nodeIntegration: true}}); 16 | 17 | // and load the index.html of the app. 18 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 19 | 20 | // Emitted when the window is closed. 21 | mainWindow.on('closed', function() { 22 | // Dereference the window object, usually you would store windows 23 | // in an array if your app supports multi windows, this is the time 24 | // when you should delete the corresponding element. 25 | mainWindow = null; 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /mp3-encoder/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "mp3-encoder-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /mp3-encoder/src/main.coffee: -------------------------------------------------------------------------------- 1 | $ -> 2 | form = new EncodeFormView 3 | logsElem: $("div.logs") 4 | 5 | form.render().$el.appendTo $("div.form") 6 | -------------------------------------------------------------------------------- /mp3-encoder/src/utils/encoder.coffee: -------------------------------------------------------------------------------- 1 | {spawn} = require "child_process" 2 | {platform} = require "os" 3 | {chmodSync} = require "fs" 4 | 5 | 6 | class Encoder 7 | constructor: ({@source, @bitrate, @target, @log}) -> 8 | @target ||= @source.replace /\.wav$/, ".mp3" 9 | if @target == @source 10 | @target = @target.replace(/\.([^.]+)$/, ' encoded.$1') 11 | 12 | @bitrate ||= 128 13 | 14 | switch platform() 15 | when "darwin" 16 | @pathToBin = "vendor/bin/osx/shineenc" 17 | when "win32" 18 | @pathToBin = "vendor/bin/win32/shineenc.exe" 19 | 20 | # binary may not be executable due to zip compression.. 21 | chmodSync @pathToBin, 0o755 22 | 23 | process: -> 24 | @log "Starting encoding process.." 25 | 26 | @child = spawn @pathToBin, ["-b", @bitrate, @source, @target] 27 | 28 | @child.stdout.on "data", (data) => 29 | @log "#{data.toString().replace(/\n/g, '
    ')}" 30 | 31 | @child.stderr.on "data", (data) => 32 | @log "ERROR: #{data.toString().replace(/\n/g, '
    ')}", 'error' 33 | 34 | @child.on "exit", (code) => 35 | style = if code == 0 then 'good' else 'error' 36 | @log "Encoding process exited with code: #{code}", style 37 | -------------------------------------------------------------------------------- /mp3-encoder/src/views/form.coffee: -------------------------------------------------------------------------------- 1 | class EncodeFormView extends Backbone.View 2 | tagName: "form" 3 | events: 4 | "submit" : "onSubmit" 5 | 6 | initialize: ({@logsElem}) -> 7 | 8 | render: -> 9 | @$el.html """ 10 | File:
    11 | Bitrate:
    12 | 13 | """ 14 | 15 | this 16 | 17 | onSubmit: (e) -> 18 | e.preventDefault() 19 | 20 | data = 21 | source: @$("input.file").val() 22 | bitrate: parseInt @$("input.bitrate").val() 23 | log: (data, type = 'info') => 24 | @logsElem.html "#{@logsElem.html()}
    #{data}" 25 | 26 | return console.log "no file!" unless data.source? 27 | 28 | (new Encoder data).process() 29 | -------------------------------------------------------------------------------- /mp3-encoder/vendor/bin/osx/shineenc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mp3-encoder/vendor/bin/osx/shineenc -------------------------------------------------------------------------------- /mp3-encoder/vendor/bin/win32/libshine-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mp3-encoder/vendor/bin/win32/libshine-1.dll -------------------------------------------------------------------------------- /mp3-encoder/vendor/bin/win32/shineenc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/mp3-encoder/vendor/bin/win32/shineenc.exe -------------------------------------------------------------------------------- /notifications/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/notifications/icon.png -------------------------------------------------------------------------------- /notifications/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | app.on('ready', function() { 6 | mainWindow = new BrowserWindow({width: 800, height: 600, webPreferences: {nodeIntegration: true}}); 7 | mainWindow.loadURL('file://' + __dirname + '/window.html'); 8 | }); 9 | -------------------------------------------------------------------------------- /notifications/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "notification-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /notifications/readme.md: -------------------------------------------------------------------------------- 1 | # Notification Demo 2 | 3 | A sample demonstrates Notification API usage. The Notification API in Electron 4 | works on OS X, Windows 8 (and up) and sometimes on Linux. [Node-notifier](https://github.com/mikaelbr/node-notifier) is a potential alternative. 5 | 6 | Electron's Notification API is implemented with native notification APIs. 7 | On OS X, you can customize your Electron's notification alert style via 8 | `Notifications` panel in `System Preference`. 9 | 10 | Related Notification issues on electron are traced in: 11 | 12 | * [atom/electron#262](https://github.com/atom/electron/issues/262) 13 | * [atom/electron#1920](https://github.com/atom/electron/issues/1920) 14 | * [atom/electron#1025](https://github.com/atom/electron/issues/1025) 15 | 16 | ## Screenshot 17 | 18 | ![screenshot1](/notifications/screenshot/screenshot1.png) 19 | 20 | ![screenshot2](/notifications/screenshot/screenshot2.png) 21 | -------------------------------------------------------------------------------- /notifications/screenshot/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/notifications/screenshot/screenshot1.png -------------------------------------------------------------------------------- /notifications/screenshot/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/notifications/screenshot/screenshot2.png -------------------------------------------------------------------------------- /notifications/slack_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/notifications/slack_icon.png -------------------------------------------------------------------------------- /notifications/window.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Notifications Sample 5 | 6 | 7 |

    Notifications Sample

    8 |

    This sample demonstrates the use of the Notifications API. Use buttons below to create various different notifications.

    9 |
    10 | 11 | Basic notification: default icon, title, and message. 12 |
    13 |
    14 | 15 | Image notification: icon, title, image, and message.(Only available on OS X Yosemite) 16 |
    17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /notifications/window.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var options = [ 3 | { 4 | title: "Basic Notification", 5 | body: "Short message part" 6 | }, 7 | { 8 | title: "Content-Image Notification", 9 | body: "Short message plus a custom content image", 10 | icon: path.join(__dirname, 'icon.png') 11 | } 12 | ] 13 | 14 | function doNotify(evt) { 15 | if (evt.srcElement.id == "basic") { 16 | new Notification(options[0].title, options[0]); 17 | } 18 | else if (evt.srcElement.id == "image") { 19 | new Notification(options[1].title, options[1]); 20 | } 21 | } 22 | 23 | document.addEventListener('DOMContentLoaded', function() { 24 | document.getElementById("basic").addEventListener("click", doNotify); 25 | document.getElementById("image").addEventListener("click", doNotify); 26 | }) 27 | -------------------------------------------------------------------------------- /pepper-flash-plugin/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | const path = require('path'); 3 | 4 | let mainWindow; 5 | 6 | app.on('window-all-closed', function() { 7 | if (process.platform != 'darwin') 8 | app.quit(); 9 | }); 10 | 11 | let ppapi_flash_path; 12 | 13 | // Specify flash path. 14 | // On Windows, it might be /path/to/pepflashplayer.dll 15 | // On OS X, /path/to/PepperFlashPlayer.plugin 16 | // On Linux, /path/to/libpepflashplayer.so 17 | if(process.platform == 'win32'){ 18 | ppapi_flash_path = path.join(__dirname, 'pepflashplayer.dll'); 19 | } else if (process.platform == 'linux') { 20 | ppapi_flash_path = path.join(__dirname, 'libpepflashplayer.so'); 21 | } else if (process.platform == 'darwin') { 22 | ppapi_flash_path = path.join(__dirname, 'PepperFlashPlayer.plugin'); 23 | } 24 | 25 | app.commandLine.appendSwitch('ppapi-flash-path', ppapi_flash_path); 26 | 27 | // Specify flash version, for example, v18.0.0.203 28 | app.commandLine.appendSwitch('ppapi-flash-version', '18.0.0.203'); 29 | 30 | app.on('ready', function() { 31 | mainWindow = new BrowserWindow({ 32 | 'width': 800, 33 | 'height': 600, 34 | 'webPreferences': { 35 | 'plugins': true, 36 | 'nodeIntegration': true 37 | }, 38 | }); 39 | mainWindow.loadURL('http://www.adobe.com/software/flash/about/'); 40 | }); 41 | -------------------------------------------------------------------------------- /pepper-flash-plugin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "pepper-flash-plugin-sample", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /pepper-flash-plugin/readme.md: -------------------------------------------------------------------------------- 1 | # Pepper-Flash-Plugin Sample 2 | 3 | A sample shows Pepper Flash Plugin usage in Electron. More details can be found 4 | at https://github.com/electron/electron/blob/master/docs/tutorial/using-pepper-flash-plugin.md. 5 | 6 | ## Run steps 7 | 8 | 1. Copy the pepper flash plugin under the current app directory. 9 | 10 | 2. Make ppapi-flash-version in `main.js` align with the copied plugin's. 11 | 12 | 3. Run the sample `electron path/to/electron-sample-apps/pepper-flash-plugin`. 13 | If it succeeds, you can view `You have version X.X.X.X installed` in the sample page. 14 | 15 | ## Ways to find pepper flash plugin 16 | 17 | **Note:** Please make sure the version of Pepper Flash Plugin is the same to the one being used 18 | in the Electron's Chromium version. 19 | 20 | 1. Copy from Chrome Browser: you can find the plugin (`Adobe Flash Player`) location 21 | by navigating `chrome://plugins` in Chrome Browser. 22 | 23 | 2. Manually install Adobe Flash Player from https://get.adobe.com/flashplayer/otherversions/. 24 | Then you can find plugin in the installed directory, ie. On Windows, the directory 25 | is under `C:\Windows\SysWOW64\Macromed\Flash`(32-bits) and `C:\Windows\System32\Macromed\Flash`(64-bits). 26 | 27 | ## Troublesome 28 | 29 | ### Failed to load Pepper module from /path/to/pepper-flash-plugin (error: 193) 30 | 31 | This means you mixing up the architectures. You need to make the architecture 32 | of flash plugin consitent with Electron you run, e.g., load 32-bit flash plugin 33 | in 32-bit Electron. 34 | 35 | ## Screenshot 36 | 37 | ![screenshot](/pepper-flash-plugin/screenshot/screenshot.png) 38 | -------------------------------------------------------------------------------- /pepper-flash-plugin/screenshot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/pepper-flash-plugin/screenshot/screenshot.png -------------------------------------------------------------------------------- /power-save-blocker/images/day-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/power-save-blocker/images/day-19.png -------------------------------------------------------------------------------- /power-save-blocker/images/night-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/power-save-blocker/images/night-19.png -------------------------------------------------------------------------------- /power-save-blocker/images/sunset-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/power-save-blocker/images/sunset-19.png -------------------------------------------------------------------------------- /power-save-blocker/main.js: -------------------------------------------------------------------------------- 1 | const {app, Tray, Menu, powerSaveBlocker, BrowserWindow} = require('electron'); 2 | const path = require('path'); 3 | 4 | let appIcon; 5 | let win; 6 | const disabledIconPath = path.join(__dirname, 'images', 'night-19.png'); 7 | const appSuspensionIconPath = path.join(__dirname, 'images', 'sunset-19.png'); 8 | const displaySleepIconPath = path.join(__dirname, 'images', 'day-19.png'); 9 | 10 | app.on('ready', function(){ 11 | win = new BrowserWindow({show: false}); 12 | appIcon = new Tray(disabledIconPath); 13 | let blocker_id = null; 14 | var contextMenu = Menu.buildFromTemplate([ 15 | { 16 | label: 'Prevent app suspension', 17 | type: 'radio', 18 | icon: appSuspensionIconPath, 19 | click: function() { 20 | if (blocker_id) 21 | powerSaveBlocker.stop(blocker_id); 22 | blocker_id = powerSaveBlocker.start('prevent-app-suspension'); 23 | } 24 | }, 25 | { 26 | label: 'Prevent display sleep', 27 | type: 'radio', 28 | icon: displaySleepIconPath, 29 | click: function() { 30 | if (blocker_id) 31 | powerSaveBlocker.stop(blocker_id); 32 | blocker_id = powerSaveBlocker.start('prevent-display-sleep'); 33 | } 34 | }, 35 | { 36 | label: 'Disable', 37 | type: 'radio', 38 | icon: disabledIconPath, 39 | checked: true, 40 | click: function() { 41 | if (blocker_id) 42 | powerSaveBlocker.stop(blocker_id); 43 | } 44 | }, 45 | { label: 'Quit', 46 | accelerator: 'Command+Q', 47 | selector: 'terminate:', 48 | } 49 | ]); 50 | appIcon.setToolTip('Keep system awake'); 51 | appIcon.setContextMenu(contextMenu); 52 | }); 53 | -------------------------------------------------------------------------------- /power-save-blocker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "power-save-blocker-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /power-save-blocker/readme.md: -------------------------------------------------------------------------------- 1 | # Power-save-blocker 2 | 3 | A tray sample reprevents the display from sleep. 4 | 5 | ## APIs 6 | 7 | [power-save-blocker](https://github.com/electron/electron/blob/master/docs/api/power-save-blocker.md) 8 | 9 | ## Screenshot 10 | 11 | ![screenshot](/power-save-blocker/screenshot/screenshot.png) 12 | -------------------------------------------------------------------------------- /power-save-blocker/screenshot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/power-save-blocker/screenshot/screenshot.png -------------------------------------------------------------------------------- /printing/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

    Print to PDF Settings

    8 |
    9 |

    Layout

    10 | 14 |
    15 | 16 |
    17 |

    Page size

    18 | 25 |
    26 | 27 |
    28 |

    Margins

    29 | 34 |
    35 | 36 |
    37 |
    38 |

    Margins

    39 |
    40 | 41 | Background graphics 42 |
    43 |
    44 | 45 | Selection only 46 |
    47 |
    48 | 49 |
    50 | 51 | 52 | 53 |
    54 | 55 |
    56 |
    57 | 58 | 59 | -------------------------------------------------------------------------------- /printing/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | app.on('ready', function() { 6 | mainWindow = new BrowserWindow({x:100, y:100, width: 400, height: 420, webPreferences: {nodeIntegration: true}}); 7 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 8 | mainWindow.on('close', () => { 9 | for (let window of BrowserWindow.getAllWindows()) { 10 | if (window != mainWindow) 11 | window.close(); 12 | } 13 | }) 14 | }); 15 | -------------------------------------------------------------------------------- /printing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "printing-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /printing/readme.md: -------------------------------------------------------------------------------- 1 | # Printing Sample 2 | 3 | A sample app demonstrates printing APIs usage. 4 | 5 | 6 | ## APIs 7 | 8 | * [webContents.print](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#contentsprintoptions) 9 | 10 | * [webContents.printToPDF](https://github.com/electron/electron/blob/master/docs/api/web-contents.md#contentsprinttopdfoptions-callback) 11 | 12 | ## Screenshot 13 | 14 | ![screenshot](/printing/screenshot/screenshot.png) 15 | -------------------------------------------------------------------------------- /printing/screenshot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/printing/screenshot/screenshot.png -------------------------------------------------------------------------------- /service-worker/mock-response/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /service-worker/mock-response/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | app.on('ready', () => { 6 | mainWindow = new BrowserWindow({ 7 | height: 300, 8 | width: 400, 9 | webPreferences: {nodeIntegration: true} 10 | }); 11 | 12 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 13 | }); 14 | -------------------------------------------------------------------------------- /service-worker/mock-response/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "service-worker-demo", 3 | "version": "1.0.1", 4 | "main": "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /service-worker/mock-response/readme.md: -------------------------------------------------------------------------------- 1 | # Service Worker Sample: Mock Response 2 | 3 | A sample demonstrates basic service worker registeration with file scheme, and 4 | the service worker's fetch handler. 5 | 6 | ## Screenshot 7 | 8 | ![screenshot](/service-worker/mock-response/screenshot/register.png) 9 | ![screenshot](/service-worker/mock-response/screenshot/response.png) 10 | -------------------------------------------------------------------------------- /service-worker/mock-response/screenshot/register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/service-worker/mock-response/screenshot/register.png -------------------------------------------------------------------------------- /service-worker/mock-response/screenshot/response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/service-worker/mock-response/screenshot/response.png -------------------------------------------------------------------------------- /service-worker/mock-response/service-worker.js: -------------------------------------------------------------------------------- 1 | console.log("Service worker startups."); 2 | 3 | self.addEventListener('install', function(event) { 4 | console.log("Service worker installed."); 5 | }); 6 | 7 | self.addEventListener('activate', function(event) { 8 | console.log("Service worker activated."); 9 | }); 10 | 11 | self.addEventListener('fetch', function(event) { 12 | console.log("Caught a fetch!"); 13 | event.respondWith(new Response("Hello world!")); 14 | }); 15 | -------------------------------------------------------------------------------- /spell-check/README.md: -------------------------------------------------------------------------------- 1 | # Spellchecking Demo 2 | 3 | This demo uses the [spellchecker](https://github.com/atom/node-spellchecker) node module which maps through to native spelling APIs on Mac, Windows, and Linux. This module needs to be compiled since it runs native code, and it's important that you compile it for the version of Electron you are using. With `apm` installed you can run the commands below. See the [instructions here](https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md) for more information. 4 | 5 | ``` 6 | export ATOM_NODE_VERSION=0.26.0 7 | cd spellchecking 8 | apm install . 9 | ``` 10 | 11 | If you do this wrong, you'll see one of these two messages in the console: 12 | 13 | ``` 14 | [37332:0514/214811:INFO:CONSOLE(134)] "Uncaught Error: Module version mismatch. Expected 43, got 41.", source: ATOM_SHELL_ASAR.js (134) 15 | 16 | ---> You compiled the module against the wrong version of Electron. 17 | ``` 18 | 19 | ``` 20 | [37617:0514/215117:INFO:CONSOLE(134)] "Uncaught Error: Module did not self-register.", source: ATOM_SHELL_ASAR.js (134) 21 | 22 | ---> You compiled the module using `npm` not `apm`, or it otherwise couldn't be loaded into Electron. 23 | ``` -------------------------------------------------------------------------------- /spell-check/app.css: -------------------------------------------------------------------------------- 1 | html, body, video { 2 | height: 100%; 3 | width: 100%; 4 | margin: 0; 5 | } 6 | -------------------------------------------------------------------------------- /spell-check/app.js: -------------------------------------------------------------------------------- 1 | // initialize spell checking 2 | const checker = require('spellchecker'); 3 | 4 | const {remote} = require('electron'); 5 | const {webFrame} = remote; 6 | 7 | webFrame.setSpellCheckProvider("en-US", true, { 8 | spellCheck: function(text) { 9 | console.log("Spellchecker called on "+text); 10 | return !checker.isMisspelled(text); 11 | } 12 | }); 13 | 14 | -------------------------------------------------------------------------------- /spell-check/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Spellchecker Test 5 | 6 | 7 | 8 | 9 |
    10 | This is a contenteditable region. Type away! 11 |
    12 | 13 | 14 | -------------------------------------------------------------------------------- /spell-check/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | // Quit when all windows are closed. 6 | app.on('window-all-closed', function() { 7 | if (process.platform != 'darwin') 8 | app.quit(); 9 | }); 10 | 11 | // This method will be called when Electron has done everything 12 | // initialization and ready for creating browser windows. 13 | app.on('ready', function() { 14 | // Create the browser window. 15 | mainWindow = new BrowserWindow({width: 800, height: 600, webPreferences: {nodeIntegration: true}}); 16 | 17 | // and load the index.html of the app. 18 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 19 | 20 | // Emitted when the window is closed. 21 | mainWindow.on('closed', function() { 22 | // Dereference the window object, usually you would store windows 23 | // in an array if your app supports multi windows, this is the time 24 | // when you should delete the corresponding element. 25 | mainWindow = null; 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /spell-check/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "spellchecker-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js", 5 | "dependencies": { 6 | "spellchecker": "2.2.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tray/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/tray/icon.png -------------------------------------------------------------------------------- /tray/main.js: -------------------------------------------------------------------------------- 1 | const {app, Tray, Menu, BrowserWindow} = require('electron'); 2 | const path = require('path'); 3 | 4 | const iconPath = path.join(__dirname, 'icon.png'); 5 | let appIcon = null; 6 | let win = null; 7 | 8 | app.on('ready', function(){ 9 | win = new BrowserWindow({show: false}); 10 | appIcon = new Tray(iconPath); 11 | var contextMenu = Menu.buildFromTemplate([ 12 | { 13 | label: 'Item1', 14 | type: 'radio', 15 | icon: iconPath 16 | }, 17 | { 18 | label: 'Item2', 19 | submenu: [ 20 | { label: 'submenu1' }, 21 | { label: 'submenu2' } 22 | ] 23 | }, 24 | { 25 | label: 'Item3', 26 | type: 'radio', 27 | checked: true 28 | }, 29 | { 30 | label: 'Toggle DevTools', 31 | accelerator: 'Alt+Command+I', 32 | click: function() { 33 | win.show(); 34 | win.toggleDevTools(); 35 | } 36 | }, 37 | { label: 'Quit', 38 | accelerator: 'Command+Q', 39 | selector: 'terminate:', 40 | } 41 | ]); 42 | appIcon.setToolTip('This is my application.'); 43 | appIcon.setContextMenu(contextMenu); 44 | }); 45 | -------------------------------------------------------------------------------- /tray/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "tray-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /webgl/README.md: -------------------------------------------------------------------------------- 1 | # Hello 3D World 2 | 3 | This is the most basic application that one can create, using WebGL capabilities. It loads a (cool) 3D model from a JSON file and allows for model rotation and camera zooming, based on mouse movements. 4 | 5 | 6 | ## External libs 7 | 8 | * [Three.js](https://github.com/mrdoob/three.js/) 9 | -------------------------------------------------------------------------------- /webgl/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/webgl/icon_128.png -------------------------------------------------------------------------------- /webgl/img/button_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/webgl/img/button_close.png -------------------------------------------------------------------------------- /webgl/img/button_close_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/webgl/img/button_close_hover.png -------------------------------------------------------------------------------- /webgl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Hello 3D World 6 | 7 | 8 | 9 | 10 | 11 |
    12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /webgl/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | // Chrome by default black lists certain GPUs because of bugs. 6 | // if your are not able to view webgl try enabling --ignore-gpu-blacklist option 7 | // But, this will make electron/chromium less stable. 8 | app.commandLine.appendSwitch('--ignore-gpu-blacklist'); 9 | 10 | // Quit when all windows are closed. 11 | app.on('window-all-closed', function() { 12 | if (process.platform != 'darwin') 13 | app.quit(); 14 | }); 15 | 16 | // This method will be called when Electron has done everything 17 | // initialization and ready for creating browser windows. 18 | app.on('ready', function() { 19 | // Create the browser window. 20 | mainWindow = new BrowserWindow({width: 800, height: 600, frame:false, webPreferences: {nodeIntegration: true}}); 21 | 22 | // and load the index.html of the app. 23 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 24 | 25 | // Emitted when the window is closed. 26 | mainWindow.on('closed', function() { 27 | // Dereference the window object, usually you would store windows 28 | // in an array if your app supports multi windows, this is the time 29 | // when you should delete the corresponding element. 30 | mainWindow = null; 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /webgl/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "webgl-demo", 3 | "version" : "1.1.0", 4 | "main" : "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /webgl/styles/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: black; 3 | margin: 0; 4 | padding: 0; 5 | overflow: hidden; 6 | } 7 | 8 | .close { 9 | background-image: url('../img/button_close.png'); 10 | background-repeat: no-repeat; 11 | position: absolute; 12 | top: 5px; 13 | right: 5px; 14 | z-index: 1000; 15 | width: 17px; 16 | height: 17px; 17 | cursor: pointer; 18 | -webkit-app-region: no-drag; 19 | } 20 | 21 | .close:hover { 22 | background-image: url('../img/button_close_hover.png'); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /webview/browser/README.md: -------------------------------------------------------------------------------- 1 | # Browser 2 | 3 | A mini browser that shows the usage of [webview](https://github.com/atom/electron/blob/master/docs/api/webview-tag.md) 4 | in an app. 5 | 6 | The app's main window contains a `` that is sized to fit most of it 7 | (via the `width` and `height` attributes). The location bar is used to 8 | update its `src` attribute. 9 | 10 | `` is the preferred way for you to load web content into your app. It 11 | runs in a separate process and has its own storage, ensuring the security and 12 | reliability of your application. 13 | 14 | ## APIs 15 | 16 | * [webview](https://github.com/atom/electron/blob/master/docs/api/webview-tag.md) 17 | 18 | 19 | ## Screenshot 20 | ![screenshot](/webview/browser/screenshot/screenshot.png) 21 | -------------------------------------------------------------------------------- /webview/browser/browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 |
    16 | 17 |
    18 | 19 | 20 | 21 | 22 | 23 | 24 |
    25 | 26 |
    27 |
    28 | 29 | 30 | 31 | 32 | 33 |
    34 | 35 |
    36 |
    37 | 38 |
    39 | 40 | 41 | 42 | 43 | 44 |
    45 | 46 | 47 | 48 |
    49 |
    50 |

    Aw, Snap!

    51 |

    He's Dead, Jim!

    52 | 53 |

    Something went wrong while displaying this webpage. 54 | To continue, reload or go to another page.

    55 |
    56 | 57 | 58 | -------------------------------------------------------------------------------- /webview/browser/main.js: -------------------------------------------------------------------------------- 1 | const {app, BrowserWindow} = require('electron'); 2 | 3 | let mainWindow; 4 | 5 | app.on('window-all-closed', function() { 6 | app.quit(); 7 | }); 8 | 9 | app.on('ready', function() { 10 | mainWindow = new BrowserWindow({width: 1024, height: 768, webPreferences: {nodeIntegration: true, webviewTag: true} }); 11 | mainWindow.loadURL('file://' + __dirname + '/browser.html'); 12 | mainWindow.openDevTools(); 13 | }); 14 | -------------------------------------------------------------------------------- /webview/browser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Browser-Sample", 3 | "version": "1.1.0", 4 | "main": "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /webview/browser/screenshot/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hokein/electron-sample-apps/cdaa96c57b9c3cfdb945bf35b9c542fc24627527/webview/browser/screenshot/screenshot.png --------------------------------------------------------------------------------

    Uploaded DateID