├── Indmind-Calc ├── vendor │ └── .gitkeep ├── app │ ├── helpers │ │ └── .gitkeep │ ├── models │ │ └── .gitkeep │ ├── routes │ │ └── .gitkeep │ ├── components │ │ ├── .gitkeep │ │ └── calc-ulator.js │ ├── controllers │ │ └── .gitkeep │ ├── templates │ │ ├── components │ │ │ ├── .gitkeep │ │ │ └── calc-ulator.hbs │ │ └── application.hbs │ ├── resolver.js │ ├── router.js │ ├── app.js │ ├── index.html │ └── styles │ │ └── app.css ├── tests │ ├── unit │ │ └── .gitkeep │ ├── integration │ │ ├── .gitkeep │ │ └── components │ │ │ └── calc-ulator-test.js │ ├── .eslintrc.js │ ├── helpers │ │ ├── destroy-app.js │ │ ├── start-app.js │ │ └── module-for-acceptance.js │ ├── test-helper.js │ └── index.html ├── public │ ├── robots.txt │ └── crossdomain.xml ├── Screenshot from 2017-12-09 22-42-06.png ├── config │ ├── targets.js │ └── environment.js ├── .eslintrc.js ├── .gitignore ├── testem.js ├── ember-cli-build.js ├── package.json └── README.md ├── 2coolife ├── calculator │ ├── vendor │ │ └── .gitkeep │ ├── app │ │ ├── components │ │ │ ├── .gitkeep │ │ │ ├── main-buttons.js │ │ │ └── main-screen.js │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── models │ │ │ └── .gitkeep │ │ ├── routes │ │ │ └── .gitkeep │ │ ├── controllers │ │ │ └── .gitkeep │ │ ├── templates │ │ │ ├── components │ │ │ │ ├── .gitkeep │ │ │ │ ├── main-screen.hbs │ │ │ │ └── main-buttons.hbs │ │ │ └── application.hbs │ │ ├── resolver.js │ │ ├── router.js │ │ ├── app.js │ │ ├── index.html │ │ └── styles │ │ │ └── app.css │ ├── tests │ │ ├── unit │ │ │ └── .gitkeep │ │ ├── integration │ │ │ ├── .gitkeep │ │ │ └── components │ │ │ │ ├── main-screen-test.js │ │ │ │ └── main-buttons-test.js │ │ ├── .eslintrc.js │ │ ├── helpers │ │ │ ├── destroy-app.js │ │ │ ├── resolver.js │ │ │ ├── start-app.js │ │ │ └── module-for-acceptance.js │ │ ├── test-helper.js │ │ └── index.html │ ├── public │ │ ├── robots.txt │ │ └── crossdomain.xml │ ├── config │ │ ├── targets.js │ │ └── environment.js │ ├── testem.js │ ├── ember-cli-build.js │ ├── package.json │ └── README.md └── README.md ├── niteshkumarniranjan └── embercalculator │ ├── vendor │ └── .gitkeep │ ├── app │ ├── helpers │ │ └── .gitkeep │ ├── models │ │ └── .gitkeep │ ├── routes │ │ └── .gitkeep │ ├── components │ │ ├── .gitkeep │ │ └── calc-main.js │ ├── controllers │ │ └── .gitkeep │ ├── templates │ │ ├── components │ │ │ ├── .gitkeep │ │ │ └── calc-main.hbs │ │ └── application.hbs │ ├── resolver.js │ ├── router.js │ ├── app.js │ ├── index.html │ └── styles │ │ └── app.css │ ├── tests │ ├── unit │ │ ├── .gitkeep │ │ └── routes │ │ │ └── calculator-test.js │ ├── integration │ │ ├── .gitkeep │ │ └── components │ │ │ └── calc-main-test.js │ ├── .eslintrc.js │ ├── helpers │ │ ├── destroy-app.js │ │ ├── resolver.js │ │ ├── start-app.js │ │ └── module-for-acceptance.js │ ├── test-helper.js │ └── index.html │ ├── .watchmanconfig │ ├── public │ ├── robots.txt │ └── crossdomain.xml │ ├── Screenshot.png │ ├── config │ ├── targets.js │ └── environment.js │ ├── .eslintrc.js │ ├── .ember-cli │ ├── .travis.yml │ ├── .gitignore │ ├── .editorconfig │ ├── testem.js │ ├── ember-cli-build.js │ ├── package.json │ └── README.md ├── README.md ├── dumbtroll ├── README.md ├── index.html └── js │ └── libs │ └── handlebars-1.1.2.js └── LICENSE /Indmind-Calc/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/app/helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/app/routes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/tests/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/app/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/app/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/app/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/app/helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/app/routes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/tests/integration/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/app/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/integration/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/app/templates/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/calculator/app/templates/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 | {{calc-ulator}} -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/routes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/integration/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /2coolife/README.md: -------------------------------------------------------------------------------- 1 | # Calculator 2 | A calculator made using Ember.js 3 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/templates/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Indmind-Calc/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /2coolife/calculator/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp", "dist"] 3 | } 4 | -------------------------------------------------------------------------------- /Indmind-Calc/app/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember-resolver'; 2 | 3 | export default Resolver; 4 | -------------------------------------------------------------------------------- /Indmind-Calc/tests/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | embertest: true 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /2coolife/calculator/app/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember-resolver'; 2 | 3 | export default Resolver; 4 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | embertest: true 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember-resolver'; 2 | 3 | export default Resolver; 4 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | embertest: true 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 |

Ember.js Calculator

