ela 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.gitlab-ci.yml +23 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +139 -0
- data/Guardfile +25 -0
- data/LICENSE.txt +205 -0
- data/README.de.md +195 -0
- data/README.md +66 -0
- data/Rakefile +96 -0
- data/app/css/screen.styl +425 -0
- data/app/css/vendor/stackedit.styl +140 -0
- data/app/fonts/Roboto-Italic-webfont.eot +0 -0
- data/app/fonts/Roboto-Italic-webfont.svg +642 -0
- data/app/fonts/Roboto-Italic-webfont.ttf +0 -0
- data/app/fonts/Roboto-Italic-webfont.woff +0 -0
- data/app/fonts/Roboto-Light-webfont.eot +0 -0
- data/app/fonts/Roboto-Light-webfont.svg +641 -0
- data/app/fonts/Roboto-Light-webfont.ttf +0 -0
- data/app/fonts/Roboto-Light-webfont.woff +0 -0
- data/app/fonts/Roboto-LightItalic-webfont.eot +0 -0
- data/app/fonts/Roboto-LightItalic-webfont.svg +641 -0
- data/app/fonts/Roboto-LightItalic-webfont.ttf +0 -0
- data/app/fonts/Roboto-LightItalic-webfont.woff +0 -0
- data/app/fonts/Roboto-Medium-webfont.eot +0 -0
- data/app/fonts/Roboto-Medium-webfont.svg +593 -0
- data/app/fonts/Roboto-Medium-webfont.ttf +0 -0
- data/app/fonts/Roboto-Medium-webfont.woff +0 -0
- data/app/fonts/Roboto-MediumItalic-webfont.eot +0 -0
- data/app/fonts/Roboto-MediumItalic-webfont.svg +642 -0
- data/app/fonts/Roboto-MediumItalic-webfont.ttf +0 -0
- data/app/fonts/Roboto-MediumItalic-webfont.woff +0 -0
- data/app/fonts/Roboto-Regular-webfont.eot +0 -0
- data/app/fonts/Roboto-Regular-webfont.svg +621 -0
- data/app/fonts/Roboto-Regular-webfont.ttf +0 -0
- data/app/fonts/Roboto-Regular-webfont.woff +0 -0
- data/app/fonts/Roboto-Thin-webfont.eot +0 -0
- data/app/fonts/Roboto-Thin-webfont.svg +631 -0
- data/app/fonts/Roboto-Thin-webfont.ttf +0 -0
- data/app/fonts/Roboto-Thin-webfont.woff +0 -0
- data/app/fonts/Roboto-ThinItalic-webfont.eot +0 -0
- data/app/fonts/Roboto-ThinItalic-webfont.svg +631 -0
- data/app/fonts/Roboto-ThinItalic-webfont.ttf +0 -0
- data/app/fonts/Roboto-ThinItalic-webfont.woff +0 -0
- data/app/fonts/droid_sans_regular.typeface.svg +1 -0
- data/app/fonts/fontawesome-webfont.eot +0 -0
- data/app/fonts/fontawesome-webfont.svg +2671 -0
- data/app/fonts/fontawesome-webfont.ttf +0 -0
- data/app/fonts/fontawesome-webfont.woff +0 -0
- data/app/fonts/fontawesome-webfont.woff2 +0 -0
- data/app/js/lib/application.coffee +83 -0
- data/app/js/lib/bootstrap_data.coffee +70 -0
- data/app/js/lib/collections/00_limited_collection.coffee +85 -0
- data/app/js/lib/collections/curves.coffee +3 -0
- data/app/js/lib/collections/named_object_collection.coffee +7 -0
- data/app/js/lib/mathjaxConfig.coffee +241 -0
- data/app/js/lib/models/app.coffee +58 -0
- data/app/js/lib/models/base_app.coffee +62 -0
- data/app/js/lib/models/base_app_model.coffee +61 -0
- data/app/js/lib/models/base_calculator.coffee +212 -0
- data/app/js/lib/models/base_subapp_container.coffee +35 -0
- data/app/js/lib/models/curve.coffee +179 -0
- data/app/js/lib/router.coffee +26 -0
- data/app/js/lib/views/app.coffee +56 -0
- data/app/js/lib/views/base_app.coffee +274 -0
- data/app/js/lib/views/base_aside.coffee +9 -0
- data/app/js/lib/views/base_graph.coffee +477 -0
- data/app/js/lib/views/base_subapp_container.coffee +44 -0
- data/app/js/lib/views/canvas.coffee +73 -0
- data/app/js/lib/views/curve_graph.coffee +163 -0
- data/app/js/lib/views/curves_aside.coffee +21 -0
- data/app/js/lib/views/curves_list_item.coffee +8 -0
- data/app/js/lib/views/grouped_parameters_aside.coffee +14 -0
- data/app/js/lib/views/headup.coffee +15 -0
- data/app/js/lib/views/help.coffee +86 -0
- data/app/js/lib/views/interpolated_graph.coffee +281 -0
- data/app/js/lib/views/legend.coffee +138 -0
- data/app/js/lib/views/legend_handler.coffee +51 -0
- data/app/js/lib/views/overview.coffee +85 -0
- data/app/js/lib/views/overview_tile.coffee +18 -0
- data/app/js/lib/views/parameters_aside.coffee +12 -0
- data/app/js/lib/views/three_graph.coffee +92 -0
- data/app/js/vendor/Markdown.Converter.js +1519 -0
- data/app/js/vendor/Markdown.Extra.js +874 -0
- data/app/js/vendor/Markdown.Toc.coffee +79 -0
- data/app/js/vendor/backbone-1.3.3.min.js +2 -0
- data/app/js/vendor/backbone-validation-0.11.5.js +8 -0
- data/app/js/vendor/backbone.poised/form.coffee +156 -0
- data/app/js/vendor/backbone.poised/form/anchor.coffee +26 -0
- data/app/js/vendor/backbone.poised/form/base_control.coffee +42 -0
- data/app/js/vendor/backbone.poised/form/linked_control.coffee +79 -0
- data/app/js/vendor/backbone.poised/form/linked_number_control.coffee +27 -0
- data/app/js/vendor/backbone.poised/form/linked_range_control.coffee +53 -0
- data/app/js/vendor/backbone.poised/form/linked_select_control.coffee +18 -0
- data/app/js/vendor/backbone.poised/form/linked_string_control.coffee +27 -0
- data/app/js/vendor/backbone.poised/form/number_control.coffee +25 -0
- data/app/js/vendor/backbone.poised/form/range_control.coffee +48 -0
- data/app/js/vendor/backbone.poised/form/select_control.coffee +16 -0
- data/app/js/vendor/backbone.poised/form/selectbox.coffee +78 -0
- data/app/js/vendor/backbone.poised/form/slider.coffee +109 -0
- data/app/js/vendor/backbone.poised/form/string_control.coffee +23 -0
- data/app/js/vendor/backbone.poised/form/submit_control.coffee +39 -0
- data/app/js/vendor/backbone.poised/form/textarea.coffee +36 -0
- data/app/js/vendor/backbone.poised/form/textfield.coffee +86 -0
- data/app/js/vendor/backbone.poised/form/value.coffee +33 -0
- data/app/js/vendor/backbone.poised/form/value_control.coffee +15 -0
- data/app/js/vendor/backbone.poised/linked_form.coffee +43 -0
- data/app/js/vendor/backbone.poised/list.coffee +97 -0
- data/app/js/vendor/backbone.poised/list/add_button.coffee +16 -0
- data/app/js/vendor/backbone.poised/list/anchor.coffee +32 -0
- data/app/js/vendor/backbone.poised/list/item.coffee +68 -0
- data/app/js/vendor/backbone.poised/list/searchfield.coffee +26 -0
- data/app/js/vendor/backbone.poised/list/selectable_item.coffee +65 -0
- data/app/js/vendor/backbone.poised/patches.coffee +6 -0
- data/app/js/vendor/backbone.poised/string_mixin.coffee +23 -0
- data/app/js/vendor/backbone.poised/underscore_ext.coffee +2 -0
- data/app/js/vendor/backbone.poised/view.coffee +59 -0
- data/app/js/vendor/gaussianElimination.coffee +40 -0
- data/app/js/vendor/hammer-2.0.8.min.js +7 -0
- data/app/js/vendor/jquery-3.1.1.min.js +4 -0
- data/app/js/vendor/jquery.after-transition.coffee +20 -0
- data/app/js/vendor/jquery.backbone-hammer.coffee +28 -0
- data/app/js/vendor/jquery.keyboard-modifiers.coffee +22 -0
- data/app/js/vendor/jquery.mark-5.2.3.min.js +7 -0
- data/app/js/vendor/jquery.scrollTo-2.1.2.min.js +7 -0
- data/app/js/vendor/js-yaml-3.4.3.min.js +3 -0
- data/app/js/vendor/markup_text.coffee +95 -0
- data/app/js/vendor/mathjax/MathJax.js +19 -0
- data/app/js/vendor/mathjax/extensions/MathEvents.js +19 -0
- data/app/js/vendor/mathjax/extensions/tex2jax.js +19 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_AMS-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Bold.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Caligraphic-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Bold.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Fraktur-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Bold.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Italic.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Main-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-BoldItalic.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-Italic.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Math-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Bold.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Italic.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_SansSerif-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Script-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size1-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size2-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size3-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Size4-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_Typewriter-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/eot/MathJax_WinIE6-Regular.eot +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_AMS-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Bold.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Caligraphic-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Bold.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Fraktur-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Bold.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Italic.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Main-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-BoldItalic.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-Italic.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Math-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Bold.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Italic.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_SansSerif-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Script-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size1-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size2-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size3-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Size4-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_Typewriter-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_WinChrome-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/otf/MathJax_WinIE6-Regular.otf +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_AMS-Regular.svg +765 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Caligraphic-Bold.svg +136 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Caligraphic-Regular.svg +134 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Fraktur-Bold.svg +319 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Fraktur-Regular.svg +309 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Bold.svg +656 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Italic.svg +374 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Main-Regular.svg +659 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-BoldItalic.svg +331 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-Italic.svg +331 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Math-Regular.svg +330 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Bold.svg +280 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Italic.svg +245 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_SansSerif-Regular.svg +211 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Script-Regular.svg +160 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size1-Regular.svg +110 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size2-Regular.svg +109 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size3-Regular.svg +49 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Size4-Regular.svg +102 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_Typewriter-Regular.svg +322 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/svg/MathJax_WinChrome-Regular.svg +39 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_AMS-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Bold.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Bold.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Fraktur-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Bold.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Italic.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-BoldItalic.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Math-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Bold.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Italic.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_SansSerif-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Script-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size2-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size3-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Size4-Regular.woff +0 -0
- data/app/js/vendor/mathjax/fonts/HTML-CSS/TeX/woff/MathJax_Typewriter-Regular.woff +0 -0
- data/app/js/vendor/mathjax/jax/element/mml/jax.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/Arrows.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/BasicLatin.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/CombDiacritMarks.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/CombDiactForSymbols.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/Dingbats.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/GeneralPunctuation.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/GeometricShapes.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/GreekAndCoptic.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/Latin1Supplement.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/LetterlikeSymbols.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MathOperators.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MiscMathSymbolsA.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MiscMathSymbolsB.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MiscSymbolsAndArrows.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/MiscTechnical.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/SpacingModLetters.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/SuppMathOperators.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/SupplementalArrowsA.js +19 -0
- data/app/js/vendor/mathjax/jax/element/mml/optable/SupplementalArrowsB.js +19 -0
- data/app/js/vendor/mathjax/jax/input/TeX/config.js +19 -0
- data/app/js/vendor/mathjax/jax/input/TeX/jax.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/annotation-xml.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/maction.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/menclose.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mglyph.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mmultiscripts.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/ms.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/mtable.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/autoload/multiline.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/config.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/AMS-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Caligraphic-Bold.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Bold.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Fraktur-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Main-Bold.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Math-BoldItalic.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Bold.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Italic.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/SansSerif-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Script-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/Typewriter-Regular.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata-extra.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/fonts/TeX/fontdata.js +19 -0
- data/app/js/vendor/mathjax/jax/output/CommonHTML/jax.js +19 -0
- data/app/js/vendor/modernizr-custom-3.3.1.min.js +3 -0
- data/app/js/vendor/persistjs-git.js +1136 -0
- data/app/js/vendor/poised/poised.general.coffee +21 -0
- data/app/js/vendor/poised/poised.tabs.coffee +31 -0
- data/app/js/vendor/poised/utils.coffee +11 -0
- data/app/js/vendor/request_animation_frame.coffee +19 -0
- data/app/js/vendor/three-82.min.js +15 -0
- data/app/js/vendor/three-CanvasRenderer-82.js +1118 -0
- data/app/js/vendor/three-Projector-82.js +929 -0
- data/app/js/vendor/underscore-1.8.3.min.js +6 -0
- data/app/js/vendor/webfontloader-1.6.26.min.js +33 -0
- data/app/views/aliasing/legend.jst.hamlc +6 -0
- data/app/views/composites/composites_list_item_label.jst.hamlc +3 -0
- data/app/views/composites/import_composites_aside.jst.hamlc +6 -0
- data/app/views/composites/mix_preset_list_item_label.jst.hamlc +8 -0
- data/app/views/composites/share_aside.jst.hamlc +7 -0
- data/app/views/doc/airplanes_list_item_label.jst.hamlc +3 -0
- data/app/views/doc/import_airplanes_aside.jst.hamlc +6 -0
- data/app/views/doc/share_aside.jst.hamlc +7 -0
- data/app/views/general/app.jst.hamlc +42 -0
- data/app/views/general/curves_list_item_label.jst.hamlc +5 -0
- data/app/views/general/help.jst.hamlc +7 -0
- data/app/views/general/tabs.jst.hamlc +6 -0
- data/app/views/index.haml +24 -0
- data/app/views/overview/app.jst.hamlc +7 -0
- data/app/views/overview/tile.jst.hamlc +4 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ela.gemspec +50 -0
- data/exe/ela +59 -0
- data/lib/ela.rb +8 -0
- data/lib/ela/jasmine.rb +87 -0
- data/lib/ela/server.rb +136 -0
- data/lib/ela/utils.rb +131 -0
- data/lib/ela/version.rb +3 -0
- data/package-lock.json +899 -0
- data/package.json +11 -0
- data/support/project/Guardfile +64 -0
- data/support/project/jasmine.yml +3 -0
- data/support/server.ru +5 -0
- metadata +4365 -0
@@ -0,0 +1,1136 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright (c) 2008, 2009 Paul Duncan (paul@pablotron.org)
|
3
|
+
*
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
9
|
+
* furnished to do so, subject to the following conditions:
|
10
|
+
*
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
12
|
+
* all copies or substantial portions of the Software.
|
13
|
+
*
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
* THE SOFTWARE.
|
21
|
+
*/
|
22
|
+
|
23
|
+
/*
|
24
|
+
* The contents of gears_init.js; we need this because Chrome supports
|
25
|
+
* Gears out of the box, but still requires this constructor. Note that
|
26
|
+
* if you include gears_init.js then this function does nothing.
|
27
|
+
*/
|
28
|
+
(function() {
|
29
|
+
// We are already defined. Hooray!
|
30
|
+
if (window.google && google.gears){
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
|
34
|
+
// factory
|
35
|
+
var F = null;
|
36
|
+
|
37
|
+
// Firefox
|
38
|
+
if (typeof GearsFactory != 'undefined') {
|
39
|
+
F = new GearsFactory();
|
40
|
+
} else {
|
41
|
+
// IE
|
42
|
+
try {
|
43
|
+
F = new ActiveXObject('Gears.Factory');
|
44
|
+
// privateSetGlobalObject is only required and supported on WinCE.
|
45
|
+
if (F.getBuildInfo().indexOf('ie_mobile') != -1){
|
46
|
+
F.privateSetGlobalObject(this);
|
47
|
+
}
|
48
|
+
|
49
|
+
} catch (e) {
|
50
|
+
// Safari
|
51
|
+
if ((typeof navigator.mimeTypes != 'undefined') && navigator.mimeTypes["application/x-googlegears"]) {
|
52
|
+
F = document.createElement("object");
|
53
|
+
F.style.display = "none";
|
54
|
+
F.width = 0;
|
55
|
+
F.height = 0;
|
56
|
+
F.type = "application/x-googlegears";
|
57
|
+
document.documentElement.appendChild(F);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
// *Do not* define any objects if Gears is not installed. This mimics the
|
63
|
+
// behavior of Gears defining the objects in the future.
|
64
|
+
if (!F){
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
// Now set up the objects, being careful not to overwrite anything.
|
70
|
+
//
|
71
|
+
// Note: In Internet Explorer for Windows Mobile, you can't add properties to
|
72
|
+
// the window object. However, global objects are automatically added as
|
73
|
+
// properties of the window object in all browsers.
|
74
|
+
if (!window.google){
|
75
|
+
google = {};
|
76
|
+
}
|
77
|
+
|
78
|
+
if (!google.gears){
|
79
|
+
google.gears = {factory: F};
|
80
|
+
}
|
81
|
+
|
82
|
+
})();
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Persist - top-level namespace for Persist library.
|
86
|
+
* @namespace
|
87
|
+
*/
|
88
|
+
Persist = (function() {
|
89
|
+
var VERSION = '0.3.1', P, B, esc, init, empty, ec;
|
90
|
+
|
91
|
+
ec = (function() {
|
92
|
+
var EPOCH = 'Thu, 01-Jan-1970 00:00:01 GMT',
|
93
|
+
// milliseconds per day
|
94
|
+
RATIO = 1000 * 60 * 60 * 24,
|
95
|
+
// keys to encode
|
96
|
+
KEYS = ['expires', 'path', 'domain'],
|
97
|
+
// wrappers for common globals
|
98
|
+
esc = escape, un = unescape, doc = document,
|
99
|
+
me;
|
100
|
+
|
101
|
+
// private methods
|
102
|
+
|
103
|
+
/*
|
104
|
+
* Get the current time.
|
105
|
+
*
|
106
|
+
* This method is private.
|
107
|
+
*/
|
108
|
+
var get_now = function() {
|
109
|
+
var r = new Date();
|
110
|
+
r.setTime(r.getTime());
|
111
|
+
return r;
|
112
|
+
};
|
113
|
+
|
114
|
+
/*
|
115
|
+
* Convert the given key/value pair to a cookie.
|
116
|
+
*
|
117
|
+
* This method is private.
|
118
|
+
*/
|
119
|
+
var cookify = function(c_key, c_val /*, opt */) {
|
120
|
+
var i, key, val, r = [],
|
121
|
+
opt = (arguments.length > 2) ? arguments[2] : {};
|
122
|
+
|
123
|
+
// add key and value
|
124
|
+
r.push(esc(c_key) + '=' + esc(c_val));
|
125
|
+
|
126
|
+
// iterate over option keys and check each one
|
127
|
+
for (var idx = 0; idx < KEYS.length; idx++) {
|
128
|
+
key = KEYS[idx];
|
129
|
+
val = opt[key];
|
130
|
+
if (val){
|
131
|
+
r.push(key + '=' + val);
|
132
|
+
}
|
133
|
+
|
134
|
+
}
|
135
|
+
|
136
|
+
// append secure (if specified)
|
137
|
+
if (opt.secure){
|
138
|
+
r.push('secure');
|
139
|
+
}
|
140
|
+
|
141
|
+
// build and return result string
|
142
|
+
return r.join('; ');
|
143
|
+
};
|
144
|
+
|
145
|
+
/*
|
146
|
+
* Check to see if cookies are enabled.
|
147
|
+
*
|
148
|
+
* This method is private.
|
149
|
+
*/
|
150
|
+
var alive = function() {
|
151
|
+
var k = '__EC_TEST__',
|
152
|
+
v = new Date();
|
153
|
+
|
154
|
+
// generate test value
|
155
|
+
v = v.toGMTString();
|
156
|
+
|
157
|
+
// set test value
|
158
|
+
this.set(k, v);
|
159
|
+
|
160
|
+
// return cookie test
|
161
|
+
this.enabled = (this.remove(k) == v);
|
162
|
+
return this.enabled;
|
163
|
+
};
|
164
|
+
|
165
|
+
// public methods
|
166
|
+
|
167
|
+
// build return object
|
168
|
+
me = {
|
169
|
+
/*
|
170
|
+
* Set a cookie value.
|
171
|
+
*
|
172
|
+
* Examples:
|
173
|
+
*
|
174
|
+
* // simplest-case
|
175
|
+
* EasyCookie.set('test_cookie', 'test_value');
|
176
|
+
*
|
177
|
+
* // more complex example
|
178
|
+
* EasyCookie.set('test_cookie', 'test_value', {
|
179
|
+
* // expires in 13 days
|
180
|
+
* expires: 13,
|
181
|
+
*
|
182
|
+
* // restrict to given domain
|
183
|
+
* domain: 'foo.example.com',
|
184
|
+
*
|
185
|
+
* // restrict to given path
|
186
|
+
* path: '/some/path',
|
187
|
+
*
|
188
|
+
* // secure cookie only
|
189
|
+
* secure: true
|
190
|
+
* });
|
191
|
+
*
|
192
|
+
*/
|
193
|
+
set: function(key, val /*, opt */) {
|
194
|
+
var opt = (arguments.length > 2) ? arguments[2] : {},
|
195
|
+
now = get_now(),
|
196
|
+
expire_at,
|
197
|
+
cfg = {};
|
198
|
+
|
199
|
+
// if expires is set, convert it from days to milliseconds
|
200
|
+
if (opt.expires) {
|
201
|
+
if(opt.expires == -1) {
|
202
|
+
cfg.expires = -1
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
// Needed to assign to a temporary variable because of pass by reference issues
|
206
|
+
var expires = opt.expires * RATIO;
|
207
|
+
|
208
|
+
// set cookie expiration date
|
209
|
+
cfg.expires = new Date(now.getTime() + expires);
|
210
|
+
cfg.expires = cfg.expires.toGMTString();
|
211
|
+
}
|
212
|
+
}
|
213
|
+
|
214
|
+
// set remaining keys
|
215
|
+
var keys = ['path', 'domain', 'secure'];
|
216
|
+
for (var i = 0; i < keys.length; i++){
|
217
|
+
if (opt[keys[i]]){
|
218
|
+
cfg[keys[i]] = opt[keys[i]];
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
var r = cookify(key, val, cfg);
|
223
|
+
doc.cookie = r;
|
224
|
+
|
225
|
+
return val;
|
226
|
+
},
|
227
|
+
|
228
|
+
/*
|
229
|
+
* Check to see if the given cookie exists.
|
230
|
+
*
|
231
|
+
* Example:
|
232
|
+
*
|
233
|
+
* val = EasyCookie.get('test_cookie');
|
234
|
+
*
|
235
|
+
*/
|
236
|
+
has: function(key) {
|
237
|
+
key = esc(key);
|
238
|
+
|
239
|
+
var c = doc.cookie,
|
240
|
+
ofs = c.indexOf(key + '='),
|
241
|
+
len = ofs + key.length + 1,
|
242
|
+
sub = c.substring(0, key.length);
|
243
|
+
|
244
|
+
// check to see if key exists
|
245
|
+
return ((!ofs && key != sub) || ofs < 0) ? false : true;
|
246
|
+
},
|
247
|
+
|
248
|
+
/*
|
249
|
+
* Get a cookie value.
|
250
|
+
*
|
251
|
+
* Example:
|
252
|
+
*
|
253
|
+
* val = EasyCookie.get('test_cookie');
|
254
|
+
*
|
255
|
+
*/
|
256
|
+
get: function(key) {
|
257
|
+
key = esc(key);
|
258
|
+
|
259
|
+
var c = doc.cookie,
|
260
|
+
ofs = c.indexOf(key + '='),
|
261
|
+
len = ofs + key.length + 1,
|
262
|
+
sub = c.substring(0, key.length),
|
263
|
+
end;
|
264
|
+
|
265
|
+
// check to see if key exists
|
266
|
+
if ((!ofs && key != sub) || ofs < 0) {
|
267
|
+
return null;
|
268
|
+
}
|
269
|
+
|
270
|
+
// grab end of value
|
271
|
+
end = c.indexOf(';', len);
|
272
|
+
if (end < 0) {
|
273
|
+
end = c.length;
|
274
|
+
}
|
275
|
+
|
276
|
+
// return unescaped value
|
277
|
+
return un(c.substring(len, end));
|
278
|
+
},
|
279
|
+
|
280
|
+
/*
|
281
|
+
* Remove a preset cookie. If the cookie is already set, then
|
282
|
+
* return the value of the cookie.
|
283
|
+
*
|
284
|
+
* Example:
|
285
|
+
*
|
286
|
+
* old_val = EasyCookie.remove('test_cookie');
|
287
|
+
*
|
288
|
+
*/
|
289
|
+
remove: function(k) {
|
290
|
+
var r = me.get(k),
|
291
|
+
opt = { expires: EPOCH };
|
292
|
+
|
293
|
+
// delete cookie
|
294
|
+
doc.cookie = cookify(k, '', opt);
|
295
|
+
|
296
|
+
// return value
|
297
|
+
return r;
|
298
|
+
},
|
299
|
+
|
300
|
+
/*
|
301
|
+
* Get a list of cookie names.
|
302
|
+
*
|
303
|
+
* Example:
|
304
|
+
*
|
305
|
+
* // get all cookie names
|
306
|
+
* cookie_keys = EasyCookie.keys();
|
307
|
+
*
|
308
|
+
*/
|
309
|
+
keys: function() {
|
310
|
+
var c = doc.cookie,
|
311
|
+
ps = c.split('; '),
|
312
|
+
i, p, r = [];
|
313
|
+
|
314
|
+
// iterate over each key=val pair and grab the key
|
315
|
+
for (var idx = 0; idx < ps.length; idx++) {
|
316
|
+
p = ps[idx].split('=');
|
317
|
+
r.push(un(p[0]));
|
318
|
+
}
|
319
|
+
|
320
|
+
// return results
|
321
|
+
return r;
|
322
|
+
},
|
323
|
+
|
324
|
+
/*
|
325
|
+
* Get an array of all cookie key/value pairs.
|
326
|
+
*
|
327
|
+
* Example:
|
328
|
+
*
|
329
|
+
* // get all cookies
|
330
|
+
* all_cookies = EasyCookie.all();
|
331
|
+
*
|
332
|
+
*/
|
333
|
+
all: function() {
|
334
|
+
var c = doc.cookie,
|
335
|
+
ps = c.split('; '),
|
336
|
+
i, p, r = [];
|
337
|
+
|
338
|
+
// iterate over each key=val pair and grab the key
|
339
|
+
for (var idx = 0; idx < ps.length; idx++) {
|
340
|
+
p = ps[idx].split('=');
|
341
|
+
r.push([un(p[0]), un(p[1])]);
|
342
|
+
}
|
343
|
+
|
344
|
+
// return results
|
345
|
+
return r;
|
346
|
+
},
|
347
|
+
|
348
|
+
/*
|
349
|
+
* Version of EasyCookie
|
350
|
+
*/
|
351
|
+
version: '0.2.1',
|
352
|
+
|
353
|
+
/*
|
354
|
+
* Are cookies enabled?
|
355
|
+
*
|
356
|
+
* Example:
|
357
|
+
*
|
358
|
+
* have_cookies = EasyCookie.enabled
|
359
|
+
*
|
360
|
+
*/
|
361
|
+
enabled: false
|
362
|
+
};
|
363
|
+
|
364
|
+
// set enabled attribute
|
365
|
+
me.enabled = alive.call(me);
|
366
|
+
|
367
|
+
// return self
|
368
|
+
return me;
|
369
|
+
}());
|
370
|
+
|
371
|
+
// wrapper for Array.prototype.indexOf, since IE doesn't have it
|
372
|
+
var index_of = (function() {
|
373
|
+
if (Array.prototype.indexOf){
|
374
|
+
return function(ary, val) {
|
375
|
+
return Array.prototype.indexOf.call(ary, val);
|
376
|
+
};
|
377
|
+
} else {
|
378
|
+
return function(ary, val) {
|
379
|
+
var i, l;
|
380
|
+
|
381
|
+
for (var idx = 0, len = ary.length; idx < len; idx++){
|
382
|
+
if (ary[idx] == val){
|
383
|
+
return idx;
|
384
|
+
}
|
385
|
+
}
|
386
|
+
|
387
|
+
return -1;
|
388
|
+
};
|
389
|
+
}
|
390
|
+
})();
|
391
|
+
|
392
|
+
|
393
|
+
// empty function
|
394
|
+
empty = function() { };
|
395
|
+
|
396
|
+
/**
|
397
|
+
* Escape spaces and underscores in name. Used to generate a "safe"
|
398
|
+
* key from a name.
|
399
|
+
*
|
400
|
+
* @private
|
401
|
+
*/
|
402
|
+
esc = function(str) {
|
403
|
+
return 'PS' + str.replace(/_/g, '__').replace(/ /g, '_s');
|
404
|
+
};
|
405
|
+
|
406
|
+
var C = {
|
407
|
+
/*
|
408
|
+
* Backend search order.
|
409
|
+
*
|
410
|
+
* Note that the search order is significant; the backends are
|
411
|
+
* listed in order of capacity, and many browsers
|
412
|
+
* support multiple backends, so changing the search order could
|
413
|
+
* result in a browser choosing a less capable backend.
|
414
|
+
*/
|
415
|
+
search_order: [
|
416
|
+
// TODO: air
|
417
|
+
'localstorage',
|
418
|
+
'globalstorage',
|
419
|
+
'gears',
|
420
|
+
'cookie',
|
421
|
+
'ie',
|
422
|
+
'flash'
|
423
|
+
],
|
424
|
+
|
425
|
+
// valid name regular expression
|
426
|
+
name_re: /^[a-z][a-z0-9_ \-]+$/i,
|
427
|
+
|
428
|
+
// list of backend methods
|
429
|
+
methods: [
|
430
|
+
'init',
|
431
|
+
'get',
|
432
|
+
'set',
|
433
|
+
'remove',
|
434
|
+
'load',
|
435
|
+
'save',
|
436
|
+
'iterate'
|
437
|
+
// TODO: clear method?
|
438
|
+
],
|
439
|
+
|
440
|
+
// sql for db backends (gears and db)
|
441
|
+
sql: {
|
442
|
+
version: '1', // db schema version
|
443
|
+
|
444
|
+
// XXX: the "IF NOT EXISTS" is a sqlite-ism; fortunately all the
|
445
|
+
// known DB implementations (safari and gears) use sqlite
|
446
|
+
create: "CREATE TABLE IF NOT EXISTS persist_data (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)",
|
447
|
+
get: "SELECT v FROM persist_data WHERE k = ?",
|
448
|
+
set: "INSERT INTO persist_data(k, v) VALUES (?, ?)",
|
449
|
+
remove: "DELETE FROM persist_data WHERE k = ?",
|
450
|
+
keys: "SELECT * FROM persist_data"
|
451
|
+
},
|
452
|
+
|
453
|
+
// default flash configuration
|
454
|
+
flash: {
|
455
|
+
// ID of wrapper element
|
456
|
+
div_id: '_persist_flash_wrap',
|
457
|
+
|
458
|
+
// id of flash object/embed
|
459
|
+
id: '_persist_flash',
|
460
|
+
|
461
|
+
// default path to flash object
|
462
|
+
path: 'persist.swf',
|
463
|
+
size: { w:1, h:1 },
|
464
|
+
|
465
|
+
// arguments passed to flash object
|
466
|
+
params: {
|
467
|
+
autostart: true
|
468
|
+
}
|
469
|
+
}
|
470
|
+
};
|
471
|
+
|
472
|
+
// built-in backends
|
473
|
+
B = {
|
474
|
+
// gears db backend
|
475
|
+
// (src: http://code.google.com/apis/gears/api_database.html)
|
476
|
+
gears: {
|
477
|
+
// no known limit
|
478
|
+
size: -1,
|
479
|
+
|
480
|
+
test: function() {
|
481
|
+
// test for gears
|
482
|
+
return (window.google && window.google.gears) ? true : false;
|
483
|
+
},
|
484
|
+
|
485
|
+
methods: {
|
486
|
+
|
487
|
+
init: function() {
|
488
|
+
var db;
|
489
|
+
|
490
|
+
// create database handle (TODO: add schema version?)
|
491
|
+
db = this.db = google.gears.factory.create('beta.database');
|
492
|
+
|
493
|
+
// open database
|
494
|
+
// from gears ref:
|
495
|
+
//
|
496
|
+
// Currently the name, if supplied and of length greater than
|
497
|
+
// zero, must consist only of visible ASCII characters
|
498
|
+
// excluding the following characters:
|
499
|
+
//
|
500
|
+
// / \ : * ? " < > | ; ,
|
501
|
+
//
|
502
|
+
// (this constraint is enforced in the Store constructor)
|
503
|
+
db.open(esc(this.name));
|
504
|
+
|
505
|
+
// create table
|
506
|
+
db.execute(C.sql.create).close();
|
507
|
+
},
|
508
|
+
|
509
|
+
get: function(key) {
|
510
|
+
var r, sql = C.sql.get;
|
511
|
+
var db = this.db;
|
512
|
+
var ret;
|
513
|
+
|
514
|
+
// begin transaction
|
515
|
+
db.execute('BEGIN').close();
|
516
|
+
|
517
|
+
// exec query
|
518
|
+
r = db.execute(sql, [key]);
|
519
|
+
|
520
|
+
// check result and get value
|
521
|
+
ret = r.isValidRow() ? r.field(0) : null;
|
522
|
+
|
523
|
+
// close result set
|
524
|
+
r.close();
|
525
|
+
|
526
|
+
// commit changes
|
527
|
+
db.execute('COMMIT').close();
|
528
|
+
return ret;
|
529
|
+
},
|
530
|
+
|
531
|
+
set: function(key, val ) {
|
532
|
+
var rm_sql = C.sql.remove,
|
533
|
+
sql = C.sql.set, r;
|
534
|
+
var db = this.db;
|
535
|
+
var ret;
|
536
|
+
|
537
|
+
// begin transaction
|
538
|
+
db.execute('BEGIN').close();
|
539
|
+
|
540
|
+
// exec remove query
|
541
|
+
db.execute(rm_sql, [key]).close();
|
542
|
+
|
543
|
+
// exec set query
|
544
|
+
db.execute(sql, [key, val]).close();
|
545
|
+
|
546
|
+
// commit changes
|
547
|
+
db.execute('COMMIT').close();
|
548
|
+
|
549
|
+
return val;
|
550
|
+
},
|
551
|
+
|
552
|
+
remove: function(key) {
|
553
|
+
var get_sql = C.sql.get,
|
554
|
+
sql = C.sql.remove,
|
555
|
+
r, val = null, is_valid = false;
|
556
|
+
var db = this.db;
|
557
|
+
|
558
|
+
// begin transaction
|
559
|
+
db.execute('BEGIN').close();
|
560
|
+
|
561
|
+
// exec remove query
|
562
|
+
db.execute(sql, [key]).close();
|
563
|
+
|
564
|
+
// commit changes
|
565
|
+
db.execute('COMMIT').close();
|
566
|
+
|
567
|
+
return true;
|
568
|
+
},
|
569
|
+
iterate: function(fn,scope) {
|
570
|
+
var key_sql = C.sql.keys;
|
571
|
+
var r;
|
572
|
+
var db = this.db;
|
573
|
+
|
574
|
+
// exec keys query
|
575
|
+
r = db.execute(key_sql);
|
576
|
+
while (r.isValidRow()) {
|
577
|
+
fn.call(scope || this, r.field(0), r.field(1));
|
578
|
+
r.next();
|
579
|
+
}
|
580
|
+
r.close();
|
581
|
+
}
|
582
|
+
}
|
583
|
+
},
|
584
|
+
|
585
|
+
// globalstorage backend (globalStorage, FF2+, IE8+)
|
586
|
+
// (src: http://developer.mozilla.org/en/docs/DOM:Storage#globalStorage)
|
587
|
+
// https://developer.mozilla.org/En/DOM/Storage
|
588
|
+
//
|
589
|
+
// TODO: test to see if IE8 uses object literal semantics or
|
590
|
+
// getItem/setItem/removeItem semantics
|
591
|
+
globalstorage: {
|
592
|
+
// (5 meg limit, src: http://ejohn.org/blog/dom-storage-answers/)
|
593
|
+
size: 5 * 1024 * 1024,
|
594
|
+
|
595
|
+
test: function() {
|
596
|
+
if (window.globalStorage) {
|
597
|
+
var domain = '127.0.0.1';
|
598
|
+
if (this.o && this.o.domain) {
|
599
|
+
domain = this.o.domain;
|
600
|
+
}
|
601
|
+
try{
|
602
|
+
var dontcare = globalStorage[domain];
|
603
|
+
return true;
|
604
|
+
} catch(e) {
|
605
|
+
if (window.console && window.console.warn) {
|
606
|
+
console.warn("globalStorage exists, but couldn't use it because your browser is running on domain:", domain);
|
607
|
+
}
|
608
|
+
return false;
|
609
|
+
}
|
610
|
+
} else {
|
611
|
+
return false;
|
612
|
+
}
|
613
|
+
},
|
614
|
+
|
615
|
+
methods: {
|
616
|
+
key: function(key) {
|
617
|
+
return esc(this.name) + esc(key);
|
618
|
+
},
|
619
|
+
|
620
|
+
init: function() {
|
621
|
+
this.store = globalStorage[this.o.domain];
|
622
|
+
},
|
623
|
+
|
624
|
+
get: function(key) {
|
625
|
+
// expand key
|
626
|
+
key = this.key(key);
|
627
|
+
|
628
|
+
return this.store.getItem(key);
|
629
|
+
},
|
630
|
+
|
631
|
+
set: function(key, val ) {
|
632
|
+
// expand key
|
633
|
+
key = this.key(key);
|
634
|
+
|
635
|
+
// set value
|
636
|
+
this.store.setItem(key, val);
|
637
|
+
|
638
|
+
return val;
|
639
|
+
},
|
640
|
+
|
641
|
+
remove: function(key) {
|
642
|
+
var val;
|
643
|
+
|
644
|
+
// expand key
|
645
|
+
key = this.key(key);
|
646
|
+
|
647
|
+
// get value
|
648
|
+
val = this.store.getItem[key];
|
649
|
+
|
650
|
+
// delete value
|
651
|
+
this.store.removeItem(key);
|
652
|
+
|
653
|
+
return val;
|
654
|
+
}
|
655
|
+
}
|
656
|
+
},
|
657
|
+
|
658
|
+
// localstorage backend (globalStorage, FF2+, IE8+)
|
659
|
+
// (src: http://www.whatwg.org/specs/web-apps/current-work/#the-localstorage)
|
660
|
+
// also http://msdn.microsoft.com/en-us/library/cc197062(VS.85).aspx#_global
|
661
|
+
localstorage: {
|
662
|
+
// (unknown?)
|
663
|
+
// ie has the remainingSpace property, see:
|
664
|
+
// http://msdn.microsoft.com/en-us/library/cc197016(VS.85).aspx
|
665
|
+
size: -1,
|
666
|
+
|
667
|
+
test: function() {
|
668
|
+
// FF: Throws a security error when cookies are disabled
|
669
|
+
try {
|
670
|
+
// Chrome: window.localStorage is available, but calling set throws a quota exceeded error
|
671
|
+
if (window.localStorage &&
|
672
|
+
window.localStorage.setItem("test", null) == undefined) {
|
673
|
+
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
|
674
|
+
var ffVersion = RegExp.$1;
|
675
|
+
|
676
|
+
if (ffVersion >= 9) {
|
677
|
+
return true;
|
678
|
+
}
|
679
|
+
|
680
|
+
// FF: Fix for Firefox bug when protocol is file: https://bugzilla.mozilla.org/show_bug.cgi?id=507361
|
681
|
+
if (window.location.protocol == 'file:') {
|
682
|
+
return false;
|
683
|
+
}
|
684
|
+
} else {
|
685
|
+
return true;
|
686
|
+
}
|
687
|
+
} else {
|
688
|
+
return false;
|
689
|
+
}
|
690
|
+
return window.localStorage ? true : false;
|
691
|
+
} catch (e) {
|
692
|
+
return false;
|
693
|
+
}
|
694
|
+
},
|
695
|
+
|
696
|
+
methods: {
|
697
|
+
key: function(key) {
|
698
|
+
return this.name + '>' + key ;
|
699
|
+
//return esc(this.name) + esc(key);
|
700
|
+
},
|
701
|
+
|
702
|
+
init: function() {
|
703
|
+
this.store = localStorage;
|
704
|
+
},
|
705
|
+
|
706
|
+
get: function(key) {
|
707
|
+
// expand key
|
708
|
+
key = this.key(key);
|
709
|
+
|
710
|
+
return this.store.getItem(key);
|
711
|
+
},
|
712
|
+
|
713
|
+
set: function(key, val ) {
|
714
|
+
// expand key
|
715
|
+
key = this.key(key);
|
716
|
+
|
717
|
+
// set value
|
718
|
+
this.store.setItem(key, val);
|
719
|
+
|
720
|
+
return val;
|
721
|
+
},
|
722
|
+
|
723
|
+
remove: function(key) {
|
724
|
+
var val;
|
725
|
+
|
726
|
+
// expand key
|
727
|
+
key = this.key(key);
|
728
|
+
|
729
|
+
// get value
|
730
|
+
val = this.store.getItem(key);
|
731
|
+
|
732
|
+
// delete value
|
733
|
+
this.store.removeItem(key);
|
734
|
+
|
735
|
+
return val;
|
736
|
+
},
|
737
|
+
|
738
|
+
iterate: function(fn, scope) {
|
739
|
+
var l = this.store, key, keys;
|
740
|
+
for (var i=0;i<l.length;i++) {
|
741
|
+
key = l.key(i);
|
742
|
+
keys = key.split('>');
|
743
|
+
if ((keys.length == 2) && (keys[0] == this.name)) {
|
744
|
+
fn.call(scope || this,keys[1], l.getItem(key));
|
745
|
+
}
|
746
|
+
}
|
747
|
+
}
|
748
|
+
}
|
749
|
+
},
|
750
|
+
|
751
|
+
// IE backend
|
752
|
+
ie: {
|
753
|
+
prefix: '_persist_data-',
|
754
|
+
// style: 'display:none; behavior:url(#default#userdata);',
|
755
|
+
|
756
|
+
// 64k limit
|
757
|
+
size: 64 * 1024,
|
758
|
+
|
759
|
+
test: function() {
|
760
|
+
// make sure we're dealing with IE
|
761
|
+
// (src: http://javariet.dk/shared/browser_dom.htm)
|
762
|
+
return window.ActiveXObject ? true : false;
|
763
|
+
},
|
764
|
+
|
765
|
+
make_userdata: function(id) {
|
766
|
+
var el = document.createElement('div');
|
767
|
+
|
768
|
+
// set element properties
|
769
|
+
// http://msdn.microsoft.com/en-us/library/ms531424(VS.85).aspx
|
770
|
+
// http://www.webreference.com/js/column24/userdata.html
|
771
|
+
el.id = id;
|
772
|
+
el.style.display = 'none';
|
773
|
+
el.addBehavior('#default#userdata');
|
774
|
+
|
775
|
+
// append element to body
|
776
|
+
document.body.appendChild(el);
|
777
|
+
|
778
|
+
// return element
|
779
|
+
return el;
|
780
|
+
},
|
781
|
+
|
782
|
+
methods: {
|
783
|
+
init: function() {
|
784
|
+
var id = B.ie.prefix + esc(this.name);
|
785
|
+
|
786
|
+
// save element
|
787
|
+
this.el = B.ie.make_userdata(id);
|
788
|
+
|
789
|
+
// load data
|
790
|
+
if (this.o.defer){
|
791
|
+
this.load();
|
792
|
+
}
|
793
|
+
},
|
794
|
+
|
795
|
+
get: function(key) {
|
796
|
+
var val;
|
797
|
+
|
798
|
+
// expand key
|
799
|
+
key = esc(key);
|
800
|
+
|
801
|
+
// load data
|
802
|
+
if (!this.o.defer){
|
803
|
+
this.load();
|
804
|
+
}
|
805
|
+
|
806
|
+
// get value
|
807
|
+
val = this.el.getAttribute(key);
|
808
|
+
|
809
|
+
return val;
|
810
|
+
},
|
811
|
+
|
812
|
+
set: function(key, val) {
|
813
|
+
// expand key
|
814
|
+
key = esc(key);
|
815
|
+
|
816
|
+
// set attribute
|
817
|
+
this.el.setAttribute(key, val);
|
818
|
+
|
819
|
+
// save data
|
820
|
+
if (!this.o.defer){
|
821
|
+
this.save();
|
822
|
+
}
|
823
|
+
|
824
|
+
return val;
|
825
|
+
},
|
826
|
+
|
827
|
+
remove: function(key) {
|
828
|
+
var val;
|
829
|
+
|
830
|
+
// expand key
|
831
|
+
key = esc(key);
|
832
|
+
|
833
|
+
// load data
|
834
|
+
if (!this.o.defer){
|
835
|
+
this.load();
|
836
|
+
}
|
837
|
+
|
838
|
+
// get old value and remove attribute
|
839
|
+
val = this.el.getAttribute(key);
|
840
|
+
this.el.removeAttribute(key);
|
841
|
+
|
842
|
+
// save data
|
843
|
+
if (!this.o.defer){
|
844
|
+
this.save();
|
845
|
+
}
|
846
|
+
|
847
|
+
return val;
|
848
|
+
},
|
849
|
+
|
850
|
+
load: function() {
|
851
|
+
this.el.load(esc(this.name));
|
852
|
+
},
|
853
|
+
|
854
|
+
save: function() {
|
855
|
+
this.el.save(esc(this.name));
|
856
|
+
}
|
857
|
+
}
|
858
|
+
},
|
859
|
+
|
860
|
+
// cookie backend
|
861
|
+
// uses easycookie: http://pablotron.org/software/easy_cookie/
|
862
|
+
cookie: {
|
863
|
+
delim: ':',
|
864
|
+
|
865
|
+
// 4k limit (low-ball this limit to handle browser weirdness, and
|
866
|
+
// so we don't hose session cookies)
|
867
|
+
size: 4000,
|
868
|
+
|
869
|
+
test: function() {
|
870
|
+
// XXX: use easycookie to test if cookies are enabled
|
871
|
+
return P.Cookie.enabled ? true : false;
|
872
|
+
},
|
873
|
+
|
874
|
+
methods: {
|
875
|
+
key: function(key) {
|
876
|
+
return this.name + B.cookie.delim + key;
|
877
|
+
},
|
878
|
+
|
879
|
+
get: function(key, fn ) {
|
880
|
+
var val;
|
881
|
+
|
882
|
+
// expand key
|
883
|
+
key = this.key(key);
|
884
|
+
|
885
|
+
// get value
|
886
|
+
val = ec.get(key);
|
887
|
+
|
888
|
+
return val;
|
889
|
+
},
|
890
|
+
|
891
|
+
set: function(key, val, fn ) {
|
892
|
+
// expand key
|
893
|
+
key = this.key(key);
|
894
|
+
|
895
|
+
// save value
|
896
|
+
ec.set(key, val, this.o);
|
897
|
+
|
898
|
+
return val;
|
899
|
+
},
|
900
|
+
|
901
|
+
remove: function(key, val ) {
|
902
|
+
var val;
|
903
|
+
|
904
|
+
// expand key
|
905
|
+
key = this.key(key);
|
906
|
+
|
907
|
+
// remove cookie
|
908
|
+
val = ec.remove(key);
|
909
|
+
|
910
|
+
return val;
|
911
|
+
}
|
912
|
+
}
|
913
|
+
},
|
914
|
+
|
915
|
+
// flash backend (requires flash 8 or newer)
|
916
|
+
// http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16194&sliceId=1
|
917
|
+
// http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002200.html
|
918
|
+
flash: {
|
919
|
+
test: function() {
|
920
|
+
// TODO: better flash detection
|
921
|
+
try {
|
922
|
+
if (!swfobject){
|
923
|
+
return false;
|
924
|
+
}
|
925
|
+
} catch (e) {
|
926
|
+
return false;
|
927
|
+
}
|
928
|
+
|
929
|
+
// get the major version
|
930
|
+
var major = swfobject.getFlashPlayerVersion().major;
|
931
|
+
|
932
|
+
// check flash version (require 8.0 or newer)
|
933
|
+
return (major >= 8) ? true : false;
|
934
|
+
},
|
935
|
+
|
936
|
+
methods: {
|
937
|
+
init: function() {
|
938
|
+
if (!B.flash.el) {
|
939
|
+
var key, el, fel, cfg = C.flash;
|
940
|
+
|
941
|
+
// create wrapper element
|
942
|
+
el = document.createElement('div');
|
943
|
+
el.id = cfg.div_id;
|
944
|
+
|
945
|
+
// create flash element
|
946
|
+
fel = document.createElement('div');
|
947
|
+
fel.id = cfg.id;
|
948
|
+
|
949
|
+
el.appendChild(fel);
|
950
|
+
|
951
|
+
// append element to body
|
952
|
+
document.body.appendChild(el);
|
953
|
+
|
954
|
+
// create new swf object
|
955
|
+
B.flash.el = swfobject.createSWF({ id: cfg.id, data: this.o.swf_path || cfg.path, width: cfg.size.w, height: cfg.size.h }, cfg.params, cfg.id);
|
956
|
+
}
|
957
|
+
|
958
|
+
this.el = B.flash.el;
|
959
|
+
},
|
960
|
+
|
961
|
+
get: function(key) {
|
962
|
+
var val;
|
963
|
+
|
964
|
+
// escape key
|
965
|
+
key = esc(key);
|
966
|
+
|
967
|
+
// get value
|
968
|
+
val = this.el.get(this.name, key);
|
969
|
+
|
970
|
+
return val;
|
971
|
+
},
|
972
|
+
|
973
|
+
set: function(key, val ) {
|
974
|
+
var old_val;
|
975
|
+
|
976
|
+
// escape key
|
977
|
+
key = esc(key);
|
978
|
+
|
979
|
+
// set value
|
980
|
+
old_val = this.el.set(this.name, key, val);
|
981
|
+
|
982
|
+
return old_val;
|
983
|
+
},
|
984
|
+
|
985
|
+
remove: function(key) {
|
986
|
+
var val;
|
987
|
+
|
988
|
+
// get key
|
989
|
+
key = esc(key);
|
990
|
+
|
991
|
+
// remove old value
|
992
|
+
val = this.el.remove(this.name, key);
|
993
|
+
return val;
|
994
|
+
}
|
995
|
+
}
|
996
|
+
}
|
997
|
+
};
|
998
|
+
|
999
|
+
/**
|
1000
|
+
* Test for available backends and pick the best one.
|
1001
|
+
* @private
|
1002
|
+
*/
|
1003
|
+
init = function() {
|
1004
|
+
var i, l, b, key, fns = C.methods, keys = C.search_order;
|
1005
|
+
|
1006
|
+
// set all functions to the empty function
|
1007
|
+
for (var idx = 0, len = fns.length; idx < len; idx++) {
|
1008
|
+
P.Store.prototype[fns[idx]] = empty;
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
// clear type and size
|
1012
|
+
P.type = null;
|
1013
|
+
P.size = -1;
|
1014
|
+
|
1015
|
+
// loop over all backends and test for each one
|
1016
|
+
for (var idx2 = 0, len2 = keys.length; !P.type && idx2 < len2; idx2++) {
|
1017
|
+
b = B[keys[idx2]];
|
1018
|
+
|
1019
|
+
// test for backend
|
1020
|
+
if (b.test()) {
|
1021
|
+
// found backend, save type and size
|
1022
|
+
P.type = keys[idx2];
|
1023
|
+
P.size = b.size;
|
1024
|
+
// extend store prototype with backend methods
|
1025
|
+
for (key in b.methods) {
|
1026
|
+
P.Store.prototype[key] = b.methods[key];
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
// mark library as initialized
|
1032
|
+
P._init = true;
|
1033
|
+
};
|
1034
|
+
|
1035
|
+
// create top-level namespace
|
1036
|
+
P = {
|
1037
|
+
// version of persist library
|
1038
|
+
VERSION: VERSION,
|
1039
|
+
|
1040
|
+
// backend type and size limit
|
1041
|
+
type: null,
|
1042
|
+
size: 0,
|
1043
|
+
|
1044
|
+
// XXX: expose init function?
|
1045
|
+
// init: init,
|
1046
|
+
|
1047
|
+
add: function(o) {
|
1048
|
+
// add to backend hash
|
1049
|
+
B[o.id] = o;
|
1050
|
+
|
1051
|
+
// add backend to front of search order
|
1052
|
+
C.search_order = [o.id].concat(C.search_order);
|
1053
|
+
|
1054
|
+
// re-initialize library
|
1055
|
+
init();
|
1056
|
+
},
|
1057
|
+
|
1058
|
+
remove: function(id) {
|
1059
|
+
var ofs = index_of(C.search_order, id);
|
1060
|
+
if (ofs < 0){
|
1061
|
+
return;
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
// remove from search order
|
1065
|
+
C.search_order.splice(ofs, 1);
|
1066
|
+
|
1067
|
+
// delete from lut
|
1068
|
+
delete B[id];
|
1069
|
+
|
1070
|
+
// re-initialize library
|
1071
|
+
init();
|
1072
|
+
},
|
1073
|
+
|
1074
|
+
// expose easycookie API
|
1075
|
+
Cookie: ec,
|
1076
|
+
|
1077
|
+
// store API
|
1078
|
+
Store: function(name, o) {
|
1079
|
+
// verify name
|
1080
|
+
if (!C.name_re.exec(name)){
|
1081
|
+
throw new Error("Invalid name");
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
// XXX: should we lazy-load type?
|
1085
|
+
// if (!P._init)
|
1086
|
+
// init();
|
1087
|
+
|
1088
|
+
if (!P.type){
|
1089
|
+
throw new Error("No suitable storage found");
|
1090
|
+
}
|
1091
|
+
|
1092
|
+
o = o || {};
|
1093
|
+
this.name = name;
|
1094
|
+
|
1095
|
+
// get domain (XXX: does this localdomain fix work?)
|
1096
|
+
o.domain = o.domain || location.hostname || 'localhost';
|
1097
|
+
|
1098
|
+
// strip port from domain (XXX: will this break ipv6?)
|
1099
|
+
o.domain = o.domain.replace(/:\d+$/, '');
|
1100
|
+
|
1101
|
+
// Specifically for IE6 and localhost
|
1102
|
+
o.domain = (o.domain == 'localhost') ? '' : o.domain;
|
1103
|
+
|
1104
|
+
// append localdomain to domains w/o '."
|
1105
|
+
// (see https://bugzilla.mozilla.org/show_bug.cgi?id=357323)
|
1106
|
+
// (file://localhost/ works, see:
|
1107
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=469192)
|
1108
|
+
/*
|
1109
|
+
* if (!o.domain.match(/\./))
|
1110
|
+
* o.domain += '.localdomain';
|
1111
|
+
*/
|
1112
|
+
|
1113
|
+
this.o = o;
|
1114
|
+
|
1115
|
+
// expires in 2 years
|
1116
|
+
o.expires = o.expires || 365 * 2;
|
1117
|
+
|
1118
|
+
// set path to root
|
1119
|
+
o.path = o.path || '/';
|
1120
|
+
|
1121
|
+
if (this.o.search_order) {
|
1122
|
+
C.search_order = this.o.search_order;
|
1123
|
+
init();
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
// call init function
|
1127
|
+
this.init();
|
1128
|
+
}
|
1129
|
+
};
|
1130
|
+
|
1131
|
+
// init persist
|
1132
|
+
init();
|
1133
|
+
|
1134
|
+
// return top-level namespace
|
1135
|
+
return P;
|
1136
|
+
})();
|