├── LICENSE
├── README.md
├── app
├── .DS_Store
├── Icon-Template.png
├── Icon-Template@2x.png
├── icon_512x512.png
├── index.html
├── index.js
├── logo.png
├── quickcalc.icns
├── quickcalc.ico
├── script.js
└── style.css
├── assets
├── complexcalc.gif
├── ezgif.com-crop-2.gif
├── ezgif.com-crop-3.gif
├── ezgif.com-crop.gif
├── quickcalc_design.jpg
└── simplecalc.gif
├── main.js
└── package.json
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Chaz Woodall
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
quickcalc
2 | Simple Menu Bar Application For Mac and Windows
3 |
4 | []()
5 | []()
6 |
7 |
8 | # 
9 |
10 | ## A Calculator That Does More 👍
11 | 
12 |
13 | ## Functions To Help Your Daily Life ✅
14 | 
15 |
16 | ## Let's Do Some Math ➗
17 | 
18 |
19 | ## Install
20 |
21 | *macOS 10.9+*, Windows now available!
22 |
23 | ### macOS
24 |
25 | [**Download**](https://github.com/Cwoodall6/quickcalc/releases/download/v1.1.0/quickcalc.app.zip), unzip, and move `quickcalc.app` to the `/Applications` folder.
26 |
27 | ### Windows
28 |
29 | [**Download**](https://github.com/Cwoodall6/quickcalc/releases/download/v1.1.0/quickcalc-win32-ia32.zip), unzip, and use `quickcalc.app`.
30 |
31 | ## Functions
32 | ### Math ➕
33 | - Calculations can be simple or complex `5 + 4` `(4**3)/(4839-32+423)`
34 | * `+` plus
35 | * `-` minus
36 | * `*` multiply
37 | * `/` divide
38 | * `%` modulo
39 | * `**` exponent
40 | - `:sqrt` returns square root ex. `:sqrt(4)`
41 | - `:abs` returns absolute value ex. `:abs(4-7)`
42 | - `:log` returns log (base 10) ex. `:log(100)`
43 | - `:ln` returns natural log (base E) ex. `:ln(50)`
44 | - `:e` returns e^x ex. `:e(2)`
45 | - Trig functions are within code but aren't guarenteed to give a desired answer, so they aren't included in this list.
46 |
47 | ### Date and Time ⌚
48 | - `:today` returns the current date; you may add or subtract days ex. `:today + 5`
49 | - `:datein` returns the date plus the value you pass ex. `:datein 3`
50 | - `:daysof` returns the amount of days in the value passed ex. `:daysof jan` `:daysof 3 years 5 months`
51 | - `:time` returns current time
52 |
53 | ### Money 💸
54 | - `:off` returns a percentage off of a value ex. `20% :off 300` `3% :off 50.50`
55 | - `:of` returns percentage of a value ex. `50% :of 40` `16% :of 32.70`
56 |
57 | ### Misc. 🖥
58 | - `:color` takes a Hex color code and displays a rectangle of inputed color ex. `:color(#000)`
59 |
60 | ## Shortcuts
61 | - Quit: command + Q
62 |
63 | ## Future Iterations
64 | - [X] May Change UI
65 | - [X] More Keyboard Shortcuts
66 | - [X] Parenthesis
67 | - [ ] Auto Updater (IMPORTANT)
68 | - [ ] More Functions
69 | - [ ] Correct Trig functions
70 | - [ ] Dark Mode
71 |
72 | ## Ispiration and Thanks
73 | - [Devin Rousso](http://devinrousso.com) Thanks for your guidance and help with getting me in the right direction. Go grab the [**GroupMe**](https://github.com/dcrousso/GroupMe#readme) client.
74 |
75 | ## License
76 | MIT © [Chaz Woodall](https://chazwoodall.com)
77 |
--------------------------------------------------------------------------------
/app/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/app/.DS_Store
--------------------------------------------------------------------------------
/app/Icon-Template.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/app/Icon-Template.png
--------------------------------------------------------------------------------
/app/Icon-Template@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/app/Icon-Template@2x.png
--------------------------------------------------------------------------------
/app/icon_512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/app/icon_512x512.png
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
quickcalc v1.1.0
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/index.js:
--------------------------------------------------------------------------------
1 | var keys = document.querySelectorAll('#calc span');
2 | var operators = ['+', '-', 'x', '÷'];
3 | var decimalAdd = false;
4 |
5 | for(var i = 0; i < keys.length; i++) {
6 | keys[i].onclick = function(e) {
7 |
8 | var input = document.querySelector('.screen');
9 | var inputVal = input.innerHTML;
10 | var btnVal = this.innerHTML;
11 |
12 | if(btnVal == 'AC') {
13 | input.innerHTML = '';
14 | decimalAdd = false;
15 | } else if(btnVal == '=') {
16 | var equation = inputVal;
17 | var lastChar = equation[equation.length - 1];
18 |
19 | equation = equation.replace(/x/g, '*').replace(/÷/g, '/');
20 | if(operators.indexOf(lastVal) > -1 || lastVal == '.')
21 | equation = equation.replace(/.$/, '');
22 |
23 | if(equation)
24 | input.innerHTML = eval(equation);
25 | decimalAdd = false;
26 | } else if(operators.indexOf(btnVal) > -1) {
27 | var lastVal = inputVal[inputVal.length - 1];
28 |
29 | if (inputVal != '' && operators.indexOf(lastVal) == -1) {
30 | input.innerHTML += btnVal;
31 | } else if(inputVal == '' && btnVal == '-') {
32 | input.innerHTML += btnVal;
33 | }
34 |
35 | if(operators.indexOf(lastVal) > -1 && inputVal.length > 1) {
36 | input.innerHTML = inputVal.replace(/.$/, btnVal);
37 | }
38 |
39 | decimalAdd =false;
40 | } else if(btnVal == '.') {
41 | if(!decimalAdd) {
42 | input.innerHTML += btnVal;
43 | decimalAdd = true;
44 | }
45 | } else {
46 | input.innerHTML += btnVal;
47 | }
48 | e.preventDefault();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/app/logo.png
--------------------------------------------------------------------------------
/app/quickcalc.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/app/quickcalc.icns
--------------------------------------------------------------------------------
/app/quickcalc.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/app/quickcalc.ico
--------------------------------------------------------------------------------
/app/script.js:
--------------------------------------------------------------------------------
1 | window.onload = function() {
2 | var pad = document.getElementById('pad');
3 | var answerArea = document.getElementById('answer');
4 | var d = new Date();
5 |
6 | var calculateLine = function(){
7 | var questionText = pad.value;
8 | var outputText = answerArea.value;
9 | answerArea.innerHTML = "";
10 |
11 | //NORMAL BEHAVIOR
12 | questionText.replace(" ", "").trim();
13 | if (!questionText.includes(":")) {
14 | if (!(eval(questionText) == undefined)) {
15 | val = eval(questionText);
16 | answerArea.innerHTML = val;
17 | }
18 | } else {
19 | answerArea.innerHTML = "";
20 | }
21 |
22 | //MATH FUNCTIONS
23 | //SQRT FUNC
24 | if (questionText.includes(":sqrt(") && questionText.includes(")")) {
25 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
26 | trueVal = eval(val);
27 | parseInt(trueVal);
28 | var calc = Math.sqrt(trueVal);
29 | answerArea.innerHTML = calc;
30 | }
31 |
32 | //ABS FUNC
33 | if (questionText.includes(":abs(") && questionText.includes(")")) {
34 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
35 | trueVal = eval(val);
36 | parseInt(trueVal);
37 | var calc = Math.abs(trueVal);
38 | answerArea.innerHTML = calc;
39 | }
40 |
41 | //LOG FUNC
42 | if (questionText.includes(":log(") && questionText.includes(")")) {
43 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
44 | trueVal = eval(val);
45 | parseInt(trueVal);
46 | var calc = Math.log(trueVal) / Math.LN10;
47 | answerArea.innerHTML = calc;
48 | }
49 |
50 | //LN FUNC
51 | if (questionText.includes(":ln(") && questionText.includes(")")) {
52 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
53 | trueVal = eval(val);
54 | parseInt(trueVal);
55 | var calc = Math.log(trueVal);
56 | answerArea.innerHTML = calc;
57 | }
58 |
59 | //E^x FUNC
60 | if (questionText.includes(":e(") && questionText.includes(")")) {
61 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
62 | trueVal = eval(val);
63 | parseInt(trueVal);
64 | var calc = Math.exp(trueVal);
65 | answerArea.innerHTML = calc;
66 | }
67 |
68 | //SIN FUNC
69 | if (questionText.includes(":sin(") && questionText.includes(")")) {
70 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
71 | trueVal = eval(val);
72 | parseInt(trueVal);
73 | var calc = Math.sin(trueVal);
74 | answerArea.innerHTML = calc;
75 | }
76 |
77 | //COS FUNC
78 | if (questionText.includes(":cos(") && questionText.includes(")")) {
79 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
80 | trueVal = eval(val);
81 | parseInt(trueVal);
82 | var calc = Math.cos(trueVal);
83 | answerArea.innerHTML = calc;
84 | }
85 |
86 | //TAN FUNC
87 | if (questionText.includes(":tan(") && questionText.includes(")")) {
88 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
89 | trueVal = eval(val);
90 | parseInt(trueVal);
91 | var calc = Math.tan(trueVal);
92 | answerArea.innerHTML = calc;
93 | }
94 |
95 | //DATE FUNCTIONS
96 | //TODAY FUNC
97 | if (questionText.includes(":today")) {
98 | answerArea.innerHTML = (d.getMonth()+1) + "/" + d.getDate() + "/" + d.getFullYear() + " ";
99 | if (questionText.includes("+")) {
100 | var currentLen = questionText.length;
101 | if ((currentLen-1) > questionText.indexOf("+")) {
102 | var addTime = 86400000 * parseInt(questionText.substring((questionText.indexOf("+")+1), (questionText.length)));
103 | var n = new Date(d.getTime() + addTime);
104 | answerArea.innerHTML = (n.getMonth()+1) + "/" + n.getDate() + "/" + n.getFullYear() + " ";
105 | } else {
106 | answerArea.innerHTML = (d.getMonth()+1) + "/" + d.getDate() + "/" + d.getFullYear() + " ";
107 | }
108 | }
109 | if (questionText.includes("-")) {
110 | var currentLen = questionText.length;
111 | if ((currentLen-1) > questionText.indexOf("-")) {
112 | var addTime = 86400000 * parseInt(questionText.substring((questionText.indexOf("-")+1), (questionText.length)));
113 | var n = new Date(d.getTime() - addTime);
114 | answerArea.innerHTML = (n.getMonth()+1) + "/" + n.getDate() + "/" + n.getFullYear() + " ";
115 | } else {
116 | answerArea.innerHTML = (d.getMonth()+1) + "/" + d.getDate() + "/" + d.getFullYear() + " ";
117 | }
118 | }
119 | }
120 |
121 | //DATEIN FUNC
122 | if (questionText.includes(":datein")) {
123 | var currentLen = questionText.length;
124 | if ((currentLen-1) > questionText.indexOf("n")) {
125 | var addTime = 86400000 * parseInt(questionText.substring((questionText.indexOf("n")+1), (questionText.length)));
126 | var n = new Date(d.getTime() + addTime);
127 | answerArea.innerHTML = (n.getMonth()+1) + "/" + n.getDate() + "/" + n.getFullYear() + " ";
128 | } else {
129 | answerArea.innerHTML = (d.getMonth()+1) + "/" + d.getDate() + "/" + d.getFullYear() + " ";
130 | }
131 | }
132 |
133 | //DAYSOF FUNC
134 | if (questionText.includes(":daysof")) {
135 | var currentLen = questionText.length;
136 | if ((currentLen-1) > questionText.indexOf("f")) {
137 | var askMon = questionText.substring((questionText.indexOf("f")+1), (questionText.length));
138 | answerArea.innerHTML = getDaysOfMon(askMon.trim());
139 | }
140 | }
141 |
142 | //TIME FUNC
143 | if (questionText.includes(":time")) {
144 | try {
145 | if (!(outputText.includes(d.toLocaleTimeString()))) {
146 | answerArea.innerHTML = d.toLocaleTimeString();
147 | }
148 | } catch(err) {
149 | if (questionText.search("time") == 0) {
150 | answerArea.innerHTML = d.toLocaleTimeString();
151 | } else {
152 | answerArea.innerHTML += d.toLocaleTimeString();
153 | }
154 | }
155 | }
156 |
157 | //MONEY FUNCTIONS
158 | //OFF FUNC
159 | if (questionText.includes(":off")) {
160 | if (questionText.includes(".")) {
161 | var per = questionText.substring(0, questionText.indexOf("%"));
162 | var cash = questionText.substring((questionText.indexOf("f")+2), questionText.length);
163 | parseInt(per);
164 | parseInt(cash);
165 | var calc = cash - ((per/100) * cash);
166 | var num = round(calc, 2);
167 | answerArea.innerHTML = num;
168 | } else {
169 | var per = questionText.substring(0, questionText.indexOf("%"));
170 | var cash = questionText.substring((questionText.indexOf("f")+2), questionText.length);
171 | parseInt(per);
172 | parseInt(cash);
173 | var calc = cash - ((per/100) * cash);
174 | answerArea.innerHTML = calc;
175 | }
176 | }
177 |
178 | //OF FUNC
179 | if (questionText.includes(":of")) {
180 | if (questionText.includes(".")) {
181 | var per = questionText.substring(0, questionText.indexOf("%"));
182 | var cash = questionText.substring((questionText.indexOf("f")+2), questionText.length);
183 | parseInt(per);
184 | parseInt(cash);
185 | var calc = (per/100) * cash;
186 | var num = round(calc, 2);
187 | answerArea.innerHTML = num;
188 | } else {
189 | var per = questionText.substring(0, questionText.indexOf("%"));
190 | var cash = questionText.substring((questionText.indexOf("f")+2), questionText.length);
191 | parseInt(per);
192 | parseInt(cash);
193 | var calc = (per/100) * cash;
194 | answerArea.innerHTML = calc;
195 | }
196 | }
197 |
198 | //MISC FUNCTIONS
199 | //COLOR FUNC
200 | if (questionText.includes(":color(") && questionText.includes(")")) {
201 | var val = questionText.substring(questionText.indexOf("(")+1, --questionText.length);
202 | answerArea.innerHTML = '';
203 | var canvas = document.getElementById("myCanvas");
204 | var ctx = canvas.getContext("2d");
205 | ctx.beginPath();
206 | ctx.fillStyle = val;
207 | ctx.rect(35,3,50,20);
208 | ctx.fill();
209 | }
210 | };
211 |
212 | function getDaysOfMon(monthStr) {
213 | monthStr.toLowerCase();
214 | if (monthStr == "january" || monthStr == "jan") {
215 | return 31 + " days ";
216 | } else if (monthStr == "february" || monthStr == "feb") {
217 | if ((d.getFullYear%4) == 0) {
218 | return 29 + " days ";
219 | } else {
220 | return 28 + " days ";
221 | }
222 | } else if (monthStr == "march" || monthStr == "mar") {
223 | return 31 + " days ";
224 | } else if (monthStr == "april" || monthStr == "apr") {
225 | return 30 + " days ";
226 | } else if (monthStr == "may") {
227 | return 31 + " days ";
228 | } else if (monthStr == "june" || monthStr == "jun") {
229 | return 30 + " days ";
230 | } else if (monthStr == "july" || monthStr == "jul") {
231 | return 31 + " days ";
232 | } else if (monthStr == "august" || monthStr == "aug") {
233 | return 31 + " days ";
234 | } else if (monthStr == "september" || monthStr == "sep") {
235 | return 30 + " days ";
236 | } else if (monthStr == "october" || monthStr == "oct") {
237 | return 31 + " days ";
238 | } else if (monthStr == "november" || monthStr == "nov") {
239 | return 30 + " days ";
240 | } else if (monthStr == "december" || monthStr == "dec") {
241 | return 31 + " days ";
242 | } else if (monthStr.includes("year") || monthStr.includes("month")) {
243 | var days = 0;
244 | if (monthStr.includes("years") && monthStr.includes("months")) {
245 | if (monthStr.indexOf("y") < monthStr.indexOf("m")) {
246 | var arrDays = monthStr.split("s");
247 | arrDays[0] = arrDays[0].replace(" ", "");
248 | arrDays[1] = arrDays[1].replace(" ", "");
249 | days += parseInt(arrDays[0].substring(0, arrDays[0].indexOf("y"))) * 365;
250 | days += parseInt(arrDays[1].substring(0, arrDays[1].indexOf("m"))) * 30;
251 | return days + " days ";
252 | } else {
253 | var arrDays = monthStr.split("s");
254 | arrDays[0] = arrDays[0].replace(" ", "");
255 | arrDays[1] = arrDays[1].replace(" ", "");
256 | days += parseInt(arrDays[0].substring(0, arrDays[0].indexOf("m"))) * 30;
257 | days += parseInt(arrDays[1].substring(0, arrDays[1].indexOf("y"))) * 365;
258 | return days + " days ";
259 | }
260 | } else if (monthStr.includes("year") && monthStr.includes("months")) {
261 | if (monthStr.indexOf("y") < monthStr.indexOf("m")) {
262 | var arrDays = monthStr.split("r");
263 | arrDays[0] = arrDays[0].replace(" ", "");
264 | arrDays[1] = arrDays[1].replace(" ", "");
265 | days += parseInt(arrDays[0].substring(0, arrDays[0].indexOf("y"))) * 365;
266 | days += parseInt(arrDays[1].substring(0, arrDays[1].indexOf("m"))) * 30;
267 | return days + " days ";
268 | }
269 | } else if (monthStr.includes("years") && monthStr.includes("month")) {
270 | if (monthStr.indexOf("m") < monthStr.indexOf("y")) {
271 | var arrDays = monthStr.split("h");
272 | arrDays[0] = arrDays[0].replace(" ", "");
273 | arrDays[1] = arrDays[1].replace(" ", "");
274 | days += parseInt(arrDays[0].substring(0, arrDays[0].indexOf("m"))) * 30;
275 | days += parseInt(arrDays[1].substring(0, arrDays[1].indexOf("y"))) * 365;
276 | return days + " days ";
277 | }
278 | }
279 | else if(monthStr.includes("y")) {
280 | days += parseInt(monthStr.substring(0, monthStr.indexOf("y"))) * 365;
281 | return days + " days ";
282 | } else {
283 | days += parseInt(monthStr.substring(0, monthStr.indexOf("m"))) * 30;
284 | return days + " days ";
285 | }
286 |
287 | }else {
288 | return 0 + " ";
289 | }
290 | }
291 |
292 | function round(value, decimals) {
293 | return Number(Math.round(value+'e'+decimals)+'e-'+decimals);
294 | }
295 |
296 | pad.addEventListener('input', calculateLine);
297 | };
298 |
--------------------------------------------------------------------------------
/app/style.css:
--------------------------------------------------------------------------------
1 | html, body, section, .full-height {
2 | height: 100%;
3 | background-color: #FFFAFA;
4 | font-family: monospace;
5 | overflow: hidden;
6 | }
7 | .title {
8 | font-size: 10px;
9 | color: #708090;
10 | font-style: italic;
11 | text-align: center;
12 | padding-bottom: 15px;
13 | }
14 | #calcs {
15 | width: 95%;
16 | }
17 | #pad {
18 | font-family: monospace;
19 | font-size: 17px;
20 | background-color: #FFFAFA;
21 | height: 100%;
22 | width: 59%;
23 | /*font-family: Menlo,Monaco,Consolas,"Courier New",monospace;*/
24 | border: none;
25 |
26 | float: left;
27 | overflow-y: hidden;
28 | margin-right: 0px;
29 | padding-right: 0px;
30 | outline: none;
31 | resize: none;
32 |
33 | -webkit-box-shadow: none;
34 | -moz-box-shadow: none;
35 | box-shadow: none;
36 | display: inline-block;
37 | }
38 |
39 | #answer {
40 | color: #008B8B;
41 | font-size: 17px;
42 | float: right;
43 | width: 40%;
44 | height: 100%;
45 | }
46 |
47 | .numops .keys {
48 | color: #FF8C00;
49 | }
50 |
51 | .numops .operator {
52 | color: #8B0000;
53 | }
54 |
55 | .numops .number {
56 | color: #191970;
57 | }
58 |
--------------------------------------------------------------------------------
/assets/complexcalc.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/assets/complexcalc.gif
--------------------------------------------------------------------------------
/assets/ezgif.com-crop-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/assets/ezgif.com-crop-2.gif
--------------------------------------------------------------------------------
/assets/ezgif.com-crop-3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/assets/ezgif.com-crop-3.gif
--------------------------------------------------------------------------------
/assets/ezgif.com-crop.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/assets/ezgif.com-crop.gif
--------------------------------------------------------------------------------
/assets/quickcalc_design.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/assets/quickcalc_design.jpg
--------------------------------------------------------------------------------
/assets/simplecalc.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cwoodall6/quickcalc/b6dc91f23a6a81c00c318a17980d748f6f185afa/assets/simplecalc.gif
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 | var menubar = require('menubar')
2 | var ipc = require('electron').ipcMain
3 | var globalShortcut = require('electron').globalShortcut
4 | var mb = menubar({ dir: __dirname + '/app', width: 520, height: 100, icon: __dirname + '/app/Icon-Template.png', preloadWindow: true, windowPosition: 'trayCenter' })
5 | var Menu = require('electron').Menu
6 |
7 | mb.on('show', function () {
8 | mb.window.webContents.send('show')
9 | })
10 |
11 | mb.app.on('will-quit', function () {
12 | globalShortcut.unregisterAll()
13 | })
14 |
15 | mb.app.on('activate', function () {
16 | mb.showWindow()
17 | })
18 |
19 | // when receive the abort message, close the app
20 | ipc.on('abort', function () {
21 | mb.hideWindow()
22 | })
23 |
24 | // when receive the abort message, close the app
25 | ipc.on('update-preference', function (evt, pref, initialization) {
26 | registerShortcut(pref['open-window-shortcut'], initialization)
27 | })
28 |
29 | var template = [
30 | {
31 | label: 'quickcalc',
32 | submenu: [
33 | {
34 | label: 'Quit App',
35 | accelerator: 'Command+Q',
36 | selector: 'terminate:'
37 | }, {
38 | label: 'Toggle DevTools',
39 | accelerator: 'Alt+Command+I',
40 | click: function () { mb.window.toggleDevTools() }
41 | }
42 | ]
43 | }
44 | ]
45 |
46 | mb.on('ready', function ready () {
47 | // Build default menu for text editing and devtools. (gone since electron 0.25.2)
48 | var menu = Menu.buildFromTemplate(template)
49 | Menu.setApplicationMenu(menu)
50 | })
51 |
52 | // Register a shortcut listener.
53 | var registerShortcut = function (keybinding, initialization) {
54 | globalShortcut.unregisterAll()
55 |
56 | try {
57 | var ret = globalShortcut.register(keybinding, function () {
58 | mb.window.isVisible() ? mb.hideWindow() : mb.showWindow()
59 | })
60 | } catch (err) {
61 | mb.window.webContents.send('preference-updated', false, initialization)
62 | }
63 |
64 | if (ret) {
65 | mb.window.webContents.send('preference-updated', true, initialization)
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "quickcalc",
3 | "productName": "quickcalc",
4 | "version": "1.0.0",
5 | "description": "Menubar Calculator Made with Electron",
6 | "main": "main.js",
7 | "dependencies": {
8 | "electron-gh-releases": "^2.0.4",
9 | "menubar": "^5.1.0"
10 | },
11 | "scripts": {
12 | "start": "electron .",
13 | "package": "electron-packager . quickcalc --platform=darwin --arch=x64 --out=~/Desktop --overwrite --icon=app/quickcalc.icns ",
14 | "pack": "npm run pack:osx && npm run pack:win",
15 | "pack:osx": "electron-packager . \"quickcalc\" --out=~/Desktop --platform=darwin --arch=x64 --overwrite --icon=app/quickcalc.icns --ignore=dist --ignore=assets --ignore=builder.json --ignore=bower.json --ignore=README.md --ignore=.gitignore --ignore=preview.png",
16 | "pack:win": "electron-packager . \"quickcalc\" --out=~/Desktop --platform=win32 --arch=ia32 --overwrite --icon=app/quickcalc.ico --ignore=dist --ignore=assets --ignore=builder.json --ignore=bower.json --ignore=README.md --ignore=.gitignore --ignore=preview.png"
17 | },
18 | "license": "MIT",
19 | "repository": {
20 | "type": "git",
21 | "url": "https://github.com/Cwoodall6/quickcalc"
22 | },
23 | "keywords": [
24 | "Calculator",
25 | "Menubar",
26 | "Quick",
27 | "Simple"
28 | ],
29 | "author": {
30 | "name": "Chaz Woodall",
31 | "email": "chazwoodall@gmail.com",
32 | "url": "http://chazwoodall.com"
33 | },
34 | "devDependencies": {
35 | "electron": "^1.3.3",
36 | "electron-packager": "^7.7.0"
37 | }
38 | }
39 |
--------------------------------------------------------------------------------