stylish 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -10
- data/ARCHITECTURE.md +96 -0
- data/Gemfile +8 -0
- data/README.md +25 -29
- data/Rakefile +24 -0
- data/bin/stylish +33 -0
- data/lib/stylish.rb +36 -1
- data/lib/stylish/configuration.rb +37 -0
- data/lib/stylish/core_ext.rb +20 -0
- data/lib/stylish/developer.rb +13 -0
- data/lib/stylish/developer/config.rb +19 -0
- data/lib/stylish/developer/environment.rb +75 -0
- data/lib/stylish/developer/listing.rb +85 -0
- data/lib/stylish/developer/model_delegator.rb +51 -0
- data/lib/stylish/developer/modification.rb +139 -0
- data/lib/stylish/developer/path.rb +168 -0
- data/lib/stylish/developer/route.rb +97 -0
- data/lib/stylish/developer/server.rb +40 -0
- data/lib/stylish/engine.rb +12 -0
- data/lib/stylish/fs.rb +59 -0
- data/lib/stylish/manifest.rb +100 -0
- data/lib/stylish/models.rb +119 -0
- data/lib/stylish/models/component.rb +19 -0
- data/lib/stylish/models/layout.rb +19 -0
- data/lib/stylish/models/library.rb +134 -0
- data/lib/stylish/models/package.rb +156 -0
- data/lib/stylish/models/script.rb +10 -0
- data/lib/stylish/models/stylesheet.rb +9 -0
- data/lib/stylish/models/template.rb +9 -0
- data/lib/stylish/models/theme.rb +8 -0
- data/lib/stylish/util.rb +20 -0
- data/lib/stylish/version.rb +1 -1
- data/library/config.json +4 -0
- data/library/second-theme/manifest.json +8 -0
- data/library/second-theme/manifest.yml +6 -0
- data/library/second-theme/templates/footers/footer-01.html +3 -0
- data/library/second-theme/templates/footers/footer-02.html +3 -0
- data/library/second-theme/templates/headers/header-01.html +3 -0
- data/library/second-theme/templates/headers/header-02.html +3 -0
- data/library/second-theme/templates/landing-page-blocks/landing-page-block-01.html +3 -0
- data/library/second-theme/templates/landing-page-blocks/landing-page-block-02.html +3 -0
- data/library/test-theme/components/footers/footer-01.json +5 -0
- data/library/test-theme/components/footers/footer-02.json +5 -0
- data/library/test-theme/components/headers/header-01.json +5 -0
- data/library/test-theme/components/headers/header-02.json +5 -0
- data/library/test-theme/components/landing-page-blocks/landing-page-01.json +5 -0
- data/library/test-theme/components/landing-page-blocks/landing-page-02.json +5 -0
- data/library/test-theme/manifest.json +8 -0
- data/library/test-theme/manifest.yml +6 -0
- data/library/test-theme/pages/page-01.json +11 -0
- data/library/test-theme/templates/footers/footer-01.html +3 -0
- data/library/test-theme/templates/footers/footer-02.html +3 -0
- data/library/test-theme/templates/headers/header-01.html +3 -0
- data/library/test-theme/templates/headers/header-02.html +3 -0
- data/library/test-theme/templates/landing-page-blocks/landing-page-block-01.html +3 -0
- data/library/test-theme/templates/landing-page-blocks/landing-page-block-02.html +3 -0
- data/library/test-theme/templates/layouts/standard-layout.html +10 -0
- data/spec/acceptance/listing_assets_spec.rb +20 -0
- data/spec/acceptance/model_browsing_spec.rb +21 -0
- data/spec/acceptance/model_creation_spec.rb +16 -0
- data/spec/acceptance/model_deleting_spec.rb +10 -0
- data/spec/acceptance/model_updating_spec.rb +12 -0
- data/spec/acceptance/modifying_assets_spec.rb +50 -0
- data/spec/acceptance/server_info_spec.rb +10 -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/javascripts/test.coffee +4 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/assets/stylesheets/test.css.scss +6 -0
- data/spec/dummy/app/assets/stylesheets/writable/existing.scss.css +0 -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/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/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -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 +4 -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/config/secrets.yml +22 -0
- data/spec/dummy/db/migrate/20140822065900_create_books.rb +11 -0
- data/spec/dummy/db/migrate/20140822065916_create_authors.rb +9 -0
- data/spec/dummy/db/migrate/20140824215902_create_users.rb +10 -0
- data/spec/dummy/db/migrate/20140826193259_create_libraries.rb +10 -0
- data/spec/dummy/db/schema.rb +37 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/fixtures/config.json +3 -0
- data/spec/fixtures/test-theme/components/footers/footer-01.json +5 -0
- data/spec/fixtures/test-theme/components/footers/footer-02.json +5 -0
- data/spec/fixtures/test-theme/components/headers/header-01.json +5 -0
- data/spec/fixtures/test-theme/components/headers/header-02.json +5 -0
- data/spec/fixtures/test-theme/components/landing-page-blocks/landing-page-01.json +5 -0
- data/spec/fixtures/test-theme/components/landing-page-blocks/landing-page-02.json +5 -0
- data/spec/fixtures/test-theme/manifest.json +8 -0
- data/spec/fixtures/test-theme/manifest.yml +6 -0
- data/spec/fixtures/test-theme/pages/page-01.json +11 -0
- data/spec/fixtures/test-theme/templates/footers/footer-01.html +3 -0
- data/spec/fixtures/test-theme/templates/footers/footer-02.html +3 -0
- data/spec/fixtures/test-theme/templates/headers/header-01.html +3 -0
- data/spec/fixtures/test-theme/templates/headers/header-02.html +3 -0
- data/spec/fixtures/test-theme/templates/landing-page-blocks/landing-page-block-01.html +3 -0
- data/spec/fixtures/test-theme/templates/landing-page-blocks/landing-page-block-02.html +3 -0
- data/spec/fixtures/test-theme/templates/layouts/standard-01.html +9 -0
- data/spec/lib/stylish/configuration_spec.rb +8 -0
- data/spec/lib/stylish/developer/path_spec.rb +36 -0
- data/spec/lib/stylish/developer/route_spec.rb +5 -0
- data/spec/lib/stylish/manifest_spec.rb +48 -0
- data/spec/lib/stylish/models/library_spec.rb +38 -0
- data/spec/lib/stylish/models/package_spec.rb +35 -0
- data/spec/lib/stylish/models_spec.rb +12 -0
- data/spec/spec_helper.rb +38 -0
- data/spec/support/json_helper.rb +7 -0
- data/spec/test.css.scss +6 -0
- data/stylish.gemspec +17 -2
- data/support/editor-app/.gitignore +2 -0
- data/support/editor-app/development/bower.json +9 -0
- data/support/editor-app/development/package.json +28 -0
- data/support/editor-app/development/semantic/components/accordion.css +257 -0
- data/support/editor-app/development/semantic/components/accordion.js +558 -0
- data/support/editor-app/development/semantic/components/accordion.min.css +11 -0
- data/support/editor-app/development/semantic/components/accordion.min.js +11 -0
- data/support/editor-app/development/semantic/components/ad.css +277 -0
- data/support/editor-app/development/semantic/components/ad.min.css +11 -0
- data/support/editor-app/development/semantic/components/api.js +851 -0
- data/support/editor-app/development/semantic/components/api.min.js +11 -0
- data/support/editor-app/development/semantic/components/breadcrumb.css +125 -0
- data/support/editor-app/development/semantic/components/breadcrumb.min.css +11 -0
- data/support/editor-app/development/semantic/components/button.css +2391 -0
- data/support/editor-app/development/semantic/components/button.min.css +11 -0
- data/support/editor-app/development/semantic/components/card.css +758 -0
- data/support/editor-app/development/semantic/components/card.min.css +11 -0
- data/support/editor-app/development/semantic/components/checkbox.css +514 -0
- data/support/editor-app/development/semantic/components/checkbox.js +507 -0
- data/support/editor-app/development/semantic/components/checkbox.min.css +11 -0
- data/support/editor-app/development/semantic/components/checkbox.min.js +11 -0
- data/support/editor-app/development/semantic/components/comment.css +260 -0
- data/support/editor-app/development/semantic/components/comment.min.css +11 -0
- data/support/editor-app/development/semantic/components/dimmer.css +187 -0
- data/support/editor-app/development/semantic/components/dimmer.js +627 -0
- data/support/editor-app/development/semantic/components/dimmer.min.css +11 -0
- data/support/editor-app/development/semantic/components/dimmer.min.js +11 -0
- data/support/editor-app/development/semantic/components/divider.css +244 -0
- data/support/editor-app/development/semantic/components/divider.min.css +11 -0
- data/support/editor-app/development/semantic/components/dropdown.css +1085 -0
- data/support/editor-app/development/semantic/components/dropdown.js +1757 -0
- data/support/editor-app/development/semantic/components/dropdown.min.css +11 -0
- data/support/editor-app/development/semantic/components/dropdown.min.js +11 -0
- data/support/editor-app/development/semantic/components/feed.css +277 -0
- data/support/editor-app/development/semantic/components/feed.min.css +11 -0
- data/support/editor-app/development/semantic/components/flag.css +1017 -0
- data/support/editor-app/development/semantic/components/flag.min.css +11 -0
- data/support/editor-app/development/semantic/components/form.css +875 -0
- data/support/editor-app/development/semantic/components/form.js +1039 -0
- data/support/editor-app/development/semantic/components/form.min.css +11 -0
- data/support/editor-app/development/semantic/components/form.min.js +11 -0
- data/support/editor-app/development/semantic/components/grid.css +1816 -0
- data/support/editor-app/development/semantic/components/grid.min.css +11 -0
- data/support/editor-app/development/semantic/components/header.css +572 -0
- data/support/editor-app/development/semantic/components/header.min.css +11 -0
- data/support/editor-app/development/semantic/components/icon.css +2127 -0
- data/support/editor-app/development/semantic/components/icon.min.css +11 -0
- data/support/editor-app/development/semantic/components/image.css +275 -0
- data/support/editor-app/development/semantic/components/image.min.css +11 -0
- data/support/editor-app/development/semantic/components/input.css +455 -0
- data/support/editor-app/development/semantic/components/input.min.css +11 -0
- data/support/editor-app/development/semantic/components/item.css +458 -0
- data/support/editor-app/development/semantic/components/item.min.css +11 -0
- data/support/editor-app/development/semantic/components/label.css +930 -0
- data/support/editor-app/development/semantic/components/label.min.css +11 -0
- data/support/editor-app/development/semantic/components/list.css +879 -0
- data/support/editor-app/development/semantic/components/list.min.css +11 -0
- data/support/editor-app/development/semantic/components/loader.css +279 -0
- data/support/editor-app/development/semantic/components/loader.min.css +11 -0
- data/support/editor-app/development/semantic/components/menu.css +1596 -0
- data/support/editor-app/development/semantic/components/menu.min.css +11 -0
- data/support/editor-app/development/semantic/components/message.css +422 -0
- data/support/editor-app/development/semantic/components/message.min.css +11 -0
- data/support/editor-app/development/semantic/components/modal.css +431 -0
- data/support/editor-app/development/semantic/components/modal.js +860 -0
- data/support/editor-app/development/semantic/components/modal.min.css +11 -0
- data/support/editor-app/development/semantic/components/modal.min.js +11 -0
- data/support/editor-app/development/semantic/components/nag.css +149 -0
- data/support/editor-app/development/semantic/components/nag.js +477 -0
- data/support/editor-app/development/semantic/components/nag.min.css +11 -0
- data/support/editor-app/development/semantic/components/nag.min.js +11 -0
- data/support/editor-app/development/semantic/components/popup.css +294 -0
- data/support/editor-app/development/semantic/components/popup.js +1187 -0
- data/support/editor-app/development/semantic/components/popup.min.css +11 -0
- data/support/editor-app/development/semantic/components/popup.min.js +11 -0
- data/support/editor-app/development/semantic/components/progress.css +449 -0
- data/support/editor-app/development/semantic/components/progress.js +785 -0
- data/support/editor-app/development/semantic/components/progress.min.css +11 -0
- data/support/editor-app/development/semantic/components/progress.min.js +11 -0
- data/support/editor-app/development/semantic/components/rail.css +125 -0
- data/support/editor-app/development/semantic/components/rail.min.css +11 -0
- data/support/editor-app/development/semantic/components/rating.css +262 -0
- data/support/editor-app/development/semantic/components/rating.js +451 -0
- data/support/editor-app/development/semantic/components/rating.min.css +11 -0
- data/support/editor-app/development/semantic/components/rating.min.js +11 -0
- data/support/editor-app/development/semantic/components/reset.css +430 -0
- data/support/editor-app/development/semantic/components/reset.min.css +11 -0
- data/support/editor-app/development/semantic/components/reveal.css +294 -0
- data/support/editor-app/development/semantic/components/reveal.min.css +11 -0
- data/support/editor-app/development/semantic/components/search.css +330 -0
- data/support/editor-app/development/semantic/components/search.js +1055 -0
- data/support/editor-app/development/semantic/components/search.min.css +11 -0
- data/support/editor-app/development/semantic/components/search.min.js +11 -0
- data/support/editor-app/development/semantic/components/segment.css +590 -0
- data/support/editor-app/development/semantic/components/segment.min.css +11 -0
- data/support/editor-app/development/semantic/components/shape.css +155 -0
- data/support/editor-app/development/semantic/components/shape.js +830 -0
- data/support/editor-app/development/semantic/components/shape.min.css +11 -0
- data/support/editor-app/development/semantic/components/shape.min.js +11 -0
- data/support/editor-app/development/semantic/components/sidebar.css +621 -0
- data/support/editor-app/development/semantic/components/sidebar.js +1084 -0
- data/support/editor-app/development/semantic/components/sidebar.min.css +11 -0
- data/support/editor-app/development/semantic/components/sidebar.min.js +11 -0
- data/support/editor-app/development/semantic/components/site.css +147 -0
- data/support/editor-app/development/semantic/components/site.js +487 -0
- data/support/editor-app/development/semantic/components/site.min.css +11 -0
- data/support/editor-app/development/semantic/components/site.min.js +11 -0
- data/support/editor-app/development/semantic/components/state.js +690 -0
- data/support/editor-app/development/semantic/components/state.min.js +11 -0
- data/support/editor-app/development/semantic/components/statistic.css +410 -0
- data/support/editor-app/development/semantic/components/statistic.min.css +11 -0
- data/support/editor-app/development/semantic/components/step.css +433 -0
- data/support/editor-app/development/semantic/components/step.min.css +11 -0
- data/support/editor-app/development/semantic/components/sticky.css +80 -0
- data/support/editor-app/development/semantic/components/sticky.js +775 -0
- data/support/editor-app/development/semantic/components/sticky.min.css +11 -0
- data/support/editor-app/development/semantic/components/sticky.min.js +11 -0
- data/support/editor-app/development/semantic/components/tab.css +93 -0
- data/support/editor-app/development/semantic/components/tab.js +787 -0
- data/support/editor-app/development/semantic/components/tab.min.css +11 -0
- data/support/editor-app/development/semantic/components/tab.min.js +11 -0
- data/support/editor-app/development/semantic/components/table.css +999 -0
- data/support/editor-app/development/semantic/components/table.min.css +11 -0
- data/support/editor-app/development/semantic/components/transition.css +2152 -0
- data/support/editor-app/development/semantic/components/transition.js +936 -0
- data/support/editor-app/development/semantic/components/transition.min.css +11 -0
- data/support/editor-app/development/semantic/components/transition.min.js +11 -0
- data/support/editor-app/development/semantic/components/video.css +126 -0
- data/support/editor-app/development/semantic/components/video.js +540 -0
- data/support/editor-app/development/semantic/components/video.min.css +11 -0
- data/support/editor-app/development/semantic/components/video.min.js +11 -0
- data/support/editor-app/development/semantic/components/visibility.js +970 -0
- data/support/editor-app/development/semantic/components/visibility.min.js +11 -0
- data/support/editor-app/development/semantic/semantic.css +31768 -0
- data/support/editor-app/development/semantic/semantic.js +18317 -0
- data/support/editor-app/development/semantic/semantic.min.css +11 -0
- data/support/editor-app/development/semantic/semantic.min.js +17 -0
- data/support/editor-app/development/semantic/themes/basic/assets/fonts/icons.eot +0 -0
- data/support/editor-app/development/semantic/themes/basic/assets/fonts/icons.svg +450 -0
- data/support/editor-app/development/semantic/themes/basic/assets/fonts/icons.ttf +0 -0
- data/support/editor-app/development/semantic/themes/basic/assets/fonts/icons.woff +0 -0
- data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.eot +0 -0
- data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.otf +0 -0
- data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.svg +504 -0
- data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.ttf +0 -0
- data/support/editor-app/development/semantic/themes/default/assets/fonts/icons.woff +0 -0
- data/support/editor-app/development/semantic/themes/default/assets/images/flags.png +0 -0
- data/support/editor-app/development/src/apis/index.coffee +35 -0
- data/support/editor-app/development/src/components/editor.cjsx +58 -0
- data/support/editor-app/development/src/components/editor_drawer.cjsx +7 -0
- data/support/editor-app/development/src/components/header.cjsx +12 -0
- data/support/editor-app/development/src/components/index.coffee +9 -0
- data/support/editor-app/development/src/components/menus/icon_grid.cjsx +0 -0
- data/support/editor-app/development/src/components/sidebar.cjsx +24 -0
- data/support/editor-app/development/src/components/tiled_grid.cjsx +35 -0
- data/support/editor-app/development/src/index.cjsx +82 -0
- data/support/editor-app/development/src/lib/util.coffee +48 -0
- data/support/editor-app/development/src/pages/home.cjsx +46 -0
- data/support/editor-app/development/src/pages/index.coffee +6 -0
- data/support/editor-app/development/src/pages/package_details.cjsx +55 -0
- data/support/editor-app/development/src/registry.coffee +35 -0
- data/support/editor-app/development/src/styles/components/tiled_grid.css.scss +5 -0
- data/support/editor-app/development/src/styles/index.css.scss +240 -0
- data/support/editor-app/development/src/sugar.cjsx +126 -0
- data/support/editor-app/development/webpack.config.js +53 -0
- data/support/editor-app/dist/base.css +0 -0
- data/support/editor-app/dist/toolit.js +62 -0
- data/support/editor-app/dist/toolkit.js +44573 -0
- data/support/editor-app/index.html +50 -0
- data/support/editor-app/package.json +15 -0
- data/support/editor-app/semantic/components/accordion.css +257 -0
- data/support/editor-app/semantic/components/accordion.js +558 -0
- data/support/editor-app/semantic/components/accordion.min.css +11 -0
- data/support/editor-app/semantic/components/accordion.min.js +11 -0
- data/support/editor-app/semantic/components/ad.css +277 -0
- data/support/editor-app/semantic/components/ad.min.css +11 -0
- data/support/editor-app/semantic/components/api.js +851 -0
- data/support/editor-app/semantic/components/api.min.js +11 -0
- data/support/editor-app/semantic/components/breadcrumb.css +125 -0
- data/support/editor-app/semantic/components/breadcrumb.min.css +11 -0
- data/support/editor-app/semantic/components/button.css +2391 -0
- data/support/editor-app/semantic/components/button.min.css +11 -0
- data/support/editor-app/semantic/components/card.css +758 -0
- data/support/editor-app/semantic/components/card.min.css +11 -0
- data/support/editor-app/semantic/components/checkbox.css +514 -0
- data/support/editor-app/semantic/components/checkbox.js +507 -0
- data/support/editor-app/semantic/components/checkbox.min.css +11 -0
- data/support/editor-app/semantic/components/checkbox.min.js +11 -0
- data/support/editor-app/semantic/components/comment.css +260 -0
- data/support/editor-app/semantic/components/comment.min.css +11 -0
- data/support/editor-app/semantic/components/dimmer.css +187 -0
- data/support/editor-app/semantic/components/dimmer.js +627 -0
- data/support/editor-app/semantic/components/dimmer.min.css +11 -0
- data/support/editor-app/semantic/components/dimmer.min.js +11 -0
- data/support/editor-app/semantic/components/divider.css +244 -0
- data/support/editor-app/semantic/components/divider.min.css +11 -0
- data/support/editor-app/semantic/components/dropdown.css +1085 -0
- data/support/editor-app/semantic/components/dropdown.js +1757 -0
- data/support/editor-app/semantic/components/dropdown.min.css +11 -0
- data/support/editor-app/semantic/components/dropdown.min.js +11 -0
- data/support/editor-app/semantic/components/feed.css +277 -0
- data/support/editor-app/semantic/components/feed.min.css +11 -0
- data/support/editor-app/semantic/components/flag.css +1017 -0
- data/support/editor-app/semantic/components/flag.min.css +11 -0
- data/support/editor-app/semantic/components/form.css +875 -0
- data/support/editor-app/semantic/components/form.js +1039 -0
- data/support/editor-app/semantic/components/form.min.css +11 -0
- data/support/editor-app/semantic/components/form.min.js +11 -0
- data/support/editor-app/semantic/components/grid.css +1816 -0
- data/support/editor-app/semantic/components/grid.min.css +11 -0
- data/support/editor-app/semantic/components/header.css +572 -0
- data/support/editor-app/semantic/components/header.min.css +11 -0
- data/support/editor-app/semantic/components/icon.css +2127 -0
- data/support/editor-app/semantic/components/icon.min.css +11 -0
- data/support/editor-app/semantic/components/image.css +275 -0
- data/support/editor-app/semantic/components/image.min.css +11 -0
- data/support/editor-app/semantic/components/input.css +455 -0
- data/support/editor-app/semantic/components/input.min.css +11 -0
- data/support/editor-app/semantic/components/item.css +458 -0
- data/support/editor-app/semantic/components/item.min.css +11 -0
- data/support/editor-app/semantic/components/label.css +930 -0
- data/support/editor-app/semantic/components/label.min.css +11 -0
- data/support/editor-app/semantic/components/list.css +879 -0
- data/support/editor-app/semantic/components/list.min.css +11 -0
- data/support/editor-app/semantic/components/loader.css +279 -0
- data/support/editor-app/semantic/components/loader.min.css +11 -0
- data/support/editor-app/semantic/components/menu.css +1596 -0
- data/support/editor-app/semantic/components/menu.min.css +11 -0
- data/support/editor-app/semantic/components/message.css +422 -0
- data/support/editor-app/semantic/components/message.min.css +11 -0
- data/support/editor-app/semantic/components/modal.css +431 -0
- data/support/editor-app/semantic/components/modal.js +860 -0
- data/support/editor-app/semantic/components/modal.min.css +11 -0
- data/support/editor-app/semantic/components/modal.min.js +11 -0
- data/support/editor-app/semantic/components/nag.css +149 -0
- data/support/editor-app/semantic/components/nag.js +477 -0
- data/support/editor-app/semantic/components/nag.min.css +11 -0
- data/support/editor-app/semantic/components/nag.min.js +11 -0
- data/support/editor-app/semantic/components/popup.css +294 -0
- data/support/editor-app/semantic/components/popup.js +1187 -0
- data/support/editor-app/semantic/components/popup.min.css +11 -0
- data/support/editor-app/semantic/components/popup.min.js +11 -0
- data/support/editor-app/semantic/components/progress.css +449 -0
- data/support/editor-app/semantic/components/progress.js +785 -0
- data/support/editor-app/semantic/components/progress.min.css +11 -0
- data/support/editor-app/semantic/components/progress.min.js +11 -0
- data/support/editor-app/semantic/components/rail.css +125 -0
- data/support/editor-app/semantic/components/rail.min.css +11 -0
- data/support/editor-app/semantic/components/rating.css +262 -0
- data/support/editor-app/semantic/components/rating.js +451 -0
- data/support/editor-app/semantic/components/rating.min.css +11 -0
- data/support/editor-app/semantic/components/rating.min.js +11 -0
- data/support/editor-app/semantic/components/reset.css +430 -0
- data/support/editor-app/semantic/components/reset.min.css +11 -0
- data/support/editor-app/semantic/components/reveal.css +294 -0
- data/support/editor-app/semantic/components/reveal.min.css +11 -0
- data/support/editor-app/semantic/components/search.css +330 -0
- data/support/editor-app/semantic/components/search.js +1055 -0
- data/support/editor-app/semantic/components/search.min.css +11 -0
- data/support/editor-app/semantic/components/search.min.js +11 -0
- data/support/editor-app/semantic/components/segment.css +590 -0
- data/support/editor-app/semantic/components/segment.min.css +11 -0
- data/support/editor-app/semantic/components/shape.css +155 -0
- data/support/editor-app/semantic/components/shape.js +830 -0
- data/support/editor-app/semantic/components/shape.min.css +11 -0
- data/support/editor-app/semantic/components/shape.min.js +11 -0
- data/support/editor-app/semantic/components/sidebar.css +621 -0
- data/support/editor-app/semantic/components/sidebar.js +1084 -0
- data/support/editor-app/semantic/components/sidebar.min.css +11 -0
- data/support/editor-app/semantic/components/sidebar.min.js +11 -0
- data/support/editor-app/semantic/components/site.css +147 -0
- data/support/editor-app/semantic/components/site.js +487 -0
- data/support/editor-app/semantic/components/site.min.css +11 -0
- data/support/editor-app/semantic/components/site.min.js +11 -0
- data/support/editor-app/semantic/components/state.js +690 -0
- data/support/editor-app/semantic/components/state.min.js +11 -0
- data/support/editor-app/semantic/components/statistic.css +410 -0
- data/support/editor-app/semantic/components/statistic.min.css +11 -0
- data/support/editor-app/semantic/components/step.css +433 -0
- data/support/editor-app/semantic/components/step.min.css +11 -0
- data/support/editor-app/semantic/components/sticky.css +80 -0
- data/support/editor-app/semantic/components/sticky.js +775 -0
- data/support/editor-app/semantic/components/sticky.min.css +11 -0
- data/support/editor-app/semantic/components/sticky.min.js +11 -0
- data/support/editor-app/semantic/components/tab.css +93 -0
- data/support/editor-app/semantic/components/tab.js +787 -0
- data/support/editor-app/semantic/components/tab.min.css +11 -0
- data/support/editor-app/semantic/components/tab.min.js +11 -0
- data/support/editor-app/semantic/components/table.css +999 -0
- data/support/editor-app/semantic/components/table.min.css +11 -0
- data/support/editor-app/semantic/components/transition.css +2152 -0
- data/support/editor-app/semantic/components/transition.js +936 -0
- data/support/editor-app/semantic/components/transition.min.css +11 -0
- data/support/editor-app/semantic/components/transition.min.js +11 -0
- data/support/editor-app/semantic/components/video.css +126 -0
- data/support/editor-app/semantic/components/video.js +540 -0
- data/support/editor-app/semantic/components/video.min.css +11 -0
- data/support/editor-app/semantic/components/video.min.js +11 -0
- data/support/editor-app/semantic/components/visibility.js +970 -0
- data/support/editor-app/semantic/components/visibility.min.js +11 -0
- data/support/editor-app/semantic/semantic.css +31768 -0
- data/support/editor-app/semantic/semantic.js +18317 -0
- data/support/editor-app/semantic/semantic.min.css +11 -0
- data/support/editor-app/semantic/semantic.min.js +17 -0
- data/support/editor-app/semantic/themes/basic/assets/fonts/icons.eot +0 -0
- data/support/editor-app/semantic/themes/basic/assets/fonts/icons.svg +450 -0
- data/support/editor-app/semantic/themes/basic/assets/fonts/icons.ttf +0 -0
- data/support/editor-app/semantic/themes/basic/assets/fonts/icons.woff +0 -0
- data/support/editor-app/semantic/themes/default/assets/fonts/icons.eot +0 -0
- data/support/editor-app/semantic/themes/default/assets/fonts/icons.otf +0 -0
- data/support/editor-app/semantic/themes/default/assets/fonts/icons.svg +504 -0
- data/support/editor-app/semantic/themes/default/assets/fonts/icons.ttf +0 -0
- data/support/editor-app/semantic/themes/default/assets/fonts/icons.woff +0 -0
- data/support/editor-app/semantic/themes/default/assets/images/flags.png +0 -0
- data/support/editor-app/vendor/jquery.js +8829 -0
- data/support/library-server/Gemfile +0 -0
- data/support/library-server/config.ru +4 -0
- metadata +740 -7
@@ -0,0 +1,860 @@
|
|
1
|
+
/*
|
2
|
+
* # Semantic - Modal
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
|
+
*
|
5
|
+
*
|
6
|
+
* Copyright 2014 Contributor
|
7
|
+
* Released under the MIT license
|
8
|
+
* http://opensource.org/licenses/MIT
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
12
|
+
;(function ( $, window, document, undefined ) {
|
13
|
+
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
$.fn.modal = function(parameters) {
|
17
|
+
var
|
18
|
+
$allModules = $(this),
|
19
|
+
$window = $(window),
|
20
|
+
$document = $(document),
|
21
|
+
$body = $('body'),
|
22
|
+
|
23
|
+
moduleSelector = $allModules.selector || '',
|
24
|
+
|
25
|
+
time = new Date().getTime(),
|
26
|
+
performance = [],
|
27
|
+
|
28
|
+
query = arguments[0],
|
29
|
+
methodInvoked = (typeof query == 'string'),
|
30
|
+
queryArguments = [].slice.call(arguments, 1),
|
31
|
+
|
32
|
+
requestAnimationFrame = window.requestAnimationFrame
|
33
|
+
|| window.mozRequestAnimationFrame
|
34
|
+
|| window.webkitRequestAnimationFrame
|
35
|
+
|| window.msRequestAnimationFrame
|
36
|
+
|| function(callback) { setTimeout(callback, 0); },
|
37
|
+
|
38
|
+
returnedValue
|
39
|
+
;
|
40
|
+
|
41
|
+
$allModules
|
42
|
+
.each(function() {
|
43
|
+
var
|
44
|
+
settings = ( $.isPlainObject(parameters) )
|
45
|
+
? $.extend(true, {}, $.fn.modal.settings, parameters)
|
46
|
+
: $.extend({}, $.fn.modal.settings),
|
47
|
+
|
48
|
+
selector = settings.selector,
|
49
|
+
className = settings.className,
|
50
|
+
namespace = settings.namespace,
|
51
|
+
error = settings.error,
|
52
|
+
|
53
|
+
eventNamespace = '.' + namespace,
|
54
|
+
moduleNamespace = 'module-' + namespace,
|
55
|
+
|
56
|
+
$module = $(this),
|
57
|
+
$context = $(settings.context),
|
58
|
+
$close = $module.find(selector.close),
|
59
|
+
|
60
|
+
$allModals,
|
61
|
+
$otherModals,
|
62
|
+
$focusedElement,
|
63
|
+
$dimmable,
|
64
|
+
$dimmer,
|
65
|
+
|
66
|
+
element = this,
|
67
|
+
instance = $module.data(moduleNamespace),
|
68
|
+
|
69
|
+
elementNamespace,
|
70
|
+
id,
|
71
|
+
observer,
|
72
|
+
module
|
73
|
+
;
|
74
|
+
module = {
|
75
|
+
|
76
|
+
initialize: function() {
|
77
|
+
module.verbose('Initializing dimmer', $context);
|
78
|
+
|
79
|
+
module.create.id();
|
80
|
+
module.create.dimmer();
|
81
|
+
module.refreshModals();
|
82
|
+
|
83
|
+
module.verbose('Attaching close events', $close);
|
84
|
+
module.bind.events();
|
85
|
+
module.observeChanges();
|
86
|
+
module.instantiate();
|
87
|
+
},
|
88
|
+
|
89
|
+
instantiate: function() {
|
90
|
+
module.verbose('Storing instance of modal');
|
91
|
+
instance = module;
|
92
|
+
$module
|
93
|
+
.data(moduleNamespace, instance)
|
94
|
+
;
|
95
|
+
},
|
96
|
+
|
97
|
+
create: {
|
98
|
+
dimmer: function() {
|
99
|
+
var
|
100
|
+
defaultSettings = {
|
101
|
+
debug : settings.debug,
|
102
|
+
dimmerName : 'modals',
|
103
|
+
duration : {
|
104
|
+
show : settings.duration,
|
105
|
+
hide : settings.duration
|
106
|
+
}
|
107
|
+
},
|
108
|
+
dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
|
109
|
+
;
|
110
|
+
if($.fn.dimmer === undefined) {
|
111
|
+
module.error(error.dimmer);
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
module.debug('Creating dimmer with settings', dimmerSettings);
|
115
|
+
$dimmable = $context.dimmer(dimmerSettings);
|
116
|
+
if(settings.detachable) {
|
117
|
+
module.verbose('Modal is detachable, moving content into dimmer');
|
118
|
+
$dimmable.dimmer('add content', $module);
|
119
|
+
}
|
120
|
+
$dimmer = $dimmable.dimmer('get dimmer');
|
121
|
+
},
|
122
|
+
id: function() {
|
123
|
+
module.verbose('Creating unique id for element');
|
124
|
+
id = module.get.uniqueID();
|
125
|
+
elementNamespace = '.' + id;
|
126
|
+
}
|
127
|
+
},
|
128
|
+
|
129
|
+
destroy: function() {
|
130
|
+
module.verbose('Destroying previous modal');
|
131
|
+
$module
|
132
|
+
.removeData(moduleNamespace)
|
133
|
+
.off(eventNamespace)
|
134
|
+
;
|
135
|
+
$window.off(elementNamespace);
|
136
|
+
$close.off(eventNamespace);
|
137
|
+
$context.dimmer('destroy');
|
138
|
+
},
|
139
|
+
|
140
|
+
observeChanges: function() {
|
141
|
+
if('MutationObserver' in window) {
|
142
|
+
observer = new MutationObserver(function(mutations) {
|
143
|
+
module.debug('DOM tree modified, refreshing');
|
144
|
+
module.refresh();
|
145
|
+
});
|
146
|
+
observer.observe(element, {
|
147
|
+
childList : true,
|
148
|
+
subtree : true
|
149
|
+
});
|
150
|
+
module.debug('Setting up mutation observer', observer);
|
151
|
+
}
|
152
|
+
},
|
153
|
+
|
154
|
+
refresh: function() {
|
155
|
+
module.remove.scrolling();
|
156
|
+
module.cacheSizes();
|
157
|
+
module.set.screenHeight();
|
158
|
+
module.set.type();
|
159
|
+
module.set.position();
|
160
|
+
},
|
161
|
+
|
162
|
+
refreshModals: function() {
|
163
|
+
$otherModals = $module.siblings(selector.modal);
|
164
|
+
$allModals = $otherModals.add($module);
|
165
|
+
},
|
166
|
+
|
167
|
+
attachEvents: function(selector, event) {
|
168
|
+
var
|
169
|
+
$toggle = $(selector)
|
170
|
+
;
|
171
|
+
event = $.isFunction(module[event])
|
172
|
+
? module[event]
|
173
|
+
: module.toggle
|
174
|
+
;
|
175
|
+
if($toggle.length > 0) {
|
176
|
+
module.debug('Attaching modal events to element', selector, event);
|
177
|
+
$toggle
|
178
|
+
.off(eventNamespace)
|
179
|
+
.on('click' + eventNamespace, event)
|
180
|
+
;
|
181
|
+
}
|
182
|
+
else {
|
183
|
+
module.error(error.notFound, selector);
|
184
|
+
}
|
185
|
+
},
|
186
|
+
|
187
|
+
bind: {
|
188
|
+
events: function() {
|
189
|
+
$close
|
190
|
+
.on('click' + eventNamespace, module.event.close)
|
191
|
+
;
|
192
|
+
$window
|
193
|
+
.on('resize' + elementNamespace, module.event.resize)
|
194
|
+
;
|
195
|
+
}
|
196
|
+
},
|
197
|
+
|
198
|
+
get: {
|
199
|
+
uniqueID: function() {
|
200
|
+
return (Math.random().toString(16) + '000000000').substr(2,8);
|
201
|
+
}
|
202
|
+
},
|
203
|
+
|
204
|
+
event: {
|
205
|
+
close: function() {
|
206
|
+
module.verbose('Closing element pressed');
|
207
|
+
if( $(this).is(selector.approve) ) {
|
208
|
+
if(settings.onApprove.call(element) !== false) {
|
209
|
+
module.hide();
|
210
|
+
}
|
211
|
+
else {
|
212
|
+
module.verbose('Approve callback returned false cancelling hide');
|
213
|
+
}
|
214
|
+
}
|
215
|
+
else if( $(this).is(selector.deny) ) {
|
216
|
+
if(settings.onDeny.call(element) !== false) {
|
217
|
+
module.hide();
|
218
|
+
}
|
219
|
+
else {
|
220
|
+
module.verbose('Deny callback returned false cancelling hide');
|
221
|
+
}
|
222
|
+
}
|
223
|
+
else {
|
224
|
+
module.hide();
|
225
|
+
}
|
226
|
+
},
|
227
|
+
click: function(event) {
|
228
|
+
if( $(event.target).closest($module).length === 0 ) {
|
229
|
+
module.debug('Dimmer clicked, hiding all modals');
|
230
|
+
if( module.is.active() ) {
|
231
|
+
module.remove.clickaway();
|
232
|
+
if(settings.allowMultiple) {
|
233
|
+
module.hide();
|
234
|
+
}
|
235
|
+
else {
|
236
|
+
module.hideAll();
|
237
|
+
}
|
238
|
+
}
|
239
|
+
}
|
240
|
+
},
|
241
|
+
debounce: function(method, delay) {
|
242
|
+
clearTimeout(module.timer);
|
243
|
+
module.timer = setTimeout(method, delay);
|
244
|
+
},
|
245
|
+
keyboard: function(event) {
|
246
|
+
var
|
247
|
+
keyCode = event.which,
|
248
|
+
escapeKey = 27
|
249
|
+
;
|
250
|
+
if(keyCode == escapeKey) {
|
251
|
+
if(settings.closable) {
|
252
|
+
module.debug('Escape key pressed hiding modal');
|
253
|
+
module.hide();
|
254
|
+
}
|
255
|
+
else {
|
256
|
+
module.debug('Escape key pressed, but closable is set to false');
|
257
|
+
}
|
258
|
+
event.preventDefault();
|
259
|
+
}
|
260
|
+
},
|
261
|
+
resize: function() {
|
262
|
+
if( $dimmable.dimmer('is active') ) {
|
263
|
+
requestAnimationFrame(module.refresh);
|
264
|
+
}
|
265
|
+
}
|
266
|
+
},
|
267
|
+
|
268
|
+
toggle: function() {
|
269
|
+
if( module.is.active() || module.is.animating() ) {
|
270
|
+
module.hide();
|
271
|
+
}
|
272
|
+
else {
|
273
|
+
module.show();
|
274
|
+
}
|
275
|
+
},
|
276
|
+
|
277
|
+
show: function(callback) {
|
278
|
+
callback = $.isFunction(callback)
|
279
|
+
? callback
|
280
|
+
: function(){}
|
281
|
+
;
|
282
|
+
module.refreshModals();
|
283
|
+
module.showModal(callback);
|
284
|
+
},
|
285
|
+
|
286
|
+
hide: function(callback) {
|
287
|
+
callback = $.isFunction(callback)
|
288
|
+
? callback
|
289
|
+
: function(){}
|
290
|
+
;
|
291
|
+
module.refreshModals();
|
292
|
+
module.hideModal(callback);
|
293
|
+
},
|
294
|
+
|
295
|
+
showModal: function(callback) {
|
296
|
+
callback = $.isFunction(callback)
|
297
|
+
? callback
|
298
|
+
: function(){}
|
299
|
+
;
|
300
|
+
if( module.is.animating() || !module.is.active() ) {
|
301
|
+
|
302
|
+
module.showDimmer();
|
303
|
+
module.cacheSizes();
|
304
|
+
module.set.position();
|
305
|
+
module.set.screenHeight();
|
306
|
+
module.set.type();
|
307
|
+
module.set.clickaway();
|
308
|
+
|
309
|
+
if( !settings.allowMultiple && $otherModals.filter(':visible').length > 0) {
|
310
|
+
module.debug('Other modals visible, queueing show animation');
|
311
|
+
module.hideOthers(module.showModal);
|
312
|
+
}
|
313
|
+
else {
|
314
|
+
settings.onShow.call(element);
|
315
|
+
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
|
316
|
+
module.debug('Showing modal with css animations');
|
317
|
+
$module
|
318
|
+
.transition({
|
319
|
+
debug : settings.debug,
|
320
|
+
animation : settings.transition + ' in',
|
321
|
+
queue : settings.queue,
|
322
|
+
duration : settings.duration,
|
323
|
+
useFailSafe : true,
|
324
|
+
onComplete : function() {
|
325
|
+
settings.onVisible.apply(element);
|
326
|
+
module.add.keyboardShortcuts();
|
327
|
+
module.save.focus();
|
328
|
+
module.set.active();
|
329
|
+
module.set.autofocus();
|
330
|
+
callback();
|
331
|
+
}
|
332
|
+
})
|
333
|
+
;
|
334
|
+
}
|
335
|
+
else {
|
336
|
+
module.debug('Showing modal with javascript');
|
337
|
+
$module
|
338
|
+
.fadeIn(settings.duration, settings.easing, function() {
|
339
|
+
settings.onVisible.apply(element);
|
340
|
+
module.add.keyboardShortcuts();
|
341
|
+
module.save.focus();
|
342
|
+
module.set.active();
|
343
|
+
callback();
|
344
|
+
})
|
345
|
+
;
|
346
|
+
}
|
347
|
+
}
|
348
|
+
}
|
349
|
+
else {
|
350
|
+
module.debug('Modal is already visible');
|
351
|
+
}
|
352
|
+
},
|
353
|
+
|
354
|
+
hideModal: function(callback) {
|
355
|
+
callback = $.isFunction(callback)
|
356
|
+
? callback
|
357
|
+
: function(){}
|
358
|
+
;
|
359
|
+
module.debug('Hiding modal');
|
360
|
+
settings.onHide.call(element);
|
361
|
+
|
362
|
+
if( module.is.animating() || module.is.active() ) {
|
363
|
+
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
|
364
|
+
module.remove.active();
|
365
|
+
$module
|
366
|
+
.transition({
|
367
|
+
debug : settings.debug,
|
368
|
+
animation : settings.transition + ' out',
|
369
|
+
queue : settings.queue,
|
370
|
+
duration : settings.duration,
|
371
|
+
useFailSafe : true,
|
372
|
+
onStart : function() {
|
373
|
+
if( !module.othersActive() ) {
|
374
|
+
module.hideDimmer();
|
375
|
+
}
|
376
|
+
module.remove.keyboardShortcuts();
|
377
|
+
},
|
378
|
+
onComplete : function() {
|
379
|
+
settings.onHidden.call(element);
|
380
|
+
module.restore.focus();
|
381
|
+
callback();
|
382
|
+
}
|
383
|
+
})
|
384
|
+
;
|
385
|
+
}
|
386
|
+
else {
|
387
|
+
module.remove.active();
|
388
|
+
if( !module.othersActive() ) {
|
389
|
+
module.hideDimmer();
|
390
|
+
}
|
391
|
+
module.remove.keyboardShortcuts();
|
392
|
+
$module
|
393
|
+
.fadeOut(settings.duration, settings.easing, function() {
|
394
|
+
settings.onHidden.call(element);
|
395
|
+
module.restore.focus();
|
396
|
+
callback();
|
397
|
+
})
|
398
|
+
;
|
399
|
+
}
|
400
|
+
}
|
401
|
+
},
|
402
|
+
|
403
|
+
showDimmer: function() {
|
404
|
+
if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) {
|
405
|
+
module.debug('Showing dimmer');
|
406
|
+
$dimmable.dimmer('show');
|
407
|
+
}
|
408
|
+
else {
|
409
|
+
module.debug('Dimmer already visible');
|
410
|
+
}
|
411
|
+
},
|
412
|
+
|
413
|
+
hideDimmer: function() {
|
414
|
+
if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) {
|
415
|
+
$dimmable.dimmer('hide', function() {
|
416
|
+
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
|
417
|
+
module.remove.clickaway();
|
418
|
+
module.remove.screenHeight();
|
419
|
+
}
|
420
|
+
});
|
421
|
+
}
|
422
|
+
else {
|
423
|
+
module.debug('Dimmer is not visible cannot hide');
|
424
|
+
return;
|
425
|
+
}
|
426
|
+
},
|
427
|
+
|
428
|
+
hideAll: function(callback) {
|
429
|
+
callback = $.isFunction(callback)
|
430
|
+
? callback
|
431
|
+
: function(){}
|
432
|
+
;
|
433
|
+
if( $allModals.is(':visible') ) {
|
434
|
+
module.debug('Hiding all visible modals');
|
435
|
+
module.hideDimmer();
|
436
|
+
$allModals
|
437
|
+
.filter(':visible')
|
438
|
+
.modal('hide modal', callback)
|
439
|
+
;
|
440
|
+
}
|
441
|
+
},
|
442
|
+
|
443
|
+
hideOthers: function(callback) {
|
444
|
+
callback = $.isFunction(callback)
|
445
|
+
? callback
|
446
|
+
: function(){}
|
447
|
+
;
|
448
|
+
if( $otherModals.is(':visible') ) {
|
449
|
+
module.debug('Hiding other modals', $otherModals);
|
450
|
+
$otherModals
|
451
|
+
.filter(':visible')
|
452
|
+
.modal('hide modal', callback)
|
453
|
+
;
|
454
|
+
}
|
455
|
+
},
|
456
|
+
|
457
|
+
othersActive: function() {
|
458
|
+
return ($otherModals.filter('.' + className.active).length > 0);
|
459
|
+
},
|
460
|
+
|
461
|
+
add: {
|
462
|
+
keyboardShortcuts: function() {
|
463
|
+
module.verbose('Adding keyboard shortcuts');
|
464
|
+
$document
|
465
|
+
.on('keyup' + eventNamespace, module.event.keyboard)
|
466
|
+
;
|
467
|
+
}
|
468
|
+
},
|
469
|
+
|
470
|
+
save: {
|
471
|
+
focus: function() {
|
472
|
+
$focusedElement = $(document.activeElement).blur();
|
473
|
+
}
|
474
|
+
},
|
475
|
+
|
476
|
+
restore: {
|
477
|
+
focus: function() {
|
478
|
+
if($focusedElement && $focusedElement.length > 0) {
|
479
|
+
$focusedElement.focus();
|
480
|
+
}
|
481
|
+
}
|
482
|
+
},
|
483
|
+
|
484
|
+
remove: {
|
485
|
+
active: function() {
|
486
|
+
$module.removeClass(className.active);
|
487
|
+
},
|
488
|
+
clickaway: function() {
|
489
|
+
if(settings.closable) {
|
490
|
+
$dimmer
|
491
|
+
.off('click' + elementNamespace)
|
492
|
+
;
|
493
|
+
}
|
494
|
+
},
|
495
|
+
screenHeight: function() {
|
496
|
+
if(module.cache.height > module.cache.pageHeight) {
|
497
|
+
module.debug('Removing page height');
|
498
|
+
$body
|
499
|
+
.css('height', '')
|
500
|
+
;
|
501
|
+
}
|
502
|
+
},
|
503
|
+
keyboardShortcuts: function() {
|
504
|
+
module.verbose('Removing keyboard shortcuts');
|
505
|
+
$document
|
506
|
+
.off('keyup' + eventNamespace)
|
507
|
+
;
|
508
|
+
},
|
509
|
+
scrolling: function() {
|
510
|
+
$dimmable.removeClass(className.scrolling);
|
511
|
+
$module.removeClass(className.scrolling);
|
512
|
+
}
|
513
|
+
},
|
514
|
+
|
515
|
+
cacheSizes: function() {
|
516
|
+
var
|
517
|
+
modalHeight = $module.outerHeight()
|
518
|
+
;
|
519
|
+
if(module.cache === undefined || modalHeight !== 0) {
|
520
|
+
module.cache = {
|
521
|
+
pageHeight : $(document).outerHeight(),
|
522
|
+
height : modalHeight + settings.offset,
|
523
|
+
contextHeight : (settings.context == 'body')
|
524
|
+
? $(window).height()
|
525
|
+
: $dimmable.height()
|
526
|
+
};
|
527
|
+
}
|
528
|
+
module.debug('Caching modal and container sizes', module.cache);
|
529
|
+
},
|
530
|
+
|
531
|
+
can: {
|
532
|
+
fit: function() {
|
533
|
+
return (module.cache.height < module.cache.contextHeight);
|
534
|
+
}
|
535
|
+
},
|
536
|
+
|
537
|
+
is: {
|
538
|
+
active: function() {
|
539
|
+
return $module.hasClass(className.active);
|
540
|
+
},
|
541
|
+
animating: function() {
|
542
|
+
return $module.transition('is supported')
|
543
|
+
? $module.transition('is animating')
|
544
|
+
: $module.is(':visible')
|
545
|
+
;
|
546
|
+
},
|
547
|
+
scrolling: function() {
|
548
|
+
return $dimmable.hasClass(className.scrolling);
|
549
|
+
},
|
550
|
+
modernBrowser: function() {
|
551
|
+
// appName for IE11 reports 'Netscape' can no longer use
|
552
|
+
return !(window.ActiveXObject || "ActiveXObject" in window);
|
553
|
+
}
|
554
|
+
},
|
555
|
+
|
556
|
+
set: {
|
557
|
+
autofocus: function() {
|
558
|
+
if(settings.autofocus) {
|
559
|
+
var
|
560
|
+
$inputs = $module.find(':input:visible'),
|
561
|
+
$autofocus = $inputs.filter('[autofocus]'),
|
562
|
+
$input = ($autofocus.length > 0)
|
563
|
+
? $autofocus
|
564
|
+
: $inputs
|
565
|
+
;
|
566
|
+
$input.first().focus();
|
567
|
+
}
|
568
|
+
},
|
569
|
+
clickaway: function() {
|
570
|
+
if(settings.closable) {
|
571
|
+
$dimmer
|
572
|
+
.on('click' + elementNamespace, module.event.click)
|
573
|
+
;
|
574
|
+
}
|
575
|
+
},
|
576
|
+
screenHeight: function() {
|
577
|
+
if(module.cache.height > module.cache.pageHeight) {
|
578
|
+
module.debug('Modal is taller than page content, resizing page height');
|
579
|
+
$body
|
580
|
+
.css('height', module.cache.height + settings.padding)
|
581
|
+
;
|
582
|
+
}
|
583
|
+
else {
|
584
|
+
$body.css('height', '');
|
585
|
+
}
|
586
|
+
},
|
587
|
+
active: function() {
|
588
|
+
$module.addClass(className.active);
|
589
|
+
},
|
590
|
+
scrolling: function() {
|
591
|
+
$dimmable.addClass(className.scrolling);
|
592
|
+
$module.addClass(className.scrolling);
|
593
|
+
},
|
594
|
+
type: function() {
|
595
|
+
if(module.can.fit()) {
|
596
|
+
module.verbose('Modal fits on screen');
|
597
|
+
if(!module.othersActive) {
|
598
|
+
module.remove.scrolling();
|
599
|
+
}
|
600
|
+
}
|
601
|
+
else {
|
602
|
+
module.verbose('Modal cannot fit on screen setting to scrolling');
|
603
|
+
module.set.scrolling();
|
604
|
+
}
|
605
|
+
},
|
606
|
+
position: function() {
|
607
|
+
module.verbose('Centering modal on page', module.cache);
|
608
|
+
if(module.can.fit()) {
|
609
|
+
$module
|
610
|
+
.css({
|
611
|
+
top: '',
|
612
|
+
marginTop: -(module.cache.height / 2)
|
613
|
+
})
|
614
|
+
;
|
615
|
+
}
|
616
|
+
else {
|
617
|
+
$module
|
618
|
+
.css({
|
619
|
+
marginTop : '',
|
620
|
+
top : $document.scrollTop()
|
621
|
+
})
|
622
|
+
;
|
623
|
+
}
|
624
|
+
}
|
625
|
+
},
|
626
|
+
|
627
|
+
setting: function(name, value) {
|
628
|
+
module.debug('Changing setting', name, value);
|
629
|
+
if( $.isPlainObject(name) ) {
|
630
|
+
$.extend(true, settings, name);
|
631
|
+
}
|
632
|
+
else if(value !== undefined) {
|
633
|
+
settings[name] = value;
|
634
|
+
}
|
635
|
+
else {
|
636
|
+
return settings[name];
|
637
|
+
}
|
638
|
+
},
|
639
|
+
internal: function(name, value) {
|
640
|
+
if( $.isPlainObject(name) ) {
|
641
|
+
$.extend(true, module, name);
|
642
|
+
}
|
643
|
+
else if(value !== undefined) {
|
644
|
+
module[name] = value;
|
645
|
+
}
|
646
|
+
else {
|
647
|
+
return module[name];
|
648
|
+
}
|
649
|
+
},
|
650
|
+
debug: function() {
|
651
|
+
if(settings.debug) {
|
652
|
+
if(settings.performance) {
|
653
|
+
module.performance.log(arguments);
|
654
|
+
}
|
655
|
+
else {
|
656
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
657
|
+
module.debug.apply(console, arguments);
|
658
|
+
}
|
659
|
+
}
|
660
|
+
},
|
661
|
+
verbose: function() {
|
662
|
+
if(settings.verbose && settings.debug) {
|
663
|
+
if(settings.performance) {
|
664
|
+
module.performance.log(arguments);
|
665
|
+
}
|
666
|
+
else {
|
667
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
668
|
+
module.verbose.apply(console, arguments);
|
669
|
+
}
|
670
|
+
}
|
671
|
+
},
|
672
|
+
error: function() {
|
673
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
674
|
+
module.error.apply(console, arguments);
|
675
|
+
},
|
676
|
+
performance: {
|
677
|
+
log: function(message) {
|
678
|
+
var
|
679
|
+
currentTime,
|
680
|
+
executionTime,
|
681
|
+
previousTime
|
682
|
+
;
|
683
|
+
if(settings.performance) {
|
684
|
+
currentTime = new Date().getTime();
|
685
|
+
previousTime = time || currentTime;
|
686
|
+
executionTime = currentTime - previousTime;
|
687
|
+
time = currentTime;
|
688
|
+
performance.push({
|
689
|
+
'Name' : message[0],
|
690
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
691
|
+
'Element' : element,
|
692
|
+
'Execution Time' : executionTime
|
693
|
+
});
|
694
|
+
}
|
695
|
+
clearTimeout(module.performance.timer);
|
696
|
+
module.performance.timer = setTimeout(module.performance.display, 100);
|
697
|
+
},
|
698
|
+
display: function() {
|
699
|
+
var
|
700
|
+
title = settings.name + ':',
|
701
|
+
totalTime = 0
|
702
|
+
;
|
703
|
+
time = false;
|
704
|
+
clearTimeout(module.performance.timer);
|
705
|
+
$.each(performance, function(index, data) {
|
706
|
+
totalTime += data['Execution Time'];
|
707
|
+
});
|
708
|
+
title += ' ' + totalTime + 'ms';
|
709
|
+
if(moduleSelector) {
|
710
|
+
title += ' \'' + moduleSelector + '\'';
|
711
|
+
}
|
712
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
713
|
+
console.groupCollapsed(title);
|
714
|
+
if(console.table) {
|
715
|
+
console.table(performance);
|
716
|
+
}
|
717
|
+
else {
|
718
|
+
$.each(performance, function(index, data) {
|
719
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
720
|
+
});
|
721
|
+
}
|
722
|
+
console.groupEnd();
|
723
|
+
}
|
724
|
+
performance = [];
|
725
|
+
}
|
726
|
+
},
|
727
|
+
invoke: function(query, passedArguments, context) {
|
728
|
+
var
|
729
|
+
object = instance,
|
730
|
+
maxDepth,
|
731
|
+
found,
|
732
|
+
response
|
733
|
+
;
|
734
|
+
passedArguments = passedArguments || queryArguments;
|
735
|
+
context = element || context;
|
736
|
+
if(typeof query == 'string' && object !== undefined) {
|
737
|
+
query = query.split(/[\. ]/);
|
738
|
+
maxDepth = query.length - 1;
|
739
|
+
$.each(query, function(depth, value) {
|
740
|
+
var camelCaseValue = (depth != maxDepth)
|
741
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
742
|
+
: query
|
743
|
+
;
|
744
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
745
|
+
object = object[camelCaseValue];
|
746
|
+
}
|
747
|
+
else if( object[camelCaseValue] !== undefined ) {
|
748
|
+
found = object[camelCaseValue];
|
749
|
+
return false;
|
750
|
+
}
|
751
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
752
|
+
object = object[value];
|
753
|
+
}
|
754
|
+
else if( object[value] !== undefined ) {
|
755
|
+
found = object[value];
|
756
|
+
return false;
|
757
|
+
}
|
758
|
+
else {
|
759
|
+
return false;
|
760
|
+
}
|
761
|
+
});
|
762
|
+
}
|
763
|
+
if ( $.isFunction( found ) ) {
|
764
|
+
response = found.apply(context, passedArguments);
|
765
|
+
}
|
766
|
+
else if(found !== undefined) {
|
767
|
+
response = found;
|
768
|
+
}
|
769
|
+
if($.isArray(returnedValue)) {
|
770
|
+
returnedValue.push(response);
|
771
|
+
}
|
772
|
+
else if(returnedValue !== undefined) {
|
773
|
+
returnedValue = [returnedValue, response];
|
774
|
+
}
|
775
|
+
else if(response !== undefined) {
|
776
|
+
returnedValue = response;
|
777
|
+
}
|
778
|
+
return found;
|
779
|
+
}
|
780
|
+
};
|
781
|
+
|
782
|
+
if(methodInvoked) {
|
783
|
+
if(instance === undefined) {
|
784
|
+
module.initialize();
|
785
|
+
}
|
786
|
+
module.invoke(query);
|
787
|
+
}
|
788
|
+
else {
|
789
|
+
if(instance !== undefined) {
|
790
|
+
module.destroy();
|
791
|
+
}
|
792
|
+
module.initialize();
|
793
|
+
}
|
794
|
+
})
|
795
|
+
;
|
796
|
+
|
797
|
+
return (returnedValue !== undefined)
|
798
|
+
? returnedValue
|
799
|
+
: this
|
800
|
+
;
|
801
|
+
};
|
802
|
+
|
803
|
+
$.fn.modal.settings = {
|
804
|
+
|
805
|
+
name : 'Modal',
|
806
|
+
namespace : 'modal',
|
807
|
+
|
808
|
+
debug : false,
|
809
|
+
verbose : true,
|
810
|
+
performance : true,
|
811
|
+
|
812
|
+
allowMultiple : false,
|
813
|
+
detachable : true,
|
814
|
+
closable : true,
|
815
|
+
autofocus : true,
|
816
|
+
|
817
|
+
dimmerSettings : {
|
818
|
+
closable : false,
|
819
|
+
useCSS : true
|
820
|
+
},
|
821
|
+
|
822
|
+
context : 'body',
|
823
|
+
|
824
|
+
queue : false,
|
825
|
+
duration : 500,
|
826
|
+
easing : 'easeOutExpo',
|
827
|
+
offset : 0,
|
828
|
+
transition : 'scale',
|
829
|
+
|
830
|
+
padding : 30,
|
831
|
+
|
832
|
+
onShow : function(){},
|
833
|
+
onHide : function(){},
|
834
|
+
|
835
|
+
onVisible : function(){},
|
836
|
+
onHidden : function(){},
|
837
|
+
|
838
|
+
onApprove : function(){ return true; },
|
839
|
+
onDeny : function(){ return true; },
|
840
|
+
|
841
|
+
selector : {
|
842
|
+
close : '.close, .actions .button',
|
843
|
+
approve : '.actions .positive, .actions .approve, .actions .ok',
|
844
|
+
deny : '.actions .negative, .actions .deny, .actions .cancel',
|
845
|
+
modal : '.ui.modal'
|
846
|
+
},
|
847
|
+
error : {
|
848
|
+
dimmer : 'UI Dimmer, a required component is not included in this page',
|
849
|
+
method : 'The method you called is not defined.',
|
850
|
+
notFound : 'The element you specified could not be found'
|
851
|
+
},
|
852
|
+
className : {
|
853
|
+
active : 'active',
|
854
|
+
animating : 'animating',
|
855
|
+
scrolling : 'scrolling'
|
856
|
+
}
|
857
|
+
};
|
858
|
+
|
859
|
+
|
860
|
+
})( jQuery, window , document );
|