2 | {{calc-main}} 3 | {{outlet}} 4 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/Ember_Simple_Calculator/master/niteshkumarniranjan/embercalculator/Screenshot.png -------------------------------------------------------------------------------- /Indmind-Calc/Screenshot from 2017-12-09 22-42-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/Ember_Simple_Calculator/master/Indmind-Calc/Screenshot from 2017-12-09 22-42-06.png -------------------------------------------------------------------------------- /Indmind-Calc/tests/helpers/destroy-app.js: -------------------------------------------------------------------------------- 1 | import { run } from '@ember/runloop'; 2 | 3 | export default function destroyApp(application) { 4 | run(application, 'destroy'); 5 | } 6 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/helpers/destroy-app.js: -------------------------------------------------------------------------------- 1 | import { run } from '@ember/runloop'; 2 | 3 | export default function destroyApp(application) { 4 | run(application, 'destroy'); 5 | } 6 | -------------------------------------------------------------------------------- /2coolife/calculator/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 | {{outlet}} 2 |
3 |
{{main-screen}}
4 |
{{main-buttons}}
5 |
-------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/helpers/destroy-app.js: -------------------------------------------------------------------------------- 1 | import { run } from '@ember/runloop'; 2 | 3 | export default function destroyApp(application) { 4 | run(application, 'destroy'); 5 | } 6 | -------------------------------------------------------------------------------- /2coolife/calculator/app/templates/components/main-screen.hbs: -------------------------------------------------------------------------------- 1 | {{yield}} 2 |
{{userInput}}
3 |
{{result}}
4 | {{input id="userInput" value=userInput class="hidden" key-up="inputQ"}} -------------------------------------------------------------------------------- /2coolife/calculator/tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { 3 | setResolver 4 | } from 'ember-qunit'; 5 | import { start } from 'ember-cli-qunit'; 6 | 7 | setResolver(resolver); 8 | start(); 9 | -------------------------------------------------------------------------------- /Indmind-Calc/config/targets.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | module.exports = { 3 | browsers: [ 4 | 'ie 9', 5 | 'last 1 Chrome versions', 6 | 'last 1 Firefox versions', 7 | 'last 1 Safari versions' 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /2coolife/calculator/config/targets.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | module.exports = { 3 | browsers: [ 4 | 'ie 9', 5 | 'last 1 Chrome versions', 6 | 'last 1 Firefox versions', 7 | 'last 1 Safari versions' 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { 3 | setResolver 4 | } from 'ember-qunit'; 5 | import { start } from 'ember-cli-qunit'; 6 | 7 | setResolver(resolver); 8 | start(); 9 | -------------------------------------------------------------------------------- /Indmind-Calc/tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import Application from '../app'; 2 | import { setApplication } from '@ember/test-helpers'; 3 | import { start } from 'ember-qunit'; 4 | 5 | setApplication(Application.create({ autoboot: false })); 6 | 7 | start(); 8 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/config/targets.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | module.exports = { 3 | browsers: [ 4 | 'ie 9', 5 | 'last 1 Chrome versions', 6 | 'last 1 Firefox versions', 7 | 'last 1 Safari versions' 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /Indmind-Calc/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | ecmaVersion: 2017, 5 | sourceType: 'module' 6 | }, 7 | extends: 'eslint:recommended', 8 | env: { 9 | browser: true 10 | }, 11 | rules: { 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | ecmaVersion: 2017, 5 | sourceType: 'module' 6 | }, 7 | extends: 'eslint:recommended', 8 | env: { 9 | browser: true 10 | }, 11 | rules: { 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /Indmind-Calc/app/router.js: -------------------------------------------------------------------------------- 1 | import EmberRouter from '@ember/routing/router'; 2 | import config from './config/environment'; 3 | 4 | const Router = EmberRouter.extend({ 5 | location: config.locationType, 6 | rootURL: config.rootURL 7 | }); 8 | 9 | Router.map(function() { 10 | }); 11 | 12 | export default Router; 13 | -------------------------------------------------------------------------------- /2coolife/calculator/app/router.js: -------------------------------------------------------------------------------- 1 | import EmberRouter from '@ember/routing/router'; 2 | import config from './config/environment'; 3 | 4 | const Router = EmberRouter.extend({ 5 | location: config.locationType, 6 | rootURL: config.rootURL 7 | }); 8 | 9 | Router.map(function() { 10 | }); 11 | 12 | export default Router; 13 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from '../../resolver'; 2 | import config from '../../config/environment'; 3 | 4 | const resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from '../../resolver'; 2 | import config from '../../config/environment'; 3 | 4 | const resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | - "6" 5 | 6 | sudo: false 7 | dist: trusty 8 | 9 | addons: 10 | chrome: stable 11 | 12 | cache: 13 | directories: 14 | - $HOME/.npm 15 | 16 | env: 17 | global: 18 | # See https://git.io/vdao3 for details. 19 | - JOBS=1 20 | 21 | before_install: 22 | - npm config set spin false 23 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/unit/routes/calculator-test.js: -------------------------------------------------------------------------------- 1 | import { moduleFor, test } from 'ember-qunit'; 2 | 3 | moduleFor('route:calculator', 'Unit | Route | calculator', { 4 | // Specify the other units that are required for this test. 5 | // needs: ['controller:foo'] 6 | }); 7 | 8 | test('it exists', function(assert) { 9 | let route = this.subject(); 10 | assert.ok(route); 11 | }); 12 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/router.js: -------------------------------------------------------------------------------- 1 | import EmberRouter from '@ember/routing/router'; 2 | import config from './config/environment'; 3 | 4 | const Router = EmberRouter.extend({ 5 | location: config.locationType, 6 | rootURL: config.rootURL 7 | }); 8 | 9 | Router.map(function() { 10 | this.route('app', function() { 11 | this.route('calculator'); 12 | }); 13 | }); 14 | 15 | export default Router; 16 | -------------------------------------------------------------------------------- /Indmind-Calc/app/app.js: -------------------------------------------------------------------------------- 1 | import Application from '@ember/application'; 2 | import Resolver from './resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from './config/environment'; 5 | 6 | const App = Application.extend({ 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix, 9 | Resolver 10 | }); 11 | 12 | loadInitializers(App, config.modulePrefix); 13 | 14 | export default App; 15 | -------------------------------------------------------------------------------- /Indmind-Calc/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log* 17 | yarn-error.log 18 | testem.log 19 | 20 | # ember-try 21 | .node_modules.ember-try/ 22 | bower.json.ember-try 23 | package.json.ember-try 24 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/app.js: -------------------------------------------------------------------------------- 1 | import Application from '@ember/application'; 2 | import Resolver from './resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from './config/environment'; 5 | 6 | const App = Application.extend({ 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix, 9 | Resolver 10 | }); 11 | 12 | loadInitializers(App, config.modulePrefix); 13 | 14 | 15 | export default App; 16 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log* 17 | yarn-error.log 18 | testem.log 19 | 20 | # ember-try 21 | .node_modules.ember-try/ 22 | bower.json.ember-try 23 | package.json.ember-try 24 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.hbs] 17 | insert_final_newline = false 18 | 19 | [*.{diff,md}] 20 | trim_trailing_whitespace = false 21 | -------------------------------------------------------------------------------- /Indmind-Calc/testem.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | module.exports = { 3 | test_page: 'tests/index.html?hidepassed', 4 | disable_watching: true, 5 | launch_in_ci: [ 6 | 'Chrome' 7 | ], 8 | launch_in_dev: [ 9 | 'Chrome' 10 | ], 11 | browser_args: { 12 | Chrome: { 13 | mode: 'ci', 14 | args: [ 15 | '--disable-gpu', 16 | '--headless', 17 | '--remote-debugging-port=0', 18 | '--window-size=1440,900' 19 | ] 20 | } 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /2coolife/calculator/testem.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | module.exports = { 3 | test_page: 'tests/index.html?hidepassed', 4 | disable_watching: true, 5 | launch_in_ci: [ 6 | 'Chrome' 7 | ], 8 | launch_in_dev: [ 9 | 'Chrome' 10 | ], 11 | browser_args: { 12 | Chrome: { 13 | mode: 'ci', 14 | args: [ 15 | '--disable-gpu', 16 | '--headless', 17 | '--remote-debugging-port=9222', 18 | '--window-size=1440,900' 19 | ] 20 | }, 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/testem.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | module.exports = { 3 | test_page: 'tests/index.html?hidepassed', 4 | disable_watching: true, 5 | launch_in_ci: [ 6 | 'Chrome' 7 | ], 8 | launch_in_dev: [ 9 | 'Chrome' 10 | ], 11 | browser_args: { 12 | Chrome: { 13 | mode: 'ci', 14 | args: [ 15 | '--disable-gpu', 16 | '--headless', 17 | '--remote-debugging-port=9222', 18 | '--window-size=1440,900' 19 | ] 20 | }, 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /Indmind-Calc/tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Application from '../../app'; 2 | import config from '../../config/environment'; 3 | import { merge } from '@ember/polyfills'; 4 | import { run } from '@ember/runloop'; 5 | 6 | export default function startApp(attrs) { 7 | let attributes = merge({}, config.APP); 8 | attributes = merge(attributes, attrs); // use defaults, but you can override; 9 | 10 | return run(() => { 11 | let application = Application.create(attributes); 12 | application.setupForTesting(); 13 | application.injectTestHelpers(); 14 | return application; 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Application from '../../app'; 2 | import config from '../../config/environment'; 3 | import { merge } from '@ember/polyfills'; 4 | import { run } from '@ember/runloop'; 5 | 6 | export default function startApp(attrs) { 7 | let attributes = merge({}, config.APP); 8 | attributes = merge(attributes, attrs); // use defaults, but you can override; 9 | 10 | return run(() => { 11 | let application = Application.create(attributes); 12 | application.setupForTesting(); 13 | application.injectTestHelpers(); 14 | return application; 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /2coolife/calculator/app/app.js: -------------------------------------------------------------------------------- 1 | import Application from '@ember/application'; 2 | import Resolver from './resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from './config/environment'; 5 | 6 | const App = Application.extend({ 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix, 9 | Resolver 10 | }); 11 | 12 | loadInitializers(App, config.modulePrefix); 13 | 14 | Ember.$('body').click(() => { 15 | window.$('#userInput').focus(); 16 | }); 17 | 18 | window.onload = () => { 19 | Ember.$('#userInput').focus(); 20 | } 21 | 22 | export default App; 23 | -------------------------------------------------------------------------------- /2coolife/calculator/app/components/main-buttons.js: -------------------------------------------------------------------------------- 1 | import Component from '@ember/component'; 2 | 3 | export default Component.extend({ 4 | actions: { 5 | inputData(value) { 6 | const old = $('#userInput').val(); 7 | let newValue = ""; 8 | if (value === '=') return; 9 | if (value === 'clear') newValue = "0"; 10 | else if (value === 'Del') newValue = old.substring(0, old.length - 1); 11 | else newValue = old + value; 12 | $('#userInput').val(newValue); 13 | $('#userInput').keyup().focus(); 14 | } 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Application from '../../app'; 2 | import config from '../../config/environment'; 3 | import { merge } from '@ember/polyfills'; 4 | import { run } from '@ember/runloop'; 5 | 6 | export default function startApp(attrs) { 7 | let attributes = merge({}, config.APP); 8 | attributes = merge(attributes, attrs); // use defaults, but you can override; 9 | 10 | return run(() => { 11 | let application = Application.create(attributes); 12 | application.setupForTesting(); 13 | application.injectTestHelpers(); 14 | return application; 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /Indmind-Calc/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /2coolife/calculator/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /Indmind-Calc/tests/helpers/module-for-acceptance.js: -------------------------------------------------------------------------------- 1 | import { module } from 'qunit'; 2 | import { resolve } from 'rsvp'; 3 | import startApp from '../helpers/start-app'; 4 | import destroyApp from '../helpers/destroy-app'; 5 | 6 | export default function(name, options = {}) { 7 | module(name, { 8 | beforeEach() { 9 | this.application = startApp(); 10 | 11 | if (options.beforeEach) { 12 | return options.beforeEach.apply(this, arguments); 13 | } 14 | }, 15 | 16 | afterEach() { 17 | let afterEach = options.afterEach && options.afterEach.apply(this, arguments); 18 | return resolve(afterEach).then(() => destroyApp(this.application)); 19 | } 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/helpers/module-for-acceptance.js: -------------------------------------------------------------------------------- 1 | import { module } from 'qunit'; 2 | import { resolve } from 'rsvp'; 3 | import startApp from '../helpers/start-app'; 4 | import destroyApp from '../helpers/destroy-app'; 5 | 6 | export default function(name, options = {}) { 7 | module(name, { 8 | beforeEach() { 9 | this.application = startApp(); 10 | 11 | if (options.beforeEach) { 12 | return options.beforeEach.apply(this, arguments); 13 | } 14 | }, 15 | 16 | afterEach() { 17 | let afterEach = options.afterEach && options.afterEach.apply(this, arguments); 18 | return resolve(afterEach).then(() => destroyApp(this.application)); 19 | } 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/helpers/module-for-acceptance.js: -------------------------------------------------------------------------------- 1 | import { module } from 'qunit'; 2 | import { resolve } from 'rsvp'; 3 | import startApp from '../helpers/start-app'; 4 | import destroyApp from '../helpers/destroy-app'; 5 | 6 | export default function(name, options = {}) { 7 | module(name, { 8 | beforeEach() { 9 | this.application = startApp(); 10 | 11 | if (options.beforeEach) { 12 | return options.beforeEach.apply(this, arguments); 13 | } 14 | }, 15 | 16 | afterEach() { 17 | let afterEach = options.afterEach && options.afterEach.apply(this, arguments); 18 | return resolve(afterEach).then(() => destroyApp(this.application)); 19 | } 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /Indmind-Calc/tests/integration/components/calc-ulator-test.js: -------------------------------------------------------------------------------- 1 | import { moduleForComponent, test } from 'ember-qunit'; 2 | import hbs from 'htmlbars-inline-precompile'; 3 | 4 | moduleForComponent('calc-ulator', 'Integration | Component | calc ulator', { 5 | integration: true 6 | }); 7 | 8 | test('it renders', function(assert) { 9 | // Set any properties with this.set('myProperty', 'value'); 10 | // Handle any actions with this.on('myAction', function(val) { ... }); 11 | 12 | this.render(hbs`{{calc-ulator}}`); 13 | 14 | assert.equal(this.$().text().trim(), ''); 15 | 16 | // Template block usage: 17 | this.render(hbs` 18 | {{#calc-ulator}} 19 | template block text 20 | {{/calc-ulator}} 21 | `); 22 | 23 | assert.equal(this.$().text().trim(), 'template block text'); 24 | }); 25 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/integration/components/main-screen-test.js: -------------------------------------------------------------------------------- 1 | import { moduleForComponent, test } from 'ember-qunit'; 2 | import hbs from 'htmlbars-inline-precompile'; 3 | 4 | moduleForComponent('main-screen', 'Integration | Component | main screen', { 5 | integration: true 6 | }); 7 | 8 | test('it renders', function(assert) { 9 | // Set any properties with this.set('myProperty', 'value'); 10 | // Handle any actions with this.on('myAction', function(val) { ... }); 11 | 12 | this.render(hbs`{{main-screen}}`); 13 | 14 | assert.equal(this.$().text().trim(), ''); 15 | 16 | // Template block usage: 17 | this.render(hbs` 18 | {{#main-screen}} 19 | template block text 20 | {{/main-screen}} 21 | `); 22 | 23 | assert.equal(this.$().text().trim(), 'template block text'); 24 | }); 25 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/integration/components/calc-main-test.js: -------------------------------------------------------------------------------- 1 | import { moduleForComponent, test } from 'ember-qunit'; 2 | import hbs from 'htmlbars-inline-precompile'; 3 | 4 | moduleForComponent('calc-main', 'Integration | Component | calc main', { 5 | integration: true 6 | }); 7 | 8 | test('it renders', function(assert) { 9 | // Set any properties with this.set('myProperty', 'value'); 10 | // Handle any actions with this.on('myAction', function(val) { ... }); 11 | 12 | this.render(hbs`{{calc-main}}`); 13 | 14 | assert.equal(this.$().text().trim(), ''); 15 | 16 | // Template block usage: 17 | this.render(hbs` 18 | {{#calc-main}} 19 | template block text 20 | {{/calc-main}} 21 | `); 22 | 23 | assert.equal(this.$().text().trim(), 'template block text'); 24 | }); 25 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/integration/components/main-buttons-test.js: -------------------------------------------------------------------------------- 1 | import { moduleForComponent, test } from 'ember-qunit'; 2 | import hbs from 'htmlbars-inline-precompile'; 3 | 4 | moduleForComponent('main-buttons', 'Integration | Component | main buttons', { 5 | integration: true 6 | }); 7 | 8 | test('it renders', function(assert) { 9 | // Set any properties with this.set('myProperty', 'value'); 10 | // Handle any actions with this.on('myAction', function(val) { ... }); 11 | 12 | this.render(hbs`{{main-buttons}}`); 13 | 14 | assert.equal(this.$().text().trim(), ''); 15 | 16 | // Template block usage: 17 | this.render(hbs` 18 | {{#main-buttons}} 19 | template block text 20 | {{/main-buttons}} 21 | `); 22 | 23 | assert.equal(this.$().text().trim(), 'template block text'); 24 | }); 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Emberjs Calculator 2 | > #### Task Name (GCI 2017) : Simple Calculator Web App Using Ember.js 3 | ![emberjs](https://cdn0.icicletech.com/media/ember-logo.jpg) 4 | 5 | ## Description : 6 | 7 | Some projects at **FOSSASIA** use **EmberJS**. Please learn about the Framework. :heart: 8 | 9 | The objective of this task is to **create a simple calculator web app with minimal UI using emberjs framework** and get introduced to it. The calculator should be able to perform the basic operations like addition, subtraction, multiplication and division. *Additional features like calculation square root, factorial, sin, cos would be great.* 10 | 11 | ![Screenshot](https://github.com/niteshkumarniranjan/Ember_Simple_Calculator/raw/master/niteshkumarniranjan/embercalculator/Screenshot.png "Screenshot") 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Indmind-Calc/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | SimpleCalculator 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | 12 | 13 | 14 | 15 | {{content-for "head-footer"}} 16 | 17 | 18 | {{content-for "body"}} 19 | 20 | 21 | 22 | 23 | {{content-for "body-footer"}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EmberCalculator 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | 12 | 13 | 14 | 15 | {{content-for "head-footer"}} 16 | 17 | 18 | {{content-for "body"}} 19 | 20 | 21 | 22 | 23 | {{content-for "body-footer"}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /2coolife/calculator/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Calculator 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | 12 | 13 | 14 | 15 | 16 | {{content-for "head-footer"}} 17 | 18 | 19 | {{content-for "body"}} 20 | 21 | 22 | 23 | 24 | {{content-for "body-footer"}} 25 | 26 | 27 | -------------------------------------------------------------------------------- /Indmind-Calc/app/components/calc-ulator.js: -------------------------------------------------------------------------------- 1 | import Component from '@ember/component'; 2 | 3 | let query = '' 4 | let result = '' 5 | 6 | export default Component.extend({ 7 | actions: { 8 | input(val) { 9 | if (val == "exec") { 10 | try { 11 | result = eval(query) 12 | } catch (err) { 13 | result = "Operation Error!" 14 | } finally { 15 | this.$("#result").text(result) 16 | query = result == "Operation Error!"? '': result 17 | } 18 | return 19 | } 20 | if (val == "C") { 21 | query = '' 22 | this.$("#result").text(query) 23 | return 24 | } 25 | if (val == "del") { 26 | query = query.toString().slice(0, -1) 27 | this.$("#result").text(query) 28 | return 29 | } 30 | query += val 31 | this.$("#result").text(query) 32 | } 33 | } 34 | }); 35 | -------------------------------------------------------------------------------- /Indmind-Calc/ember-cli-build.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 'use strict'; 3 | 4 | const EmberApp = require('ember-cli/lib/broccoli/ember-app'); 5 | 6 | module.exports = function(defaults) { 7 | let app = new EmberApp(defaults, { 8 | // Add options here 9 | }); 10 | 11 | // Use `app.import` to add additional libraries to the generated 12 | // output files. 13 | // 14 | // If you need to use different assets in different 15 | // environments, specify an object as the first parameter. That 16 | // object's keys should be the environment name and the values 17 | // should be the asset to use in that environment. 18 | // 19 | // If the library that you are including contains AMD or ES6 20 | // modules that you would like to import into your application 21 | // please specify an object with the list of modules as keys 22 | // along with the exports of each module as its value. 23 | 24 | return app.toTree(); 25 | }; 26 | -------------------------------------------------------------------------------- /2coolife/calculator/ember-cli-build.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 'use strict'; 3 | 4 | const EmberApp = require('ember-cli/lib/broccoli/ember-app'); 5 | 6 | module.exports = function(defaults) { 7 | let app = new EmberApp(defaults, { 8 | // Add options here 9 | }); 10 | 11 | // Use `app.import` to add additional libraries to the generated 12 | // output files. 13 | // 14 | // If you need to use different assets in different 15 | // environments, specify an object as the first parameter. That 16 | // object's keys should be the environment name and the values 17 | // should be the asset to use in that environment. 18 | // 19 | // If the library that you are including contains AMD or ES6 20 | // modules that you would like to import into your application 21 | // please specify an object with the list of modules as keys 22 | // along with the exports of each module as its value. 23 | 24 | return app.toTree(); 25 | }; 26 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/ember-cli-build.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 'use strict'; 3 | 4 | const EmberApp = require('ember-cli/lib/broccoli/ember-app'); 5 | 6 | module.exports = function(defaults) { 7 | let app = new EmberApp(defaults, { 8 | // Add options here 9 | }); 10 | 11 | // Use `app.import` to add additional libraries to the generated 12 | // output files. 13 | // 14 | // If you need to use different assets in different 15 | // environments, specify an object as the first parameter. That 16 | // object's keys should be the environment name and the values 17 | // should be the asset to use in that environment. 18 | // 19 | // If the library that you are including contains AMD or ES6 20 | // modules that you would like to import into your application 21 | // please specify an object with the list of modules as keys 22 | // along with the exports of each module as its value. 23 | 24 | return app.toTree(); 25 | }; 26 | -------------------------------------------------------------------------------- /2coolife/calculator/tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Src Tests 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | {{content-for "test-head"}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for "head-footer"}} 18 | {{content-for "test-head-footer"}} 19 | 20 | 21 | {{content-for "body"}} 22 | {{content-for "test-body"}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {{content-for "body-footer"}} 31 | {{content-for "test-body-footer"}} 32 | 33 | 34 | -------------------------------------------------------------------------------- /Indmind-Calc/tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | SimpleCalculator Tests 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | {{content-for "test-head"}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for "head-footer"}} 18 | {{content-for "test-head-footer"}} 19 | 20 | 21 | {{content-for "body"}} 22 | {{content-for "test-body"}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {{content-for "body-footer"}} 31 | {{content-for "test-body-footer"}} 32 | 33 | 34 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EmberCalculator Tests 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | {{content-for "test-head"}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for "head-footer"}} 18 | {{content-for "test-head-footer"}} 19 | 20 | 21 | {{content-for "body"}} 22 | {{content-for "test-body"}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {{content-for "body-footer"}} 31 | {{content-for "test-body-footer"}} 32 | 33 | 34 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/components/calc-main.js: -------------------------------------------------------------------------------- 1 | import Component from '@ember/component'; 2 | 3 | var operators = ['+', '-', '×', '÷']; 4 | 5 | export default Component.extend({ 6 | actions : { 7 | 8 | // insert text (event) to screen 9 | ins(event) { 10 | let value = this.get('value') || ""; 11 | this.set("value", value + event) 12 | }, 13 | 14 | // equal button clicked 15 | equal(){ 16 | // get eqaution from screen 17 | var equation = this.get('value'); 18 | var lastChar = equation[equation.length - 1]; 19 | equation = equation.replace(/×/g, '*').replace(/÷/g, '/'); 20 | // if last character is a opertator 21 | if(operators.indexOf(lastChar ) > -1 || (lastChar == '.')) { 22 | equation = equation.replace(/.$/,''); 23 | } 24 | if(equation) { 25 | // evaluate the eqation 26 | this.set('value', eval(equation)); 27 | } 28 | }, 29 | 30 | // clear text screen 31 | clear(){ 32 | this.set('value', ''); 33 | }, 34 | 35 | // delete last character form screen 36 | del() { 37 | let value = this.get('value') || ''; 38 | this.set('value', value.substring(0, value.length - 1)); 39 | } 40 | 41 | } 42 | 43 | }); 44 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/templates/components/calc-main.hbs: -------------------------------------------------------------------------------- 1 | {{yield}} 2 |
3 |
4 |
{{value}}
5 |
6 | 7 |
8 | C 9 | CE 10 | ÷ 11 | × 12 | 7 13 | 8 14 | 9 15 | - 16 | 4 17 | 5 18 | 6 19 | + 20 | 1 21 | 2 22 | 3 23 | 0 24 | . 25 | = 26 |
27 |
-------------------------------------------------------------------------------- /2coolife/calculator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "src", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "Small description for src goes here", 6 | "license": "MIT", 7 | "author": "", 8 | "directories": { 9 | "doc": "doc", 10 | "test": "tests" 11 | }, 12 | "repository": "", 13 | "scripts": { 14 | "build": "ember build", 15 | "start": "ember server", 16 | "test": "ember test" 17 | }, 18 | "devDependencies": { 19 | "broccoli-asset-rev": "^2.4.5", 20 | "ember-ajax": "^3.0.0", 21 | "ember-cli": "~2.16.2", 22 | "ember-cli-app-version": "^3.0.0", 23 | "ember-cli-babel": "^6.6.0", 24 | "ember-cli-dependency-checker": "^2.0.0", 25 | "ember-cli-eslint": "^4.0.0", 26 | "ember-cli-htmlbars": "^2.0.1", 27 | "ember-cli-htmlbars-inline-precompile": "^1.0.0", 28 | "ember-cli-inject-live-reload": "^1.4.1", 29 | "ember-cli-qunit": "^4.0.0", 30 | "ember-cli-shims": "^1.1.0", 31 | "ember-cli-sri": "^2.1.0", 32 | "ember-cli-uglify": "^2.0.0", 33 | "ember-data": "~2.16.2", 34 | "ember-export-application-global": "^2.0.0", 35 | "ember-load-initializers": "^1.0.0", 36 | "ember-resolver": "^4.0.0", 37 | "ember-source": "~2.16.0", 38 | "ember-welcome-page": "^3.0.0", 39 | "loader.js": "^4.2.3" 40 | }, 41 | "engines": { 42 | "node": "^4.5 || 6.* || >= 7.*" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Indmind-Calc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-calculator", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "Small description for simple-calculator goes here", 6 | "license": "MIT", 7 | "author": "", 8 | "directories": { 9 | "doc": "doc", 10 | "test": "tests" 11 | }, 12 | "repository": "", 13 | "scripts": { 14 | "build": "ember build", 15 | "start": "ember serve", 16 | "test": "ember test" 17 | }, 18 | "devDependencies": { 19 | "broccoli-asset-rev": "^2.4.5", 20 | "ember-ajax": "^3.0.0", 21 | "ember-cli": "~2.17.0", 22 | "ember-cli-app-version": "^3.0.0", 23 | "ember-cli-babel": "^6.6.0", 24 | "ember-cli-dependency-checker": "^2.0.0", 25 | "ember-cli-eslint": "^4.2.1", 26 | "ember-cli-htmlbars": "^2.0.1", 27 | "ember-cli-htmlbars-inline-precompile": "^1.0.0", 28 | "ember-cli-inject-live-reload": "^1.4.1", 29 | "ember-cli-qunit": "^4.1.1", 30 | "ember-cli-shims": "^1.2.0", 31 | "ember-cli-sri": "^2.1.0", 32 | "ember-cli-uglify": "^2.0.0", 33 | "ember-data": "~2.17.0", 34 | "ember-export-application-global": "^2.0.0", 35 | "ember-load-initializers": "^1.0.0", 36 | "ember-resolver": "^4.0.0", 37 | "ember-source": "~2.17.0", 38 | "ember-welcome-page": "^3.0.0", 39 | "loader.js": "^4.2.3" 40 | }, 41 | "engines": { 42 | "node": "^4.5 || 6.* || >= 7.*" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /2coolife/calculator/app/styles/app.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 0; 3 | margin: 0; 4 | font-family: Roboto; 5 | background-color: #2f2f2f; 6 | height: -webkit-fill-available; 7 | } 8 | 9 | .center { 10 | position: fixed; 11 | top: 50%; 12 | left: 50%; 13 | transform: translate(-50%, -50%); 14 | box-shadow: 0px 0px 34px #1d1d1d; 15 | } 16 | 17 | .screen-box { 18 | width: 500px; 19 | background: #efefef; 20 | color: #555; 21 | text-align: right; 22 | padding: 10px; 23 | box-sizing: border-box; 24 | padding-bottom: 0px; 25 | } 26 | 27 | .user-input { 28 | font-size: 40px; 29 | height: 47px; 30 | overflow: hidden; 31 | } 32 | 33 | .result { 34 | font-size: 20px; 35 | } 36 | 37 | .row { 38 | font-size: 0px; 39 | } 40 | 41 | .button-box { 42 | font-size: 0px; 43 | } 44 | 45 | .button { 46 | cursor: pointer; 47 | width: 127px; 48 | display: inline-block; 49 | box-sizing: border-box; 50 | padding: 14px; 51 | text-align: center; 52 | background: #333; 53 | color: #e0e0e0; 54 | font-size: 18px; 55 | margin: -1px; 56 | } 57 | 58 | .button:hover { 59 | background: #444; 60 | } 61 | 62 | .button.btn-operator { 63 | background: #565656; 64 | } 65 | 66 | .button.btn-operator:hover { 67 | background: #666; 68 | } 69 | 70 | #userInput { 71 | height: 0px; 72 | margin: 0px; 73 | padding: 0px; 74 | border: none; 75 | } 76 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-calculator", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "Small description for ember-calculator goes here", 6 | "license": "MIT", 7 | "author": "", 8 | "directories": { 9 | "doc": "doc", 10 | "test": "tests" 11 | }, 12 | "repository": "", 13 | "scripts": { 14 | "build": "ember build", 15 | "start": "ember server", 16 | "test": "ember test" 17 | }, 18 | "devDependencies": { 19 | "broccoli-asset-rev": "^2.4.5", 20 | "ember-ajax": "^3.0.0", 21 | "ember-cli": "~2.16.2", 22 | "ember-cli-app-version": "^3.0.0", 23 | "ember-cli-babel": "^6.6.0", 24 | "ember-cli-dependency-checker": "^2.0.0", 25 | "ember-cli-eslint": "^4.0.0", 26 | "ember-cli-github-pages": "^0.1.2", 27 | "ember-cli-htmlbars": "^2.0.1", 28 | "ember-cli-htmlbars-inline-precompile": "^1.0.0", 29 | "ember-cli-inject-live-reload": "^1.4.1", 30 | "ember-cli-qunit": "^4.0.0", 31 | "ember-cli-shims": "^1.1.0", 32 | "ember-cli-sri": "^2.1.0", 33 | "ember-cli-uglify": "^2.0.0", 34 | "ember-data": "~2.16.2", 35 | "ember-export-application-global": "^2.0.0", 36 | "ember-load-initializers": "^1.0.0", 37 | "ember-resolver": "^4.0.0", 38 | "ember-source": "~2.16.0", 39 | "ember-welcome-page": "^3.0.0", 40 | "loader.js": "^4.2.3" 41 | }, 42 | "engines": { 43 | "node": "^4.5 || 6.* || >= 7.*" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /2coolife/calculator/config/environment.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 'use strict'; 3 | 4 | module.exports = function(environment) { 5 | let ENV = { 6 | modulePrefix: 'src', 7 | environment, 8 | rootURL: '/calculator/', 9 | locationType: 'auto', 10 | EmberENV: { 11 | FEATURES: { 12 | // Here you can enable experimental features on an ember canary build 13 | // e.g. 'with-controller': true 14 | }, 15 | EXTEND_PROTOTYPES: { 16 | // Prevent Ember Data from overriding Date.parse. 17 | Date: false 18 | } 19 | }, 20 | 21 | APP: { 22 | // Here you can pass flags/options to your application instance 23 | // when it is created 24 | } 25 | }; 26 | 27 | if (environment === 'development') { 28 | // ENV.APP.LOG_RESOLVER = true; 29 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 30 | // ENV.APP.LOG_TRANSITIONS = true; 31 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 32 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 33 | } 34 | 35 | if (environment === 'test') { 36 | // Testem prefers this... 37 | ENV.locationType = 'none'; 38 | 39 | // keep test console output quieter 40 | ENV.APP.LOG_ACTIVE_GENERATION = false; 41 | ENV.APP.LOG_VIEW_LOOKUPS = false; 42 | 43 | ENV.APP.rootElement = '#ember-testing'; 44 | } 45 | 46 | if (environment === 'production') { 47 | // here you can enable a production-specific feature 48 | } 49 | 50 | return ENV; 51 | }; 52 | -------------------------------------------------------------------------------- /Indmind-Calc/config/environment.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 'use strict'; 3 | 4 | module.exports = function(environment) { 5 | let ENV = { 6 | modulePrefix: 'simple-calculator', 7 | environment, 8 | rootURL: '/', 9 | locationType: 'auto', 10 | EmberENV: { 11 | FEATURES: { 12 | // Here you can enable experimental features on an ember canary build 13 | // e.g. 'with-controller': true 14 | }, 15 | EXTEND_PROTOTYPES: { 16 | // Prevent Ember Data from overriding Date.parse. 17 | Date: false 18 | } 19 | }, 20 | 21 | APP: { 22 | // Here you can pass flags/options to your application instance 23 | // when it is created 24 | } 25 | }; 26 | 27 | if (environment === 'development') { 28 | // ENV.APP.LOG_RESOLVER = true; 29 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 30 | // ENV.APP.LOG_TRANSITIONS = true; 31 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 32 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 33 | } 34 | 35 | if (environment === 'test') { 36 | // Testem prefers this... 37 | ENV.locationType = 'none'; 38 | 39 | // keep test console output quieter 40 | ENV.APP.LOG_ACTIVE_GENERATION = false; 41 | ENV.APP.LOG_VIEW_LOOKUPS = false; 42 | 43 | ENV.APP.rootElement = '#ember-testing'; 44 | } 45 | 46 | if (environment === 'production') { 47 | // here you can enable a production-specific feature 48 | } 49 | 50 | return ENV; 51 | }; 52 | -------------------------------------------------------------------------------- /2coolife/calculator/README.md: -------------------------------------------------------------------------------- 1 | # src 2 | 3 | This README outlines the details of collaborating on this Ember application. 4 | A short introduction of this app could easily go here. 5 | 6 | ## Prerequisites 7 | 8 | You will need the following things properly installed on your computer. 9 | 10 | * [Git](https://git-scm.com/) 11 | * [Node.js](https://nodejs.org/) (with NPM) 12 | * [Ember CLI](https://ember-cli.com/) 13 | * [Google Chrome](https://google.com/chrome/) 14 | 15 | ## Installation 16 | 17 | * `git clone ` this repository 18 | * `cd src` 19 | * `npm install` 20 | 21 | ## Running / Development 22 | 23 | * `ember serve` 24 | * Visit your app at [http://localhost:4200](http://localhost:4200). 25 | * Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests). 26 | 27 | ### Code Generators 28 | 29 | Make use of the many generators for code, try `ember help generate` for more details 30 | 31 | ### Running Tests 32 | 33 | * `ember test` 34 | * `ember test --server` 35 | 36 | ### Building 37 | 38 | * `ember build` (development) 39 | * `ember build --environment production` (production) 40 | 41 | ### Deploying 42 | 43 | Specify what it takes to deploy your app. 44 | 45 | ## Further Reading / Useful Links 46 | 47 | * [ember.js](https://emberjs.com/) 48 | * [ember-cli](https://ember-cli.com/) 49 | * Development Browser Extensions 50 | * [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi) 51 | * [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/) 52 | -------------------------------------------------------------------------------- /Indmind-Calc/README.md: -------------------------------------------------------------------------------- 1 | # simple-calculator 2 | 3 | This README outlines the details of collaborating on this Ember application. 4 | A short introduction of this app could easily go here. 5 | 6 | ## Prerequisites 7 | 8 | You will need the following things properly installed on your computer. 9 | 10 | * [Git](https://git-scm.com/) 11 | * [Node.js](https://nodejs.org/) (with npm) 12 | * [Ember CLI](https://ember-cli.com/) 13 | * [Google Chrome](https://google.com/chrome/) 14 | 15 | ## Installation 16 | 17 | * `git clone ` this repository 18 | * `cd simple-calculator` 19 | * `npm install` 20 | 21 | ## Running / Development 22 | 23 | * `ember serve` 24 | * Visit your app at [http://localhost:4200](http://localhost:4200). 25 | * Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests). 26 | 27 | ### Code Generators 28 | 29 | Make use of the many generators for code, try `ember help generate` for more details 30 | 31 | ### Running Tests 32 | 33 | * `ember test` 34 | * `ember test --server` 35 | 36 | ### Building 37 | 38 | * `ember build` (development) 39 | * `ember build --environment production` (production) 40 | 41 | ### Deploying 42 | 43 | Specify what it takes to deploy your app. 44 | 45 | ## Further Reading / Useful Links 46 | 47 | * [ember.js](https://emberjs.com/) 48 | * [ember-cli](https://ember-cli.com/) 49 | * Development Browser Extensions 50 | * [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi) 51 | * [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/) 52 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/README.md: -------------------------------------------------------------------------------- 1 | # ember-calculator 2 | 3 | This README outlines the details of collaborating on this Ember application. 4 | A short introduction of this app could easily go here. 5 | 6 | ## Prerequisites 7 | 8 | You will need the following things properly installed on your computer. 9 | 10 | * [Git](https://git-scm.com/) 11 | * [Node.js](https://nodejs.org/) (with NPM) 12 | * [Ember CLI](https://ember-cli.com/) 13 | * [Google Chrome](https://google.com/chrome/) 14 | 15 | ## Installation 16 | 17 | * `git clone ` this repository 18 | * `cd ember-calculator` 19 | * `npm install` 20 | 21 | ## Running / Development 22 | 23 | * `ember serve` 24 | * Visit your app at [http://localhost:4200](http://localhost:4200). 25 | * Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests). 26 | 27 | ### Code Generators 28 | 29 | Make use of the many generators for code, try `ember help generate` for more details 30 | 31 | ### Running Tests 32 | 33 | * `ember test` 34 | * `ember test --server` 35 | 36 | ### Building 37 | 38 | * `ember build` (development) 39 | * `ember build --environment production` (production) 40 | 41 | ### Deploying 42 | 43 | Specify what it takes to deploy your app. 44 | 45 | ## Further Reading / Useful Links 46 | 47 | * [ember.js](https://emberjs.com/) 48 | * [ember-cli](https://ember-cli.com/) 49 | * Development Browser Extensions 50 | * [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi) 51 | * [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/) 52 | -------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/config/environment.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 'use strict'; 3 | 4 | module.exports = function(environment) { 5 | let ENV = { 6 | modulePrefix: 'ember-calculator', 7 | environment, 8 | rootURL: '/', 9 | locationType: 'auto', 10 | EmberENV: { 11 | FEATURES: { 12 | // Here you can enable experimental features on an ember canary build 13 | // e.g. 'with-controller': true 14 | }, 15 | EXTEND_PROTOTYPES: { 16 | // Prevent Ember Data from overriding Date.parse. 17 | Date: false 18 | } 19 | }, 20 | 21 | APP: { 22 | // Here you can pass flags/options to your application instance 23 | // when it is created 24 | } 25 | }; 26 | 27 | if (environment === 'development') { 28 | // ENV.APP.LOG_RESOLVER = true; 29 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 30 | // ENV.APP.LOG_TRANSITIONS = true; 31 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 32 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 33 | } 34 | 35 | if (environment === 'test') { 36 | // Testem prefers this... 37 | ENV.locationType = 'none'; 38 | 39 | // keep test console output quieter 40 | ENV.APP.LOG_ACTIVE_GENERATION = false; 41 | ENV.APP.LOG_VIEW_LOOKUPS = false; 42 | 43 | ENV.APP.rootElement = '#ember-testing'; 44 | } 45 | 46 | if (environment === 'production') { 47 | ENV.locationType = 'hash'; 48 | ENV.rootURL = '/ember-calc-host/'; 49 | ENV.locationType = 'hash'; 50 | ENV.rootURL = '/ember-calc-host/'; 51 | // here you can enable a production-specific feature 52 | } 53 | 54 | return ENV; 55 | }; 56 | -------------------------------------------------------------------------------- /dumbtroll/README.md: -------------------------------------------------------------------------------- 1 | This calculator uses fundamental Ember.js concepts such as models and components which generates a more organized and modern workflow compared to traditional Javascript. 2 | 3 | The calculator buttons can be pressed just like a normal calculator. 4 | 5 | The calculator supports consecutive arithmetic operations. If you wish to start a new equation, simply hit the "Reset" button (equivalent to AC on a traditional calculator) and start writing your new arithmetic equation! 6 | 7 | This README outlines the details of collaborating on this Ember application. A short introduction of this app could easily go here. Prerequisites 8 | 9 | You will need the following things properly installed on your computer. 10 | 11 | Git 12 | Node.js (with NPM) 13 | Ember CLI 14 | Google Chrome 15 | 16 | Installation 17 | 18 | git clone this repository 19 | cd ember-calculator 20 | npm install 21 | 22 | Running / Development 23 | 24 | ember serve 25 | Visit your app at http://localhost:4200. 26 | Visit your tests at http://localhost:4200/tests. 27 | 28 | Code Generators 29 | 30 | Make use of the many generators for code, try ember help generate for more details Running Tests 31 | 32 | ember test 33 | ember test --server 34 | 35 | Building 36 | 37 | ember build (development) 38 | ember build --environment production (production) 39 | 40 | Deploying 41 | 42 | Essential downloads to deploy the app. Further Reading / Useful Links 43 | 44 | https://emberjs.com/ 45 | Development Browser Extensions 46 | https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi?hl=en 47 | https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/ 48 | 49 | -------------------------------------------------------------------------------- /2coolife/calculator/app/templates/components/main-buttons.hbs: -------------------------------------------------------------------------------- 1 | {{yield}} 2 |
3 |
C
4 |
(
5 |
)
6 |
DEL
7 |
8 |
9 |
1
10 |
2
11 |
3
12 |
+
13 |
14 |
15 |
4
16 |
5
17 |
6
18 |
-
19 |
20 |
21 |
7
22 |
8
23 |
9
24 |
×
25 |
26 |
27 |
.
28 |
0
29 |
=
30 |
÷
31 |
-------------------------------------------------------------------------------- /Indmind-Calc/app/templates/components/calc-ulator.hbs: -------------------------------------------------------------------------------- 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 |
-------------------------------------------------------------------------------- /niteshkumarniranjan/embercalculator/app/styles/app.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | font: 400 21px Quicksand, sans-serif; 6 | } 7 | 8 | body { 9 | background: #4C4C4B; 10 | } 11 | 12 | #calculator { 13 | width: 280px; 14 | height: auto; 15 | margin: 3em; 16 | box-shadow: 0 0 0 1px #9b9b9b; 17 | border-radius: 2px; 18 | position: absolute; 19 | top: 50%; 20 | left: 50%; 21 | margin-left: -140px; 22 | margin-top: -200px; 23 | } 24 | 25 | .top span.clear { 26 | float: left; 27 | } 28 | 29 | .top .screen { 30 | height: 130px; 31 | width: 100%; 32 | float: right; 33 | padding: 0 10px; 34 | background: #e3e7ea; 35 | font-size: 52px; 36 | line-height: 155px; 37 | color: #656464; 38 | font-weight: 100; 39 | text-shadow: 1px 1px 2px rgba(128, 128, 128, 0.8); 40 | text-align: right; 41 | letter-spacing: 1px; 42 | } 43 | 44 | .keys, 45 | .top { 46 | overflow: hidden; 47 | } 48 | 49 | .keys span, 50 | .top span.clear { 51 | float: left; 52 | position: relative; 53 | top: 0; 54 | cursor: pointer; 55 | width: 70px; 56 | height: 60px; 57 | background: #fafbfd; 58 | box-shadow: 0 0 0 1px #e3e7ea; 59 | color: #999a9d; 60 | line-height: 60px; 61 | text-align: center; 62 | -webkit-user-select: none; 63 | user-select: none; 64 | transition: all 0.2s ease; 65 | } 66 | 67 | span.operator { 68 | margin-right: 0; 69 | } 70 | 71 | .keys span.operator { 72 | background: #f79331; 73 | color: white; 74 | margin-right: 0; 75 | } 76 | 77 | .keys span.operatora { 78 | background: #f7f8fa; 79 | color: #999a9d; 80 | } 81 | 82 | .keys span.eval { 83 | background: #f1ff92; 84 | box-shadow: 0px 4px #9da853; 85 | color: #888e5f; 86 | } 87 | 88 | .top span.clear { 89 | background: #ff9fa8; 90 | box-shadow: 0px 4px #ff7c87; 91 | color: white; 92 | } 93 | 94 | .keys span:active { 95 | background: #c3c3c3; 96 | } 97 | 98 | .keys span.operator:active { 99 | background: #c3701e; 100 | } 101 | 102 | .keys span.zero { 103 | width: 140px; 104 | } 105 | 106 | .operator.equal { 107 | height: 120px; 108 | margin-top: -60px; 109 | line-height: 6.5; 110 | } 111 | 112 | .center { 113 | text-align: center; 114 | color: #ffffff; 115 | margin-top: 50px; 116 | } 117 | ::-webkit-scrollbar { 118 | width: 5px; 119 | height: 5px; 120 | } 121 | 122 | ::-webkit-scrollbar-track { 123 | background-color: rgba(255,255,255,0.0); 124 | border-radius: 5px; 125 | } 126 | 127 | ::-webkit-scrollbar-thumb { 128 | background-color: rgba(0,0,0,0.1); 129 | border-radius: 5px; 130 | } 131 | -------------------------------------------------------------------------------- /Indmind-Calc/app/styles/app.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #777; 3 | margin: 0px; 4 | } 5 | 6 | #background { 7 | height: 400px; 8 | width: 280px; 9 | border-radius: 5px; 10 | background: rgb(66, 198, 216); 11 | margin: 50px auto; 12 | transition: all 2s ease; 13 | } 14 | 15 | button { 16 | border: 0; 17 | color: #fff; 18 | } 19 | 20 | #result { 21 | display: block; 22 | font-family: sans-serif; 23 | width: 83%; 24 | height: 40px; 25 | margin: 15px; 26 | text-align: right; 27 | border: 0; 28 | border-radius: 5px; 29 | background: #3b3535; 30 | color: #fff; 31 | padding-top: 20px; 32 | font-size: 20px; 33 | outline: none; 34 | overflow: hidden; 35 | letter-spacing: 4px; 36 | position: relative; 37 | top: 20px; 38 | left: 8px; 39 | } 40 | 41 | #result:hover { 42 | cursor: text; 43 | } 44 | 45 | .first-row { 46 | width: 300px; 47 | margin-bottom: 20px; 48 | position: relative; 49 | top: 10px; 50 | left: 20px; 51 | } 52 | 53 | .rows { 54 | width: 300px; 55 | margin-top: 10px; 56 | } 57 | 58 | .delete { 59 | width: 110px; 60 | height: 50px; 61 | margin-left: 25px; 62 | border-radius: 4px; 63 | } 64 | 65 | .fall-back { 66 | margin-left: 3px !important; 67 | } 68 | 69 | .align { 70 | margin-left: 6px !important; 71 | } 72 | 73 | .btn-style { 74 | width: 50px; 75 | height: 50px; 76 | margin-left: 5px; 77 | border-radius: 4px; 78 | } 79 | 80 | .eqn { 81 | width: 50px; 82 | height: 50px; 83 | margin-left: 5px; 84 | border-radius: 4px; 85 | } 86 | 87 | .first-child { 88 | margin-left: 25px; 89 | } 90 | 91 | .num-bg { 92 | background: rgb(43, 42, 42); 93 | color: #fff; 94 | font-size: 26px; 95 | cursor: pointer; 96 | } 97 | 98 | .num-bg:active { 99 | background: rgb(32, 32, 32); 100 | color: #fff; 101 | font-size: 26px; 102 | cursor: pointer; 103 | } 104 | 105 | .del-bg { 106 | background: rgb(219, 231, 54); 107 | color: #fff; 108 | font-size: 26px; 109 | cursor: pointer; 110 | } 111 | 112 | .del-bg:active { 113 | background: rgb(178, 180, 37); 114 | color: #fff; 115 | font-size: 26px; 116 | cursor: pointer; 117 | } 118 | 119 | .opera-bg { 120 | background: #333; 121 | color: #fff; 122 | font-size: 26px; 123 | cursor: pointer; 124 | } 125 | 126 | .opera-bg:active { 127 | background: #333; 128 | color: #fff; 129 | font-size: 26px; 130 | cursor: pointer; 131 | } 132 | 133 | .c-bg { 134 | background: rgb(204, 28, 28); 135 | color: #fff; 136 | font-size: 26px; 137 | cursor: pointer; 138 | } 139 | 140 | .c-bg:active { 141 | background: rgb(133, 33, 33); 142 | color: #fff; 143 | font-size: 26px; 144 | cursor: pointer; 145 | } 146 | 147 | .eqn-bg { 148 | background: #17a928; 149 | color: #fff; 150 | font-size: 26px; 151 | cursor: pointer; 152 | } 153 | 154 | .eqn-bg:active { 155 | background: #17a928; 156 | color: #fff; 157 | font-size: 26px; 158 | cursor: pointer; 159 | } 160 | -------------------------------------------------------------------------------- /2coolife/calculator/app/components/main-screen.js: -------------------------------------------------------------------------------- 1 | import Component from '@ember/component'; 2 | 3 | export default Component.extend({ 4 | userInput: "0", 5 | result: "0", 6 | lastLength: 0, 7 | parse() { 8 | if (!this.goodBrackets()) return; 9 | let input = this.userInput; 10 | const last = (this.userInput.length > 1) ? this.userInput[this.userInput.length - 1] : null; 11 | if (last === '+' || last === '-' || last === '/' || last === '*') input = input.substring(0, input.length - 1); 12 | const answer = this.simplify(input); 13 | this.set('result', answer); 14 | }, 15 | simplify(query) { 16 | if (query.indexOf('(') <= 0) return this.answer(query); 17 | let queryCopy = query; 18 | let sQuery = ""; 19 | let opened = 0; 20 | for (let i = 0; i < query.length; i++) { 21 | const char = query[i]; 22 | 23 | if (char === '(') { 24 | if (!opened) sQuery = ""; 25 | opened++; 26 | } 27 | 28 | if (opened) sQuery += char; 29 | 30 | if (char === ')') { 31 | opened--; 32 | if (!opened) { 33 | queryCopy = queryCopy.replace(sQuery, this.simplify(sQuery.substring(1, sQuery.length - 1))); 34 | } 35 | } 36 | } 37 | return this.answer(queryCopy); 38 | }, 39 | answer(line) { 40 | const operations = []; 41 | for (let i = 0; i < line.length; i++) { 42 | const charL = 48; 43 | const charH = 57; 44 | const charDot = 46; 45 | const charCode = line.charCodeAt(i) 46 | if ((charCode >= charL && charCode <= charH) || charCode === charDot) continue; 47 | 48 | operations.push(line[i]); 49 | line = line.split(''); 50 | line[i] = '|'; 51 | line = line.join(''); 52 | } 53 | if (operations.length < 1) return Number(line); 54 | 55 | line = line.split('|'); 56 | let answer = Number(line[0]); 57 | for (let i = 0; i < operations.length; i++) { 58 | answer = this.solveSimple(answer + operations[i] + line[i + 1]); 59 | } 60 | return answer; 61 | }, 62 | solveSimple(query) { 63 | if (query.indexOf('+') >= 0) { 64 | const numbers = query.split('+'); 65 | return Number(numbers[0]) + Number(numbers[1]); 66 | } else if (query.indexOf('-') >= 0) { 67 | const numbers = query.split('-'); 68 | return Number(numbers[0]) - Number(numbers[1]); 69 | } else if (query.indexOf('*') >= 0) { 70 | const numbers = query.split('*'); 71 | return Number(numbers[0]) * Number(numbers[1]); 72 | } else if (query.indexOf('/') >= 0) { 73 | const numbers = query.split('/'); 74 | return Number(numbers[0]) / Number(numbers[1]); 75 | } 76 | return 0; 77 | }, 78 | goodBrackets() { 79 | let open = 0; 80 | let close = 0; 81 | 82 | for (let i = 0; i < this.userInput.length; i++) { 83 | if (this.userInput[i] === '(') open++; 84 | else if (this.userInput[i] === ')') close++; 85 | if (close > open) return false; 86 | } 87 | 88 | return open === close; 89 | }, 90 | validKey(event) { 91 | const key = event.keyCode || event.which; 92 | const ekey = event.key; 93 | return (key > 48 && key < 57 && !event.shiftKey) || (key >= 96 && key <= 105) || key === 48 || key === 57 || ekey === '+' || ekey === "-" || ekey === '/' || ekey === '*' || ekey === '.' || key === 8 || key === undefined; 94 | }, 95 | actions: { 96 | inputQ(value, event) { 97 | if (!this.validKey(event) && this.lastLength !== this.userInput.length) { 98 | this.set('userInput', value.substring(0, this.lastLength)); 99 | if (this.userInput.length < 1) this.set('userInput', "0"); 100 | return; 101 | } 102 | if (!value) return void this.set('userInput', "0"); 103 | if (value[0] === '0') this.set('userInput', value.substring(1, value.length)); 104 | this.lastLength = this.userInput.length; 105 | this.parse(); 106 | } 107 | } 108 | }); 109 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /dumbtroll/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | c a l c l a n d 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 83 | 84 | 85 | 88 | 89 | 99 | 100 | 105 | 106 | 122 | 123 | 124 | 327 | 328 | 329 | -------------------------------------------------------------------------------- /dumbtroll/js/libs/handlebars-1.1.2.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | handlebars v1.1.2 4 | 5 | Copyright (C) 2011 by Yehuda Katz 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | 25 | @license 26 | */ 27 | var Handlebars = (function() { 28 | // handlebars/safe-string.js 29 | var __module4__ = (function() { 30 | "use strict"; 31 | var __exports__; 32 | // Build out our basic SafeString type 33 | function SafeString(string) { 34 | this.string = string; 35 | } 36 | 37 | SafeString.prototype.toString = function() { 38 | return "" + this.string; 39 | }; 40 | 41 | __exports__ = SafeString; 42 | return __exports__; 43 | })(); 44 | 45 | // handlebars/utils.js 46 | var __module3__ = (function(__dependency1__) { 47 | "use strict"; 48 | var __exports__ = {}; 49 | var SafeString = __dependency1__; 50 | 51 | var escape = { 52 | "&": "&", 53 | "<": "<", 54 | ">": ">", 55 | '"': """, 56 | "'": "'", 57 | "`": "`" 58 | }; 59 | 60 | var badChars = /[&<>"'`]/g; 61 | var possible = /[&<>"'`]/; 62 | 63 | function escapeChar(chr) { 64 | return escape[chr] || "&"; 65 | } 66 | 67 | function extend(obj, value) { 68 | for(var key in value) { 69 | if(value.hasOwnProperty(key)) { 70 | obj[key] = value[key]; 71 | } 72 | } 73 | } 74 | 75 | __exports__.extend = extend;var toString = Object.prototype.toString; 76 | __exports__.toString = toString; 77 | // Sourced from lodash 78 | // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt 79 | var isFunction = function(value) { 80 | return typeof value === 'function'; 81 | }; 82 | // fallback for older versions of Chrome and Safari 83 | if (isFunction(/x/)) { 84 | isFunction = function(value) { 85 | return typeof value === 'function' && toString.call(value) === '[object Function]'; 86 | }; 87 | } 88 | var isFunction; 89 | __exports__.isFunction = isFunction; 90 | var isArray = Array.isArray || function(value) { 91 | return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; 92 | }; 93 | __exports__.isArray = isArray; 94 | 95 | function escapeExpression(string) { 96 | // don't escape SafeStrings, since they're already safe 97 | if (string instanceof SafeString) { 98 | return string.toString(); 99 | } else if (!string && string !== 0) { 100 | return ""; 101 | } 102 | 103 | // Force a string conversion as this will be done by the append regardless and 104 | // the regex test will do this transparently behind the scenes, causing issues if 105 | // an object's to string has escaped characters in it. 106 | string = "" + string; 107 | 108 | if(!possible.test(string)) { return string; } 109 | return string.replace(badChars, escapeChar); 110 | } 111 | 112 | __exports__.escapeExpression = escapeExpression;function isEmpty(value) { 113 | if (!value && value !== 0) { 114 | return true; 115 | } else if (isArray(value) && value.length === 0) { 116 | return true; 117 | } else { 118 | return false; 119 | } 120 | } 121 | 122 | __exports__.isEmpty = isEmpty; 123 | return __exports__; 124 | })(__module4__); 125 | 126 | // handlebars/exception.js 127 | var __module5__ = (function() { 128 | "use strict"; 129 | var __exports__; 130 | 131 | var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; 132 | 133 | function Exception(/* message */) { 134 | var tmp = Error.prototype.constructor.apply(this, arguments); 135 | 136 | // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. 137 | for (var idx = 0; idx < errorProps.length; idx++) { 138 | this[errorProps[idx]] = tmp[errorProps[idx]]; 139 | } 140 | } 141 | 142 | Exception.prototype = new Error(); 143 | 144 | __exports__ = Exception; 145 | return __exports__; 146 | })(); 147 | 148 | // handlebars/base.js 149 | var __module2__ = (function(__dependency1__, __dependency2__) { 150 | "use strict"; 151 | var __exports__ = {}; 152 | /*globals Exception, Utils */ 153 | var Utils = __dependency1__; 154 | var Exception = __dependency2__; 155 | 156 | var VERSION = "1.1.2"; 157 | __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; 158 | __exports__.COMPILER_REVISION = COMPILER_REVISION; 159 | var REVISION_CHANGES = { 160 | 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 161 | 2: '== 1.0.0-rc.3', 162 | 3: '== 1.0.0-rc.4', 163 | 4: '>= 1.0.0' 164 | }; 165 | __exports__.REVISION_CHANGES = REVISION_CHANGES; 166 | var isArray = Utils.isArray, 167 | isFunction = Utils.isFunction, 168 | toString = Utils.toString, 169 | objectType = '[object Object]'; 170 | 171 | function HandlebarsEnvironment(helpers, partials) { 172 | this.helpers = helpers || {}; 173 | this.partials = partials || {}; 174 | 175 | registerDefaultHelpers(this); 176 | } 177 | 178 | __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { 179 | constructor: HandlebarsEnvironment, 180 | 181 | logger: logger, 182 | log: log, 183 | 184 | registerHelper: function(name, fn, inverse) { 185 | if (toString.call(name) === objectType) { 186 | if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } 187 | Utils.extend(this.helpers, name); 188 | } else { 189 | if (inverse) { fn.not = inverse; } 190 | this.helpers[name] = fn; 191 | } 192 | }, 193 | 194 | registerPartial: function(name, str) { 195 | if (toString.call(name) === objectType) { 196 | Utils.extend(this.partials, name); 197 | } else { 198 | this.partials[name] = str; 199 | } 200 | } 201 | }; 202 | 203 | function registerDefaultHelpers(instance) { 204 | instance.registerHelper('helperMissing', function(arg) { 205 | if(arguments.length === 2) { 206 | return undefined; 207 | } else { 208 | throw new Error("Missing helper: '" + arg + "'"); 209 | } 210 | }); 211 | 212 | instance.registerHelper('blockHelperMissing', function(context, options) { 213 | var inverse = options.inverse || function() {}, fn = options.fn; 214 | 215 | if (isFunction(context)) { context = context.call(this); } 216 | 217 | if(context === true) { 218 | return fn(this); 219 | } else if(context === false || context == null) { 220 | return inverse(this); 221 | } else if (isArray(context)) { 222 | if(context.length > 0) { 223 | return instance.helpers.each(context, options); 224 | } else { 225 | return inverse(this); 226 | } 227 | } else { 228 | return fn(context); 229 | } 230 | }); 231 | 232 | instance.registerHelper('each', function(context, options) { 233 | var fn = options.fn, inverse = options.inverse; 234 | var i = 0, ret = "", data; 235 | 236 | if (isFunction(context)) { context = context.call(this); } 237 | 238 | if (options.data) { 239 | data = createFrame(options.data); 240 | } 241 | 242 | if(context && typeof context === 'object') { 243 | if (isArray(context)) { 244 | for(var j = context.length; i 0) { throw new Exception("Invalid path: " + original); } 614 | else if (part === "..") { depth++; } 615 | else { this.isScoped = true; } 616 | } 617 | else { dig.push(part); } 618 | } 619 | 620 | this.original = original; 621 | this.parts = dig; 622 | this.string = dig.join('.'); 623 | this.depth = depth; 624 | 625 | // an ID is simple if it only has one part, and that part is not 626 | // `..` or `this`. 627 | this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; 628 | 629 | this.stringModeValue = this.string; 630 | } 631 | 632 | __exports__.IdNode = IdNode;function PartialNameNode(name) { 633 | this.type = "PARTIAL_NAME"; 634 | this.name = name.original; 635 | } 636 | 637 | __exports__.PartialNameNode = PartialNameNode;function DataNode(id) { 638 | this.type = "DATA"; 639 | this.id = id; 640 | } 641 | 642 | __exports__.DataNode = DataNode;function StringNode(string) { 643 | this.type = "STRING"; 644 | this.original = 645 | this.string = 646 | this.stringModeValue = string; 647 | } 648 | 649 | __exports__.StringNode = StringNode;function IntegerNode(integer) { 650 | this.type = "INTEGER"; 651 | this.original = 652 | this.integer = integer; 653 | this.stringModeValue = Number(integer); 654 | } 655 | 656 | __exports__.IntegerNode = IntegerNode;function BooleanNode(bool) { 657 | this.type = "BOOLEAN"; 658 | this.bool = bool; 659 | this.stringModeValue = bool === "true"; 660 | } 661 | 662 | __exports__.BooleanNode = BooleanNode;function CommentNode(comment) { 663 | this.type = "comment"; 664 | this.comment = comment; 665 | } 666 | 667 | __exports__.CommentNode = CommentNode; 668 | return __exports__; 669 | })(__module5__); 670 | 671 | // handlebars/compiler/parser.js 672 | var __module9__ = (function() { 673 | "use strict"; 674 | var __exports__; 675 | /* Jison generated parser */ 676 | var handlebars = (function(){ 677 | var parser = {trace: function trace() { }, 678 | yy: {}, 679 | symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"inMustache":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"inMustache_repetition0":28,"inMustache_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"hash":35,"hash_repetition_plus0":36,"hashSegment":37,"ID":38,"EQUALS":39,"DATA":40,"pathSegments":41,"SEP":42,"$accept":0,"$end":1}, 680 | terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",38:"ID",39:"EQUALS",40:"DATA",42:"SEP"}, 681 | productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[35,1],[37,3],[26,1],[26,1],[26,1],[30,2],[21,1],[41,3],[41,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[36,1],[36,2]], 682 | performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { 683 | 684 | var $0 = $$.length - 1; 685 | switch (yystate) { 686 | case 1: return new yy.ProgramNode($$[$0-1]); 687 | break; 688 | case 2: return new yy.ProgramNode([]); 689 | break; 690 | case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0]); 691 | break; 692 | case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0]); 693 | break; 694 | case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], []); 695 | break; 696 | case 6:this.$ = new yy.ProgramNode($$[$0]); 697 | break; 698 | case 7:this.$ = new yy.ProgramNode([]); 699 | break; 700 | case 8:this.$ = new yy.ProgramNode([]); 701 | break; 702 | case 9:this.$ = [$$[$0]]; 703 | break; 704 | case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; 705 | break; 706 | case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0]); 707 | break; 708 | case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0]); 709 | break; 710 | case 13:this.$ = $$[$0]; 711 | break; 712 | case 14:this.$ = $$[$0]; 713 | break; 714 | case 15:this.$ = new yy.ContentNode($$[$0]); 715 | break; 716 | case 16:this.$ = new yy.CommentNode($$[$0]); 717 | break; 718 | case 17:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); 719 | break; 720 | case 18:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); 721 | break; 722 | case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; 723 | break; 724 | case 20:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); 725 | break; 726 | case 21:this.$ = new yy.MustacheNode($$[$0-1][0], $$[$0-1][1], $$[$0-2], stripFlags($$[$0-2], $$[$0])); 727 | break; 728 | case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0])); 729 | break; 730 | case 23:this.$ = stripFlags($$[$0-1], $$[$0]); 731 | break; 732 | case 24:this.$ = [[$$[$0-2]].concat($$[$0-1]), $$[$0]]; 733 | break; 734 | case 25:this.$ = [[$$[$0]], null]; 735 | break; 736 | case 26:this.$ = $$[$0]; 737 | break; 738 | case 27:this.$ = new yy.StringNode($$[$0]); 739 | break; 740 | case 28:this.$ = new yy.IntegerNode($$[$0]); 741 | break; 742 | case 29:this.$ = new yy.BooleanNode($$[$0]); 743 | break; 744 | case 30:this.$ = $$[$0]; 745 | break; 746 | case 31:this.$ = new yy.HashNode($$[$0]); 747 | break; 748 | case 32:this.$ = [$$[$0-2], $$[$0]]; 749 | break; 750 | case 33:this.$ = new yy.PartialNameNode($$[$0]); 751 | break; 752 | case 34:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0])); 753 | break; 754 | case 35:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0])); 755 | break; 756 | case 36:this.$ = new yy.DataNode($$[$0]); 757 | break; 758 | case 37:this.$ = new yy.IdNode($$[$0]); 759 | break; 760 | case 38: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; 761 | break; 762 | case 39:this.$ = [{part: $$[$0]}]; 763 | break; 764 | case 42:this.$ = []; 765 | break; 766 | case 43:$$[$0-1].push($$[$0]); 767 | break; 768 | case 46:this.$ = [$$[$0]]; 769 | break; 770 | case 47:$$[$0-1].push($$[$0]); 771 | break; 772 | } 773 | }, 774 | table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:29,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:30,21:24,30:25,38:[1,28],40:[1,27],41:26},{17:31,21:24,30:25,38:[1,28],40:[1,27],41:26},{21:33,26:32,32:[1,34],33:[1,35],38:[1,28],41:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,38:[1,28],40:[1,27],41:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,42],24:[2,42],28:43,32:[2,42],33:[2,42],34:[2,42],38:[2,42],40:[2,42]},{18:[2,25],24:[2,25]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],38:[2,37],40:[2,37],42:[1,44]},{21:45,38:[1,28],41:26},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],40:[2,39],42:[2,39]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,40],21:50,27:49,38:[1,28],41:26},{18:[2,33],38:[2,33]},{18:[2,34],38:[2,34]},{18:[2,35],38:[2,35]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,38:[1,28],41:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,44],21:56,24:[2,44],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:55,36:61,37:62,38:[1,63],40:[1,27],41:26},{38:[1,64]},{18:[2,36],24:[2,36],32:[2,36],33:[2,36],34:[2,36],38:[2,36],40:[2,36]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,65]},{18:[2,41]},{18:[1,66]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24]},{18:[2,43],24:[2,43],32:[2,43],33:[2,43],34:[2,43],38:[2,43],40:[2,43]},{18:[2,45],24:[2,45]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],38:[2,26],40:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],38:[2,27],40:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],38:[2,28],40:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],38:[2,29],40:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],38:[2,30],40:[2,30]},{18:[2,31],24:[2,31],37:67,38:[1,68]},{18:[2,46],24:[2,46],38:[2,46]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],38:[2,39],39:[1,69],40:[2,39],42:[2,39]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],38:[2,38],40:[2,38],42:[2,38]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{18:[2,47],24:[2,47],38:[2,47]},{39:[1,69]},{21:56,30:60,31:70,32:[1,57],33:[1,58],34:[1,59],38:[1,28],40:[1,27],41:26},{18:[2,32],24:[2,32],38:[2,32]}], 775 | defaultActions: {3:[2,2],16:[2,1],50:[2,41]}, 776 | parseError: function parseError(str, hash) { 777 | throw new Error(str); 778 | }, 779 | parse: function parse(input) { 780 | var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; 781 | this.lexer.setInput(input); 782 | this.lexer.yy = this.yy; 783 | this.yy.lexer = this.lexer; 784 | this.yy.parser = this; 785 | if (typeof this.lexer.yylloc == "undefined") 786 | this.lexer.yylloc = {}; 787 | var yyloc = this.lexer.yylloc; 788 | lstack.push(yyloc); 789 | var ranges = this.lexer.options && this.lexer.options.ranges; 790 | if (typeof this.yy.parseError === "function") 791 | this.parseError = this.yy.parseError; 792 | function popStack(n) { 793 | stack.length = stack.length - 2 * n; 794 | vstack.length = vstack.length - n; 795 | lstack.length = lstack.length - n; 796 | } 797 | function lex() { 798 | var token; 799 | token = self.lexer.lex() || 1; 800 | if (typeof token !== "number") { 801 | token = self.symbols_[token] || token; 802 | } 803 | return token; 804 | } 805 | var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; 806 | while (true) { 807 | state = stack[stack.length - 1]; 808 | if (this.defaultActions[state]) { 809 | action = this.defaultActions[state]; 810 | } else { 811 | if (symbol === null || typeof symbol == "undefined") { 812 | symbol = lex(); 813 | } 814 | action = table[state] && table[state][symbol]; 815 | } 816 | if (typeof action === "undefined" || !action.length || !action[0]) { 817 | var errStr = ""; 818 | if (!recovering) { 819 | expected = []; 820 | for (p in table[state]) 821 | if (this.terminals_[p] && p > 2) { 822 | expected.push("'" + this.terminals_[p] + "'"); 823 | } 824 | if (this.lexer.showPosition) { 825 | errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; 826 | } else { 827 | errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); 828 | } 829 | this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); 830 | } 831 | } 832 | if (action[0] instanceof Array && action.length > 1) { 833 | throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); 834 | } 835 | switch (action[0]) { 836 | case 1: 837 | stack.push(symbol); 838 | vstack.push(this.lexer.yytext); 839 | lstack.push(this.lexer.yylloc); 840 | stack.push(action[1]); 841 | symbol = null; 842 | if (!preErrorSymbol) { 843 | yyleng = this.lexer.yyleng; 844 | yytext = this.lexer.yytext; 845 | yylineno = this.lexer.yylineno; 846 | yyloc = this.lexer.yylloc; 847 | if (recovering > 0) 848 | recovering--; 849 | } else { 850 | symbol = preErrorSymbol; 851 | preErrorSymbol = null; 852 | } 853 | break; 854 | case 2: 855 | len = this.productions_[action[1]][1]; 856 | yyval.$ = vstack[vstack.length - len]; 857 | yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; 858 | if (ranges) { 859 | yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; 860 | } 861 | r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); 862 | if (typeof r !== "undefined") { 863 | return r; 864 | } 865 | if (len) { 866 | stack = stack.slice(0, -1 * len * 2); 867 | vstack = vstack.slice(0, -1 * len); 868 | lstack = lstack.slice(0, -1 * len); 869 | } 870 | stack.push(this.productions_[action[1]][0]); 871 | vstack.push(yyval.$); 872 | lstack.push(yyval._$); 873 | newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 874 | stack.push(newState); 875 | break; 876 | case 3: 877 | return true; 878 | } 879 | } 880 | return true; 881 | } 882 | }; 883 | 884 | 885 | function stripFlags(open, close) { 886 | return { 887 | left: open[2] === '~', 888 | right: close[0] === '~' || close[1] === '~' 889 | }; 890 | } 891 | 892 | /* Jison generated lexer */ 893 | var lexer = (function(){ 894 | var lexer = ({EOF:1, 895 | parseError:function parseError(str, hash) { 896 | if (this.yy.parser) { 897 | this.yy.parser.parseError(str, hash); 898 | } else { 899 | throw new Error(str); 900 | } 901 | }, 902 | setInput:function (input) { 903 | this._input = input; 904 | this._more = this._less = this.done = false; 905 | this.yylineno = this.yyleng = 0; 906 | this.yytext = this.matched = this.match = ''; 907 | this.conditionStack = ['INITIAL']; 908 | this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; 909 | if (this.options.ranges) this.yylloc.range = [0,0]; 910 | this.offset = 0; 911 | return this; 912 | }, 913 | input:function () { 914 | var ch = this._input[0]; 915 | this.yytext += ch; 916 | this.yyleng++; 917 | this.offset++; 918 | this.match += ch; 919 | this.matched += ch; 920 | var lines = ch.match(/(?:\r\n?|\n).*/g); 921 | if (lines) { 922 | this.yylineno++; 923 | this.yylloc.last_line++; 924 | } else { 925 | this.yylloc.last_column++; 926 | } 927 | if (this.options.ranges) this.yylloc.range[1]++; 928 | 929 | this._input = this._input.slice(1); 930 | return ch; 931 | }, 932 | unput:function (ch) { 933 | var len = ch.length; 934 | var lines = ch.split(/(?:\r\n?|\n)/g); 935 | 936 | this._input = ch + this._input; 937 | this.yytext = this.yytext.substr(0, this.yytext.length-len-1); 938 | //this.yyleng -= len; 939 | this.offset -= len; 940 | var oldLines = this.match.split(/(?:\r\n?|\n)/g); 941 | this.match = this.match.substr(0, this.match.length-1); 942 | this.matched = this.matched.substr(0, this.matched.length-1); 943 | 944 | if (lines.length-1) this.yylineno -= lines.length-1; 945 | var r = this.yylloc.range; 946 | 947 | this.yylloc = {first_line: this.yylloc.first_line, 948 | last_line: this.yylineno+1, 949 | first_column: this.yylloc.first_column, 950 | last_column: lines ? 951 | (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: 952 | this.yylloc.first_column - len 953 | }; 954 | 955 | if (this.options.ranges) { 956 | this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 957 | } 958 | return this; 959 | }, 960 | more:function () { 961 | this._more = true; 962 | return this; 963 | }, 964 | less:function (n) { 965 | this.unput(this.match.slice(n)); 966 | }, 967 | pastInput:function () { 968 | var past = this.matched.substr(0, this.matched.length - this.match.length); 969 | return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); 970 | }, 971 | upcomingInput:function () { 972 | var next = this.match; 973 | if (next.length < 20) { 974 | next += this._input.substr(0, 20-next.length); 975 | } 976 | return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); 977 | }, 978 | showPosition:function () { 979 | var pre = this.pastInput(); 980 | var c = new Array(pre.length + 1).join("-"); 981 | return pre + this.upcomingInput() + "\n" + c+"^"; 982 | }, 983 | next:function () { 984 | if (this.done) { 985 | return this.EOF; 986 | } 987 | if (!this._input) this.done = true; 988 | 989 | var token, 990 | match, 991 | tempMatch, 992 | index, 993 | col, 994 | lines; 995 | if (!this._more) { 996 | this.yytext = ''; 997 | this.match = ''; 998 | } 999 | var rules = this._currentRules(); 1000 | for (var i=0;i < rules.length; i++) { 1001 | tempMatch = this._input.match(this.rules[rules[i]]); 1002 | if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 1003 | match = tempMatch; 1004 | index = i; 1005 | if (!this.options.flex) break; 1006 | } 1007 | } 1008 | if (match) { 1009 | lines = match[0].match(/(?:\r\n?|\n).*/g); 1010 | if (lines) this.yylineno += lines.length; 1011 | this.yylloc = {first_line: this.yylloc.last_line, 1012 | last_line: this.yylineno+1, 1013 | first_column: this.yylloc.last_column, 1014 | last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; 1015 | this.yytext += match[0]; 1016 | this.match += match[0]; 1017 | this.matches = match; 1018 | this.yyleng = this.yytext.length; 1019 | if (this.options.ranges) { 1020 | this.yylloc.range = [this.offset, this.offset += this.yyleng]; 1021 | } 1022 | this._more = false; 1023 | this._input = this._input.slice(match[0].length); 1024 | this.matched += match[0]; 1025 | token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); 1026 | if (this.done && this._input) this.done = false; 1027 | if (token) return token; 1028 | else return; 1029 | } 1030 | if (this._input === "") { 1031 | return this.EOF; 1032 | } else { 1033 | return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), 1034 | {text: "", token: null, line: this.yylineno}); 1035 | } 1036 | }, 1037 | lex:function lex() { 1038 | var r = this.next(); 1039 | if (typeof r !== 'undefined') { 1040 | return r; 1041 | } else { 1042 | return this.lex(); 1043 | } 1044 | }, 1045 | begin:function begin(condition) { 1046 | this.conditionStack.push(condition); 1047 | }, 1048 | popState:function popState() { 1049 | return this.conditionStack.pop(); 1050 | }, 1051 | _currentRules:function _currentRules() { 1052 | return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; 1053 | }, 1054 | topState:function () { 1055 | return this.conditionStack[this.conditionStack.length-2]; 1056 | }, 1057 | pushState:function begin(condition) { 1058 | this.begin(condition); 1059 | }}); 1060 | lexer.options = {}; 1061 | lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { 1062 | 1063 | 1064 | function strip(start, end) { 1065 | return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); 1066 | } 1067 | 1068 | 1069 | var YYSTATE=YY_START 1070 | switch($avoiding_name_collisions) { 1071 | case 0: 1072 | if(yy_.yytext.slice(-2) === "\\\\") { 1073 | strip(0,1); 1074 | this.begin("mu"); 1075 | } else if(yy_.yytext.slice(-1) === "\\") { 1076 | strip(0,1); 1077 | this.begin("emu"); 1078 | } else { 1079 | this.begin("mu"); 1080 | } 1081 | if(yy_.yytext) return 14; 1082 | 1083 | break; 1084 | case 1:return 14; 1085 | break; 1086 | case 2: 1087 | if(yy_.yytext.slice(-1) !== "\\") this.popState(); 1088 | if(yy_.yytext.slice(-1) === "\\") strip(0,1); 1089 | return 14; 1090 | 1091 | break; 1092 | case 3:strip(0,4); this.popState(); return 15; 1093 | break; 1094 | case 4:return 25; 1095 | break; 1096 | case 5:return 16; 1097 | break; 1098 | case 6:return 20; 1099 | break; 1100 | case 7:return 19; 1101 | break; 1102 | case 8:return 19; 1103 | break; 1104 | case 9:return 23; 1105 | break; 1106 | case 10:return 22; 1107 | break; 1108 | case 11:this.popState(); this.begin('com'); 1109 | break; 1110 | case 12:strip(3,5); this.popState(); return 15; 1111 | break; 1112 | case 13:return 22; 1113 | break; 1114 | case 14:return 39; 1115 | break; 1116 | case 15:return 38; 1117 | break; 1118 | case 16:return 38; 1119 | break; 1120 | case 17:return 42; 1121 | break; 1122 | case 18:/*ignore whitespace*/ 1123 | break; 1124 | case 19:this.popState(); return 24; 1125 | break; 1126 | case 20:this.popState(); return 18; 1127 | break; 1128 | case 21:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; 1129 | break; 1130 | case 22:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; 1131 | break; 1132 | case 23:return 40; 1133 | break; 1134 | case 24:return 34; 1135 | break; 1136 | case 25:return 34; 1137 | break; 1138 | case 26:return 33; 1139 | break; 1140 | case 27:return 38; 1141 | break; 1142 | case 28:yy_.yytext = strip(1,2); return 38; 1143 | break; 1144 | case 29:return 'INVALID'; 1145 | break; 1146 | case 30:return 5; 1147 | break; 1148 | } 1149 | }; 1150 | lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s])))/,/^(?:false(?=([~}\s])))/,/^(?:-?[0-9]+(?=([~}\s])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; 1151 | lexer.conditions = {"mu":{"rules":[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],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,30],"inclusive":true}}; 1152 | return lexer;})() 1153 | parser.lexer = lexer; 1154 | function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; 1155 | return new Parser; 1156 | })();__exports__ = handlebars; 1157 | return __exports__; 1158 | })(); 1159 | 1160 | // handlebars/compiler/base.js 1161 | var __module8__ = (function(__dependency1__, __dependency2__) { 1162 | "use strict"; 1163 | var __exports__ = {}; 1164 | var parser = __dependency1__; 1165 | var AST = __dependency2__; 1166 | 1167 | __exports__.parser = parser; 1168 | 1169 | function parse(input) { 1170 | // Just return if an already-compile AST was passed in. 1171 | if(input.constructor === AST.ProgramNode) { return input; } 1172 | 1173 | parser.yy = AST; 1174 | return parser.parse(input); 1175 | } 1176 | 1177 | __exports__.parse = parse; 1178 | return __exports__; 1179 | })(__module9__, __module7__); 1180 | 1181 | // handlebars/compiler/javascript-compiler.js 1182 | var __module11__ = (function(__dependency1__) { 1183 | "use strict"; 1184 | var __exports__; 1185 | var COMPILER_REVISION = __dependency1__.COMPILER_REVISION; 1186 | var REVISION_CHANGES = __dependency1__.REVISION_CHANGES; 1187 | var log = __dependency1__.log; 1188 | 1189 | function Literal(value) { 1190 | this.value = value; 1191 | } 1192 | 1193 | function JavaScriptCompiler() {} 1194 | 1195 | JavaScriptCompiler.prototype = { 1196 | // PUBLIC API: You can override these methods in a subclass to provide 1197 | // alternative compiled forms for name lookup and buffering semantics 1198 | nameLookup: function(parent, name /* , type*/) { 1199 | var wrap, 1200 | ret; 1201 | if (parent.indexOf('depth') === 0) { 1202 | wrap = true; 1203 | } 1204 | 1205 | if (/^[0-9]+$/.test(name)) { 1206 | ret = parent + "[" + name + "]"; 1207 | } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { 1208 | ret = parent + "." + name; 1209 | } 1210 | else { 1211 | ret = parent + "['" + name + "']"; 1212 | } 1213 | 1214 | if (wrap) { 1215 | return '(' + parent + ' && ' + ret + ')'; 1216 | } else { 1217 | return ret; 1218 | } 1219 | }, 1220 | 1221 | appendToBuffer: function(string) { 1222 | if (this.environment.isSimple) { 1223 | return "return " + string + ";"; 1224 | } else { 1225 | return { 1226 | appendToBuffer: true, 1227 | content: string, 1228 | toString: function() { return "buffer += " + string + ";"; } 1229 | }; 1230 | } 1231 | }, 1232 | 1233 | initializeBuffer: function() { 1234 | return this.quotedString(""); 1235 | }, 1236 | 1237 | namespace: "Handlebars", 1238 | // END PUBLIC API 1239 | 1240 | compile: function(environment, options, context, asObject) { 1241 | this.environment = environment; 1242 | this.options = options || {}; 1243 | 1244 | log('debug', this.environment.disassemble() + "\n\n"); 1245 | 1246 | this.name = this.environment.name; 1247 | this.isChild = !!context; 1248 | this.context = context || { 1249 | programs: [], 1250 | environments: [], 1251 | aliases: { } 1252 | }; 1253 | 1254 | this.preamble(); 1255 | 1256 | this.stackSlot = 0; 1257 | this.stackVars = []; 1258 | this.registers = { list: [] }; 1259 | this.compileStack = []; 1260 | this.inlineStack = []; 1261 | 1262 | this.compileChildren(environment, options); 1263 | 1264 | var opcodes = environment.opcodes, opcode; 1265 | 1266 | this.i = 0; 1267 | 1268 | for(var l=opcodes.length; this.i 0) { 1319 | this.source[1] = this.source[1] + ", " + locals.join(", "); 1320 | } 1321 | 1322 | // Generate minimizer alias mappings 1323 | if (!this.isChild) { 1324 | for (var alias in this.context.aliases) { 1325 | if (this.context.aliases.hasOwnProperty(alias)) { 1326 | this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; 1327 | } 1328 | } 1329 | } 1330 | 1331 | if (this.source[1]) { 1332 | this.source[1] = "var " + this.source[1].substring(2) + ";"; 1333 | } 1334 | 1335 | // Merge children 1336 | if (!this.isChild) { 1337 | this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; 1338 | } 1339 | 1340 | if (!this.environment.isSimple) { 1341 | this.pushSource("return buffer;"); 1342 | } 1343 | 1344 | var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; 1345 | 1346 | for(var i=0, l=this.environment.depths.list.length; i this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } 1912 | return this.topStackName(); 1913 | }, 1914 | topStackName: function() { 1915 | return "stack" + this.stackSlot; 1916 | }, 1917 | flushInline: function() { 1918 | var inlineStack = this.inlineStack; 1919 | if (inlineStack.length) { 1920 | this.inlineStack = []; 1921 | for (var i = 0, len = inlineStack.length; i < len; i++) { 1922 | var entry = inlineStack[i]; 1923 | if (entry instanceof Literal) { 1924 | this.compileStack.push(entry); 1925 | } else { 1926 | this.pushStack(entry); 1927 | } 1928 | } 1929 | } 1930 | }, 1931 | isInline: function() { 1932 | return this.inlineStack.length; 1933 | }, 1934 | 1935 | popStack: function(wrapped) { 1936 | var inline = this.isInline(), 1937 | item = (inline ? this.inlineStack : this.compileStack).pop(); 1938 | 1939 | if (!wrapped && (item instanceof Literal)) { 1940 | return item.value; 1941 | } else { 1942 | if (!inline) { 1943 | this.stackSlot--; 1944 | } 1945 | return item; 1946 | } 1947 | }, 1948 | 1949 | topStack: function(wrapped) { 1950 | var stack = (this.isInline() ? this.inlineStack : this.compileStack), 1951 | item = stack[stack.length - 1]; 1952 | 1953 | if (!wrapped && (item instanceof Literal)) { 1954 | return item.value; 1955 | } else { 1956 | return item; 1957 | } 1958 | }, 1959 | 1960 | quotedString: function(str) { 1961 | return '"' + str 1962 | .replace(/\\/g, '\\\\') 1963 | .replace(/"/g, '\\"') 1964 | .replace(/\n/g, '\\n') 1965 | .replace(/\r/g, '\\r') 1966 | .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 1967 | .replace(/\u2029/g, '\\u2029') + '"'; 1968 | }, 1969 | 1970 | setupHelper: function(paramSize, name, missingParams) { 1971 | var params = []; 1972 | this.setupParams(paramSize, params, missingParams); 1973 | var foundHelper = this.nameLookup('helpers', name, 'helper'); 1974 | 1975 | return { 1976 | params: params, 1977 | name: foundHelper, 1978 | callParams: ["depth0"].concat(params).join(", "), 1979 | helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") 1980 | }; 1981 | }, 1982 | 1983 | // the params and contexts arguments are passed in arrays 1984 | // to fill in 1985 | setupParams: function(paramSize, params, useRegister) { 1986 | var options = [], contexts = [], types = [], param, inverse, program; 1987 | 1988 | options.push("hash:" + this.popStack()); 1989 | 1990 | inverse = this.popStack(); 1991 | program = this.popStack(); 1992 | 1993 | // Avoid setting fn and inverse if neither are set. This allows 1994 | // helpers to do a check for `if (options.fn)` 1995 | if (program || inverse) { 1996 | if (!program) { 1997 | this.context.aliases.self = "this"; 1998 | program = "self.noop"; 1999 | } 2000 | 2001 | if (!inverse) { 2002 | this.context.aliases.self = "this"; 2003 | inverse = "self.noop"; 2004 | } 2005 | 2006 | options.push("inverse:" + inverse); 2007 | options.push("fn:" + program); 2008 | } 2009 | 2010 | for(var i=0; i