├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── mathview
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── zanvent
│ │ └── mathview
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── mathscribe
│ │ │ ├── function.js
│ │ │ ├── jqmath-0.4.3.css
│ │ │ ├── jqmath-0.4.6.js
│ │ │ ├── jqmath-etc-0.4.6.min.js
│ │ │ ├── jquery-1.4.3.js
│ │ │ ├── jquery-1.4.3.min.js
│ │ │ ├── jscurry-0.4.5.js
│ │ │ ├── jscurry-0.4.5.min.js
│ │ │ ├── jscurry-documentation.txt
│ │ │ └── view.html
│ └── java
│ │ └── com
│ │ └── zanvent
│ │ └── mathview
│ │ ├── MathView.java
│ │ └── Util.java
│ └── test
│ └── java
│ └── com
│ └── zanvent
│ └── mathview
│ └── ExampleUnitTest.java
├── screenshots
├── screenshot.png
└── screenshot2.png
└── settings.gradle
/.gitattributes:
--------------------------------------------------------------------------------
1 | * linguist-vendored
2 | *.java linguist-vendored=false
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | /app
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2018 Farhan Farooqui
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://jitpack.io/#frhnfrq/MathView)
2 |
3 | # MathView
4 |
5 | `MathView` is a library to render Math equations in Android. It uses [jqMath](https://mathscribe.com/author/jqmath.html) to render math equations.
6 |
7 | ## Setup
8 |
9 | Add it in your **root** build.gradle at the end of repositories:
10 |
11 | ```groovy
12 | allprojects {
13 | repositories {
14 | ...
15 | maven { url 'https://jitpack.io' }
16 | }
17 | }
18 | ```
19 |
20 | Add `implementation 'com.github.frhnfrq:MathView:1.2'` into **dependencies** section of your **module** build.gradle file. For example:
21 |
22 | ```groovy
23 | dependencies {
24 | implementation 'com.github.frhnfrq:MathView:1.2'
25 | }
26 | ```
27 | ## Usage
28 |
29 | #### Add `MathView` in your layout
30 |
31 | ```xml
32 |
36 | ```
37 |
38 | #### Get an instance of it in your code
39 | ```java
40 | MathView mathview = findViewById(R.id.mathview);
41 | mathview.setText("If $ax^2+bx+c=0$ with $a≠0$, then: $$x={-b±√{b^2-4ac}}/{2a}$$");
42 | mathview.setPixelScaleType(Scale.SCALE_DP);
43 | mathview.setTextSize(16);
44 | mathview.setTextColor("#111111");
45 | ```
46 |
47 | ## Screenshot
48 |
49 |
50 | ## How to
51 |
52 | To learn how to write math equations in it, please have a look at [jqMath](https://mathscribe.com/author/jqmath.html).
53 |
54 | ## Advantages
55 |
56 | 1. Faster than MathJax.
57 | 2. Change text size and color easily.
58 | 3. Supports HTML outside of the equation. Example
59 | ```java
60 | mathview.setText("This is a straight line, $\ax + \by = \c$");
61 | ```
62 |
63 |
64 | ## Disadvantages
65 |
66 | 1. Special symbols are typed manually. Example: √ ∑ ∫ ← → + >
67 | 2. Some parts of the MathML standard are not yet implemented in jqMath, such as elementary school mathematics (e.g. “long division”), and “Content MathML.”
68 |
69 |
70 |
71 |
72 | License
73 | =======
74 |
75 | Copyright 2018 Farhan Farooqui
76 |
77 | Licensed under the Apache License, Version 2.0 (the "License");
78 | you may not use this file except in compliance with the License.
79 | You may obtain a copy of the License at
80 |
81 | http://www.apache.org/licenses/LICENSE-2.0
82 |
83 | Unless required by applicable law or agreed to in writing, software
84 | distributed under the License is distributed on an "AS IS" BASIS,
85 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
86 | See the License for the specific language governing permissions and
87 | limitations under the License.
88 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | mavenCentral()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:7.3.1'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | mavenCentral()
22 | maven { url 'https://jitpack.io' }
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | android.enableJetifier=true
10 | android.useAndroidX=true
11 | org.gradle.jvmargs=-Xmx1536m
12 | # When configured, Gradle will run in incubating parallel mode.
13 | # This option should only be used with decoupled projects. More details, visit
14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
15 | # org.gradle.parallel=true
16 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/frhnfrq/MathView/468eabd9645218286a3fd8841fbfefffb9bb8dc4/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Nov 29 08:13:06 MSK 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/mathview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/mathview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | namespace = "com.zanvert.mathview"
5 |
6 | compileSdkVersion 33
7 |
8 | defaultConfig {
9 | minSdkVersion 16
10 | targetSdkVersion 33
11 | versionCode 1
12 | versionName "1.2"
13 |
14 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 |
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: 'libs', include: ['*.jar'])
29 | implementation 'androidx.appcompat:appcompat:1.5.1'
30 | testImplementation 'junit:junit:4.13.2'
31 | androidTestImplementation 'androidx.test.ext:junit:1.1.4'
32 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
33 | }
34 |
--------------------------------------------------------------------------------
/mathview/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/mathview/src/androidTest/java/com/zanvent/mathview/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.zanvent.mathview;
2 |
3 | import android.content.Context;
4 | import androidx.test.platform.app.InstrumentationRegistry;
5 | import androidx.test.ext.junit.runners.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23 |
24 | assertEquals("com.zanvent.mathview.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/mathview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/mathview/src/main/assets/mathscribe/function.js:
--------------------------------------------------------------------------------
1 | function setText(text) {
2 | $("#text").html(text);
3 | var script = document.createElement('script');
4 | script.src = 'jqmath-etc-0.4.6.min.js';
5 | document.head.appendChild(script);
6 | }
7 |
8 | function setTextSize(fontSize) {
9 | $("#text").css("font-size", fontSize + "px");
10 | }
11 |
12 | function setTextColor(colorCode) {
13 | $("#text").css("color", colorCode);
14 | }
--------------------------------------------------------------------------------
/mathview/src/main/assets/mathscribe/jqmath-0.4.3.css:
--------------------------------------------------------------------------------
1 | /* "fm" classes are mostly for imitating MathML in browsers without it; we try to roughly mimic
2 | Firefox's MathML layout, which seems better than http://www.w3.org/TR/mathml-for-css/ */
3 |
4 | /* Cambria [Math]'s line height currently (2/11) is large in most non-Microsoft browsers: */
5 | fmath, .fm-math { font-family: STIXGeneral, 'DejaVu Serif', 'DejaVu Sans',
6 | /* Cambria, 'Cambria Math', */ Times, 'Lucida Sans Unicode',
7 | OpenSymbol, 'Standard Symbols L', serif; line-height: 1.2 }
8 | fmath mtext, .fm-math mtext
9 | { line-height: normal }
10 | fmath mo, .fm-mo, .ma-sans-serif, fmath mi[mathvariant*=sans-serif],
11 | fmath mn[mathvariant*=sans-serif], fmath mtext[mathvariant*=sans-serif],
12 | fmath ms[mathvariant*=sans-serif]
13 | /* some (crossbrowsertesting/browsershots) IE7s require no line break before
14 | 'Lucida Sans Unicode': */
15 | { font-family: STIXGeneral, 'DejaVu Sans', 'DejaVu Serif', /* Cambria, 'Cambria Math', */ 'Lucida Sans Unicode',
16 | 'Arial Unicode MS', 'Lucida Grande', Times,
17 | OpenSymbol, 'Standard Symbols L', sans-serif }
18 | .fm-mo-Luc /* avoid extra space at character tops, especially when stretched */
19 | { font-family: STIXGeneral, 'DejaVu Sans', 'DejaVu Serif', /* Cambria, 'Cambria Math', */ 'Lucida Sans Unicode',
20 | 'Lucida Grande', 'Arial Unicode MS', Times,
21 | OpenSymbol, 'Standard Symbols L', sans-serif }
22 | * html fmath, * html .fm-math, * html fmath mo, * html .fm-mo, * html .IE6-LSU
23 | { font-family: 'Lucida Sans Unicode' !important } /* IE <=6 only */
24 | mo.fm-radic { font-family: 'Lucida Sans Unicode', 'Lucida Grande',
25 | Verdana, sans-serif !important }
26 | .ma-script, fmath mi[mathvariant*=script], fmath mo[mathvariant*=script],
27 | fmath mn[mathvariant*=script], fmath mtext[mathvariant*=script], fmath ms[mathvariant*=script]
28 | { font-family:
29 | 'England Hand DB', 'Embassy BT', 'Amazone BT', 'Bank Script D',
30 | 'URW Chancery L', 'Lucida Calligraphy', 'Apple Chancery',
31 | 'Monotype Corsiva', Corsiva,
32 | 'Vivaldi D', Gabriola, 'Segoe Script', cursive }
33 | .ma-fraktur, fmath mi[mathvariant*=fraktur], fmath mo[mathvariant*=fraktur],
34 | fmath mn[mathvariant*=fraktur], fmath mtext[mathvariant*=fraktur],
35 | fmath ms[mathvariant*=fraktur]
36 | { font-family: UnifrakturMaguntia, Impact, fantasy }
37 | fmath mi[mathvariant*=monospace], fmath mo[mathvariant*=monospace],
38 | fmath mn[mathvariant*=monospace], fmath mtext[mathvariant*=monospace],
39 | fmath ms[mathvariant*=monospace]
40 | { font-family: monospace }
41 | /* .ma-double-struck currently ignored */
42 |
43 | .fm-mi-length-1 { font-style: italic }
44 | fmath mi[mathvariant] { font-style: normal }
45 |
46 | .ma-bold, fmath mi[mathvariant*=bold], fmath mo[mathvariant*=bold],
47 | fmath mn[mathvariant*=bold], fmath mtext[mathvariant*=bold], fmath ms[mathvariant*=bold]
48 | { font-weight: bold }
49 | .ma-nonbold { font-weight: normal }
50 | .ma-upright { font-style: normal !important }
51 | .ma-italic, fmath mi[mathvariant*=italic], fmath mo[mathvariant*=italic],
52 | fmath mn[mathvariant*=italic], fmath mtext[mathvariant*=italic], fmath ms[mathvariant*=italic]
53 | { font-style: italic }
54 |
55 | fmath.ma-block { display: block; text-align: center; text-indent: 0;
56 | page-break-inside: avoid }
57 |
58 | /* note an operator might be 'mo' or "embellished": */
59 | .fm-separator { padding: 0 0.56ex 0 0 }
60 | .fm-infix-loose { padding: 0 0.56ex } /* typically a relation */
61 | .fm-infix { padding: 0 0.44ex }
62 | .fm-prefix { padding: 0 0.33ex 0 0 }
63 | .fm-postfix { padding: 0 0 0 0.33ex }
64 | .fm-prefix-tight { padding: 0 0.11ex 0 0 }
65 | .fm-postfix-tight { padding: 0 0 0 0.11ex }
66 | .fm-quantifier { padding: 0 0.11ex 0 0.22ex } /* to match MathML */
67 | /* fences should have no padding */
68 | .ma-non-marking { display: none }
69 |
70 | .fm-large-op { font-size: 1.3em }
71 | .fm-inline .fm-large-op { font-size: 1em }
72 |
73 | fmath mrow { white-space: nowrap }
74 |
75 | .fm-vert { display: inline-block; vertical-align: middle }
76 |
77 | fmath table, fmath tbody, fmath tr, fmath td /* reset to default(?) styles */
78 | { border: 0 !important; padding: 0 !important; margin: 0 !important;
79 | outline: 0 !important }
80 |
81 | fmath table { border-collapse: collapse !important; text-align: center !important;
82 | table-layout: auto !important; float: none !important }
83 |
84 | .fm-frac { padding: 0 1px !important }
85 | td.fm-den-frac { border-top: solid thin !important }
86 |
87 | .fm-root { font-size: 0.6em }
88 | .fm-radicand { padding: 0 1px 0 0; border-top: solid; margin-top: 0.1em }
89 |
90 | .fm-script { font-size: 0.71em }
91 | .fm-script .fm-script .fm-script { font-size: 1em }
92 |
93 | td.fm-underover-base { line-height: 1 !important }
94 |
95 | td.fm-mtd { padding: 0.5ex 0.4em !important; vertical-align: baseline !important }
96 |
97 | fmath mphantom { visibility: hidden }
98 | fmath menclose, menclose.fm-menclose
99 | { display: inline-block }
100 | fmath menclose[notation=top], menclose.fm-menclose[notation=top]
101 | { border-top: solid thin }
102 | fmath menclose[notation=right], menclose.fm-menclose[notation=right]
103 | { border-right: solid thin }
104 | fmath menclose[notation=bottom], menclose.fm-menclose[notation=bottom]
105 | { border-bottom: solid thin }
106 | fmath menclose[notation=left], menclose.fm-menclose[notation=left]
107 | { border-left: solid thin }
108 | fmath menclose[notation=box], menclose.fm-menclose[notation=box]
109 | { border: solid thin }
110 | fmath none { display: none } /* probably unnecessary */
111 |
112 | mtd.middle, fmath td.middle { vertical-align: middle !important }
113 |
114 | fmath table[columnalign=left], fmath tr[columnalign=left], fmath td[columnalign=left]
115 | { text-align: left !important }
116 | fmath table[columnalign=right], fmath tr[columnalign=right], fmath td[columnalign=right]
117 | { text-align: right !important }
118 | fmath td[rowalign=top]
119 | { vertical-align: top !important }
120 | fmath td[rowalign=bottom]
121 | { vertical-align: bottom !important }
122 | fmath td[rowalign=center]
123 | { vertical-align: middle !important }
124 |
125 | mtable.ma-join-align > mtr > mtd:first-child,
126 | fmath span.ma-join-align > table > tbody > tr > td:first-child
127 | { text-align: right; padding-right: 0 !important }
128 | mtable.ma-join-align > mtr > mtd:first-child + mtd,
129 | fmath span.ma-join-align > table > tbody > tr > td:first-child + td
130 | { text-align: left; padding-left: 0 !important }
131 | mtable.ma-join1-align > mtr > mtd:first-child, /* e.g. for cases after a stretched { */
132 | fmath span.ma-join1-align > table > tbody > tr > td:first-child
133 | { text-align: left; padding-left: 0 !important }
134 |
135 | mtable.ma-binom > mtr > mtd, fmath span.ma-binom > table > tbody > tr > td
136 | { padding: 0 !important }
137 | mtable.ma-binom > mtr:first-child > mtd,
138 | fmath span.ma-binom > table > tbody > tr:first-child > td
139 | { padding: 0 0 0.18em 0 !important }
140 |
--------------------------------------------------------------------------------
/mathview/src/main/assets/mathscribe/jqmath-0.4.6.js:
--------------------------------------------------------------------------------
1 | /* jqmath.js: a JavaScript module for symbolic expressions, e.g. formatted mathematical
2 | formulas. This file uses charset UTF-8, and requires jQuery 1.0+, jsCurry, and jqmath.css.
3 | By default, we use Presentation MathML when available, else simple HTML and CSS.
4 | Expressions may be constructed programmatically, or using a simple TeX-like syntax.
5 |
6 | To use symbolic expressions in a web page or problem domain, one must choose a set of
7 | symbols, ensure they can be viewed by users, and specify precedences for the operator
8 | symbols. We use Unicode character numbers for encoding, and fonts for display. Normally
9 | standard characters and fonts suffice, but "private use" character numbers and custom fonts
10 | can be used when necessary. By default, this module currently uses standard MathML 3
11 | precedences for operator symbols, except we omit "multiple character operator"s like && or
12 | <=, and choose a single precedence for each of |, ^, and _.
13 |
14 | The algorithm to detect MathML only works after some document.body is defined and available.
15 | Thus it should probably not be used during document loading.
16 |
17 | See http://mathscribe.com/author/jqmath.html for usage documentation and examples, and
18 | jscurry.js for some coding conventions and goals. */
19 |
20 | /* Copyright 2017, Mathscribe, Inc. Released under the MIT license (same as jQuery).
21 | See e.g. http://jquery.org/license for an explanation of this license. */
22 |
23 |
24 | "use strict";
25 |
26 |
27 | var jqMath = function() {
28 | var $ = jQuery, F = jsCurry;
29 |
30 | if (! Math.sign)
31 | Math.sign = function(x) {
32 | x = Number(x);
33 | return x > 0 ? 1 : x < 0 ? -1 : x /* +0, -0, or NaN */;
34 | };
35 | if (! Math.trunc)
36 | Math.trunc = function(x) { return (x < 0 ? Math.ceil : Math.floor)(x); };
37 |
38 | function M(x, y, z) /* any number of arguments */ {
39 | if (typeof x == 'number') x = String(x); // e.g. for small integers
40 | if (typeof x == 'string' || Array.isArray(x)) return M.sToMathE(x, y, z);
41 | if (x.nodeType == 1 /* Element */ && x.tagName.toLowerCase() == 'math')
42 | return M.eToMathE(x);
43 | F.err(err_M_);
44 | }
45 |
46 | M.toArray1 = function(g) { return Array.isArray(g) ? g : [g]; };
47 |
48 | M.getSpecAttrP = function(e, attrName) {
49 | var attrP = e.getAttributeNode(attrName);
50 | return attrP && /* for IE6-7: */ attrP.specified !== false ? attrP.value : undefined;
51 | };
52 | M.objToAttrs = function(obj) {
53 | var res = [];
54 | for (var p in obj) res.push({ name: p, value: obj[p] });
55 | return res;
56 | };
57 | M.setAttrs = function(e, attrsP) /* uses attr.name/value/[specified for IE6-7] */ {
58 | if (attrsP && attrsP.length == null) attrsP = M.objToAttrs(attrsP);
59 |
60 | F.iter(function(attr) {
61 | if (attr.specified !== false /* for IE6-7 */)
62 | e.setAttribute(attr.name, attr.value);
63 | }, attrsP || []);
64 | return e;
65 | };
66 |
67 | M.replaceNode = function(newNode, oldNode) /* returns newNode (unlike node.replaceChild) */
68 | {
69 | oldNode.parentNode.replaceChild(newNode, oldNode);
70 | return newNode;
71 | };
72 |
73 | M.addClass = function(e, ws) {
74 | // $(e).addClass(ws) doesn't seem to work for XML elements
75 | if (typeof e.className != 'undefined') { // needed for old IE, works for non-XML
76 | var classes = e.className;
77 | e.className = (classes ? classes+' ' : '')+ws;
78 | } else { // needed for XML, would work for non-IE
79 | var classes = e.getAttribute('class');
80 | e.setAttribute('class', (classes ? classes+' ' : '')+ws);
81 | }
82 | return e;
83 | };
84 | M.eToClassesS = function(e) {
85 | var sP = typeof e.className != 'undefined' ? e.className : e.getAttribute('class');
86 | return sP || '';
87 | };
88 | M.hasClass = function(e, w) { // works for HTML or XML elements, unlike jQuery e.g. 1.4.3
89 | return (' '+M.eToClassesS(e)+' ').replace(/[\n\t]/g, ' ').indexOf(' '+w+' ') != -1;
90 | // we replace /[\n\t]/g to be consistent with jQuery
91 | };
92 |
93 | M.inlineBlock = function(/* ... */) /* each argument is a DOM elt, jQuery object, or HTML
94 | string */ {
95 | var res$ = $('
').css('display', 'inline-block');
96 | if (arguments.length) res$.append.apply(res$, arguments);
97 | return res$[0];
98 | };
99 |
100 | M.tr$ = function(/* ... */) /* each argument is a DOM elt, jQuery object, HTML string, or
101 | Array of them; each argument produces one
*/ {
102 | var appendMF = $.fn.append;
103 | function td$(g) { return appendMF.apply($('
",l).append(M))))).attr("mtagname",s)}else if("msqrt"==s||"mroot"==s){if(f.length!=("msqrt"==s?1:2))throw"Wrong number of <"+s+"> arguments: "+f.length;m=D("",l).attr("mtagname",s);var b=.06*(c[0]+p[0]),g=c[0]+b+.1,v=p[0];if("mroot"==s){var _=.6*(c[1]+p[1]),x=.25/.6-.25;g>_?x+=g/.6-c[1]:(x+=p[1],g=_),m.append(D('',l).append(f[1]).css("verticalAlign",x.toFixed(2)+"em"))}var w=D("",l).addClass("fm-radic").append("√"),A=i(g,v,D('',l).append(f[0]).css("borderTopWidth",b.toFixed(3)+"em"));a(g,v,w[0]),m.append(w).append(A),m[0].fmUp=g,m[0].fmDn=v}else if("msub"==s||"msup"==s||"msubsup"==s||"mmultiscripts"==s){if("mmultiscripts"!=s&&f.length!=("msubsup"==s?3:2))throw"Wrong number of <"+s+"> arguments: "+f.length;for(var g=c[0],v=p[0],N="msup"==s,C=g/.71-.6,k=v/.71-.6,T=1;T').parent().css("verticalAlign",x.toFixed(2)+"em"),e.msieVersion&&(document.documentMode||e.msieVersion)<8&&(f[T].style.zoom=1),"mmultiscripts"==s&&(S||I).push(f[T].parentNode)}"mmultiscripts"==s&&(m=D("").append(D((S||[]).concat(f[0],I))).attr({mtagname:"mmultiscripts",nprescripts:F})),m[0].fmUp=g,m[0].fmDn=v}else if("munder"==s||"mover"==s||"munderover"==s){if(f.length!=("munderover"==s?3:2))throw"Wrong number of <"+s+"> arguments: "+f.length;var P,j=D("
',l).append(D(f));var g=.6,v=.6;O.iter(function(t,r){1==(t.getAttribute(e.MathML?"rowspan":"rowSpan")||1)&&(g=Math.max(g,c[r]),v=Math.max(v,p[r]))},f),m[0].fmUp=g+.25,m[0].fmDn=v+.25}else{if("mtd"!=s){if("mfenced"==s){var h=e.setAttrs(m[0],u);return e.newMe("mrow",e.mfencedToMRowArgs(h),u,l)}throw"Unrecognized or unimplemented MathML tagName: "+s}m=D('
',l).append(D(f)),c[0]>.65&&(m[0].fmUp=c[0]),p[0]>.65&&(m[0].fmDn=p[0]);var h=e.setAttrs(m[0],u);u=void 0;var B=h.getAttribute("rowspan"),Q=h.getAttribute("columnspan");B&&(h.setAttribute("rowSpan",B),e.hasClass(h,"middle")||e.addClass(h,"middle")),Q&&h.setAttribute("colSpan",Q)}return r(e.setAttrs(m[0],u))},e.mfencedToMRowArgs=function(t){function r(t){return e.newMe("mo",t,void 0,n)}"mfenced"==t.tagName.toLowerCase()||O.err(err_mfencedToMRowArgs_);var n=t.ownerDocument,a=[r(O.defOr(e.getSpecAttrP(t,"open"),"(")),r(O.defOr(e.getSpecAttrP(t,"close"),")"))],i=O.slice(t.childNodes);if(0==i.length)return a;var s;if(1==i.length)s=i[0];else{for(var o=O.defOr(e.getSpecAttrP(t,"separators"),",").match(/\S/g),u=o?i.length-1:0,l=0;u>l;l++)i.splice(2*l+1,0,r(o[Math.min(l,o.length-1)]));s=e.newMe("mrow",i,void 0,n)}return a.splice(1,0,s),a},e.spaceMe=function(t,r){return e.newMe("mspace",void 0,{width:t},r)},e.fenceMe=function(t,r,n,a){return e.newMe("mrow",[e.newMe("mo",O.defOr(r,"("),a),t,e.newMe("mo",O.defOr(n,")"),a)],a)},O.iter(function(t){e[t]=O(e.newMe,t)},["mn","mi","mo","mtext","mspace","mrow","mfenced","mfrac","msqrt","mroot","msub","msup","msubsup","mmultiscripts","mprescripts","none","munder","mover","munderover","mtable","mtr","mtd","mstyle","merror","mpadded","mphantom","menclose"]),e.setMathBlockQ=function(t,r){return r?(t.setAttribute("display","block"),e.addClass(t,"ma-block")):e.MathML||D(t).addClass("fm-inline"),t},e.math=function(t,r,n){return e.setMathBlockQ(e.newMe("math",t,n),r)},e.eToMathE=function(t){function n(e){return 1!=e.nodeType?e:(O.elem(e.tagName,$)||O.iter(n,e.childNodes),r(e))}function a(t){function r(r){return 3==r.nodeType?/^\s*$/.test(r.data)?[]:[e.mtext(r.data,i)]:8==r.nodeType?[]:(1==t.nodeType||O.err(err_newMeDeep_),[a(r)])}var n=t.tagName.toLowerCase(),s=t.childNodes;O.elem(n,$)?"mo"==n&&1==s.length&&3==s[0].nodeType&&"-"==s[0].data&&(s=e["-"]):s=O.concatMap(r,s);var o=e.newMe(n,s,t.attributes,i);return"math"==n&&e.setMathBlockQ(o,"block"==t.getAttribute("display")),o}if((null==e.MathML||"math"!=t.tagName.toLowerCase())&&O.err(err_eToMathE_),e.MathML&&"math"==t.tagName)return E?n(t):t;var i=t.ownerDocument;return a(t)},e["-"]="−",e.trimNumS=function(e){return e.replace(/(\d\.\d*?)0+(?!\d)/g,"$1").replace(/(\d)\.(?!\d)/g,"$1").replace(/[-\u2212]0(?![.\d])/g,"0")},e.numS=function(t,r){return r&&(t=e.trimNumS(t)),t.replace(/Infinity/gi,"∞").replace(/NaN/gi,"{?}").replace(/e(-\d+)/gi,"·10^{$1}").replace(/e\+?(\d+)/gi,"·10^$1").replace(/-/g,e["-"])},e.combiningChar_="[̀-ͯ᷀-᷿⃐-︠-︯]",e.surrPair_="[�-�][�-�]";var U,q="[\\\\`]([A-Za-z]+|.)";e.decimalComma=function(t){if(null!=t){U=t;var r=(t?"\\d*,\\d+|":"")+"\\d+\\.?\\d*|\\.\\d+";e.re_=RegExp("("+r+")|"+q+"|"+e.surrPair_+"|\\S"+e.combiningChar_+"*","g")}return U};var B="af|an|ar|av|az|ba|be|bg|bs|ca|ce|co|cs|cu|cv|da|de|el|es|et|eu|fi|fo|fr|gl|hr|hu|hy|id|is|it|jv|kk|kl|kv|lb|lt|lv|mk|mn|mo|nl|no|os|pl|pt|ro|ru|sc|sk|sq|sr|su|sv|tr|tt|ug|uk|vi|yi";e.decimalComma(RegExp("^("+B+")\\b","i").test(document.documentElement.lang)),e.infix_={"⊂⃒":240,"⊃⃒":240,"≪̸":260,"≫̸":260,"⪯̸":260,"⪰̸":260,"∽̱":265,"≂̸":265,"≎̸":265,"≏̸":265,"≦̸":265,"≿̸":265,"⊏̸":265,"⊐̸":265,"⧏̸":265,"⧐̸":265,"⩽̸":265,"⩾̸":265,"⪡̸":265,"⪢̸":265," ":390,"":500},e.prefix_={},e.postfix_={},s(e.infix_,[[21,"|"],[30,";"],[40,","],[70,"∴∵"],[100,":"],[110,"϶"],[150,"…⋮⋯⋱"],[160,"∋"],[170,"⊢⊣⊤⊨⊩⊬⊭⊮⊯"],[190,"∨"],[200,"∧"],[240,"∁∈∉∌⊂⊃⊄⊅⊆⊇⊈⊉⊊⊋"],[241,"≤"],[242,"≥"],[243,">"],[244,"≯"],[245,"<"],[246,"≮"],[247,"≈"],[250,"∼≉"],[252,"≢"],[255,"≠"],[260,"=∝∤∥∦≁≃≄≅≆≇≍≔≗≙≚≜≟≡≨≩≪≫≭≰≱≺≻≼≽⊀⊁⊥⊴⊵⋉⋊⋋⋌⋔⋖⋗⋘⋙⋪⋫⋬⋭■□▪▫▭▮▯▰▱△▴▵▶▷▸▹▼▽▾▿◀◁◂◃◄◅◆◇◈◉◌◍◎●◖◗◦⧀⧁⧣⧤⧥⧦⧳⪇⪈⪯⪰"],[265,"⁄∆∊∍∎∕∗∘∙∟∣∶∷∸∹∺∻∽∾∿≂≊≋≌≎≏≐≑≒≓≕≖≘≝≞≣≦≧≬≲≳≴≵≶≷≸≹≾≿⊌⊍⊎⊏⊐⊑⊒⊓⊔⊚⊛⊜⊝⊦⊧⊪⊫⊰⊱⊲⊳⊶⊷⊹⊺⊻⊼⊽⊾⊿⋄⋆⋇⋈⋍⋎⋏⋐⋑⋒⋓⋕⋚⋛⋜⋝⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩⋰⋲⋳⋴⋵⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿▲❘⦁⦂⦠⦡⦢⦣⦤⦥⦦⦧⦨⦩⦪⦫⦬⦭⦮⦯⦰⦱⦲⦳⦴⦵⦶⦷⦸⦹⦺⦻⦼⦽⦾⦿⧂⧃⧄⧅⧆⧇⧈⧉⧊⧋⧌⧍⧎⧏⧐⧑⧒⧓⧔⧕⧖⧗⧘⧙⧛⧜⧝⧞⧠⧡⧢⧧⧨⧩⧪⧫⧬⧭⧮⧰⧱⧲⧵⧶⧷⧸⧹⧺⧻⧾⧿⨝⨞⨟⨠⨡⨢⨣⨤⨥⨦⨧⨨⨩⨪⨫⨬⨭⨮⨰⨱⨲⨳⨴⨵⨶⨷⨸⨹⨺⨻⨼⨽⨾⩀⩁⩂⩃⩄⩅⩆⩇⩈⩉⩊⩋⩌⩍⩎⩏⩐⩑⩒⩓⩔⩕⩖⩗⩘⩙⩚⩛⩜⩝⩞⩟⩠⩡⩢⩣⩤⩥⩦⩧⩨⩩⩪⩫⩬⩭⩮⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪⪫⪬⪭⪮⪱⪲⪳⪴⪵⪶⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫚⫛⫝⫝⫞⫟⫠⫡⫢⫣⫤⫥⫦⫧⫨⫩⫪⫫⫬⫭⫮⫯⫰⫱⫲⫳⫴⫵⫶⫷⫸⫹⫺⫻⫽⫾"],[270,"←↑→↓↔↕↖↗↘↙↚↛↜↝↞↟↠↡↢↣↤↥↦↧↨↩↪↫↬↭↮↯↰↱↲↳↴↵↶↷↸↹↺↻↼↽↾↿⇀⇁⇂⇃⇄⇅⇆⇇⇈⇉⇊⇋⇌⇍⇎⇏⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙⇚⇛⇜⇝⇞⇟⇠⇡⇢⇣⇤⇥⇦⇧⇨⇩⇪⇫⇬⇭⇮⇯⇰⇱⇲⇳⇴⇵⇶⇷⇸⇹⇺⇻⇼⇽⇾⇿⊸⟰⟱⟵⟶⟷⟸⟹⟺⟻⟼⟽⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤈⤉⤊⤋⤌⤍⤎⤏⤐⤑⤒⤓⤔⤕⤖⤗⤘⤙⤚⤛⤜⤝⤞⤟⤠⤡⤢⤣⤤⤥⤦⤧⤨⤩⤪⤫⤬⤭⤮⤯⤰⤱⤲⤳⤴⤵⤶⤷⤸⤹⤺⤻⤼⤽⤾⤿⥀⥁⥂⥃⥄⥅⥆⥇⥈⥉⥊⥋⥌⥍⥎⥏⥐⥑⥒⥓⥔⥕⥖⥗⥘⥙⥚⥛⥜⥝⥞⥟⥠⥡⥢⥣⥤⥥⥦⥧⥨⥩⥪⥫⥬⥭⥮⥯⥰⥱⥲⥳⥴⥵⥶⥷⥸⥹⥺⥻⥼⥽⥾⥿⦙⦚⦛⦜⦝⦞⦟⧟⧯⧴⭅⭆"],[275,"+-±−∓∔⊞⊟"],[300,"⊕⊖⊘"],[340,"≀"],[350,"∩∪"],[390,"*.ו⊠⊡⋅⨯⨿"],[400,"·"],[410,"⊗"],[640,"%"],[650,"\\∖"],[660,"/÷"],[710,"⊙"],[825,"@"],[835,"?"],[850,""],[880,"^_"]]),s(e.prefix_,[[10,"‘“"],[20,"([{‖⌈⌊❲⟦⟨⟪⟬⟮⦀⦃⦅⦇⦉⦋⦍⦏⦑⦓⦕⦗⧼"],[230,"∀∃∄"],[290,"∑⨊⨋"],[300,"∬∭⨁"],[310,"∫∮∯∰∱∲∳⨌⨍⨎⨏⨐⨑⨒⨓⨔⨕⨖⨗⨘⨙⨚⨛⨜"],[320,"⋃⨃⨄"],[330,"⋀⋁⋂⨀⨂⨅⨆⨇⨈⨉⫼⫿"],[350,"∏∐"],[670,"∠∡∢"],[680,"¬"],[740,"∂∇"],[845,"ⅅⅆ√∛∜"]]),s(e.postfix_,[[10,"’”"],[20,")]}‖⌉⌋❳⟧⟩⟫⟭⟯⦀⦄⦆⦈⦊⦌⦎⦐⦒⦔⦖⦘⧽"],[800,"′♭♮♯"],[810,"!"],[880,"&'`~¨¯°´¸ˆˇˉˊˋˍ˘˙˚˜˝˷̂̑‾⃛⃜⎴⎵⏜⏝⏞⏟⏠⏡"]]);var Q,V,W,H,X;e.macros_={mn:O(c,"mn"),mi:O(c,"mi"),mo:O(c,"mo"),text:O(c,"mtext"),html:p,sp:d,attr:g,attrMML:O(g,null,!0),id:O(g,"id"),dir:O(g,"dir"),cl:v,mv:y,bo:O(y,"bold"),it:O(y,"italic"),bi:O(y,"bold-italic"),sc:O(y,"script"),bs:O(y,"bold-script"),fr:O(y,"fraktur"),ds:O(y,"double-struck"),bf:O(y,"bold-fraktur"),mstyle:O(M,"mstyle"),merror:O(M,"merror"),mpadded:O(M,"mpadded"),phantom:O(b,"phantom"),vphantom:O(b,"vphantom"),enclose:O(M,"menclose"),ov:_,minsize:x,mrowOne:w,binom:A},e.alias_={"-":e["-"],"'":"′","ℭ":["C","fraktur"],"ℌ":["H","fraktur"],"ℑ":["I","fraktur"],"ℜ":["R","fraktur"],"ℨ":["Z","fraktur"],
4 | "ℬ":["B","script"],"ℰ":["E","script"],"ℱ":["F","script"],"ℋ":["H","script"],"ℐ":["I","script"],"ℒ":["L","script"],"ℳ":["M","script"],"ℛ":["R","script"],"ℯ":["e","script"],"ℊ":["g","script"],"ℴ":["o","script"]};var Z={",":".17em",":":".22em",";":".28em","!":"-.17em"};e.dtableQ=!1,e.macro1s_={mtd:C,rowspan:k,colspan:T,mtr:L,dtable:O(S,!0),ttable:O(S,!1),table:O(S,void 0),math:I};var J={_:"sub","^":"sup","↙":"under","↖":"over"};return e.sMxAToMe=function(t,r){r||(r=document),e.infix_[""]&&e.infix_[","]||O.err(err_sToMe_1_),void 0===e.MathML&&(e.MathML=e.canMathML()),e.re_.lastIndex=0,Q="",V=Array.isArray(t)?t:[t],W=0,H=r,X=e.infix_[""];var n=j(0);if(n[1])throw"Extra input: "+n[1][1]+Q.substring(e.re_.lastIndex)+(Wm&&(u+=s.substring(m,c)),f&&f[1])u+=f[1];else{var p,d=-1;if(f){if(p="\\("==f[0]?"\\)":"\\["==f[0]?"\\]":f[0],l.lastIndex",i).css("display","inline-block").append(g);v=D("",i).css("white-space","nowrap").append(v),g=v[0]}o.push(g),l.lastIndex=d+p.length}}O.iter(function(e){t.parentNode.insertBefore(e,t)},o),t.parentNode.removeChild(t)}},e.parseMathQ=!0,D(function(){if(void 0===e.MathML&&(e.MathML=e.canMathML()),e.parseMathQ)try{e.parseMath(document.body)}catch(t){alert(t)}}),null==D.fn.parseMath&&(D.fn.parseMath=function(){return O.iter(e.parseMath,this),this}),e}(),M;void 0===M&&(M=jqMath);
--------------------------------------------------------------------------------
/mathview/src/main/assets/mathscribe/jscurry-0.4.5.js:
--------------------------------------------------------------------------------
1 | /* jscurry.js: a JavaScript module for functional programming; requires ECMAScript 3. These
2 | definitions are based on Haskell's, but allow side effects, and do not use automatic lazy
3 | evaluation, compile-time type checking, or automatic Currying.
4 |
5 | We believe that "member functions" are the wrong technique in general for implementing
6 | function closures or passing functions to polymorphic algorithms.
7 |
8 | Variable suffixes (in this and other modules):
9 | F: function
10 | P ("Possible" or "Pointer"): undefined and maybe null treated specially
11 | Q ("Question"): value effectively converted to a boolean when used
12 | S: string
13 | _: a (usually non-constant) variable with a large scope
14 | $: a jQuery() result or "wrapped set"
15 |
16 | These library modules aim to be small, efficient, compatible with standards, and hopefully
17 | elegant. */
18 |
19 | /* Copyright 2016, Mathscribe, Inc. Released under the MIT license (same as jQuery).
20 | See e.g. http://jquery.org/license for an explanation of this license. */
21 |
22 |
23 | "use strict";
24 |
25 |
26 | var jsCurry = function() {
27 | var sliceMF = Array.prototype.slice; // slice "Member Function"
28 |
29 | // provide a few basic ECMAScript 5 functions if they are missing:
30 | if (! Function.prototype.bind)
31 | Function.prototype.bind = function(thisArg /* , ... */) {
32 | var f = this, args0 = sliceMF.call(arguments, 1);
33 | return function(/* ... */) {
34 | return f.apply(thisArg, args0.concat(sliceMF.call(arguments, 0)));
35 | };
36 | };
37 | if (! String.prototype.trim)
38 | String.prototype.trim = function() { return String(this).replace(/^\s+|\s+$/g, ''); };
39 | if (! Array.isArray)
40 | Array.isArray = function(x) {
41 | return typeof x == 'object' && x !== null &&
42 | Object.prototype.toString.call(x) === '[object Array]';
43 | };
44 | if (! Object.keys)
45 | Object.keys = function(obj) {
46 | var res = [];
47 | for (var p in obj) if (obj.hasOwnProperty(p)) res.push(p);
48 | return res;
49 | };
50 | if (! Date.now) Date.now = function() { return (new Date()).getTime(); };
51 |
52 | function F(x /* , ... */) { // F() shorthand notation for some basic operations
53 | if (typeof x == 'function') return F.curry.apply(undefined, arguments);
54 | if (arguments.length == 2) {
55 | var y = arguments[1];
56 | if (typeof x == 'string') return y[x].bind(y);
57 | if (typeof y == 'function')
58 | return (typeof x == 'number' ? F.aritize : F.partial)(x, y);
59 | }
60 | arguments.length == 1 || F.err(err_F_1_);
61 | if (typeof x == 'number' || typeof x == 'string') return F.pToF(x);
62 | if (x.nodeType == 1 /* Element */) // requires jQuery 1.4+; e.g. for widget ops
63 | return jQuery.data(x);
64 | if (x && typeof x == 'object') return F.aToF(x);
65 | F.err(err_F_2_);
66 | }
67 |
68 | F.err = function() { if (F.debug) debugger; throw Error('Assertion failed'); };
69 | // usually argument evaluation intentionally fails, to report its line number
70 |
71 | F.id = function(x) { return x; };
72 | F.constant = function(x) { return function(/* ... */) { return x; }; };
73 | // "const" is a reserved word in ECMAScript 3
74 | F.applyF = function(f, args) { return f.apply(undefined, args); }
75 | F.curry = function(f /* , ... */)
76 | { var g = f; arguments[0] = undefined; return g.bind.apply(g, arguments); };
77 | F._ = {}; // needed since e.g. (0 in [ , 3]) is apparently wrong in e.g. Firefox 3.0
78 | F.partial = function(a, f) { // 'a' supplies some arguments to 'f'
79 | var n = a.length;
80 | return function(/* ... */) {
81 | var args = sliceMF.call(arguments, 0);
82 | for (var i = 0; i < n; i++)
83 | if (a[i] !== F._) args.splice(i, 0, a[i]);
84 | else if (args.length == i) args.push(undefined);
85 | return f.apply(this, args);
86 | };
87 | };
88 | F.uncurry = function(f) { return function(x, y) { return f(x)(y); }; };
89 | F.o = function(/* ... */) { // composition of 1 or more functions
90 | var fs = arguments;
91 | return function(/* ... */) {
92 | var n = fs.length, res = fs[--n].apply(undefined, arguments);
93 | while (n > 0) res = fs[--n](res);
94 | return res;
95 | };
96 | };
97 | F.oMap = function(f, g) // composition, using F.map(g, )
98 | { return function(/* ... */) { return F.applyF(f, F.map(g, arguments)); }; };
99 | F.flip = function(f) { return function(x, y) { return f(y, x); }; };
100 | F.seqF = function(/* ... */) {
101 | var fs = arguments, n = fs.length;
102 | return function(/* ... */) {
103 | var y;
104 | for (var i = 0; i < n; i++) y = fs[i].apply(undefined, arguments);
105 | return y; // returns undefined if n == 0
106 | };
107 | };
108 | F.cor = function(/* ... */) { // conditional or
109 | var fs = arguments;
110 | return function(/* ... */) { return F.any(F([F._, arguments], F.applyF), fs); };
111 | };
112 | F.aritize = function(n, f) // for discarding optional trailing arguments
113 | { return function(/* ... */) { return F.applyF(f, sliceMF.call(arguments, 0, n)); }; };
114 |
115 | F.not = function(x) { return ! x; };
116 | F.defOr = function(xP, y) { return xP !== undefined ? xP : y; };
117 |
118 | /* The following functions that act on arrays also work on "array-like" objects (with a
119 | 'length' property), including array-like host objects. The functions may or may not
120 | skip missing elements. */
121 |
122 | // A "cmp" function returns 0, < 0, or > 0 for ==, <, or > respectively.
123 | F.cmpX = function(x, y) { return x - y; }; // for finite numbers, or Dates
124 | F.cmpJS = function(s, t) { return s < t ? -1 : s == t ? 0 : 1; };
125 | // JavaScript built-in comparison; for numbers, strings, or Dates; NaN => !=
126 | F.cmpLex = function(cmpE, v, w) // "lexicographic order"; cmpE need not return a number
127 | { return F.any(function(e, i) { return i == w.length ? 1 : cmpE(e, w[i]); }, v) ||
128 | v.length - w.length; };
129 | F.eqTo = function(x, cmpP) {
130 | if (! cmpP) cmpP = function(y, z) { return y !== z; };
131 | return F.o(F.not, F(cmpP, x));
132 | };
133 |
134 | F.pToF = function(p) { return function(obj) { return obj[p]; }; };
135 | F.aToF = function(obj) { return function(p) { return obj[p]; }; };
136 | F.fToA = function(f, n) {
137 | var a = new Array(n);
138 | for (var i = 0; i < n; i++) a[i] = f(i);
139 | return a;
140 | };
141 | F.memoF = function(f, memo) {
142 | if (! memo) memo = {};
143 | return function(p) { return memo.hasOwnProperty(p) ? memo[p] : (memo[p] = f(p)); };
144 | };
145 | F.replicate = function(n, e) { return F.fToA(F.constant(e), n); };
146 | F.setF = function(obj, p, v) { obj[p] = v; };
147 | F.obj1 = function(p, v) { var res = {}; res[p] = v; return res; };
148 |
149 | F.slice = function(a, startP, endP) {
150 | if (startP == null) startP = 0;
151 | if (Array.isArray(a)) return a.slice(startP, endP);
152 | var n = a.length;
153 | startP = startP < 0 ? Math.max(0, n + startP) : Math.min(n, startP);
154 | endP = endP === undefined ? n : endP < 0 ? Math.max(0, n + endP) : Math.min(n, endP);
155 | var res = [];
156 | while (startP < endP) res.push(a[startP++]);
157 | return res;
158 | };
159 | F.array = function(/* ... */) { return sliceMF.call(arguments, 0); };
160 | F.concatArgs = F.oMap(F('concat', []),
161 | function(a) { return Array.isArray(a) ? a : F.slice(a); });
162 | F.concatMap = function(f, a) { return F.applyF(F.concatArgs, F.map(f, a)); };
163 | F.reverseCopy = function(a) { return F.slice(a).reverse(); };
164 |
165 | F.findIndex = function(qF, a) {
166 | var n = a.length;
167 | for (var i = 0; i < n; i++) if (qF(a[i], i, a)) return i;
168 | return -1;
169 | };
170 | F.findLastIndex = function(qF, a) {
171 | for (var i = a.length; --i >= 0; ) if (qF(a[i], i, a)) return i;
172 | return -1;
173 | };
174 | F.find = function(qF, a) {
175 | var j = F.findIndex(qF, a);
176 | return j == -1 ? undefined : a[j];
177 | };
178 | F.elemIndex = function(e, a, cmpP) {
179 | if (a.indexOf && ! cmpP && Array.isArray(a)) return a.indexOf(e);
180 | return F.findIndex(F.eqTo(e, cmpP), a);
181 | };
182 | F.elemLastIndex = function(e, a, cmpP) {
183 | if (a.lastIndexOf && ! cmpP && Array.isArray(a)) return a.lastIndexOf(e);
184 | return F.findLastIndex(F.eqTo(e, cmpP), a);
185 | };
186 | F.elem = function(e, a, cmpP) { return F.elemIndex(e, a, cmpP) != -1; };
187 | F.all = function(qF, a) {
188 | if (a.every && Array.isArray(a)) return a.every(qF);
189 | var n = a.length;
190 | for (var i = 0; i < n; i++) if (! qF(a[i], i, a)) return false;
191 | return true;
192 | };
193 | F.any = function(f, a) /* note result may be non-boolean */ {
194 | var n = a.length, y = false /* in case n == 0 */;
195 | for (var i = 0; i < n; i++) {
196 | y = f(a[i], i, a);
197 | if (y) return y;
198 | }
199 | return y;
200 | };
201 | F.iter = function(f, a /* , ... */) {
202 | if (arguments.length == 2) { // for speed
203 | if (a.forEach && Array.isArray(a)) return a.forEach(f);
204 | var n = a.length;
205 | for (var i = 0; i < n; i++) f(a[i], i, a);
206 | } else {
207 | arguments.length > 2 || F.err(err_iter_);
208 | var args = sliceMF.call(arguments, 1),
209 | n = F.applyF(Math.min, F.map(F('length'), args));
210 | for (var i = 0; i < n; i++) F.applyF(f, F.map(F(i), args).concat(i, args));
211 | }
212 | };
213 | F.map = function(f, a) {
214 | if (a.map && Array.isArray(a)) return a.map(f);
215 | var n = a.length, res = new Array(n);
216 | for (var i = 0; i < n; i++) res[i] = f(a[i], i, a);
217 | return res;
218 | };
219 | F.map1 = function(f, a) { return F.map(F(1, f), a); };
220 | F.zipWith = function(f /* , ... */) {
221 | arguments.length > 1 || F.err(err_zipWith_);
222 | var res = [];
223 | for (var i = 0; ; i++) {
224 | var args = [];
225 | for (var j = 1; j < arguments.length; j++) {
226 | var a = arguments[j];
227 | if (i < a.length) args.push(a[i]);
228 | else return res;
229 | }
230 | res.push(F.applyF(f, args));
231 | }
232 | return res;
233 | };
234 | F.zip = F(F.zipWith, F.array);
235 | F.unzip = // matrix transpose, similar to Haskell unzip/unzip3/unzip4/...
236 | function(zs) { return zs.length ? F.applyF(F.zip, zs) : []; };
237 | F.filter = function(qF, a) {
238 | if (a.filter && Array.isArray(a)) return a.filter(qF);
239 | return F.fold(function(y, e, i, a) { if (qF(e, i, a)) y.push(e); return y; }, a, []);
240 | };
241 | F.fold = function(op, a, xOpt) {
242 | if (a.reduce && Array.isArray(a))
243 | return arguments.length < 3 ? a.reduce(op) : a.reduce(op, xOpt);
244 | var n = a.length, i = 0;
245 | if (arguments.length < 3) xOpt = n ? a[i++] : F.err(err_fold_);
246 | for ( ; i < n; i++) xOpt = op(xOpt, a[i], i, a);
247 | return xOpt;
248 | };
249 | F.foldR = function(op, a, xOpt) { // similar to Haskell (foldr (flip op) xOpt a)
250 | if (a.reduceRight && Array.isArray(a))
251 | return arguments.length < 3 ? a.reduceRight(op) : a.reduceRight(op, xOpt);
252 | var n = a.length;
253 | if (arguments.length < 3) xOpt = n ? a[--n] : F.err(err_foldR_);
254 | while (--n >= 0) xOpt = op(xOpt, a[n], n, a);
255 | return xOpt;
256 | };
257 |
258 | F.sum = function(a) {
259 | var n = a.length, res = 0;
260 | for (var i = 0; i < n; i++) res += a[i];
261 | return res;
262 | };
263 |
264 | F.test = function(t) { // e.g. for dynamic type checking when appropriate
265 | if (t === 0 || t === '') t = typeof t;
266 | if (typeof t == 'string') return function(x) { return typeof x == t; };
267 | if (t === Array || t === Date || t === RegExp) // assumes same frame
268 | return function(x) { return x != null && x.constructor == t; };
269 | if (t === null) return F.eqTo(null);
270 | if (t.constructor == RegExp) return F('test', t); // assumes same frame
271 | if (typeof t == 'function') return t;
272 | if (Array.isArray(t)) {
273 | if (t.length == 1) {
274 | t = F.test(t[0]);
275 | return function(x) { return Array.isArray(x) && F.all(t, x); };
276 | } else { // "or" of tests
277 | t = F.map(F.test, t);
278 | return function(x) { return F.any(function(qF) { return qF(x); }, t); };
279 | }
280 | }
281 | if (typeof t == 'object') {
282 | var ks = Object.keys(t), fs = F.map(F.o(F.test, F(t)), ks);
283 | return function(x)
284 | { return x != null && F.all(function(k, i) { return fs[i](x[k]); }, ks); };
285 | }
286 | F.err(err_test_);
287 | };
288 |
289 | F.translations_ = {}; // can override, e.g. in language translation files
290 | F.s = function(s) { return F.translations_[s] || s; };
291 |
292 | return F;
293 | }();
294 | var F; if (F === undefined) F = jsCurry;
295 | if (typeof module == 'object') module.exports = jsCurry;
296 |
--------------------------------------------------------------------------------
/mathview/src/main/assets/mathscribe/jscurry-0.4.5.min.js:
--------------------------------------------------------------------------------
1 | /* Copyright 2016, Mathscribe, Inc. Released under the MIT license (same as jQuery).
2 | See e.g. http://jquery.org/license for an explanation of this license. */
3 | "use strict";var jsCurry=function(){function r(n){if("function"==typeof n)return r.curry.apply(void 0,arguments);if(2==arguments.length){var t=arguments[1];if("string"==typeof n)return t[n].bind(t);if("function"==typeof t)return("number"==typeof n?r.aritize:r.partial)(n,t)}return 1==arguments.length||r.err(err_F_1_),"number"==typeof n||"string"==typeof n?r.pToF(n):1==n.nodeType?jQuery.data(n):n&&"object"==typeof n?r.aToF(n):void r.err(err_F_2_)}var n=Array.prototype.slice;return Function.prototype.bind||(Function.prototype.bind=function(r){var t=this,e=n.call(arguments,1);return function(){return t.apply(r,e.concat(n.call(arguments,0)))}}),String.prototype.trim||(String.prototype.trim=function(){return String(this).replace(/^\s+|\s+$/g,"")}),Array.isArray||(Array.isArray=function(r){return"object"==typeof r&&null!==r&&"[object Array]"===Object.prototype.toString.call(r)}),Object.keys||(Object.keys=function(r){var n=[];for(var t in r)r.hasOwnProperty(t)&&n.push(t);return n}),Date.now||(Date.now=function(){return(new Date).getTime()}),r.err=function(){throw r.debug,Error("Assertion failed")},r.id=function(r){return r},r.constant=function(r){return function(){return r}},r.applyF=function(r,n){return r.apply(void 0,n)},r.curry=function(r){var n=r;return arguments[0]=void 0,n.bind.apply(n,arguments)},r._={},r.partial=function(t,e){var u=t.length;return function(){for(var i=n.call(arguments,0),o=0;u>o;o++)t[o]!==r._?i.splice(o,0,t[o]):i.length==o&&i.push(void 0);return e.apply(this,i)}},r.uncurry=function(r){return function(n,t){return r(n)(t)}},r.o=function(){var r=arguments;return function(){for(var n=r.length,t=r[--n].apply(void 0,arguments);n>0;)t=r[--n](t);return t}},r.oMap=function(n,t){return function(){return r.applyF(n,r.map(t,arguments))}},r.flip=function(r){return function(n,t){return r(t,n)}},r.seqF=function(){var r=arguments,n=r.length;return function(){for(var t,e=0;n>e;e++)t=r[e].apply(void 0,arguments);return t}},r.cor=function(){var n=arguments;return function(){return r.any(r([r._,arguments],r.applyF),n)}},r.aritize=function(t,e){return function(){return r.applyF(e,n.call(arguments,0,t))}},r.not=function(r){return!r},r.defOr=function(r,n){return void 0!==r?r:n},r.cmpX=function(r,n){return r-n},r.cmpJS=function(r,n){return n>r?-1:r==n?0:1},r.cmpLex=function(n,t,e){return r.any(function(r,t){return t==e.length?1:n(r,e[t])},t)||t.length-e.length},r.eqTo=function(n,t){return t||(t=function(r,n){return r!==n}),r.o(r.not,r(t,n))},r.pToF=function(r){return function(n){return n[r]}},r.aToF=function(r){return function(n){return r[n]}},r.fToA=function(r,n){for(var t=new Array(n),e=0;n>e;e++)t[e]=r(e);return t},r.memoF=function(r,n){return n||(n={}),function(t){return n.hasOwnProperty(t)?n[t]:n[t]=r(t)}},r.replicate=function(n,t){return r.fToA(r.constant(t),n)},r.setF=function(r,n,t){r[n]=t},r.obj1=function(r,n){var t={};return t[r]=n,t},r.slice=function(r,n,t){if(null==n&&(n=0),Array.isArray(r))return r.slice(n,t);var e=r.length;n=0>n?Math.max(0,e+n):Math.min(e,n),t=void 0===t?e:0>t?Math.max(0,e+t):Math.min(e,t);for(var u=[];t>n;)u.push(r[n++]);return u},r.array=function(){return n.call(arguments,0)},r.concatArgs=r.oMap(r("concat",[]),function(n){return Array.isArray(n)?n:r.slice(n)}),r.concatMap=function(n,t){return r.applyF(r.concatArgs,r.map(n,t))},r.reverseCopy=function(n){return r.slice(n).reverse()},r.findIndex=function(r,n){for(var t=n.length,e=0;t>e;e++)if(r(n[e],e,n))return e;return-1},r.findLastIndex=function(r,n){for(var t=n.length;--t>=0;)if(r(n[t],t,n))return t;return-1},r.find=function(n,t){var e=r.findIndex(n,t);return-1==e?void 0:t[e]},r.elemIndex=function(n,t,e){return t.indexOf&&!e&&Array.isArray(t)?t.indexOf(n):r.findIndex(r.eqTo(n,e),t)},r.elemLastIndex=function(n,t,e){return t.lastIndexOf&&!e&&Array.isArray(t)?t.lastIndexOf(n):r.findLastIndex(r.eqTo(n,e),t)},r.elem=function(n,t,e){return-1!=r.elemIndex(n,t,e)},r.all=function(r,n){if(n.every&&Array.isArray(n))return n.every(r);for(var t=n.length,e=0;t>e;e++)if(!r(n[e],e,n))return!1;return!0},r.any=function(r,n){for(var t=n.length,e=!1,u=0;t>u;u++)if(e=r(n[u],u,n))return e;return e},r.iter=function(t,e){if(2==arguments.length){if(e.forEach&&Array.isArray(e))return e.forEach(t);for(var u=e.length,i=0;u>i;i++)t(e[i],i,e)}else{arguments.length>2||r.err(err_iter_);for(var o=n.call(arguments,1),u=r.applyF(Math.min,r.map(r("length"),o)),i=0;u>i;i++)r.applyF(t,r.map(r(i),o).concat(i,o))}},r.map=function(r,n){if(n.map&&Array.isArray(n))return n.map(r);for(var t=n.length,e=new Array(t),u=0;t>u;u++)e[u]=r(n[u],u,n);return e},r.map1=function(n,t){return r.map(r(1,n),t)},r.zipWith=function(n){arguments.length>1||r.err(err_zipWith_);for(var t=[],e=0;;e++){for(var u=[],i=1;ii;i++)e=n(e,t[i],i,t);return e},r.foldR=function(n,t,e){if(t.reduceRight&&Array.isArray(t))return arguments.length<3?t.reduceRight(n):t.reduceRight(n,e);var u=t.length;for(arguments.length<3&&(e=u?t[--u]:r.err(err_foldR_));--u>=0;)e=n(e,t[u],u,t);return e},r.sum=function(r){for(var n=r.length,t=0,e=0;n>e;e++)t+=r[e];return t},r.test=function(n){if((0===n||""===n)&&(n=typeof n),"string"==typeof n)return function(r){return typeof r==n};if(n===Array||n===Date||n===RegExp)return function(r){return null!=r&&r.constructor==n};if(null===n)return r.eqTo(null);if(n.constructor==RegExp)return r("test",n);if("function"==typeof n)return n;if(Array.isArray(n))return 1==n.length?(n=r.test(n[0]),function(t){return Array.isArray(t)&&r.all(n,t)}):(n=r.map(r.test,n),function(t){return r.any(function(r){return r(t)},n)});if("object"==typeof n){var t=Object.keys(n),e=r.map(r.o(r.test,r(n)),t);return function(n){return null!=n&&r.all(function(r,t){return e[t](n[r])},t)}}r.err(err_test_)},r.translations_={},r.s=function(n){return r.translations_[n]||n},r}(),F;void 0===F&&(F=jsCurry),"object"==typeof module&&(module.exports=jsCurry);
--------------------------------------------------------------------------------
/mathview/src/main/assets/mathscribe/jscurry-documentation.txt:
--------------------------------------------------------------------------------
1 | jscurry-0.4.5.js Usage Documentation
2 | by Micah Smukler
3 |
4 | Type conventions:
5 |
6 | x,y,z are arbitrary objects or values.
7 | f,g,h are functions.
8 | a,b,c are arrays or array-like objects.
9 | m,n are integers.
10 | s,t are strings.
11 | p,q are either integers or strings when used as array indices/object property names.
12 |
13 | F(): Several different behaviors depending on the types of its arguments.
14 |
15 | F(f, ...): Equivalent to F.curry(f, ...) (see below).
16 |
17 | F(s, x): Returns the method of x with name s.
18 |
19 | Example: If a is an array, F('concat', a) is a function which returns an array consisting of
20 | a followed by its arguments; F('push', a) is a function with the side-effect of appending
21 | its arguments to a.
22 |
23 | F(n, f): Equivalent to F.aritize(n, f) (see below).
24 |
25 | F(a, f): Equivalent to F.partial(a, f) (see below).
26 |
27 | F(p): Equivalent to F.pToF(p). (see below)
28 |
29 | F(x): If x is an HTML element, returns the jQuery data associated to that element.
30 | In all other cases (not covered above), equivalent to F.aToF(x). (see below)
31 |
32 | F.id(x): Identity function; returns x.
33 |
34 | F.constant(x): Builds a constant function; returns the function whose value is constantly x.
35 |
36 | F.applyF(f, a): Evaluates f using the elements of a as arguments.
37 |
38 | Example: F.applyF(f, [x, y, z]) is equivalent to f(x, y, z).
39 |
40 | F.curry(f, ...): Returns the function given by partially evaluating f on the remaining
41 | arguments.
42 |
43 | Example: g = F.curry(f, x) is a function with g(y, z, ...) = f(x, y, z, ...).
44 |
45 | F.partial(a, f): Returns the function given by partially evaluating f on the elements of a.
46 |
47 | Example: g = F.partial([x, y], f) is a function with g(z, ...) = f(x, y, z, ...).
48 |
49 | If any of the elements of a is F._, the function returned will "fill in" the corresponding
50 | argument in f before moving on to further-right arguments.
51 |
52 | Example: g = F.partial([x, F._, y], f) is a function with g(z, ...) = f(x, z, y, ...).
53 |
54 | F.uncurry(f): f should be a one-argument function that returns another one-argument function.
55 | Then g = F.uncurry(f) is a function with g(x, y) = f(x)(y).
56 |
57 | F.o(f, g, h, ...): Returns the function composition f o g o h o ...
58 |
59 | Example: F.o(f, g, h)(x) = f(g(h(x))).
60 |
61 | F.oMap(f, g): returns a function which evaluates g on each of its arguments, then uses them as
62 | an argument list for f.
63 |
64 | Example: If g is a one-argument function, h = F.oMap(f, g) is a function with
65 | h(x, y, z, ...) = f(g(x), g(y), g(z), ...)
66 |
67 | F.oMap() passes the index of each argument as a second argument to g.
68 |
69 | Example: If g is a two-argument function, h = F.oMap(f, g) is a function
70 | with h(x, y, z, ...) = f(g(x, 0), g(y, 1), g(z, 2), ...)
71 |
72 | As a third argument to g, F.oMap() passes its full Argument object.
73 |
74 | Example: If g is a function with at least 3 arguments, h = F.oMap(f, g) is a function with
75 | h(x, y, z) = f(g(x, 0, [x, y, z, ...]), g(y, 0, [x, y, z, ...]), g(z, 0, [x, y, z]), ...),
76 | except that the "arrays" are actually all array-like Argument objects.
77 |
78 | F.flip(f): f should be a two-argument function. F.flip(f) is the two argument function which
79 | is identical to f but with the arguments reversed: F.flip(f)(x, y) = f(y, x).
80 |
81 | F.seqF(f, g, h, ...): The arguments should be functions with side-effects. F.seqF returns a
82 | function which calls each of f, g, h, ... in turn, using its arguments as the arguments of each
83 | of them.
84 |
85 | Example: If h = F.seqF(f, g), then calling h(x, y, z, ...) is equivalent to calling
86 | f(x, y, z, ...) and then calling g(x, y, z, ...).
87 |
88 | F.cor(f, g, h, ...): The arguments should be functions. F.cor returns a function which calls
89 | each of f, g, h until one returns a truthy value, and then returns that value.
90 |
91 | Example: F.cor(F.eqTo(0), F.eqTo(1), F.eqTo(2)) returns a boolean-valued function which
92 | returns true iff x is either 0, 1, or 2. (see below for F.eqTo)
93 |
94 | F.aritize(n, f): Returns a function that is equivalent to f except that it ignores any arguments
95 | past the first n.
96 |
97 | Example: If g = F.aritize(2, f), then g(x, y) and g(x, y, z) are both equivalent to f(x, y).
98 |
99 | F.not(x): Returns ! x.
100 |
101 | F.defOr(x, y): Returns x if x !== undefined, else y. Beware: y is evaluated in either case.
102 |
103 | F.cmpX(x, y): Comparison for numbers or Dates; returns x - y (so negative if x < y, positive if
104 | x > y, 0 if x == y).
105 |
106 | F.cmpJS(x, y): Default JavaScript comparison for numbers, Dates, or strings; returns -1
107 | if x < y, 1 if x > 1, 0 otherwise.
108 |
109 | F.cmpLex(f, a, b) -- Compares a and b using "lexicographic order"; returns the first
110 | f(a[i], b[i]) which is truthy, or if none then just compares their lengths.
111 |
112 | F.eqTo(x): Returns a function of one argument that checks whether x is equal (===) to that
113 | argument.
114 |
115 | Example: If g = F.eqTo(5), g(x) returns true when x === 5 and false otherwise.
116 |
117 | F.eqTo(x, f): As above, but f is a comparison function (such as the three above). The function
118 | returned by F.eqTo will use f to check whether its argument is equal to x or not.
119 |
120 | Example: If g = F.eqTo(5, f) and f returns a number, then g(x) returns true when
121 | f(5, x) == 0 and false otherwise.
122 |
123 | F.pToF(p): Converts a property name or subscript to a function; returns the function that looks
124 | at its argument and returns the value indexed by p.
125 |
126 | Example: F.pToF(0) is a one-argument function that picks out the zeroth element in arrays.
127 | F.pToF('baseHeightA') is a one-argument function that picks out the value of the baseHeightA
128 | property in objects.
129 |
130 | F.aToF(a): "array to function": Returns the function f with f(i) = a[i]. (Despite the suggestive
131 | name, works on arbitrary objects.)
132 |
133 | Example: f = F.aToF([0, 1, 1]) is a function with f(0) = 0, f(1) = f(2) = 1, and f(x)
134 | undefined for any other x.
135 |
136 | g = F.aToF({ x: 1, y: 'fnord' }) is a function with g('x') = 1, g('y') = 'fnord', and g(z)
137 | undefined for any other z.
138 |
139 | F.fToA(f, n): "function to array": Returns an n-element array a with a[i] = f(i).
140 |
141 | F.memoF(f, x): returns a memoized version of f, storing all previously computed values of f in
142 | x. Can be called as a one-argument function in which case x will be automatically created and
143 | inaccessible.
144 |
145 | F.replicate(n, x): Returns an array whose n elements are all x.
146 |
147 | F.setF(x, p, y): A function whose side-effect is to set x[p] = y. Good for feeding to F to build
148 | other functions.
149 |
150 | F.obj1(p, x): Returns an object whose sole property p has value x.
151 |
152 | F.slice(a): Returns an array which is a shallow copy of the array-like object a.
153 |
154 | F.slice(a, n): Returns an array consisting of all the elements of a starting with a[n] if n is
155 | non-negative, or the element -n from the end if n is negative. Analogous to the array method of
156 | the same name, but also works on array-like objects.
157 |
158 | F.slice(a, n, m): Returns an array consisting of the elements of a starting with a[n] and
159 | going up to but not including a[m]; treats negative arguments modulo a.length as the
160 | two-argument version does. Can be called with n == null to start from the beginning of the
161 | array, like n == 0.
162 |
163 | F.array(x, y, z, ...): Returns its arguments in an array (not an array-like Argument object).
164 |
165 | Example: F.array(x, y, z, ...) returns [x, y, z, ...].
166 |
167 | F.concatArgs(a, b, c, ...): Returns an array consisting of the elements of the array-like
168 | objects a, b, c, ....
169 |
170 | Example: F.concatArgs([x, y], [1, 2], [z]) returns [x, y, 1, 2, z].
171 |
172 | F.concatMap(f, a): f should be a function that returns an array-like object. Returns an array
173 | obtained by applying f to each element of a in turn and then concatenating the resulting arrays.
174 |
175 | Example: If f(n) returns [n^2, 2n, 1], F.concatMap(f, [0, 1, 5, 100]) returns
176 | [0, 0, 1, 1, 2, 1, 25, 10, 1, 10000, 200, 1].
177 |
178 | F.reverseCopy(a): Returns an array which is the reverse of a shallow copy of the array-like
179 | object a.
180 |
181 | F.findIndex(f, a): Returns the smallest i where f(a[i]) is truthy. If f has a second argument,
182 | it is taken to be the index i; a third argument is taken to be the entire array a. If no such i
183 | exists, returns -1.
184 |
185 | Example: F.findIndex(function(x) { return x == 3; }, [0, 1, 2, 3, 4, 3]) returns 3.
186 | F.findIndex(function(x) { return x == 3; }, [0, 1, 2]) returns -1.
187 |
188 | F.findLastIndex(f, a): As findIndex, except that it returns the largest i where f(a[i]) is
189 | truthy.
190 |
191 | Example: F.findLastIndex(function(x) { return x == 3; }, [0, 1, 2, 3, 4, 3]) returns 5.
192 |
193 | F.find(f, a): Returns the first a[i] with f(a[i]) truthy, or undefined if there is no such a[i].
194 |
195 | Example: F.find(function(x) { return x > 3; }, [0, 4, 2]) returns 4.
196 |
197 | F.elemIndex(x, a, f): Returns the smallest i where a[i] == x, using f as a comparison function
198 | for equality if given (i.e., it finds i where f(x, a[i]) is falsy).
199 |
200 | F.elemLastIndex(x, a, f): As F.elemIndex, except that it returns the largest such i.
201 |
202 | F.elem(x, a, f): Returns true if x can be found in a and false otherwise, using f as a
203 | comparison function if given.
204 |
205 | F.all(f, a): Returns true if f(a[i], i, a) returns a truthy value for all i, and false
206 | otherwise.
207 |
208 | F.any(f, a): Returns the smallest-index f(a[i], i, a) which is truthy, or the last such value if
209 | none are truthy, or false if a is empty.
210 |
211 | F.iter(f, a, b, c, ...): f should be a function with side-effects. Calls f with arguments
212 | a[0], b[0], c[0], ...; then with arguments a[1], b[1], c[1], ...; and so on. If the arrays
213 | differ in length, ignores all remaining elements in longer arrays once the shortest array has
214 | run out. If f wants more arguments than there are arrays, the first additional argument is the
215 | index and each subsequent additional argument is an entire array a, b, c, ... .
216 |
217 | Example: F.iter(f, [x0, x1, x2], [y0, y1, y2]) is equivalent to calling:
218 | f(x0, y0); f(x1, y1); f(x2; y2); if f is a function of at most 2 arguments
219 | f(x0, y0, 0); f(x1, y1, 1); f(x2, y2, 2); if f is a function of 3 arguments
220 | f(x0, y0, 0, [x0, x1, x2], [y0, y1, y2]); ... in general.
221 |
222 | F.map(f, a): Returns the array whose ith element is f(a[i], i, a).
223 |
224 | F.map1(f, a): Returns the array whose ith element is f(a[i]) (even if f is capable of being
225 | passed more than one argument).
226 |
227 | F.zipWith(f, a, b, c, ...): Returns the array whose ith element is f(a[i], b[i], c[i], ...). If
228 | a, b, c, ... are not all the same length, ignores remaining elements in the longer ones once the
229 | shortest one has run out.
230 |
231 | F.zip(a, b, c, ...): Returns the array [[a[0], b[0], c[0], ...], [a[1], b[1], c[1], ...], ...].
232 |
233 | F.unzip(a): a should be a *matrix* -- an array of arrays, where each row array has the same
234 | length (or elements beyond the shortest length are ignored). Returns the matrix transpose of a.
235 |
236 | Example: F.unzip([[1,2,3], [4,5,6], [7,8,9]]) returns [[1,4,7], [2,5,8], [3,6,9]].
237 |
238 | F.filter(f, a): returns an array consisting of all those a[i] where f(a[i], i, a) is truthy, in
239 | their original order.
240 |
241 | Example: F.filter(eqTo(4), [1,2,3,4,5,4]) returns [4,4].
242 | F.filter(F.not, [0, 1, null, 2, undefined, 3]) returns [0, null, undefined].
243 |
244 | F.fold(f, a, x): Calls f(x, a[0]), then calls f on the result and a[1], and so on until the
245 | array is exhausted, and returns the result. If x is omitted, start the process with
246 | f(a[0], a[1]). Equivalent to the reduce method for genuine arrays. Also passes i and a to f.
247 |
248 | Example: If plus is a function that returns x + y, F.fold(plus, [0, 1, 2], ' ') returns the
249 | string ' 012'.
250 |
251 | F.foldR(f, a, x): The same as to F.fold except that it begins at the end of a (so it starts by
252 | calling f(x, a[a.length - 1])). Equivalent to the reduceRight method for genuine arrays.
253 |
254 | Example: If plus is a function that returns x + y, F.foldR(plus, [0, 1, 2], ' ') returns the
255 | string ' 210'.
256 |
257 | F.sum(a): Returns the sum of the elements of a.
258 |
259 | F.test(x): Returns a boolean function of one argument which checks that argument in some way
260 | determined by x -- usually some form of type-checking.
261 |
262 | To check whether:
263 | Something is a number Use F.test(0) (or F.test('number') -- see below)
264 | Something is a string Use F.test('') (or F.test('string') -- see below)
265 | Something has a type readable Use F.test(s) where s is a string returnable by the typeof
266 | by the typeof operator operator.
267 | (undefined, object, boolean,
268 | number, string, function)
269 | Something is an array, Date Use F.test(Array), F.test(Date), and F.test(RegExp)
270 | object, or Javascript regular respectively.
271 | expression, constructed in
272 | the same window frame
273 | Something is null Use F.test(null)
274 |
275 | If r is a regular expression, F.test(r) is equivalent to r.test (it returns true if its argument
276 | contains a match for r).
277 |
278 | If f is a function, F.test(f) returns f (allowing you to feed arbitrary test functions into the
279 | following recursive cases).
280 |
281 | F.test([x]) checks to see if its argument is an array, all of whose elements satisfy F.test(x).
282 |
283 | For arrays of more than one element, F.test(a) checks to see if its argument satisfies
284 | F.test(a[i]) for any i.
285 |
286 | For generic objects that don’t match any of the above, F.test(x) looks at some other object y
287 | and returns true if:
288 | -y is non-null, and
289 | -for every property p of x, y[p] passes the test F.test(x[p]).
290 |
291 | F.translations_: An object mapping user visible strings to their translations in the current
292 | language.
293 |
294 | F.s(s): Returns the translation of s if one exists, else s.
295 |
--------------------------------------------------------------------------------
/mathview/src/main/assets/mathscribe/view.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
41 |
42 |
43 |