-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
349 lines (268 loc) Β· 18.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
ο»Ώ<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="A Trinary Calculator for: + (Addition), - (Subtraction), * (Multiplication), / (Division), ! (NOT), << (Bitwise Left Shift), >> (Bitwise Right Shift), AND / NAND, OR / NOR, XOR / XNOR .">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<meta name="viewport" content="width=device-width" />
<!-- Icon -->
<link rel="shortcut icon" href="/favicon.ico">
<link rel="icon" sizes="16x16 32x32 64x64" href="img/favicon.ico">
<link rel="icon" type="image/png" sizes="196x196" href="img/favicon-192.png">
<link rel="icon" type="image/png" sizes="160x160" href="img/favicon-160.png">
<link rel="icon" type="image/png" sizes="96x96" href="img/favicon-96.png">
<link rel="icon" type="image/png" sizes="64x64" href="img/favicon-64.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16.png">
<link rel="apple-touch-icon" href="img/favicon-57.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/favicon-114.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/favicon-72.png">
<link rel="apple-touch-icon" sizes="144x144" href="img/favicon-144.png">
<link rel="apple-touch-icon" sizes="60x60" href="img/favicon-60.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/favicon-120.png">
<link rel="apple-touch-icon" sizes="76x76" href="img/favicon-76.png">
<link rel="apple-touch-icon" sizes="152x152" href="img/favicon-152.png">
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon-180.png">
<meta name="msapplication-TileColor" content="#FFFFFF">
<meta name="msapplication-TileImage" content="img/favicon-144.png">
<meta name="msapplication-config" content="/browserconfig.xml">
<title>Trinary Calculator</title>
<link rel="stylesheet" href="css/styles.css?v=1.0">
<link rel="stylesheet" type="text/css" href="css/default.css" />
<link rel="stylesheet" type="text/css" href="css/component.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-grid.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-switch.css" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<!-- <link rel="stylesheet" type="text/css" href="css/fontawesome.css" > -->
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jquery.pubsub.js"></script>
<script src="js/bignumber.js"></script>
<script src="js/clipboard.js"></script>
<script src="js/cleave.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap.bundle.js"></script>
<script src="js/bootstrap-switch.js"></script>
<script>
function FilterInput(event) {
var keyCode = ('which' in event) ? event.which : event.keyCode;
isNotWanted = (keyCode == 51 || keyCode == 52 || keyCode == 53 || keyCode == 54 || keyCode == 55 || keyCode == 56 || keyCode == 57 || keyCode == 98 || keyCode == 99 || keyCode == 100 || keyCode == 101 || keyCode == 102 || keyCode == 103 || keyCode == 104 || keyCode == 105 );
return !isNotWanted;
};
function handlePaste (e) {
var clipboardData, pastedData;
// Get pasted data via clipboard API
clipboardData = e.clipboardData || window.clipboardData;
pastedData = clipboardData.getData('Text').toUpperCase();
if(pastedData.indexOf('E')>-1) {
//alert('found an E');
e.stopPropagation();
e.preventDefault();
}
};
// Disable scroll when focused on a number input.
$('form').on('focus', 'input[type=number]', function(e) {
$(this).on('wheel', function(e) {
e.preventDefault();
});
});
// Restore scroll on number inputs.
$('form').on('blur', 'input[type=number]', function(e) {
$(this).off('wheel');
});
// Disable up and down keys.
$('form').on('keydown', 'input[type=number]', function(e) {
if ( e.which == 38 || e.which == 40 )
e.preventDefault();
});
</script>
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<!-- GitHub Ribbon - Start -->
<a href="https://github.com/AYIDouble/Trinary-Calculator-JavaScript" class="ribbon"><img style="position: absolute; top: 0; right: 0; border: 0;" src="img/forkme_right_darkblue.png" alt="Fork me on GitHub"></a>
<!-- GitHub Ribbon - End -->
<header class="col-lg-12 header">
<h1>Trinary Calculator </h1>
<span class="col-lg-12 titleSpan">
<ul class="col-lg-4">
</ul>
<ul class="col-lg-4">
<li>Trinary/Balanced Ternary (0,1,2) <-> (-,0,+)</li>
<li>+ (Addition)</li>
<li>- (Subtraction)</li>
<li>* (Multiplication)</li>
<li>/ (Division)</li>
</ul>
<ul class="col-lg-4">
</ul>
</span>
</header>
<section class="color-1 col-lg-12">
<div class="jumbotron col-lg-10 offset-lg-1 optionsBox">
<div class="container optionContainer">
<h1 class="display-6 h1Options">Options</h1>
<hr class="my-4">
<div class="input-group input-group-lg optionRow">
<!-- Bit Selectbox - Start -->
<div class="input-group mb-3 col-lg-3 leftBox">
<div class="input-group-prepend">
<label class="input-group-text" id="inputGroup-sizing" for="inputGroupSelectBit">Trits</label>
</div>
<select class="custom-select" id="inputGroupSelectBit">
<!-- custom-select-lg, for bigger box -->
<option value="8">8 Trit</option>
<option value="16">16 Trit</option>
<option value="32">32 Trit</option>
<option value="64">64 Trit</option>
<option value="3">3 Trit</option>
<option value="6" selected>6 Trit</option>
<option value="9">9 Trit</option>
<option value="21">21 Trit</option>
<option value="27">27 Trit</option>
<option value="81">81 Trit</option>
<!--<option value="64">64 Trit</option>-->
</select>
</div>
<!-- Bit Selectbox - End -->
<!-- Option Buttons - Signed/Unsigned -->
<div class="input-group mb-3 offset-lg-1 col-lg-2" title="Balanced Ternary (-,0,+)">
<div class="checkbox">
<label>
<input id="checkboxBalanced" type="checkbox" value="">
<span class="cr"><i class="cr-icon fa fa-check"></i></span>
Balanced
</label>
</div>
</div>
<!-- Option Buttons - Signed/Unsigned - End-->
<!-- Option Buttons - AC -->
<div class="input-group mb-3 offset-lg-1 col-lg-1">
<p class="optionButtons AC">
<button class="button button-2 button-2c" id="ACButton">AC</button>
</p>
</div>
<!-- Option Buttons - AC - End -->
<!-- Hexdecimal,Ternary Selectbox - Start -->
<div class="input-group mb-3 offset-lg-1 col-lg-3 rightBox">
<select class="custom-select" id="inputGroupSelectSystem">
<option value="16">Hexadecimal(16)</option> <!-- 16 -->
<option value="8">Octal(8)</option> <!-- 8 -->
<option value="4">Quaternary(4)</option> <!-- 4 -->
<option value="3" selected>Trinary(3)</option> <!-- 3 -->
<option value="2" selected>Binary(2)</option> <!-- 2 -->
</select>
</div>
<!-- Hexdecimal,Ternary Selectbox - End -->
</div>
</div>
</div>
<div class="inputs">
<!-- Input Group - Operand 1 - Start -->
<div class="input-group input-group-lg col-lg-10 offset-lg-1">
<div class="input-group spinner col-lg-2">
<input type="number" pattern="[0-9]*" onkeydown="return( FilterInput(event) || event.ctrlKey || event.altKey || (47<event.keyCode && event.keyCode<58 && event.shiftKey==false) || (95<event.keyCode && event.keyCode<106) || (event.keyCode==8) || (event.keyCode==9) || (event.keyCode>34 && event.keyCode<40) || (event.keyCode==46) )" onpaste="handlePaste(event)" class="decimalInputs form-control" id="operand1Decimal" value="5">
<div class="input-group-btn-vertical">
<button class="btn btn-default plus" id="operand1DecimalPlus" type="button"><i class="fa fa-plus"></i></button>
<button class="btn btn-default minus" id="operand1DecimalMinus" type="button"><i class="fa fa-minus"></i></button>
</div>
</div>
<div class="input-group input-group-lg col-lg-8">
<div class="input-group-prepend">
<span class="input-group-text inputLabel" id="inputGroup-sizing-lg">Operand 1</span>
</div>
<input type="text" class="trinaryInputs form-control" id="operand1Trinary" aria-label="Large" aria-describedby="inputGroup-sizing-sm">
</div>
<!--
<div class="input-group input-group-lg col-lg-2 bitwiseButtonsContainer">
<p class="col-lg-12 bitwiseButtons">
<button class="button button-2 button-2c" id="operand1NOT">~</button>
<button class="button button-2 button-2c" id="operand1LEFTSHIFT"><<</button>
<button class="button button-2 button-2c" id="operand1RIGHTSHIFT">>></button>
</p>
</div>
-->
<div class="input-group col-lg-2 operandSystemContainer">
<input type="text" class="form-control" id="operand1System">
</div>
</div>
<!-- Input Group - End -->
<!-- Input Group - Operand 2 - Start -->
<div class="input-group input-group-lg col-lg-10 offset-lg-1">
<div class="input-group spinner col-lg-2">
<input type="number" pattern="[0-9]*" onkeydown="return( FilterInput(event) || event.ctrlKey || event.altKey || (47<event.keyCode && event.keyCode<58 && event.shiftKey==false) || (95<event.keyCode && event.keyCode<106) || (event.keyCode==8) || (event.keyCode==9) || (event.keyCode>34 && event.keyCode<40) || (event.keyCode==46) )" onpaste="handlePaste(event)" class="decimalInputs form-control" id="operand2Decimal" value="8">
<div class="input-group-btn-vertical">
<button class="btn btn-default plus" id="operand2DecimalPlus" type="button"><i class="fa fa-plus"></i></button>
<button class="btn btn-default minus" id="operand2DecimalMinus" type="button"><i class="fa fa-minus"></i></button>
</div>
</div>
<div class="input-group input-group-lg col-lg-8">
<div class="input-group-prepend">
<span class="input-group-text inputLabel" id="inputGroup-sizing-lg">Operand 2</span>
</div>
<input type="text" class="trinaryInputs form-control" id="operand2Trinary" aria-label="Large" aria-describedby="inputGroup-sizing-sm">
</div>
<!--
<div class="input-group input-group-lg col-lg-2 bitwiseButtonsContainer">
<p class="col-lg-12 bitwiseButtons">
<button class="button button-2 button-2c" id="operand2NOT">~</button>
<button class="button button-2 button-2c" id="operand2LEFTSHIFT"><<</button>
<button class="button button-2 button-2c" id="operand2RIGHTSHIFT">>></button>
</p>
</div>
-->
<div class="input-group col-lg-2 operandSystemContainer">
<input type="text" class="form-control" id="operand2System">
</div>
</div>
<!-- Input Group - Operand 2 - End -->
<!-- Input Group - Result - Start -->
<div class="input-group input-group-lg col-lg-10 offset-lg-1">
<div class="input-group spinner col-lg-2">
<input onClick="this.select();" type="text" pattern="[0-9]*" onkeydown="return( FilterInput(event) || event.ctrlKey || event.altKey || (47<event.keyCode && event.keyCode<58 && event.shiftKey==false) || (95<event.keyCode && event.keyCode<106) || (event.keyCode==8) || (event.keyCode==9) || (event.keyCode>34 && event.keyCode<40) || (event.keyCode==46) )" onpaste="handlePaste(event)" class="decimalInputs form-control" id="resultDecimal" value="13" readonly>
<div class="input-group-btn-vertical">
<button class="btn btn-default" id="resultCopy" type="button" data-clipboard-target="#resultDecimal"><i class="fa fa-copy"></i></button>
</div>
</div>
<div class="input-group input-group-lg col-lg-8">
<div class="input-group-prepend">
<span class="input-group-text inputLabel" id="inputGroup-sizing-lg">Result</span>
</div>
<input onClick="this.select();" type="text" class="trinaryInputs form-control" id="resultTrinary" aria-label="Large" aria-describedby="inputGroup-sizing-sm" readonly>
</div>
<div class="input-group col-lg-2">
<input onClick="this.select();" type="text" class="form-control" id="resultSystem" readonly>
</div>
</div>
<!-- Input Group - Result - End -->
<!-- Input Group - Function Buttons -->
<div class="functionalButtons" id="BTNContainer">
<p class="col-lg-12 BTNRow">
<button class="button button-2 button-2c active" id="addBtn" title="Addition">+</button>
<button class="button button-2 button-2c" id="subBtn" title="Subtraction">-</button>
<button class="button button-2 button-2c" id="mulBtn" title="Multiplication">*</button>
<button class="button button-2 button-2c" id="divBtn" title="Division">/</button>
</p>
<!--
<p class="col-lg-12 BTNRow">
<!--<button class="button button-2 button-2c" id="CNOTBtn">CNOT</button>
<!--<button class="button button-2 button-2c" id="ANDBtn">(&) AND</button>-->
<!--<button class="button button-2 button-2c" id="ORBtn">(|) OR</button>-->
<!--<button class="button button-2 button-2c" id="XORBtn">(^) XOR</button>--><!--
</p>
-->
</div>
<!-- Input Group - Function Buttons - End -->
</div>
</section>
<section class="color-2 col-lg-12 footer">
<a href="https://github.com/AYIDouble" class="gitHubText" target="_blank"><p>Created by AYIDouble (Alpay Yildirim)</p> <p> <img src="img/GitHub_Logo_White.png" alt="GitHub Logo" class="gitHubLogo"></img></p></a>
</section>
</div><!-- /container -->
<script src="js/scripts.js"></script>
</body>
</html>