JavaScript Calculator (jscalc)
jscalc is written in JavaScript and CSS3, and may be easilty incorporated into a web-page.
To make it draggable (moveable), jQuery-UI is required.
As well as having basic mathematical functions, many in-build JavaScript functions, such as Math.random (), are available
Installation
Add this line to your application's Gemfile:
gem 'jscalc'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install jscalc
Add the following HTML code to the page where you want the calculator to appear
<div id = "myCalculator"> <div id="panelDiv"> <input type ="text" id = "calcPanel" /> </div> <!--End panelDiv--> </div><!--End myCalculator Div-->
Add the following to the bottom of application.html.erb (the script file must render in the body section of the HTML page, not in the head section)
<%= javascript_include_tag "jscalc.js" %>
Add the following line to the head section of application.html.erb
<%= stylesheet_link_tag "jscalc.css" %>
TO MAKE THE CALCULATOR DRAGGABLE, ensure that jQuery-ui is installed or add the following files to the head section of application.html.erb BEFORE the stylesheet link tag.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
Usage
Math.random()
x = new Date()
x.getMonth()
x.getDate()
x.getDay()
x.getFullYear()
Math.round()
navigator.appName
parseInt(1101,2)
isNaN(2)
typeof(2)
Contributing
Written by Thomas Dowling (tomgdow)
The National College of Ireland