├── README.md
├── caret.js
├── index.php
├── mathematica.css
├── mathematica.gif
├── mathematica.ico
├── mathematica.js
├── mathematica.php
├── mathematica.png
└── todo
/README.md:
--------------------------------------------------------------------------------
1 | Web Interface for Mathematica
2 | =========================================
3 |
4 | A simple clean **web interface** for a local install of the **Mathematica** kernel.
5 | This is *not* meant as a replacement for Mathematica's rich Notebook interface but
6 | rather, a simple interface for that *quick computation* that is required when you
7 | (or your colleagues) are offsite and all you have is a browser.
8 |
9 | ###### Pre-requisites:
10 |
11 | * **Mathematica** installed on a networked machine
12 | * Web-server (Apache, nginx, etc.) running PHP
13 |
14 | ###### Installation:
15 |
16 | 1. Copy out the files here into a directory inside your DocumentRoot (e.g. `C:/www/mathematica/`)
17 | 2. Change the appropriate variables in `mathematica.php`
18 |
19 |
20 | ###### Screenshot:
21 |
22 | 
23 |
24 |
25 | ###### Notes:
26 |
27 | * Tested with Mathematica 8 on Windows - no major issues. Linux has some issues with graphics but mostly works.
28 | * **Evaluated expressions are independent** - you cannot use a value assigned in a previous expression
29 |
30 |
31 |
--------------------------------------------------------------------------------
/caret.js:
--------------------------------------------------------------------------------
1 | // Set caret position easily in jQuery
2 | // Written by and Copyright of Luke Morton, 2011
3 | // Licensed under MIT
4 | (function ($) {
5 | // Behind the scenes method deals with browser
6 | // idiosyncrasies and such
7 | $.caretTo = function (el, index) {
8 | if (el.createTextRange) {
9 | var range = el.createTextRange();
10 | range.move("character", index);
11 | range.select();
12 | } else if (el.selectionStart != null) {
13 | el.focus();
14 | el.setSelectionRange(index, index);
15 | }
16 | };
17 |
18 | // Another behind the scenes that collects the
19 | // current caret position for an element
20 |
21 | // TODO: Get working with Opera
22 | $.caretPos = function (el) {
23 | if ("selection" in document) {
24 | var range = el.createTextRange();
25 | try {
26 | range.setEndPoint("EndToStart", document.selection.createRange());
27 | } catch (e) {
28 | // Catch IE failure here, return 0 like
29 | // other browsers
30 | return 0;
31 | }
32 | return range.text.length;
33 | } else if (el.selectionStart != null) {
34 | return el.selectionStart;
35 | }
36 | };
37 |
38 | // The following methods are queued under fx for more
39 | // flexibility when combining with $.fn.delay() and
40 | // jQuery effects.
41 |
42 | // Set caret to a particular index
43 | $.fn.caret = function (index, offset) {
44 | if (typeof(index) === "undefined") {
45 | return $.caretPos(this.get(0));
46 | }
47 |
48 | return this.queue(function (next) {
49 | if (isNaN(index)) {
50 | var i = $(this).val().indexOf(index);
51 |
52 | if (offset === true) {
53 | i += index.length;
54 | } else if (typeof(offset) !== "undefined") {
55 | i += offset;
56 | }
57 |
58 | $.caretTo(this, i);
59 | } else {
60 | $.caretTo(this, index);
61 | }
62 |
63 | next();
64 | });
65 | };
66 |
67 | // Set caret to beginning of an element
68 | $.fn.caretToStart = function () {
69 | return this.caret(0);
70 | };
71 |
72 | // Set caret to the end of an element
73 | $.fn.caretToEnd = function () {
74 | return this.queue(function (next) {
75 | $.caretTo(this, $(this).val().length);
76 | next();
77 | });
78 | };
79 | }(jQuery));
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
');
84 | mathematica_prompt();
85 | history = maths.length;
86 | }
87 |
88 |
89 | $(document).ready(function(){
90 | row = $("#row").html();
91 | mathematica_prompt();
92 | $("#clear").click(function(e) { mathematica_clear(); });
93 | });
94 |
95 |
--------------------------------------------------------------------------------
/mathematica.php:
--------------------------------------------------------------------------------
1 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/mathematica.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forhadahmed/mathematica/280ae289c4b01ec2ec0a74817e18f968815a27f5/mathematica.png
--------------------------------------------------------------------------------
/todo:
--------------------------------------------------------------------------------
1 | filter commands that can cause harm
2 | warning to users if they set a variable that their setting will not be permanent
3 | show "loading" gif when user presses enter for a computation
4 | going up in history causes caret to be placed at the beginning of line (should be at end)
5 | global settings tweaks
6 | toggle between text output and rendered output
7 | mobile site
8 | FIX BUGS!
9 |
--------------------------------------------------------------------------------