jscalc 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +33 -27
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80f42a3213f6474d4b3bab8f9c569096c7a06cc9
|
4
|
+
data.tar.gz: f0d36f668fa8f3c1e7d893be4abd2ffad5122d44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec873b8c99db9c92d1bd7203a8c376e0d07b0e1dfd4daff7c4a43196d6959d0af79cd0b219b399aadfda5d59d12ef8bbf0d5a00e8fd50859358e08c644691b2
|
7
|
+
data.tar.gz: ad900ad1eebe095f0e6d4b8e11ab3be8fb2fe336a323b67d489afe82ba99bf05466938e67878c37490d1206532ffa8885481578312e7a5e32c822d8afaf7c150
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# JavaScript Calculator (jscalc)
|
2
2
|
[](http://badge.fury.io/rb/jscalc)
|
3
3
|
|
4
|
-
**jscalc is a calculator written entirely in JavaScript and CSS-3, and may be easily incorporated into a
|
4
|
+
**jscalc** is a calculator written entirely in JavaScript and CSS-3, and may be easily incorporated into a
|
5
5
|
web-page. There are no images.
|
6
6
|
|
7
7
|
To make it draggable (moveable), jQuery-UI is required.
|
@@ -11,7 +11,6 @@ functions, such as those available in the **Math** Object are available.
|
|
11
11
|
Examples are **Math.random ()** and **parseInt()**.
|
12
12
|
|
13
13
|
## Installation
|
14
|
-
|
15
14
|
Add this line to your application's Gemfile:
|
16
15
|
|
17
16
|
gem 'jscalc'
|
@@ -27,14 +26,10 @@ Or install it yourself as:
|
|
27
26
|
Add the following HTML code to the page where you want the calculator to appear
|
28
27
|
|
29
28
|
>`<div id = "myCalculator">
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
</div> <!--End panelDiv-->
|
36
|
-
|
37
|
-
</div><!--End myCalculator Div-->`
|
29
|
+
><div id="panelDiv">
|
30
|
+
><input type ="text" id = "calcPanel" />
|
31
|
+
></div> <!--End panelDiv-->
|
32
|
+
></div><!--End myCalculator Div-->`
|
38
33
|
|
39
34
|
|
40
35
|
Add the following to the bottom of **application.html.erb** (the script file must render in the body
|
@@ -46,44 +41,55 @@ Add the following line to the head section of **application.html.erb**
|
|
46
41
|
|
47
42
|
> `<%= stylesheet_link_tag "jscalc.css" %>`
|
48
43
|
|
49
|
-
**
|
44
|
+
**To Make THE Calculator Draggable**
|
45
|
+
|
46
|
+
Ensure that jQuery-ui is installed or add the following code to the Head section of **application.html.erb** BEFORE the stylesheet link tag.
|
50
47
|
|
51
48
|
`<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>`
|
52
49
|
|
53
50
|
`<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>`
|
51
|
+
|
52
|
+
**To Inspect the Code**
|
53
|
+
|
54
|
+
When the gem is installed in an App running on a local machine, the code may be inspected using the following URLs
|
55
|
+
|
56
|
+
`http://localhost:3000/assets/jscalc.js`
|
57
|
+
|
58
|
+
`http://localhost:3000/assets/jscalc.css`
|
59
|
+
|
54
60
|
## Usage
|
55
61
|
|
56
|
-
Math.random()
|
62
|
+
Math.random()
|
57
63
|
|
58
|
-
Math.PI
|
64
|
+
Math.PI
|
59
65
|
|
60
|
-
Math.sqrt()
|
66
|
+
Math.sqrt()
|
61
67
|
|
62
|
-
Math.exp()
|
68
|
+
Math.exp()
|
63
69
|
|
64
|
-
Math.pow(10,3)
|
70
|
+
Math.pow(10,3)
|
65
71
|
|
66
|
-
Math.E
|
72
|
+
Math.E
|
67
73
|
|
68
|
-
Math.round()
|
74
|
+
Math.round()
|
69
75
|
|
70
|
-
x = new Date()
|
76
|
+
x = new Date()
|
71
77
|
|
72
|
-
x.getMonth()
|
78
|
+
x.getMonth()
|
73
79
|
|
74
|
-
x.getDate()
|
80
|
+
x.getDate()
|
75
81
|
|
76
|
-
x.getDay()
|
82
|
+
x.getDay()
|
77
83
|
|
78
|
-
x.getFullYear()
|
84
|
+
x.getFullYear()
|
79
85
|
|
80
|
-
navigator.appName
|
86
|
+
navigator.appName
|
81
87
|
|
82
|
-
parseInt(1101,2)
|
88
|
+
parseInt(1101,2)
|
83
89
|
|
84
|
-
isNaN(2)
|
90
|
+
isNaN(2)
|
85
91
|
|
86
|
-
typeof(2)
|
92
|
+
typeof(2)
|
87
93
|
|
88
94
|
See [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math) for a more comprehensive list.
|
89
95
|
|