dune-dashboard 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.bowerrc +3 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/.travis.yml +13 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +392 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +23 -0
- data/app/assets/images/dune/dashboard/logo@2x.png +0 -0
- data/app/assets/javascripts/adapters/channel_adapter.coffee +1 -0
- data/app/assets/javascripts/adapters/form_data.coffee +26 -0
- data/app/assets/javascripts/adapters/press_asset_adapter.coffee +1 -0
- data/app/assets/javascripts/configs.coffee +10 -0
- data/app/assets/javascripts/controllers/.gitkeep +0 -0
- data/app/assets/javascripts/controllers/channels.coffee +40 -0
- data/app/assets/javascripts/controllers/contributions.coffee +26 -0
- data/app/assets/javascripts/controllers/press_assets.coffee +24 -0
- data/app/assets/javascripts/controllers/projects.coffee +36 -0
- data/app/assets/javascripts/controllers/sessions.coffee +2 -0
- data/app/assets/javascripts/controllers/tags.coffee +24 -0
- data/app/assets/javascripts/controllers/users.coffee +8 -0
- data/app/assets/javascripts/dashboard.coffee +5 -0
- data/app/assets/javascripts/dune-dashboard-application.js +16 -0
- data/app/assets/javascripts/dune-dashboard-libs.js +25 -0
- data/app/assets/javascripts/dune-dashboard-templates.js +1 -0
- data/app/assets/javascripts/helpers/daterangepicker.coffee +1 -0
- data/app/assets/javascripts/helpers/format-date.coffee +5 -0
- data/app/assets/javascripts/helpers/loading.coffee +14 -0
- data/app/assets/javascripts/helpers/number-to-currency.coffee +5 -0
- data/app/assets/javascripts/helpers/pagination.coffee +1 -0
- data/app/assets/javascripts/helpers/show-boolean.coffee +5 -0
- data/app/assets/javascripts/i18n/translations_en.js +165 -0
- data/app/assets/javascripts/initializers/authentication.coffee +50 -0
- data/app/assets/javascripts/mixins/modal-controller.coffee +7 -0
- data/app/assets/javascripts/mixins/modal-view.coffee +15 -0
- data/app/assets/javascripts/mixins/paginable.coffee +25 -0
- data/app/assets/javascripts/mixins/searchable.coffee +58 -0
- data/app/assets/javascripts/models/.gitkeep +0 -0
- data/app/assets/javascripts/models/channel.coffee +25 -0
- data/app/assets/javascripts/models/contributions.coffee +15 -0
- data/app/assets/javascripts/models/press_asset.coffee +5 -0
- data/app/assets/javascripts/models/project.coffee +16 -0
- data/app/assets/javascripts/models/reward.coffee +4 -0
- data/app/assets/javascripts/models/tag.coffee +4 -0
- data/app/assets/javascripts/models/user.coffee +13 -0
- data/app/assets/javascripts/router.coffee +36 -0
- data/app/assets/javascripts/routes/.gitkeep +0 -0
- data/app/assets/javascripts/routes/application.coffee +35 -0
- data/app/assets/javascripts/routes/channels-edit.coffee +4 -0
- data/app/assets/javascripts/routes/channels-new.coffee +4 -0
- data/app/assets/javascripts/routes/channels.coffee +21 -0
- data/app/assets/javascripts/routes/contributions.coffee +29 -0
- data/app/assets/javascripts/routes/index.coffee +4 -0
- data/app/assets/javascripts/routes/press_assets-edit.coffee +4 -0
- data/app/assets/javascripts/routes/press_assets-new.coffee +5 -0
- data/app/assets/javascripts/routes/press_assets.coffee +13 -0
- data/app/assets/javascripts/routes/projects.coffee +23 -0
- data/app/assets/javascripts/routes/sessions.coffee +3 -0
- data/app/assets/javascripts/routes/tags-edit.coffee +4 -0
- data/app/assets/javascripts/routes/tags-new.coffee +5 -0
- data/app/assets/javascripts/routes/tags.coffee +15 -0
- data/app/assets/javascripts/routes/users.coffee +17 -0
- data/app/assets/javascripts/serializers/channel.coffee +10 -0
- data/app/assets/javascripts/serializers/file.coffee +6 -0
- data/app/assets/javascripts/serializers/object.coffee +6 -0
- data/app/assets/javascripts/serializers/project.coffee +4 -0
- data/app/assets/javascripts/store.coffee +5 -0
- data/app/assets/javascripts/templates/.gitkeep +0 -0
- data/app/assets/javascripts/templates/channels/_form.emblem +256 -0
- data/app/assets/javascripts/templates/channels/edit.emblem +1 -0
- data/app/assets/javascripts/templates/channels/index.emblem +66 -0
- data/app/assets/javascripts/templates/channels/new.emblem +1 -0
- data/app/assets/javascripts/templates/channels/search-form.emblem +13 -0
- data/app/assets/javascripts/templates/contributions/index.emblem +111 -0
- data/app/assets/javascripts/templates/contributions/search-form.emblem +27 -0
- data/app/assets/javascripts/templates/contributions/show.emblem +79 -0
- data/app/assets/javascripts/templates/daterangepicker.emblem +5 -0
- data/app/assets/javascripts/templates/layouts/application.emblem +19 -0
- data/app/assets/javascripts/templates/layouts/header.emblem +25 -0
- data/app/assets/javascripts/templates/layouts/sidebar.emblem +32 -0
- data/app/assets/javascripts/templates/pagination.emblem +10 -0
- data/app/assets/javascripts/templates/press_assets/_form.emblem +33 -0
- data/app/assets/javascripts/templates/press_assets/edit.emblem +1 -0
- data/app/assets/javascripts/templates/press_assets/index.emblem +45 -0
- data/app/assets/javascripts/templates/press_assets/new.emblem +1 -0
- data/app/assets/javascripts/templates/projects/index.emblem +119 -0
- data/app/assets/javascripts/templates/projects/search-form.emblem +19 -0
- data/app/assets/javascripts/templates/search-tab.emblem +6 -0
- data/app/assets/javascripts/templates/sessions/new.emblem +17 -0
- data/app/assets/javascripts/templates/tags/_form.emblem +24 -0
- data/app/assets/javascripts/templates/tags/edit.emblem +1 -0
- data/app/assets/javascripts/templates/tags/index.emblem +46 -0
- data/app/assets/javascripts/templates/tags/new.emblem +1 -0
- data/app/assets/javascripts/templates/users/index.emblem +51 -0
- data/app/assets/javascripts/templates/users/search-form.emblem +13 -0
- data/app/assets/javascripts/views/auto-save-checkbox.coffee +14 -0
- data/app/assets/javascripts/views/contributions/show.coffee +1 -0
- data/app/assets/javascripts/views/daterangepicker.coffee +60 -0
- data/app/assets/javascripts/views/file.coffee +7 -0
- data/app/assets/javascripts/views/layouts/header.coffee +23 -0
- data/app/assets/javascripts/views/layouts/sidebar.coffee +6 -0
- data/app/assets/javascripts/views/page-title.coffee +45 -0
- data/app/assets/javascripts/views/pagination.coffee +51 -0
- data/app/assets/javascripts/views/projects/index.coffee +5 -0
- data/app/assets/javascripts/views/search-tab.coffee +24 -0
- data/app/assets/stylesheets/core/core.sass +299 -0
- data/app/assets/stylesheets/core/mixins.sass +83 -0
- data/app/assets/stylesheets/core/settings.sass +75 -0
- data/app/assets/stylesheets/dune-dashboard-application.sass +12 -0
- data/app/assets/stylesheets/modules/alerts.sass +21 -0
- data/app/assets/stylesheets/modules/avatar.sass +13 -0
- data/app/assets/stylesheets/modules/boxes.sass +274 -0
- data/app/assets/stylesheets/modules/buttons.sass +160 -0
- data/app/assets/stylesheets/modules/dl-details.sass +13 -0
- data/app/assets/stylesheets/modules/forms.sass +53 -0
- data/app/assets/stylesheets/modules/generic.sass +9 -0
- data/app/assets/stylesheets/modules/header.sass +153 -0
- data/app/assets/stylesheets/modules/labels.sass +3 -0
- data/app/assets/stylesheets/modules/navs.sass +98 -0
- data/app/assets/stylesheets/modules/pagination.sass +19 -0
- data/app/assets/stylesheets/modules/sidebar.sass +147 -0
- data/app/assets/stylesheets/modules/small-box.sass +78 -0
- data/app/assets/stylesheets/pages/login.sass +42 -0
- data/app/controllers/dune/dashboard/ember_controller.rb +7 -0
- data/app/views/layouts/dune/dashboard/application.html.erb +15 -0
- data/bower.json +28 -0
- data/config/ember-i18n.yml +2 -0
- data/config/ember_locales/channels.en.yml +49 -0
- data/config/ember_locales/contributions.en.yml +42 -0
- data/config/ember_locales/en.yml +1 -0
- data/config/ember_locales/layouts.en.yml +16 -0
- data/config/ember_locales/press_assets.en.yml +14 -0
- data/config/ember_locales/projects.en.yml +33 -0
- data/config/ember_locales/sessions.en.yml +11 -0
- data/config/ember_locales/tags.en.yml +12 -0
- data/config/ember_locales/titles.en.yml +22 -0
- data/config/ember_locales/users.en.yml +12 -0
- data/config/ember_locales/words.en.yml +12 -0
- data/config/routes.rb +4 -0
- data/dune-dashboard.gemspec +28 -0
- data/lib/dune/dashboard.rb +11 -0
- data/lib/dune/dashboard/engine.rb +12 -0
- data/lib/dune/dashboard/i18n.rb +108 -0
- data/lib/dune/dashboard/version.rb +5 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +30 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +38 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/javascripts/controllers/channels_spec.coffee +16 -0
- data/spec/javascripts/controllers/press_assets_spec.coffee +5 -0
- data/spec/javascripts/controllers/projects_spec.coffee +16 -0
- data/spec/javascripts/controllers/users_spec.coffee +16 -0
- data/spec/javascripts/fixtures/channels.coffee +49 -0
- data/spec/javascripts/fixtures/contributions.coffee +46 -0
- data/spec/javascripts/fixtures/press_assets.coffee +15 -0
- data/spec/javascripts/fixtures/projects.coffee +108 -0
- data/spec/javascripts/fixtures/tags.coffee +15 -0
- data/spec/javascripts/fixtures/users.coffee +26 -0
- data/spec/javascripts/helpers/auththentication.coffee +11 -0
- data/spec/javascripts/integration/channels_spec.coffee +109 -0
- data/spec/javascripts/integration/contributions_spec.coffee +108 -0
- data/spec/javascripts/integration/press_assets_spec.coffee +66 -0
- data/spec/javascripts/integration/projects_spec.coffee +110 -0
- data/spec/javascripts/integration/sessions_spec.coffee +71 -0
- data/spec/javascripts/integration/tags_spec.coffee +65 -0
- data/spec/javascripts/integration/users_spec.coffee +108 -0
- data/spec/javascripts/models/channel_spec.coffee +4 -0
- data/spec/javascripts/models/contribution_spec.coffee +4 -0
- data/spec/javascripts/models/press_asset_spec.coffee +5 -0
- data/spec/javascripts/models/project_spec.coffee +4 -0
- data/spec/javascripts/models/reward_spec.coffee +4 -0
- data/spec/javascripts/models/tag_spec.coffee +4 -0
- data/spec/javascripts/models/user_spec.coffee +4 -0
- data/spec/javascripts/spec_helper.coffee +56 -0
- data/spec/javascripts/support/jquery.mockjax.js +598 -0
- data/spec/teaspoon_env.rb +183 -0
- data/vendor/assets/components/cldr/.bower.json +14 -0
- data/vendor/assets/components/cldr/README.md +47 -0
- data/vendor/assets/components/cldr/plurals.js +240 -0
- data/vendor/assets/components/ember-i18n/.bower.json +46 -0
- data/vendor/assets/components/ember-i18n/CONTRIBUTING.md +13 -0
- data/vendor/assets/components/ember-i18n/Changelog.md +82 -0
- data/vendor/assets/components/ember-i18n/LICENSE +10 -0
- data/vendor/assets/components/ember-i18n/README.md +148 -0
- data/vendor/assets/components/ember-i18n/VERSION +1 -0
- data/vendor/assets/components/ember-i18n/bower.json +34 -0
- data/vendor/assets/components/ember-i18n/lib/i18n.js +215 -0
- data/vendor/assets/components/ember-i18n/package.json +27 -0
- data/vendor/assets/components/ember-i18n/script/buildSuite.js +34 -0
- data/vendor/assets/components/ember-i18n/script/fetch_vendor.js +66 -0
- data/vendor/assets/components/ember-i18n/script/run.js +24 -0
- data/vendor/assets/components/ember-simple-auth/.bower.json +31 -0
- data/vendor/assets/components/ember-simple-auth/LICENSE +20 -0
- data/vendor/assets/components/ember-simple-auth/README.md +15 -0
- data/vendor/assets/components/ember-simple-auth/bower.json +21 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-cookie-store.amd.js +220 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-cookie-store.js +284 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-devise.amd.js +243 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-devise.js +312 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-oauth2.amd.js +386 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-oauth2.js +455 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-testing.amd.js +79 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-testing.js +137 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-torii.amd.js +142 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth-torii.js +199 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth.amd.js +1450 -0
- data/vendor/assets/components/ember-simple-auth/simple-auth.js +1548 -0
- data/vendor/assets/components/ember/.bower.json +21 -0
- data/vendor/assets/components/ember/.gitignore +5 -0
- data/vendor/assets/components/ember/Makefile +9 -0
- data/vendor/assets/components/ember/README.md +12 -0
- data/vendor/assets/components/ember/bower.json +11 -0
- data/vendor/assets/components/ember/component.json +13 -0
- data/vendor/assets/components/ember/composer.json +27 -0
- data/vendor/assets/components/ember/ember-template-compiler.js +336 -0
- data/vendor/assets/components/ember/ember.js +46762 -0
- data/vendor/assets/components/ember/ember.min.js +20 -0
- data/vendor/assets/components/ember/ember.prod.js +46319 -0
- data/vendor/assets/components/ember/package.json +11 -0
- data/vendor/assets/components/handlebars/.bower.json +16 -0
- data/vendor/assets/components/handlebars/.gitignore +2 -0
- data/vendor/assets/components/handlebars/README.md +11 -0
- data/vendor/assets/components/handlebars/bower.json +6 -0
- data/vendor/assets/components/handlebars/component.json +9 -0
- data/vendor/assets/components/handlebars/composer.json +35 -0
- data/vendor/assets/components/handlebars/handlebars-source.gemspec +21 -0
- data/vendor/assets/components/handlebars/handlebars.amd.js +2719 -0
- data/vendor/assets/components/handlebars/handlebars.amd.min.js +28 -0
- data/vendor/assets/components/handlebars/handlebars.js +2746 -0
- data/vendor/assets/components/handlebars/handlebars.js.nuspec +17 -0
- data/vendor/assets/components/handlebars/handlebars.min.js +28 -0
- data/vendor/assets/components/handlebars/handlebars.runtime.amd.js +515 -0
- data/vendor/assets/components/handlebars/handlebars.runtime.amd.min.js +27 -0
- data/vendor/assets/components/handlebars/handlebars.runtime.js +530 -0
- data/vendor/assets/components/handlebars/handlebars.runtime.min.js +27 -0
- data/vendor/assets/components/handlebars/lib/handlebars/source.rb +11 -0
- data/vendor/assets/components/jquery/.bower.json +37 -0
- data/vendor/assets/components/jquery/MIT-LICENSE.txt +21 -0
- data/vendor/assets/components/jquery/bower.json +27 -0
- data/vendor/assets/components/jquery/dist/jquery.js +9111 -0
- data/vendor/assets/components/jquery/dist/jquery.min.js +5 -0
- data/vendor/assets/components/jquery/dist/jquery.min.map +1 -0
- data/vendor/assets/components/jquery/src/ajax.js +806 -0
- data/vendor/assets/components/jquery/src/ajax/jsonp.js +89 -0
- data/vendor/assets/components/jquery/src/ajax/load.js +75 -0
- data/vendor/assets/components/jquery/src/ajax/parseJSON.js +13 -0
- data/vendor/assets/components/jquery/src/ajax/parseXML.js +28 -0
- data/vendor/assets/components/jquery/src/ajax/script.js +64 -0
- data/vendor/assets/components/jquery/src/ajax/var/nonce.js +5 -0
- data/vendor/assets/components/jquery/src/ajax/var/rquery.js +3 -0
- data/vendor/assets/components/jquery/src/ajax/xhr.js +130 -0
- data/vendor/assets/components/jquery/src/attributes.js +11 -0
- data/vendor/assets/components/jquery/src/attributes/attr.js +143 -0
- data/vendor/assets/components/jquery/src/attributes/classes.js +158 -0
- data/vendor/assets/components/jquery/src/attributes/prop.js +96 -0
- data/vendor/assets/components/jquery/src/attributes/support.js +35 -0
- data/vendor/assets/components/jquery/src/attributes/val.js +153 -0
- data/vendor/assets/components/jquery/src/callbacks.js +205 -0
- data/vendor/assets/components/jquery/src/core.js +500 -0
- data/vendor/assets/components/jquery/src/core/access.js +60 -0
- data/vendor/assets/components/jquery/src/core/init.js +123 -0
- data/vendor/assets/components/jquery/src/core/parseHTML.js +39 -0
- data/vendor/assets/components/jquery/src/core/ready.js +96 -0
- data/vendor/assets/components/jquery/src/core/var/rsingleTag.js +4 -0
- data/vendor/assets/components/jquery/src/css.js +455 -0
- data/vendor/assets/components/jquery/src/css/addGetHookIf.js +24 -0
- data/vendor/assets/components/jquery/src/css/curCSS.js +57 -0
- data/vendor/assets/components/jquery/src/css/defaultDisplay.js +69 -0
- data/vendor/assets/components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/vendor/assets/components/jquery/src/css/support.js +83 -0
- data/vendor/assets/components/jquery/src/css/swap.js +28 -0
- data/vendor/assets/components/jquery/src/css/var/cssExpand.js +3 -0
- data/vendor/assets/components/jquery/src/css/var/getStyles.js +5 -0
- data/vendor/assets/components/jquery/src/css/var/isHidden.js +13 -0
- data/vendor/assets/components/jquery/src/css/var/rmargin.js +3 -0
- data/vendor/assets/components/jquery/src/css/var/rnumnonpx.js +5 -0
- data/vendor/assets/components/jquery/src/data.js +175 -0
- data/vendor/assets/components/jquery/src/data/Data.js +181 -0
- data/vendor/assets/components/jquery/src/data/accepts.js +20 -0
- data/vendor/assets/components/jquery/src/data/var/data_priv.js +5 -0
- data/vendor/assets/components/jquery/src/data/var/data_user.js +5 -0
- data/vendor/assets/components/jquery/src/deferred.js +149 -0
- data/vendor/assets/components/jquery/src/deprecated.js +13 -0
- data/vendor/assets/components/jquery/src/dimensions.js +50 -0
- data/vendor/assets/components/jquery/src/effects.js +642 -0
- data/vendor/assets/components/jquery/src/effects/Tween.js +114 -0
- data/vendor/assets/components/jquery/src/effects/animatedSelector.js +13 -0
- data/vendor/assets/components/jquery/src/event.js +859 -0
- data/vendor/assets/components/jquery/src/event/alias.js +39 -0
- data/vendor/assets/components/jquery/src/event/support.js +9 -0
- data/vendor/assets/components/jquery/src/exports/amd.js +18 -0
- data/vendor/assets/components/jquery/src/exports/global.js +32 -0
- data/vendor/assets/components/jquery/src/intro.js +44 -0
- data/vendor/assets/components/jquery/src/jquery.js +36 -0
- data/vendor/assets/components/jquery/src/manipulation.js +583 -0
- data/vendor/assets/components/jquery/src/manipulation/_evalUrl.js +18 -0
- data/vendor/assets/components/jquery/src/manipulation/support.js +24 -0
- data/vendor/assets/components/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/vendor/assets/components/jquery/src/offset.js +204 -0
- data/vendor/assets/components/jquery/src/outro.js +1 -0
- data/vendor/assets/components/jquery/src/queue.js +142 -0
- data/vendor/assets/components/jquery/src/queue/delay.js +22 -0
- data/vendor/assets/components/jquery/src/selector-native.js +171 -0
- data/vendor/assets/components/jquery/src/selector-sizzle.js +14 -0
- data/vendor/assets/components/jquery/src/selector.js +1 -0
- data/vendor/assets/components/jquery/src/serialize.js +111 -0
- data/vendor/assets/components/jquery/src/sizzle/dist/sizzle.js +2015 -0
- data/vendor/assets/components/jquery/src/sizzle/dist/sizzle.min.js +3 -0
- data/vendor/assets/components/jquery/src/sizzle/dist/sizzle.min.map +1 -0
- data/vendor/assets/components/jquery/src/traversing.js +200 -0
- data/vendor/assets/components/jquery/src/traversing/findFilter.js +100 -0
- data/vendor/assets/components/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/vendor/assets/components/jquery/src/var/arr.js +3 -0
- data/vendor/assets/components/jquery/src/var/class2type.js +4 -0
- data/vendor/assets/components/jquery/src/var/concat.js +5 -0
- data/vendor/assets/components/jquery/src/var/hasOwn.js +5 -0
- data/vendor/assets/components/jquery/src/var/indexOf.js +5 -0
- data/vendor/assets/components/jquery/src/var/pnum.js +3 -0
- data/vendor/assets/components/jquery/src/var/push.js +5 -0
- data/vendor/assets/components/jquery/src/var/rnotwhite.js +3 -0
- data/vendor/assets/components/jquery/src/var/slice.js +5 -0
- data/vendor/assets/components/jquery/src/var/strundefined.js +3 -0
- data/vendor/assets/components/jquery/src/var/support.js +4 -0
- data/vendor/assets/components/jquery/src/var/toString.js +5 -0
- data/vendor/assets/components/jquery/src/var/trim.js +3 -0
- data/vendor/assets/components/jquery/src/wrap.js +78 -0
- data/vendor/assets/components/moment/.bower.json +30 -0
- data/vendor/assets/components/moment/LICENSE +22 -0
- data/vendor/assets/components/moment/bower.json +20 -0
- data/vendor/assets/components/moment/lang/ar-ma.js +56 -0
- data/vendor/assets/components/moment/lang/ar-sa.js +96 -0
- data/vendor/assets/components/moment/lang/ar.js +97 -0
- data/vendor/assets/components/moment/lang/az.js +102 -0
- data/vendor/assets/components/moment/lang/bg.js +86 -0
- data/vendor/assets/components/moment/lang/bn.js +106 -0
- data/vendor/assets/components/moment/lang/br.js +107 -0
- data/vendor/assets/components/moment/lang/bs.js +139 -0
- data/vendor/assets/components/moment/lang/ca.js +66 -0
- data/vendor/assets/components/moment/lang/cs.js +155 -0
- data/vendor/assets/components/moment/lang/cv.js +59 -0
- data/vendor/assets/components/moment/lang/cy.js +77 -0
- data/vendor/assets/components/moment/lang/da.js +56 -0
- data/vendor/assets/components/moment/lang/de-at.js +72 -0
- data/vendor/assets/components/moment/lang/de.js +71 -0
- data/vendor/assets/components/moment/lang/el.js +90 -0
- data/vendor/assets/components/moment/lang/en-au.js +62 -0
- data/vendor/assets/components/moment/lang/en-ca.js +59 -0
- data/vendor/assets/components/moment/lang/en-gb.js +63 -0
- data/vendor/assets/components/moment/lang/eo.js +65 -0
- data/vendor/assets/components/moment/lang/es.js +75 -0
- data/vendor/assets/components/moment/lang/et.js +76 -0
- data/vendor/assets/components/moment/lang/eu.js +60 -0
- data/vendor/assets/components/moment/lang/fa.js +97 -0
- data/vendor/assets/components/moment/lang/fi.js +103 -0
- data/vendor/assets/components/moment/lang/fo.js +56 -0
- data/vendor/assets/components/moment/lang/fr-ca.js +54 -0
- data/vendor/assets/components/moment/lang/fr.js +58 -0
- data/vendor/assets/components/moment/lang/gl.js +71 -0
- data/vendor/assets/components/moment/lang/he.js +77 -0
- data/vendor/assets/components/moment/lang/hi.js +105 -0
- data/vendor/assets/components/moment/lang/hr.js +140 -0
- data/vendor/assets/components/moment/lang/hu.js +105 -0
- data/vendor/assets/components/moment/lang/hy-am.js +113 -0
- data/vendor/assets/components/moment/lang/id.js +67 -0
- data/vendor/assets/components/moment/lang/is.js +124 -0
- data/vendor/assets/components/moment/lang/it.js +59 -0
- data/vendor/assets/components/moment/lang/ja.js +58 -0
- data/vendor/assets/components/moment/lang/ka.js +108 -0
- data/vendor/assets/components/moment/lang/km.js +55 -0
- data/vendor/assets/components/moment/lang/ko.js +63 -0
- data/vendor/assets/components/moment/lang/lb.js +160 -0
- data/vendor/assets/components/moment/lang/lt.js +118 -0
- data/vendor/assets/components/moment/lang/lv.js +77 -0
- data/vendor/assets/components/moment/lang/mk.js +86 -0
- data/vendor/assets/components/moment/lang/ml.js +64 -0
- data/vendor/assets/components/moment/lang/mr.js +104 -0
- data/vendor/assets/components/moment/lang/ms-my.js +66 -0
- data/vendor/assets/components/moment/lang/nb.js +57 -0
- data/vendor/assets/components/moment/lang/ne.js +105 -0
- data/vendor/assets/components/moment/lang/nl.js +67 -0
- data/vendor/assets/components/moment/lang/nn.js +56 -0
- data/vendor/assets/components/moment/lang/pl.js +98 -0
- data/vendor/assets/components/moment/lang/pt-br.js +56 -0
- data/vendor/assets/components/moment/lang/pt.js +60 -0
- data/vendor/assets/components/moment/lang/ro.js +72 -0
- data/vendor/assets/components/moment/lang/ru.js +166 -0
- data/vendor/assets/components/moment/lang/sk.js +156 -0
- data/vendor/assets/components/moment/lang/sl.js +144 -0
- data/vendor/assets/components/moment/lang/sq.js +61 -0
- data/vendor/assets/components/moment/lang/sr-cyrl.js +106 -0
- data/vendor/assets/components/moment/lang/sr.js +106 -0
- data/vendor/assets/components/moment/lang/sv.js +63 -0
- data/vendor/assets/components/moment/lang/ta.js +112 -0
- data/vendor/assets/components/moment/lang/th.js +58 -0
- data/vendor/assets/components/moment/lang/tl-ph.js +58 -0
- data/vendor/assets/components/moment/lang/tr.js +93 -0
- data/vendor/assets/components/moment/lang/tzm-latn.js +55 -0
- data/vendor/assets/components/moment/lang/tzm.js +55 -0
- data/vendor/assets/components/moment/lang/uk.js +157 -0
- data/vendor/assets/components/moment/lang/uz.js +55 -0
- data/vendor/assets/components/moment/lang/vi.js +62 -0
- data/vendor/assets/components/moment/lang/zh-cn.js +108 -0
- data/vendor/assets/components/moment/lang/zh-tw.js +84 -0
- data/vendor/assets/components/moment/min/langs.js +6426 -0
- data/vendor/assets/components/moment/min/langs.min.js +4 -0
- data/vendor/assets/components/moment/min/moment-with-langs.js +8521 -0
- data/vendor/assets/components/moment/min/moment-with-langs.min.js +9 -0
- data/vendor/assets/components/moment/min/moment.min.js +6 -0
- data/vendor/assets/components/moment/moment.js +2610 -0
- data/vendor/assets/components/moment/readme.md +388 -0
- data/vendor/assets/components/numeral/.bower.json +28 -0
- data/vendor/assets/components/numeral/.gitignore +29 -0
- data/vendor/assets/components/numeral/.travis.yml +7 -0
- data/vendor/assets/components/numeral/Gruntfile.js +91 -0
- data/vendor/assets/components/numeral/LICENSE +22 -0
- data/vendor/assets/components/numeral/README.md +213 -0
- data/vendor/assets/components/numeral/bower.json +16 -0
- data/vendor/assets/components/numeral/component.json +16 -0
- data/vendor/assets/components/numeral/languages.js +989 -0
- data/vendor/assets/components/numeral/languages/be-nl.js +35 -0
- data/vendor/assets/components/numeral/languages/chs.js +34 -0
- data/vendor/assets/components/numeral/languages/cs.js +34 -0
- data/vendor/assets/components/numeral/languages/da-dk.js +34 -0
- data/vendor/assets/components/numeral/languages/de-ch.js +34 -0
- data/vendor/assets/components/numeral/languages/de.js +34 -0
- data/vendor/assets/components/numeral/languages/en-gb.js +38 -0
- data/vendor/assets/components/numeral/languages/es-ES.js +39 -0
- data/vendor/assets/components/numeral/languages/es.js +39 -0
- data/vendor/assets/components/numeral/languages/et.js +37 -0
- data/vendor/assets/components/numeral/languages/fi.js +34 -0
- data/vendor/assets/components/numeral/languages/fr-CA.js +34 -0
- data/vendor/assets/components/numeral/languages/fr-ch.js +34 -0
- data/vendor/assets/components/numeral/languages/fr.js +34 -0
- data/vendor/assets/components/numeral/languages/hu.js +34 -0
- data/vendor/assets/components/numeral/languages/it.js +34 -0
- data/vendor/assets/components/numeral/languages/ja.js +34 -0
- data/vendor/assets/components/numeral/languages/nl-nl.js +35 -0
- data/vendor/assets/components/numeral/languages/pl.js +34 -0
- data/vendor/assets/components/numeral/languages/pt-br.js +34 -0
- data/vendor/assets/components/numeral/languages/pt-pt.js +34 -0
- data/vendor/assets/components/numeral/languages/ru-UA.js +35 -0
- data/vendor/assets/components/numeral/languages/ru.js +37 -0
- data/vendor/assets/components/numeral/languages/sk.js +34 -0
- data/vendor/assets/components/numeral/languages/th.js +34 -0
- data/vendor/assets/components/numeral/languages/tr.js +67 -0
- data/vendor/assets/components/numeral/languages/uk-UA.js +35 -0
- data/vendor/assets/components/numeral/min/languages.min.js +129 -0
- data/vendor/assets/components/numeral/min/languages/be-nl.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/chs.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/cs.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/da-dk.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/de-ch.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/de.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/en-gb.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/es-ES.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/es.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/et.min.js +9 -0
- data/vendor/assets/components/numeral/min/languages/fi.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/fr-CA.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/fr-ch.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/fr.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/hu.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/it.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/ja.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/nl-nl.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/pl.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/pt-br.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/pt-pt.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/ru-UA.min.js +1 -0
- data/vendor/assets/components/numeral/min/languages/ru.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/sk.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/th.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/tr.min.js +6 -0
- data/vendor/assets/components/numeral/min/languages/uk-UA.min.js +1 -0
- data/vendor/assets/components/numeral/min/numeral.min.js +8 -0
- data/vendor/assets/components/numeral/numeral.js +679 -0
- data/vendor/assets/components/numeral/package.json +50 -0
- data/vendor/assets/components/numeral/tests/languages/be-nl.js +107 -0
- data/vendor/assets/components/numeral/tests/languages/chs.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/cs.js +102 -0
- data/vendor/assets/components/numeral/tests/languages/da-dk.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/de-ch.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/de.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/en-gb.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/en.js +98 -0
- data/vendor/assets/components/numeral/tests/languages/es-ES.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/es.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/et.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/fi.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/fr-CA.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/fr-ch.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/fr.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/hu.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/it.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/ja.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/nl-nl.js +109 -0
- data/vendor/assets/components/numeral/tests/languages/pl.js +102 -0
- data/vendor/assets/components/numeral/tests/languages/pt-br.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/pt-pt.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/ru-UA.js +102 -0
- data/vendor/assets/components/numeral/tests/languages/ru.js +102 -0
- data/vendor/assets/components/numeral/tests/languages/sk.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/th.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/tr.js +101 -0
- data/vendor/assets/components/numeral/tests/languages/uk-UA.js +102 -0
- data/vendor/assets/components/numeral/tests/numeral/format.js +204 -0
- data/vendor/assets/components/numeral/tests/numeral/manipulate.js +104 -0
- data/vendor/assets/components/numeral/tests/numeral/misc.js +123 -0
- data/vendor/assets/components/numeral/tests/numeral/unformat.js +96 -0
- data/vendor/assets/components/qunit-bdd/.bower.json +31 -0
- data/vendor/assets/components/qunit-bdd/LICENSE +13 -0
- data/vendor/assets/components/qunit-bdd/README.md +282 -0
- data/vendor/assets/components/qunit-bdd/bower.json +22 -0
- data/vendor/assets/components/qunit-bdd/karma.conf.js +70 -0
- data/vendor/assets/components/qunit-bdd/lib/qunit-bdd.js +755 -0
- data/vendor/assets/components/qunit-bdd/package.json +33 -0
- data/vendor/assets/javascripts/bs-breadcrumbs.js +85 -0
- data/vendor/assets/javascripts/bs-core.js +476 -0
- data/vendor/assets/javascripts/bs-notifications.js +111 -0
- data/vendor/assets/javascripts/daterangepicker.js +1030 -0
- data/vendor/assets/javascripts/fix_bind_phantomjs.js +37 -0
- data/vendor/assets/javascripts/jquery-deparam.js +97 -0
- data/vendor/assets/javascripts/sidebar-tree.js +68 -0
- data/vendor/assets/stylesheets/daterangepicker.css +271 -0
- metadata +766 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){var a={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"тис.",million:"млн",billion:"млрд",trillion:"блн"},ordinal:function(){return""},currency:{symbol:"₴"}};"undefined"!=typeof module&&module.exports&&(module.exports=a),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("uk-UA",a)}();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* numeral.js
|
|
3
|
+
* version : 1.5.3
|
|
4
|
+
* author : Adam Draper
|
|
5
|
+
* license : MIT
|
|
6
|
+
* http://adamwdraper.github.com/Numeral-js/
|
|
7
|
+
*/
|
|
8
|
+
(function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===q)a._value=0;else{for("."!==o[p].delimiters.decimal&&(b=b.replace(/\./g,"").replace(o[p].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+o[p].abbreviations.thousand+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+o[p].abbreviations.million+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+o[p].abbreviations.billion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+o[p].abbreviations.trillion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e,f=b.indexOf("$"),g=b.indexOf("("),h=b.indexOf("-"),j="";return b.indexOf(" $")>-1?(j=" ",b=b.replace(" $","")):b.indexOf("$ ")>-1?(j=" ",b=b.replace("$ ","")):b=b.replace("$",""),e=i(a._value,b,c),1>=f?e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=1,(g>f||h>f)&&(d=0),e.splice(d,0,o[p].currency.symbol+j),e=e.join("")):e=o[p].currency.symbol+j+e:e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,j+o[p].currency.symbol),e=e.join("")):e=e+j+o[p].currency.symbol,e}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d){var e,f,g,h,i,j,k=!1,l=!1,m=!1,n="",r=!1,s=!1,t=!1,u=!1,v=!1,w="",x="",y=Math.abs(a),z=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],A="",B=!1;if(0===a&&null!==q)return q;if(c.indexOf("(")>-1?(k=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(l=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1&&(r=c.indexOf("aK")>=0,s=c.indexOf("aM")>=0,t=c.indexOf("aB")>=0,u=c.indexOf("aT")>=0,v=r||s||t||u,c.indexOf(" a")>-1?(n=" ",c=c.replace(" a","")):c=c.replace("a",""),y>=Math.pow(10,12)&&!v||u?(n+=o[p].abbreviations.trillion,a/=Math.pow(10,12)):y<Math.pow(10,12)&&y>=Math.pow(10,9)&&!v||t?(n+=o[p].abbreviations.billion,a/=Math.pow(10,9)):y<Math.pow(10,9)&&y>=Math.pow(10,6)&&!v||s?(n+=o[p].abbreviations.million,a/=Math.pow(10,6)):(y<Math.pow(10,6)&&y>=Math.pow(10,3)&&!v||r)&&(n+=o[p].abbreviations.thousand,a/=Math.pow(10,3))),c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(w=" ",c=c.replace(" b","")):c=c.replace("b",""),g=0;g<=z.length;g++)if(e=Math.pow(1024,g),f=Math.pow(1024,g+1),a>=e&&f>a){w+=z[g],e>0&&(a/=e);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(x=" ",c=c.replace(" o","")):c=c.replace("o",""),x+=o[p].ordinal(a)),c.indexOf("[.]")>-1&&(m=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],j=c.indexOf(","),i?(i.indexOf("[")>-1?(i=i.replace("]",""),i=i.split("["),A=b(a,i[0].length+i[1].length,d,i[1].length)):A=b(a,i.length,d),h=A.split(".")[0],A=A.split(".")[1].length?o[p].delimiters.decimal+A.split(".")[1]:"",m&&0===Number(A.slice(1))&&(A="")):h=b(a,null,d),h.indexOf("-")>-1&&(h=h.slice(1),B=!0),j>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[p].delimiters.thousands)),0===c.indexOf(".")&&(h=""),(k&&B?"(":"")+(!k&&B?"-":"")+(!B&&l?"+":"")+h+A+(x?x:"")+(n?n:"")+(w?w:"")+(k&&B?")":"")}function j(a,b){o[a]=b}function k(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)}function l(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var c=k(a),d=k(b);return c>d?c:d},-1/0)}var m,n="1.5.3",o={},p="en",q=null,r="0,0",s="undefined"!=typeof module&&module.exports;m=function(b){return m.isNumeral(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=m.fn.unformat(b)),new a(Number(b))},m.version=n,m.isNumeral=function(b){return b instanceof a},m.language=function(a,b){if(!a)return p;if(a&&!b){if(!o[a])throw new Error("Unknown language : "+a);p=a}return(b||!o[a])&&j(a,b),m},m.languageData=function(a){if(!a)return o[p];if(!o[a])throw new Error("Unknown language : "+a);return o[a]},m.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),m.zeroFormat=function(a){q="string"==typeof a?a:null},m.defaultFormat=function(a){r="string"==typeof a?a:"0.0"},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){"use strict";if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof a)throw new TypeError(a+" is not a function");var c,d,e=this.length>>>0,f=!1;for(1<arguments.length&&(d=b,f=!0),c=0;e>c;++c)this.hasOwnProperty(c)&&(f?d=a(d,this[c],c,this):(d=this[c],f=!0));if(!f)throw new TypeError("Reduce of empty array with no initial value");return d}),m.fn=a.prototype={clone:function(){return m(this)},format:function(a,b){return c(this,a?a:r,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:r)},value:function(){return this._value},valueOf:function(){return this._value},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b){return a+c*b}var c=l.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b){return a-c*b}var c=l.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b){var c=l(a,b);return a*c*b*c/(c*c)}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b){var c=l(a,b);return a*c/(b*c)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(m(this._value).subtract(a).value())}},s&&(module.exports=m),"undefined"==typeof ender&&(this.numeral=m),"function"==typeof define&&define.amd&&define([],function(){return m})}).call(this);
|
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* numeral.js
|
|
3
|
+
* version : 1.5.3
|
|
4
|
+
* author : Adam Draper
|
|
5
|
+
* license : MIT
|
|
6
|
+
* http://adamwdraper.github.com/Numeral-js/
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
(function () {
|
|
10
|
+
|
|
11
|
+
/************************************
|
|
12
|
+
Constants
|
|
13
|
+
************************************/
|
|
14
|
+
|
|
15
|
+
var numeral,
|
|
16
|
+
VERSION = '1.5.3',
|
|
17
|
+
// internal storage for language config files
|
|
18
|
+
languages = {},
|
|
19
|
+
currentLanguage = 'en',
|
|
20
|
+
zeroFormat = null,
|
|
21
|
+
defaultFormat = '0,0',
|
|
22
|
+
// check for nodeJS
|
|
23
|
+
hasModule = (typeof module !== 'undefined' && module.exports);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/************************************
|
|
27
|
+
Constructors
|
|
28
|
+
************************************/
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// Numeral prototype object
|
|
32
|
+
function Numeral (number) {
|
|
33
|
+
this._value = number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Implementation of toFixed() that treats floats more like decimals
|
|
38
|
+
*
|
|
39
|
+
* Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present
|
|
40
|
+
* problems for accounting- and finance-related software.
|
|
41
|
+
*/
|
|
42
|
+
function toFixed (value, precision, roundingFunction, optionals) {
|
|
43
|
+
var power = Math.pow(10, precision),
|
|
44
|
+
optionalsRegExp,
|
|
45
|
+
output;
|
|
46
|
+
|
|
47
|
+
//roundingFunction = (roundingFunction !== undefined ? roundingFunction : Math.round);
|
|
48
|
+
// Multiply up by precision, round accurately, then divide and use native toFixed():
|
|
49
|
+
output = (roundingFunction(value * power) / power).toFixed(precision);
|
|
50
|
+
|
|
51
|
+
if (optionals) {
|
|
52
|
+
optionalsRegExp = new RegExp('0{1,' + optionals + '}$');
|
|
53
|
+
output = output.replace(optionalsRegExp, '');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return output;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/************************************
|
|
60
|
+
Formatting
|
|
61
|
+
************************************/
|
|
62
|
+
|
|
63
|
+
// determine what type of formatting we need to do
|
|
64
|
+
function formatNumeral (n, format, roundingFunction) {
|
|
65
|
+
var output;
|
|
66
|
+
|
|
67
|
+
// figure out what kind of format we are dealing with
|
|
68
|
+
if (format.indexOf('$') > -1) { // currency!!!!!
|
|
69
|
+
output = formatCurrency(n, format, roundingFunction);
|
|
70
|
+
} else if (format.indexOf('%') > -1) { // percentage
|
|
71
|
+
output = formatPercentage(n, format, roundingFunction);
|
|
72
|
+
} else if (format.indexOf(':') > -1) { // time
|
|
73
|
+
output = formatTime(n, format);
|
|
74
|
+
} else { // plain ol' numbers or bytes
|
|
75
|
+
output = formatNumber(n._value, format, roundingFunction);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// return string
|
|
79
|
+
return output;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// revert to number
|
|
83
|
+
function unformatNumeral (n, string) {
|
|
84
|
+
var stringOriginal = string,
|
|
85
|
+
thousandRegExp,
|
|
86
|
+
millionRegExp,
|
|
87
|
+
billionRegExp,
|
|
88
|
+
trillionRegExp,
|
|
89
|
+
suffixes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
|
90
|
+
bytesMultiplier = false,
|
|
91
|
+
power;
|
|
92
|
+
|
|
93
|
+
if (string.indexOf(':') > -1) {
|
|
94
|
+
n._value = unformatTime(string);
|
|
95
|
+
} else {
|
|
96
|
+
if (string === zeroFormat) {
|
|
97
|
+
n._value = 0;
|
|
98
|
+
} else {
|
|
99
|
+
if (languages[currentLanguage].delimiters.decimal !== '.') {
|
|
100
|
+
string = string.replace(/\./g,'').replace(languages[currentLanguage].delimiters.decimal, '.');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// see if abbreviations are there so that we can multiply to the correct number
|
|
104
|
+
thousandRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.thousand + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
|
|
105
|
+
millionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.million + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
|
|
106
|
+
billionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.billion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
|
|
107
|
+
trillionRegExp = new RegExp('[^a-zA-Z]' + languages[currentLanguage].abbreviations.trillion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
|
|
108
|
+
|
|
109
|
+
// see if bytes are there so that we can multiply to the correct number
|
|
110
|
+
for (power = 0; power <= suffixes.length; power++) {
|
|
111
|
+
bytesMultiplier = (string.indexOf(suffixes[power]) > -1) ? Math.pow(1024, power + 1) : false;
|
|
112
|
+
|
|
113
|
+
if (bytesMultiplier) {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// do some math to create our number
|
|
119
|
+
n._value = ((bytesMultiplier) ? bytesMultiplier : 1) * ((stringOriginal.match(thousandRegExp)) ? Math.pow(10, 3) : 1) * ((stringOriginal.match(millionRegExp)) ? Math.pow(10, 6) : 1) * ((stringOriginal.match(billionRegExp)) ? Math.pow(10, 9) : 1) * ((stringOriginal.match(trillionRegExp)) ? Math.pow(10, 12) : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * (((string.split('-').length + Math.min(string.split('(').length-1, string.split(')').length-1)) % 2)? 1: -1) * Number(string.replace(/[^0-9\.]+/g, ''));
|
|
120
|
+
|
|
121
|
+
// round if we are talking about bytes
|
|
122
|
+
n._value = (bytesMultiplier) ? Math.ceil(n._value) : n._value;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return n._value;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function formatCurrency (n, format, roundingFunction) {
|
|
129
|
+
var symbolIndex = format.indexOf('$'),
|
|
130
|
+
openParenIndex = format.indexOf('('),
|
|
131
|
+
minusSignIndex = format.indexOf('-'),
|
|
132
|
+
space = '',
|
|
133
|
+
spliceIndex,
|
|
134
|
+
output;
|
|
135
|
+
|
|
136
|
+
// check for space before or after currency
|
|
137
|
+
if (format.indexOf(' $') > -1) {
|
|
138
|
+
space = ' ';
|
|
139
|
+
format = format.replace(' $', '');
|
|
140
|
+
} else if (format.indexOf('$ ') > -1) {
|
|
141
|
+
space = ' ';
|
|
142
|
+
format = format.replace('$ ', '');
|
|
143
|
+
} else {
|
|
144
|
+
format = format.replace('$', '');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// format the number
|
|
148
|
+
output = formatNumber(n._value, format, roundingFunction);
|
|
149
|
+
|
|
150
|
+
// position the symbol
|
|
151
|
+
if (symbolIndex <= 1) {
|
|
152
|
+
if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {
|
|
153
|
+
output = output.split('');
|
|
154
|
+
spliceIndex = 1;
|
|
155
|
+
if (symbolIndex < openParenIndex || symbolIndex < minusSignIndex){
|
|
156
|
+
// the symbol appears before the "(" or "-"
|
|
157
|
+
spliceIndex = 0;
|
|
158
|
+
}
|
|
159
|
+
output.splice(spliceIndex, 0, languages[currentLanguage].currency.symbol + space);
|
|
160
|
+
output = output.join('');
|
|
161
|
+
} else {
|
|
162
|
+
output = languages[currentLanguage].currency.symbol + space + output;
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
if (output.indexOf(')') > -1) {
|
|
166
|
+
output = output.split('');
|
|
167
|
+
output.splice(-1, 0, space + languages[currentLanguage].currency.symbol);
|
|
168
|
+
output = output.join('');
|
|
169
|
+
} else {
|
|
170
|
+
output = output + space + languages[currentLanguage].currency.symbol;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return output;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function formatPercentage (n, format, roundingFunction) {
|
|
178
|
+
var space = '',
|
|
179
|
+
output,
|
|
180
|
+
value = n._value * 100;
|
|
181
|
+
|
|
182
|
+
// check for space before %
|
|
183
|
+
if (format.indexOf(' %') > -1) {
|
|
184
|
+
space = ' ';
|
|
185
|
+
format = format.replace(' %', '');
|
|
186
|
+
} else {
|
|
187
|
+
format = format.replace('%', '');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
output = formatNumber(value, format, roundingFunction);
|
|
191
|
+
|
|
192
|
+
if (output.indexOf(')') > -1 ) {
|
|
193
|
+
output = output.split('');
|
|
194
|
+
output.splice(-1, 0, space + '%');
|
|
195
|
+
output = output.join('');
|
|
196
|
+
} else {
|
|
197
|
+
output = output + space + '%';
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return output;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function formatTime (n) {
|
|
204
|
+
var hours = Math.floor(n._value/60/60),
|
|
205
|
+
minutes = Math.floor((n._value - (hours * 60 * 60))/60),
|
|
206
|
+
seconds = Math.round(n._value - (hours * 60 * 60) - (minutes * 60));
|
|
207
|
+
return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function unformatTime (string) {
|
|
211
|
+
var timeArray = string.split(':'),
|
|
212
|
+
seconds = 0;
|
|
213
|
+
// turn hours and minutes into seconds and add them all up
|
|
214
|
+
if (timeArray.length === 3) {
|
|
215
|
+
// hours
|
|
216
|
+
seconds = seconds + (Number(timeArray[0]) * 60 * 60);
|
|
217
|
+
// minutes
|
|
218
|
+
seconds = seconds + (Number(timeArray[1]) * 60);
|
|
219
|
+
// seconds
|
|
220
|
+
seconds = seconds + Number(timeArray[2]);
|
|
221
|
+
} else if (timeArray.length === 2) {
|
|
222
|
+
// minutes
|
|
223
|
+
seconds = seconds + (Number(timeArray[0]) * 60);
|
|
224
|
+
// seconds
|
|
225
|
+
seconds = seconds + Number(timeArray[1]);
|
|
226
|
+
}
|
|
227
|
+
return Number(seconds);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function formatNumber (value, format, roundingFunction) {
|
|
231
|
+
var negP = false,
|
|
232
|
+
signed = false,
|
|
233
|
+
optDec = false,
|
|
234
|
+
abbr = '',
|
|
235
|
+
abbrK = false, // force abbreviation to thousands
|
|
236
|
+
abbrM = false, // force abbreviation to millions
|
|
237
|
+
abbrB = false, // force abbreviation to billions
|
|
238
|
+
abbrT = false, // force abbreviation to trillions
|
|
239
|
+
abbrForce = false, // force abbreviation
|
|
240
|
+
bytes = '',
|
|
241
|
+
ord = '',
|
|
242
|
+
abs = Math.abs(value),
|
|
243
|
+
suffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
|
244
|
+
min,
|
|
245
|
+
max,
|
|
246
|
+
power,
|
|
247
|
+
w,
|
|
248
|
+
precision,
|
|
249
|
+
thousands,
|
|
250
|
+
d = '',
|
|
251
|
+
neg = false;
|
|
252
|
+
|
|
253
|
+
// check if number is zero and a custom zero format has been set
|
|
254
|
+
if (value === 0 && zeroFormat !== null) {
|
|
255
|
+
return zeroFormat;
|
|
256
|
+
} else {
|
|
257
|
+
// see if we should use parentheses for negative number or if we should prefix with a sign
|
|
258
|
+
// if both are present we default to parentheses
|
|
259
|
+
if (format.indexOf('(') > -1) {
|
|
260
|
+
negP = true;
|
|
261
|
+
format = format.slice(1, -1);
|
|
262
|
+
} else if (format.indexOf('+') > -1) {
|
|
263
|
+
signed = true;
|
|
264
|
+
format = format.replace(/\+/g, '');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// see if abbreviation is wanted
|
|
268
|
+
if (format.indexOf('a') > -1) {
|
|
269
|
+
// check if abbreviation is specified
|
|
270
|
+
abbrK = format.indexOf('aK') >= 0;
|
|
271
|
+
abbrM = format.indexOf('aM') >= 0;
|
|
272
|
+
abbrB = format.indexOf('aB') >= 0;
|
|
273
|
+
abbrT = format.indexOf('aT') >= 0;
|
|
274
|
+
abbrForce = abbrK || abbrM || abbrB || abbrT;
|
|
275
|
+
|
|
276
|
+
// check for space before abbreviation
|
|
277
|
+
if (format.indexOf(' a') > -1) {
|
|
278
|
+
abbr = ' ';
|
|
279
|
+
format = format.replace(' a', '');
|
|
280
|
+
} else {
|
|
281
|
+
format = format.replace('a', '');
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) {
|
|
285
|
+
// trillion
|
|
286
|
+
abbr = abbr + languages[currentLanguage].abbreviations.trillion;
|
|
287
|
+
value = value / Math.pow(10, 12);
|
|
288
|
+
} else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) {
|
|
289
|
+
// billion
|
|
290
|
+
abbr = abbr + languages[currentLanguage].abbreviations.billion;
|
|
291
|
+
value = value / Math.pow(10, 9);
|
|
292
|
+
} else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) {
|
|
293
|
+
// million
|
|
294
|
+
abbr = abbr + languages[currentLanguage].abbreviations.million;
|
|
295
|
+
value = value / Math.pow(10, 6);
|
|
296
|
+
} else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) {
|
|
297
|
+
// thousand
|
|
298
|
+
abbr = abbr + languages[currentLanguage].abbreviations.thousand;
|
|
299
|
+
value = value / Math.pow(10, 3);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// see if we are formatting bytes
|
|
304
|
+
if (format.indexOf('b') > -1) {
|
|
305
|
+
// check for space before
|
|
306
|
+
if (format.indexOf(' b') > -1) {
|
|
307
|
+
bytes = ' ';
|
|
308
|
+
format = format.replace(' b', '');
|
|
309
|
+
} else {
|
|
310
|
+
format = format.replace('b', '');
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
for (power = 0; power <= suffixes.length; power++) {
|
|
314
|
+
min = Math.pow(1024, power);
|
|
315
|
+
max = Math.pow(1024, power+1);
|
|
316
|
+
|
|
317
|
+
if (value >= min && value < max) {
|
|
318
|
+
bytes = bytes + suffixes[power];
|
|
319
|
+
if (min > 0) {
|
|
320
|
+
value = value / min;
|
|
321
|
+
}
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// see if ordinal is wanted
|
|
328
|
+
if (format.indexOf('o') > -1) {
|
|
329
|
+
// check for space before
|
|
330
|
+
if (format.indexOf(' o') > -1) {
|
|
331
|
+
ord = ' ';
|
|
332
|
+
format = format.replace(' o', '');
|
|
333
|
+
} else {
|
|
334
|
+
format = format.replace('o', '');
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
ord = ord + languages[currentLanguage].ordinal(value);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (format.indexOf('[.]') > -1) {
|
|
341
|
+
optDec = true;
|
|
342
|
+
format = format.replace('[.]', '.');
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
w = value.toString().split('.')[0];
|
|
346
|
+
precision = format.split('.')[1];
|
|
347
|
+
thousands = format.indexOf(',');
|
|
348
|
+
|
|
349
|
+
if (precision) {
|
|
350
|
+
if (precision.indexOf('[') > -1) {
|
|
351
|
+
precision = precision.replace(']', '');
|
|
352
|
+
precision = precision.split('[');
|
|
353
|
+
d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, precision[1].length);
|
|
354
|
+
} else {
|
|
355
|
+
d = toFixed(value, precision.length, roundingFunction);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
w = d.split('.')[0];
|
|
359
|
+
|
|
360
|
+
if (d.split('.')[1].length) {
|
|
361
|
+
d = languages[currentLanguage].delimiters.decimal + d.split('.')[1];
|
|
362
|
+
} else {
|
|
363
|
+
d = '';
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
if (optDec && Number(d.slice(1)) === 0) {
|
|
367
|
+
d = '';
|
|
368
|
+
}
|
|
369
|
+
} else {
|
|
370
|
+
w = toFixed(value, null, roundingFunction);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// format number
|
|
374
|
+
if (w.indexOf('-') > -1) {
|
|
375
|
+
w = w.slice(1);
|
|
376
|
+
neg = true;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (thousands > -1) {
|
|
380
|
+
w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + languages[currentLanguage].delimiters.thousands);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (format.indexOf('.') === 0) {
|
|
384
|
+
w = '';
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return ((negP && neg) ? '(' : '') + ((!negP && neg) ? '-' : '') + ((!neg && signed) ? '+' : '') + w + d + ((ord) ? ord : '') + ((abbr) ? abbr : '') + ((bytes) ? bytes : '') + ((negP && neg) ? ')' : '');
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/************************************
|
|
392
|
+
Top Level Functions
|
|
393
|
+
************************************/
|
|
394
|
+
|
|
395
|
+
numeral = function (input) {
|
|
396
|
+
if (numeral.isNumeral(input)) {
|
|
397
|
+
input = input.value();
|
|
398
|
+
} else if (input === 0 || typeof input === 'undefined') {
|
|
399
|
+
input = 0;
|
|
400
|
+
} else if (!Number(input)) {
|
|
401
|
+
input = numeral.fn.unformat(input);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return new Numeral(Number(input));
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
// version number
|
|
408
|
+
numeral.version = VERSION;
|
|
409
|
+
|
|
410
|
+
// compare numeral object
|
|
411
|
+
numeral.isNumeral = function (obj) {
|
|
412
|
+
return obj instanceof Numeral;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
// This function will load languages and then set the global language. If
|
|
416
|
+
// no arguments are passed in, it will simply return the current global
|
|
417
|
+
// language key.
|
|
418
|
+
numeral.language = function (key, values) {
|
|
419
|
+
if (!key) {
|
|
420
|
+
return currentLanguage;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (key && !values) {
|
|
424
|
+
if(!languages[key]) {
|
|
425
|
+
throw new Error('Unknown language : ' + key);
|
|
426
|
+
}
|
|
427
|
+
currentLanguage = key;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (values || !languages[key]) {
|
|
431
|
+
loadLanguage(key, values);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return numeral;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// This function provides access to the loaded language data. If
|
|
438
|
+
// no arguments are passed in, it will simply return the current
|
|
439
|
+
// global language object.
|
|
440
|
+
numeral.languageData = function (key) {
|
|
441
|
+
if (!key) {
|
|
442
|
+
return languages[currentLanguage];
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (!languages[key]) {
|
|
446
|
+
throw new Error('Unknown language : ' + key);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return languages[key];
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
numeral.language('en', {
|
|
453
|
+
delimiters: {
|
|
454
|
+
thousands: ',',
|
|
455
|
+
decimal: '.'
|
|
456
|
+
},
|
|
457
|
+
abbreviations: {
|
|
458
|
+
thousand: 'k',
|
|
459
|
+
million: 'm',
|
|
460
|
+
billion: 'b',
|
|
461
|
+
trillion: 't'
|
|
462
|
+
},
|
|
463
|
+
ordinal: function (number) {
|
|
464
|
+
var b = number % 10;
|
|
465
|
+
return (~~ (number % 100 / 10) === 1) ? 'th' :
|
|
466
|
+
(b === 1) ? 'st' :
|
|
467
|
+
(b === 2) ? 'nd' :
|
|
468
|
+
(b === 3) ? 'rd' : 'th';
|
|
469
|
+
},
|
|
470
|
+
currency: {
|
|
471
|
+
symbol: '$'
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
numeral.zeroFormat = function (format) {
|
|
476
|
+
zeroFormat = typeof(format) === 'string' ? format : null;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
numeral.defaultFormat = function (format) {
|
|
480
|
+
defaultFormat = typeof(format) === 'string' ? format : '0.0';
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
/************************************
|
|
484
|
+
Helpers
|
|
485
|
+
************************************/
|
|
486
|
+
|
|
487
|
+
function loadLanguage(key, values) {
|
|
488
|
+
languages[key] = values;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/************************************
|
|
492
|
+
Floating-point helpers
|
|
493
|
+
************************************/
|
|
494
|
+
|
|
495
|
+
// The floating-point helper functions and implementation
|
|
496
|
+
// borrows heavily from sinful.js: http://guipn.github.io/sinful.js/
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Array.prototype.reduce for browsers that don't support it
|
|
500
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce#Compatibility
|
|
501
|
+
*/
|
|
502
|
+
if ('function' !== typeof Array.prototype.reduce) {
|
|
503
|
+
Array.prototype.reduce = function (callback, opt_initialValue) {
|
|
504
|
+
'use strict';
|
|
505
|
+
|
|
506
|
+
if (null === this || 'undefined' === typeof this) {
|
|
507
|
+
// At the moment all modern browsers, that support strict mode, have
|
|
508
|
+
// native implementation of Array.prototype.reduce. For instance, IE8
|
|
509
|
+
// does not support strict mode, so this check is actually useless.
|
|
510
|
+
throw new TypeError('Array.prototype.reduce called on null or undefined');
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if ('function' !== typeof callback) {
|
|
514
|
+
throw new TypeError(callback + ' is not a function');
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
var index,
|
|
518
|
+
value,
|
|
519
|
+
length = this.length >>> 0,
|
|
520
|
+
isValueSet = false;
|
|
521
|
+
|
|
522
|
+
if (1 < arguments.length) {
|
|
523
|
+
value = opt_initialValue;
|
|
524
|
+
isValueSet = true;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
for (index = 0; length > index; ++index) {
|
|
528
|
+
if (this.hasOwnProperty(index)) {
|
|
529
|
+
if (isValueSet) {
|
|
530
|
+
value = callback(value, this[index], index, this);
|
|
531
|
+
} else {
|
|
532
|
+
value = this[index];
|
|
533
|
+
isValueSet = true;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (!isValueSet) {
|
|
539
|
+
throw new TypeError('Reduce of empty array with no initial value');
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return value;
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Computes the multiplier necessary to make x >= 1,
|
|
549
|
+
* effectively eliminating miscalculations caused by
|
|
550
|
+
* finite precision.
|
|
551
|
+
*/
|
|
552
|
+
function multiplier(x) {
|
|
553
|
+
var parts = x.toString().split('.');
|
|
554
|
+
if (parts.length < 2) {
|
|
555
|
+
return 1;
|
|
556
|
+
}
|
|
557
|
+
return Math.pow(10, parts[1].length);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Given a variable number of arguments, returns the maximum
|
|
562
|
+
* multiplier that must be used to normalize an operation involving
|
|
563
|
+
* all of them.
|
|
564
|
+
*/
|
|
565
|
+
function correctionFactor() {
|
|
566
|
+
var args = Array.prototype.slice.call(arguments);
|
|
567
|
+
return args.reduce(function (prev, next) {
|
|
568
|
+
var mp = multiplier(prev),
|
|
569
|
+
mn = multiplier(next);
|
|
570
|
+
return mp > mn ? mp : mn;
|
|
571
|
+
}, -Infinity);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
/************************************
|
|
576
|
+
Numeral Prototype
|
|
577
|
+
************************************/
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
numeral.fn = Numeral.prototype = {
|
|
581
|
+
|
|
582
|
+
clone : function () {
|
|
583
|
+
return numeral(this);
|
|
584
|
+
},
|
|
585
|
+
|
|
586
|
+
format : function (inputString, roundingFunction) {
|
|
587
|
+
return formatNumeral(this,
|
|
588
|
+
inputString ? inputString : defaultFormat,
|
|
589
|
+
(roundingFunction !== undefined) ? roundingFunction : Math.round
|
|
590
|
+
);
|
|
591
|
+
},
|
|
592
|
+
|
|
593
|
+
unformat : function (inputString) {
|
|
594
|
+
if (Object.prototype.toString.call(inputString) === '[object Number]') {
|
|
595
|
+
return inputString;
|
|
596
|
+
}
|
|
597
|
+
return unformatNumeral(this, inputString ? inputString : defaultFormat);
|
|
598
|
+
},
|
|
599
|
+
|
|
600
|
+
value : function () {
|
|
601
|
+
return this._value;
|
|
602
|
+
},
|
|
603
|
+
|
|
604
|
+
valueOf : function () {
|
|
605
|
+
return this._value;
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
set : function (value) {
|
|
609
|
+
this._value = Number(value);
|
|
610
|
+
return this;
|
|
611
|
+
},
|
|
612
|
+
|
|
613
|
+
add : function (value) {
|
|
614
|
+
var corrFactor = correctionFactor.call(null, this._value, value);
|
|
615
|
+
function cback(accum, curr, currI, O) {
|
|
616
|
+
return accum + corrFactor * curr;
|
|
617
|
+
}
|
|
618
|
+
this._value = [this._value, value].reduce(cback, 0) / corrFactor;
|
|
619
|
+
return this;
|
|
620
|
+
},
|
|
621
|
+
|
|
622
|
+
subtract : function (value) {
|
|
623
|
+
var corrFactor = correctionFactor.call(null, this._value, value);
|
|
624
|
+
function cback(accum, curr, currI, O) {
|
|
625
|
+
return accum - corrFactor * curr;
|
|
626
|
+
}
|
|
627
|
+
this._value = [value].reduce(cback, this._value * corrFactor) / corrFactor;
|
|
628
|
+
return this;
|
|
629
|
+
},
|
|
630
|
+
|
|
631
|
+
multiply : function (value) {
|
|
632
|
+
function cback(accum, curr, currI, O) {
|
|
633
|
+
var corrFactor = correctionFactor(accum, curr);
|
|
634
|
+
return (accum * corrFactor) * (curr * corrFactor) /
|
|
635
|
+
(corrFactor * corrFactor);
|
|
636
|
+
}
|
|
637
|
+
this._value = [this._value, value].reduce(cback, 1);
|
|
638
|
+
return this;
|
|
639
|
+
},
|
|
640
|
+
|
|
641
|
+
divide : function (value) {
|
|
642
|
+
function cback(accum, curr, currI, O) {
|
|
643
|
+
var corrFactor = correctionFactor(accum, curr);
|
|
644
|
+
return (accum * corrFactor) / (curr * corrFactor);
|
|
645
|
+
}
|
|
646
|
+
this._value = [this._value, value].reduce(cback);
|
|
647
|
+
return this;
|
|
648
|
+
},
|
|
649
|
+
|
|
650
|
+
difference : function (value) {
|
|
651
|
+
return Math.abs(numeral(this._value).subtract(value).value());
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
/************************************
|
|
657
|
+
Exposing Numeral
|
|
658
|
+
************************************/
|
|
659
|
+
|
|
660
|
+
// CommonJS module is defined
|
|
661
|
+
if (hasModule) {
|
|
662
|
+
module.exports = numeral;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/*global ender:false */
|
|
666
|
+
if (typeof ender === 'undefined') {
|
|
667
|
+
// here, `this` means `window` in the browser, or `global` on the server
|
|
668
|
+
// add `numeral` as a global object via a string identifier,
|
|
669
|
+
// for Closure Compiler 'advanced' mode
|
|
670
|
+
this['numeral'] = numeral;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/*global define:false */
|
|
674
|
+
if (typeof define === 'function' && define.amd) {
|
|
675
|
+
define([], function () {
|
|
676
|
+
return numeral;
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
}).call(this);
|