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,11 @@
|
|
1
|
+
/*
|
2
|
+
* # Semantic UI - 1.8.1
|
3
|
+
* https://github.com/Semantic-Org/Semantic-UI
|
4
|
+
* http://www.semantic-ui.com/
|
5
|
+
*
|
6
|
+
* Copyright 2014 Contributors
|
7
|
+
* Released under the MIT license
|
8
|
+
* http://opensource.org/licenses/MIT
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
.ui.sticky{position:static;-webkit-transition:width .2s ease,height .2s ease,top .2s ease,bottom .2s ease;transition:width .2s ease,height .2s ease,top .2s ease,bottom .2s ease;z-index:800}.ui.sticky.bound{position:absolute;left:auto;right:auto}.ui.sticky.fixed{position:fixed;left:auto;right:auto}.ui.sticky.bound.top,.ui.sticky.fixed.top{top:0;bottom:auto}.ui.sticky.bound.bottom,.ui.sticky.fixed.bottom{top:auto;bottom:0}.ui.native.sticky{position:-webkit-sticky;position:-moz-sticky;position:-ms-sticky;position:-o-sticky;position:sticky}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*
|
2
|
+
* # Semantic UI - 1.8.1
|
3
|
+
* https://github.com/Semantic-Org/Semantic-UI
|
4
|
+
* http://www.semantic-ui.com/
|
5
|
+
*
|
6
|
+
* Copyright 2014 Contributors
|
7
|
+
* Released under the MIT license
|
8
|
+
* http://opensource.org/licenses/MIT
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
!function(e,t,o,n){"use strict";e.fn.sticky=function(o){var i,s=e(this),r=s.selector||"",c=(new Date).getTime(),a=[],l=arguments[0],f="string"==typeof l,m=[].slice.call(arguments,1);return s.each(function(){var s,u,d,h=e.extend(!0,{},e.fn.sticky.settings,o),p=h.className,g=h.namespace,b=h.error,v="."+g,x="module-"+g,C=e(this),S=e(t),y=C.offsetParent(),k=e(h.scrollContext),T=(C.selector||"",C.data(x)),w=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)},z=this;d={initialize:function(){return s=h.context?e(h.context):y,0===s.length?void d.error(b.invalidContext,h.context,C):(d.verbose("Initializing sticky",h,y),d.save.positions(),d.is.hidden()&&d.error(b.visible,C),d.cache.element.height>d.cache.context.height?(d.reset(),void d.error(b.elementSize,C)):(S.on("resize"+v,d.event.resize),k.on("scroll"+v,d.event.scroll),d.observeChanges(),void d.instantiate()))},instantiate:function(){d.verbose("Storing instance of module",d),T=d,C.data(x,d)},destroy:function(){d.verbose("Destroying previous module"),d.reset(),u&&u.disconnect(),S.off("resize"+v,d.event.resize),k.off("scroll"+v,d.event.scroll),C.removeData(x)},observeChanges:function(){var e=s[0];h.observeChanges&&"MutationObserver"in t&&(u=new MutationObserver(function(){clearTimeout(d.timer),d.timer=setTimeout(function(){d.verbose("DOM tree modified, updating sticky menu"),d.refresh()},200)}),u.observe(z,{childList:!0,subtree:!0}),u.observe(e,{childList:!0,subtree:!0}),d.debug("Setting up mutation observer",u))},event:{resize:function(){w(function(){d.refresh(),d.stick()})},scroll:function(){w(function(){d.stick(),h.onScroll.call(z)})}},refresh:function(e){d.reset(),e&&(y=C.offsetParent()),d.save.positions(),d.stick(),h.onReposition.call(z)},supports:{sticky:function(){{var t=e("<div/>");t.get()}return t.addClass(p.supported),t.css("position").match("sticky")}},save:{scroll:function(e){d.lastScroll=e},positions:function(){var e={height:S.height()},t={margin:{top:parseInt(C.css("margin-top"),10),bottom:parseInt(C.css("margin-bottom"),10)},offset:C.offset(),width:C.outerWidth(),height:C.outerHeight()},o={offset:s.offset(),height:s.outerHeight()};d.cache={fits:t.height<e.height,window:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:o.offset.top,height:o.height,bottom:o.offset.top+o.height}},d.set.containerSize(),d.set.size(),d.stick(),d.debug("Caching element positions",d.cache)}},get:{direction:function(e){var t="down";return e=e||k.scrollTop(),d.lastScroll!==n&&(d.lastScroll<e?t="down":d.lastScroll>e&&(t="up")),t},scrollChange:function(e){return e=e||k.scrollTop(),d.lastScroll?e-d.lastScroll:0},currentElementScroll:function(){return d.is.top()?Math.abs(parseInt(C.css("top"),10))||0:Math.abs(parseInt(C.css("bottom"),10))||0},elementScroll:function(e){e=e||k.scrollTop();var t,o=d.cache.element,n=d.cache.window,i=d.get.scrollChange(e),s=o.height-n.height+h.offset,r=d.get.currentElementScroll(),c=r+i;return t=d.cache.fits||0>c?0:c>s?s:c}},remove:{offset:function(){C.css("margin-top","")}},set:{offset:function(){d.verbose("Setting offset on element",h.offset),C.css("margin-top",h.offset)},containerSize:function(){var e=y.get(0).tagName;"HTML"===e||"body"==e?y=C.offsetParent():(d.debug("Settings container size",d.cache.context.height),y.height(d.cache.context.height))},scroll:function(e){d.debug("Setting scroll on element",e),d.is.top()&&C.css("bottom","").css("top",-e),d.is.bottom()&&C.css("top","").css("bottom",e)},size:function(){0!==d.cache.element.height&&0!==d.cache.element.width&&C.css({width:d.cache.element.width,height:d.cache.element.height})}},is:{top:function(){return C.hasClass(p.top)},bottom:function(){return C.hasClass(p.bottom)},initialPosition:function(){return!d.is.fixed()&&!d.is.bound()},hidden:function(){return!C.is(":visible")},bound:function(){return C.hasClass(p.bound)},fixed:function(){return C.hasClass(p.fixed)}},stick:function(){var e=d.cache,t=e.fits,o=e.element,n=e.window,i=e.context,s=d.is.bottom()&&h.pushing?h.bottomOffset:h.offset,r={top:k.scrollTop()+s,bottom:k.scrollTop()+s+n.height},c=(d.get.direction(r.top),d.get.elementScroll(r.top)),a=!t,l=0!==o.height;d.save.scroll(r.top),l&&(d.is.initialPosition()?r.top>=o.top&&(d.debug("Element passed, fixing element to page"),d.fixTop()):d.is.fixed()?d.is.top()?r.top<o.top?(d.debug("Fixed element reached top of container"),d.setInitialPosition()):o.height+r.top-c>i.bottom?(d.debug("Fixed element reached bottom of container"),d.bindBottom()):a&&d.set.scroll(c):d.is.bottom()&&(r.bottom-o.height<o.top?(d.debug("Bottom fixed rail has reached top of container"),d.setInitialPosition()):r.bottom>i.bottom?(d.debug("Bottom fixed rail has reached bottom of container"),d.bindBottom()):a&&d.set.scroll(c)):d.is.bottom()&&(h.pushing?d.is.bound()&&r.bottom<i.bottom&&(d.debug("Fixing bottom attached element to bottom of browser."),d.fixBottom()):d.is.bound()&&r.top<i.bottom-o.height&&(d.debug("Fixing bottom attached element to top of browser."),d.fixTop())))},bindTop:function(){d.debug("Binding element to top of parent container"),d.remove.offset(),C.css("left","").css("top","").css("bottom","").removeClass(p.fixed).removeClass(p.bottom).addClass(p.bound).addClass(p.top),h.onTop.call(z),h.onUnstick.call(z)},bindBottom:function(){d.debug("Binding element to bottom of parent container"),d.remove.offset(),C.css("left","").css("top","").css("bottom","").removeClass(p.fixed).removeClass(p.top).addClass(p.bound).addClass(p.bottom),h.onBottom.call(z),h.onUnstick.call(z)},setInitialPosition:function(){d.unfix(),d.unbind()},fixTop:function(){d.debug("Fixing element to top of page"),d.set.offset(),C.css("left",d.cache.element.left).removeClass(p.bound).removeClass(p.bottom).addClass(p.fixed).addClass(p.top),h.onStick.call(z)},fixBottom:function(){d.debug("Sticking element to bottom of page"),d.set.offset(),C.css("left",d.cache.element.left).removeClass(p.bound).removeClass(p.top).addClass(p.fixed).addClass(p.bottom),h.onStick.call(z)},unbind:function(){d.debug("Removing absolute position on element"),d.remove.offset(),C.removeClass(p.bound).removeClass(p.top).removeClass(p.bottom)},unfix:function(){d.debug("Removing fixed position on element"),d.remove.offset(),C.removeClass(p.fixed).removeClass(p.top).removeClass(p.bottom),h.onUnstick.call(z)},reset:function(){d.debug("Reseting elements position"),d.unbind(),d.unfix(),d.resetCSS()},resetCSS:function(){C.css({top:"",bottom:"",width:"",height:""}),y.css({height:""})},setting:function(t,o){if(e.isPlainObject(t))e.extend(!0,h,t);else{if(o===n)return h[t];h[t]=o}},internal:function(t,o){if(e.isPlainObject(t))e.extend(!0,d,t);else{if(o===n)return d[t];d[t]=o}},debug:function(){h.debug&&(h.performance?d.performance.log(arguments):(d.debug=Function.prototype.bind.call(console.info,console,h.name+":"),d.debug.apply(console,arguments)))},verbose:function(){h.verbose&&h.debug&&(h.performance?d.performance.log(arguments):(d.verbose=Function.prototype.bind.call(console.info,console,h.name+":"),d.verbose.apply(console,arguments)))},error:function(){d.error=Function.prototype.bind.call(console.error,console,h.name+":"),d.error.apply(console,arguments)},performance:{log:function(e){var t,o,n;h.performance&&(t=(new Date).getTime(),n=c||t,o=t-n,c=t,a.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:z,"Execution Time":o})),clearTimeout(d.performance.timer),d.performance.timer=setTimeout(d.performance.display,0)},display:function(){var t=h.name+":",o=0;c=!1,clearTimeout(d.performance.timer),e.each(a,function(e,t){o+=t["Execution Time"]}),t+=" "+o+"ms",r&&(t+=" '"+r+"'"),(console.group!==n||console.table!==n)&&a.length>0&&(console.groupCollapsed(t),console.table?console.table(a):e.each(a,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),a=[]}},invoke:function(t,o,s){var r,c,a,l=T;return o=o||m,s=z||s,"string"==typeof t&&l!==n&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(o,i){var s=o!=r?i+t[o+1].charAt(0).toUpperCase()+t[o+1].slice(1):t;if(e.isPlainObject(l[s])&&o!=r)l=l[s];else{if(l[s]!==n)return c=l[s],!1;if(!e.isPlainObject(l[i])||o==r)return l[i]!==n?(c=l[i],!1):!1;l=l[i]}})),e.isFunction(c)?a=c.apply(s,o):c!==n&&(a=c),e.isArray(i)?i.push(a):i!==n?i=[i,a]:a!==n&&(i=a),c}},f?(T===n&&d.initialize(),d.invoke(l)):(T!==n&&d.destroy(),d.initialize())}),i!==n?i:this},e.fn.sticky.settings={name:"Sticky",namespace:"sticky",debug:!1,verbose:!1,performance:!1,pushing:!1,context:!1,scrollContext:t,offset:0,bottomOffset:0,observeChanges:!0,onReposition:function(){},onScroll:function(){},onStick:function(){},onUnstick:function(){},onTop:function(){},onBottom:function(){},error:{container:"Sticky element must be inside a relative container",visible:"Element is hidden, you must call refresh after element becomes visible",method:"The method you called is not defined.",invalidContext:"Context specified does not exist",elementSize:"Sticky element is larger than its container, cannot create sticky."},className:{bound:"bound",fixed:"fixed",supported:"native",top:"top",bottom:"bottom"}}}(jQuery,window,document);
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/*
|
2
|
+
* # Semantic UI - 1.8.1
|
3
|
+
* https://github.com/Semantic-Org/Semantic-UI
|
4
|
+
* http://www.semantic-ui.com/
|
5
|
+
*
|
6
|
+
* Copyright 2014 Contributors
|
7
|
+
* Released under the MIT license
|
8
|
+
* http://opensource.org/licenses/MIT
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
/*******************************
|
15
|
+
UI Tabs
|
16
|
+
*******************************/
|
17
|
+
|
18
|
+
.ui.tab {
|
19
|
+
display: none;
|
20
|
+
}
|
21
|
+
|
22
|
+
|
23
|
+
/*******************************
|
24
|
+
States
|
25
|
+
*******************************/
|
26
|
+
|
27
|
+
|
28
|
+
/*--------------------
|
29
|
+
Active
|
30
|
+
---------------------*/
|
31
|
+
|
32
|
+
.ui.tab.active,
|
33
|
+
.ui.tab.open {
|
34
|
+
display: block;
|
35
|
+
}
|
36
|
+
|
37
|
+
/*--------------------
|
38
|
+
Loading
|
39
|
+
---------------------*/
|
40
|
+
|
41
|
+
.ui.tab.loading {
|
42
|
+
position: relative;
|
43
|
+
overflow: hidden;
|
44
|
+
display: block;
|
45
|
+
min-height: 250px;
|
46
|
+
}
|
47
|
+
.ui.tab.loading * {
|
48
|
+
position: relative !important;
|
49
|
+
left: -10000px !important;
|
50
|
+
}
|
51
|
+
.ui.tab.loading:before,
|
52
|
+
.ui.tab.loading.segment:before {
|
53
|
+
position: absolute;
|
54
|
+
content: '';
|
55
|
+
top: 100px;
|
56
|
+
left: 50%;
|
57
|
+
margin: -1.25em 0em 0em -1.25em;
|
58
|
+
width: 2.5em;
|
59
|
+
height: 2.5em;
|
60
|
+
border-radius: 500rem;
|
61
|
+
border: 0.2em solid rgba(0, 0, 0, 0.1);
|
62
|
+
}
|
63
|
+
.ui.tab.loading:after,
|
64
|
+
.ui.tab.loading.segment:after {
|
65
|
+
position: absolute;
|
66
|
+
content: '';
|
67
|
+
top: 100px;
|
68
|
+
left: 50%;
|
69
|
+
margin: -1.25em 0em 0em -1.25em;
|
70
|
+
width: 2.5em;
|
71
|
+
height: 2.5em;
|
72
|
+
-webkit-animation: button-spin 0.6s linear;
|
73
|
+
animation: button-spin 0.6s linear;
|
74
|
+
-webkit-animation-iteration-count: infinite;
|
75
|
+
animation-iteration-count: infinite;
|
76
|
+
border-radius: 500rem;
|
77
|
+
border-color: #aaaaaa transparent transparent;
|
78
|
+
border-style: solid;
|
79
|
+
border-width: 0.2em;
|
80
|
+
box-shadow: 0px 0px 0px 1px transparent;
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
/*******************************
|
85
|
+
Tab Overrides
|
86
|
+
*******************************/
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
/*******************************
|
91
|
+
User Overrides
|
92
|
+
*******************************/
|
93
|
+
|
@@ -0,0 +1,787 @@
|
|
1
|
+
/*
|
2
|
+
* # Semantic - Tab
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
|
+
*
|
5
|
+
*
|
6
|
+
* Copyright 2014 Contributors
|
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.tab = function(parameters) {
|
17
|
+
|
18
|
+
var
|
19
|
+
// use window context if none specified
|
20
|
+
$allModules = $.isFunction(this)
|
21
|
+
? $(window)
|
22
|
+
: $(this),
|
23
|
+
|
24
|
+
settings = ( $.isPlainObject(parameters) )
|
25
|
+
? $.extend(true, {}, $.fn.tab.settings, parameters)
|
26
|
+
: $.extend({}, $.fn.tab.settings),
|
27
|
+
|
28
|
+
moduleSelector = $allModules.selector || '',
|
29
|
+
time = new Date().getTime(),
|
30
|
+
performance = [],
|
31
|
+
|
32
|
+
query = arguments[0],
|
33
|
+
methodInvoked = (typeof query == 'string'),
|
34
|
+
queryArguments = [].slice.call(arguments, 1),
|
35
|
+
|
36
|
+
module,
|
37
|
+
returnedValue
|
38
|
+
;
|
39
|
+
|
40
|
+
$allModules
|
41
|
+
.each(function() {
|
42
|
+
var
|
43
|
+
|
44
|
+
className = settings.className,
|
45
|
+
metadata = settings.metadata,
|
46
|
+
selector = settings.selector,
|
47
|
+
error = settings.error,
|
48
|
+
|
49
|
+
eventNamespace = '.' + settings.namespace,
|
50
|
+
moduleNamespace = 'module-' + settings.namespace,
|
51
|
+
|
52
|
+
$module = $(this),
|
53
|
+
|
54
|
+
cache = {},
|
55
|
+
firstLoad = true,
|
56
|
+
recursionDepth = 0,
|
57
|
+
|
58
|
+
$context,
|
59
|
+
$tabs,
|
60
|
+
activeTabPath,
|
61
|
+
parameterArray,
|
62
|
+
historyEvent,
|
63
|
+
|
64
|
+
element = this,
|
65
|
+
instance = $module.data(moduleNamespace)
|
66
|
+
;
|
67
|
+
|
68
|
+
module = {
|
69
|
+
|
70
|
+
initialize: function() {
|
71
|
+
module.debug('Initializing tab menu item', $module);
|
72
|
+
|
73
|
+
module.determineTabs();
|
74
|
+
module.debug('Determining tabs', settings.context, $tabs);
|
75
|
+
|
76
|
+
// set up automatic routing
|
77
|
+
if(settings.auto) {
|
78
|
+
module.verbose('Setting up automatic tab retrieval from server');
|
79
|
+
settings.apiSettings = {
|
80
|
+
url: settings.path + '/{$tab}'
|
81
|
+
};
|
82
|
+
}
|
83
|
+
|
84
|
+
// attach events if navigation wasn't set to window
|
85
|
+
if( !$.isWindow( element ) ) {
|
86
|
+
module.debug('Attaching tab activation events to element', $module);
|
87
|
+
$module
|
88
|
+
.on('click' + eventNamespace, module.event.click)
|
89
|
+
;
|
90
|
+
}
|
91
|
+
module.instantiate();
|
92
|
+
},
|
93
|
+
|
94
|
+
determineTabs: function() {
|
95
|
+
var
|
96
|
+
$reference
|
97
|
+
;
|
98
|
+
|
99
|
+
// determine tab context
|
100
|
+
if(settings.context === 'parent') {
|
101
|
+
if($module.closest(selector.ui).length > 0) {
|
102
|
+
$reference = $module.closest(selector.ui);
|
103
|
+
module.verbose('Using closest UI element for determining parent', $reference);
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
$reference = $module;
|
107
|
+
}
|
108
|
+
$context = $reference.parent();
|
109
|
+
module.verbose('Determined parent element for creating context', $context);
|
110
|
+
}
|
111
|
+
else if(settings.context) {
|
112
|
+
$context = $(settings.context);
|
113
|
+
module.verbose('Using selector for tab context', settings.context, $context);
|
114
|
+
}
|
115
|
+
else {
|
116
|
+
$context = $('body');
|
117
|
+
}
|
118
|
+
|
119
|
+
// find tabs
|
120
|
+
if(settings.childrenOnly) {
|
121
|
+
$tabs = $context.children(selector.tabs);
|
122
|
+
module.debug('Searching tab context children for tabs', $context, $tabs);
|
123
|
+
}
|
124
|
+
else {
|
125
|
+
$tabs = $context.find(selector.tabs);
|
126
|
+
module.debug('Searching tab context for tabs', $context, $tabs);
|
127
|
+
}
|
128
|
+
},
|
129
|
+
|
130
|
+
initializeHistory: function() {
|
131
|
+
if(settings.history) {
|
132
|
+
module.debug('Initializing page state');
|
133
|
+
if( $.address === undefined ) {
|
134
|
+
module.error(error.state);
|
135
|
+
return false;
|
136
|
+
}
|
137
|
+
else {
|
138
|
+
if(settings.historyType == 'state') {
|
139
|
+
module.debug('Using HTML5 to manage state');
|
140
|
+
if(settings.path !== false) {
|
141
|
+
$.address
|
142
|
+
.history(true)
|
143
|
+
.state(settings.path)
|
144
|
+
;
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
module.error(error.path);
|
148
|
+
return false;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
$.address
|
152
|
+
.bind('change', module.event.history.change)
|
153
|
+
;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
},
|
157
|
+
|
158
|
+
instantiate: function () {
|
159
|
+
module.verbose('Storing instance of module', module);
|
160
|
+
instance = module;
|
161
|
+
$module
|
162
|
+
.data(moduleNamespace, module)
|
163
|
+
;
|
164
|
+
},
|
165
|
+
|
166
|
+
destroy: function() {
|
167
|
+
module.debug('Destroying tabs', $module);
|
168
|
+
$module
|
169
|
+
.removeData(moduleNamespace)
|
170
|
+
.off(eventNamespace)
|
171
|
+
;
|
172
|
+
},
|
173
|
+
|
174
|
+
event: {
|
175
|
+
click: function(event) {
|
176
|
+
var
|
177
|
+
tabPath = $(this).data(metadata.tab)
|
178
|
+
;
|
179
|
+
if(tabPath !== undefined) {
|
180
|
+
if(settings.history) {
|
181
|
+
module.verbose('Updating page state', event);
|
182
|
+
$.address.value(tabPath);
|
183
|
+
}
|
184
|
+
else {
|
185
|
+
module.verbose('Changing tab', event);
|
186
|
+
module.changeTab(tabPath);
|
187
|
+
}
|
188
|
+
event.preventDefault();
|
189
|
+
}
|
190
|
+
else {
|
191
|
+
module.debug('No tab specified');
|
192
|
+
}
|
193
|
+
},
|
194
|
+
history: {
|
195
|
+
change: function(event) {
|
196
|
+
var
|
197
|
+
tabPath = event.pathNames.join('/') || module.get.initialPath(),
|
198
|
+
pageTitle = settings.templates.determineTitle(tabPath) || false
|
199
|
+
;
|
200
|
+
module.performance.display();
|
201
|
+
module.debug('History change event', tabPath, event);
|
202
|
+
historyEvent = event;
|
203
|
+
if(tabPath !== undefined) {
|
204
|
+
module.changeTab(tabPath);
|
205
|
+
}
|
206
|
+
if(pageTitle) {
|
207
|
+
$.address.title(pageTitle);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
},
|
212
|
+
|
213
|
+
refresh: function() {
|
214
|
+
if(activeTabPath) {
|
215
|
+
module.debug('Refreshing tab', activeTabPath);
|
216
|
+
module.changeTab(activeTabPath);
|
217
|
+
}
|
218
|
+
},
|
219
|
+
|
220
|
+
cache: {
|
221
|
+
|
222
|
+
read: function(cacheKey) {
|
223
|
+
return (cacheKey !== undefined)
|
224
|
+
? cache[cacheKey]
|
225
|
+
: false
|
226
|
+
;
|
227
|
+
},
|
228
|
+
add: function(cacheKey, content) {
|
229
|
+
cacheKey = cacheKey || activeTabPath;
|
230
|
+
module.debug('Adding cached content for', cacheKey);
|
231
|
+
cache[cacheKey] = content;
|
232
|
+
},
|
233
|
+
remove: function(cacheKey) {
|
234
|
+
cacheKey = cacheKey || activeTabPath;
|
235
|
+
module.debug('Removing cached content for', cacheKey);
|
236
|
+
delete cache[cacheKey];
|
237
|
+
}
|
238
|
+
},
|
239
|
+
|
240
|
+
set: {
|
241
|
+
state: function(state) {
|
242
|
+
$.address.value(state);
|
243
|
+
}
|
244
|
+
},
|
245
|
+
|
246
|
+
changeTab: function(tabPath) {
|
247
|
+
var
|
248
|
+
pushStateAvailable = (window.history && window.history.pushState),
|
249
|
+
shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
|
250
|
+
remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
|
251
|
+
// only get default path if not remote content
|
252
|
+
pathArray = (remoteContent && !shouldIgnoreLoad)
|
253
|
+
? module.utilities.pathToArray(tabPath)
|
254
|
+
: module.get.defaultPathArray(tabPath)
|
255
|
+
;
|
256
|
+
tabPath = module.utilities.arrayToPath(pathArray);
|
257
|
+
$.each(pathArray, function(index, tab) {
|
258
|
+
var
|
259
|
+
currentPathArray = pathArray.slice(0, index + 1),
|
260
|
+
currentPath = module.utilities.arrayToPath(currentPathArray),
|
261
|
+
|
262
|
+
isTab = module.is.tab(currentPath),
|
263
|
+
isLastIndex = (index + 1 == pathArray.length),
|
264
|
+
|
265
|
+
$tab = module.get.tabElement(currentPath),
|
266
|
+
$anchor,
|
267
|
+
nextPathArray,
|
268
|
+
nextPath,
|
269
|
+
isLastTab
|
270
|
+
;
|
271
|
+
module.verbose('Looking for tab', tab);
|
272
|
+
if(isTab) {
|
273
|
+
module.verbose('Tab was found', tab);
|
274
|
+
|
275
|
+
// scope up
|
276
|
+
activeTabPath = currentPath;
|
277
|
+
parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
|
278
|
+
|
279
|
+
if(isLastIndex) {
|
280
|
+
isLastTab = true;
|
281
|
+
}
|
282
|
+
else {
|
283
|
+
nextPathArray = pathArray.slice(0, index + 2);
|
284
|
+
nextPath = module.utilities.arrayToPath(nextPathArray);
|
285
|
+
isLastTab = ( !module.is.tab(nextPath) );
|
286
|
+
if(isLastTab) {
|
287
|
+
module.verbose('Tab parameters found', nextPathArray);
|
288
|
+
}
|
289
|
+
}
|
290
|
+
if(isLastTab && remoteContent) {
|
291
|
+
if(!shouldIgnoreLoad) {
|
292
|
+
module.activate.navigation(currentPath);
|
293
|
+
module.content.fetch(currentPath, tabPath);
|
294
|
+
}
|
295
|
+
else {
|
296
|
+
module.debug('Ignoring remote content on first tab load', currentPath);
|
297
|
+
firstLoad = false;
|
298
|
+
module.cache.add(tabPath, $tab.html());
|
299
|
+
module.activate.all(currentPath);
|
300
|
+
settings.onTabInit.call($tab, currentPath, parameterArray, historyEvent);
|
301
|
+
settings.onTabLoad.call($tab, currentPath, parameterArray, historyEvent);
|
302
|
+
}
|
303
|
+
return false;
|
304
|
+
}
|
305
|
+
else {
|
306
|
+
module.debug('Opened local tab', currentPath);
|
307
|
+
module.activate.all(currentPath);
|
308
|
+
if( !module.cache.read(currentPath) ) {
|
309
|
+
module.cache.add(currentPath, true);
|
310
|
+
module.debug('First time tab loaded calling tab init');
|
311
|
+
settings.onTabInit.call($tab, currentPath, parameterArray, historyEvent);
|
312
|
+
}
|
313
|
+
settings.onTabLoad.call($tab, currentPath, parameterArray, historyEvent);
|
314
|
+
}
|
315
|
+
}
|
316
|
+
else if(tabPath.search('/') == -1 && tabPath !== '') {
|
317
|
+
// look for in page anchor
|
318
|
+
$anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]'),
|
319
|
+
currentPath = $anchor.closest('[data-tab]').data('tab');
|
320
|
+
$tab = module.get.tabElement(currentPath);
|
321
|
+
// if anchor exists use parent tab
|
322
|
+
if($anchor && $anchor.length > 0 && currentPath) {
|
323
|
+
module.debug('No tab found, but deep anchor link present, opening parent tab');
|
324
|
+
module.activate.all(currentPath);
|
325
|
+
if( !module.cache.read(currentPath) ) {
|
326
|
+
module.cache.add(currentPath, true);
|
327
|
+
module.debug('First time tab loaded calling tab init');
|
328
|
+
settings.onTabInit.call($tab, currentPath, parameterArray, historyEvent);
|
329
|
+
}
|
330
|
+
return false;
|
331
|
+
}
|
332
|
+
}
|
333
|
+
else {
|
334
|
+
module.error(error.missingTab, $module, $context, currentPath);
|
335
|
+
return false;
|
336
|
+
}
|
337
|
+
});
|
338
|
+
},
|
339
|
+
|
340
|
+
content: {
|
341
|
+
|
342
|
+
fetch: function(tabPath, fullTabPath) {
|
343
|
+
var
|
344
|
+
$tab = module.get.tabElement(tabPath),
|
345
|
+
apiSettings = {
|
346
|
+
dataType : 'html',
|
347
|
+
stateContext : $tab,
|
348
|
+
onSuccess : function(response) {
|
349
|
+
module.cache.add(fullTabPath, response);
|
350
|
+
module.content.update(tabPath, response);
|
351
|
+
if(tabPath == activeTabPath) {
|
352
|
+
module.debug('Content loaded', tabPath);
|
353
|
+
module.activate.tab(tabPath);
|
354
|
+
}
|
355
|
+
else {
|
356
|
+
module.debug('Content loaded in background', tabPath);
|
357
|
+
}
|
358
|
+
settings.onTabInit.call($tab, tabPath, parameterArray, historyEvent);
|
359
|
+
settings.onTabLoad.call($tab, tabPath, parameterArray, historyEvent);
|
360
|
+
},
|
361
|
+
urlData: { tab: fullTabPath }
|
362
|
+
},
|
363
|
+
request = $tab.data(metadata.promise) || false,
|
364
|
+
existingRequest = ( request && request.state() === 'pending' ),
|
365
|
+
requestSettings,
|
366
|
+
cachedContent
|
367
|
+
;
|
368
|
+
|
369
|
+
fullTabPath = fullTabPath || tabPath;
|
370
|
+
cachedContent = module.cache.read(fullTabPath);
|
371
|
+
|
372
|
+
if(settings.cache && cachedContent) {
|
373
|
+
module.debug('Showing existing content', fullTabPath);
|
374
|
+
module.content.update(tabPath, cachedContent);
|
375
|
+
module.activate.tab(tabPath);
|
376
|
+
settings.onTabLoad.call($tab, tabPath, parameterArray, historyEvent);
|
377
|
+
}
|
378
|
+
else if(existingRequest) {
|
379
|
+
module.debug('Content is already loading', fullTabPath);
|
380
|
+
$tab
|
381
|
+
.addClass(className.loading)
|
382
|
+
;
|
383
|
+
}
|
384
|
+
else if($.api !== undefined) {
|
385
|
+
requestSettings = $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings);
|
386
|
+
module.debug('Retrieving remote content', fullTabPath, requestSettings);
|
387
|
+
$.api( requestSettings );
|
388
|
+
}
|
389
|
+
else {
|
390
|
+
module.error(error.api);
|
391
|
+
}
|
392
|
+
},
|
393
|
+
|
394
|
+
update: function(tabPath, html) {
|
395
|
+
module.debug('Updating html for', tabPath);
|
396
|
+
var
|
397
|
+
$tab = module.get.tabElement(tabPath)
|
398
|
+
;
|
399
|
+
$tab
|
400
|
+
.html(html)
|
401
|
+
;
|
402
|
+
}
|
403
|
+
},
|
404
|
+
|
405
|
+
activate: {
|
406
|
+
all: function(tabPath) {
|
407
|
+
module.activate.tab(tabPath);
|
408
|
+
module.activate.navigation(tabPath);
|
409
|
+
},
|
410
|
+
tab: function(tabPath) {
|
411
|
+
var
|
412
|
+
$tab = module.get.tabElement(tabPath)
|
413
|
+
;
|
414
|
+
module.verbose('Showing tab content for', $tab);
|
415
|
+
$tab
|
416
|
+
.addClass(className.active)
|
417
|
+
.siblings($tabs)
|
418
|
+
.removeClass(className.active + ' ' + className.loading)
|
419
|
+
;
|
420
|
+
},
|
421
|
+
navigation: function(tabPath) {
|
422
|
+
var
|
423
|
+
$navigation = module.get.navElement(tabPath)
|
424
|
+
;
|
425
|
+
module.verbose('Activating tab navigation for', $navigation, tabPath);
|
426
|
+
$navigation
|
427
|
+
.addClass(className.active)
|
428
|
+
.siblings($allModules)
|
429
|
+
.removeClass(className.active + ' ' + className.loading)
|
430
|
+
;
|
431
|
+
}
|
432
|
+
},
|
433
|
+
|
434
|
+
deactivate: {
|
435
|
+
all: function() {
|
436
|
+
module.deactivate.navigation();
|
437
|
+
module.deactivate.tabs();
|
438
|
+
},
|
439
|
+
navigation: function() {
|
440
|
+
$allModules
|
441
|
+
.removeClass(className.active)
|
442
|
+
;
|
443
|
+
},
|
444
|
+
tabs: function() {
|
445
|
+
$tabs
|
446
|
+
.removeClass(className.active + ' ' + className.loading)
|
447
|
+
;
|
448
|
+
}
|
449
|
+
},
|
450
|
+
|
451
|
+
is: {
|
452
|
+
tab: function(tabName) {
|
453
|
+
return (tabName !== undefined)
|
454
|
+
? ( module.get.tabElement(tabName).length > 0 )
|
455
|
+
: false
|
456
|
+
;
|
457
|
+
}
|
458
|
+
},
|
459
|
+
|
460
|
+
get: {
|
461
|
+
initialPath: function() {
|
462
|
+
return $allModules.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
|
463
|
+
},
|
464
|
+
path: function() {
|
465
|
+
return $.address.value();
|
466
|
+
},
|
467
|
+
// adds default tabs to tab path
|
468
|
+
defaultPathArray: function(tabPath) {
|
469
|
+
return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
|
470
|
+
},
|
471
|
+
defaultPath: function(tabPath) {
|
472
|
+
var
|
473
|
+
$defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + tabPath + '/"]').eq(0),
|
474
|
+
defaultTab = $defaultNav.data(metadata.tab) || false
|
475
|
+
;
|
476
|
+
if( defaultTab ) {
|
477
|
+
module.debug('Found default tab', defaultTab);
|
478
|
+
if(recursionDepth < settings.maxDepth) {
|
479
|
+
recursionDepth++;
|
480
|
+
return module.get.defaultPath(defaultTab);
|
481
|
+
}
|
482
|
+
module.error(error.recursion);
|
483
|
+
}
|
484
|
+
else {
|
485
|
+
module.debug('No default tabs found for', tabPath, $tabs);
|
486
|
+
}
|
487
|
+
recursionDepth = 0;
|
488
|
+
return tabPath;
|
489
|
+
},
|
490
|
+
navElement: function(tabPath) {
|
491
|
+
tabPath = tabPath || activeTabPath;
|
492
|
+
return $allModules.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
|
493
|
+
},
|
494
|
+
tabElement: function(tabPath) {
|
495
|
+
var
|
496
|
+
$fullPathTab,
|
497
|
+
$simplePathTab,
|
498
|
+
tabPathArray,
|
499
|
+
lastTab
|
500
|
+
;
|
501
|
+
tabPath = tabPath || activeTabPath;
|
502
|
+
tabPathArray = module.utilities.pathToArray(tabPath);
|
503
|
+
lastTab = module.utilities.last(tabPathArray);
|
504
|
+
$fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
|
505
|
+
$simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
|
506
|
+
return ($fullPathTab.length > 0)
|
507
|
+
? $fullPathTab
|
508
|
+
: $simplePathTab
|
509
|
+
;
|
510
|
+
},
|
511
|
+
tab: function() {
|
512
|
+
return activeTabPath;
|
513
|
+
}
|
514
|
+
},
|
515
|
+
|
516
|
+
utilities: {
|
517
|
+
filterArray: function(keepArray, removeArray) {
|
518
|
+
return $.grep(keepArray, function(keepValue) {
|
519
|
+
return ( $.inArray(keepValue, removeArray) == -1);
|
520
|
+
});
|
521
|
+
},
|
522
|
+
last: function(array) {
|
523
|
+
return $.isArray(array)
|
524
|
+
? array[ array.length - 1]
|
525
|
+
: false
|
526
|
+
;
|
527
|
+
},
|
528
|
+
pathToArray: function(pathName) {
|
529
|
+
if(pathName === undefined) {
|
530
|
+
pathName = activeTabPath;
|
531
|
+
}
|
532
|
+
return typeof pathName == 'string'
|
533
|
+
? pathName.split('/')
|
534
|
+
: [pathName]
|
535
|
+
;
|
536
|
+
},
|
537
|
+
arrayToPath: function(pathArray) {
|
538
|
+
return $.isArray(pathArray)
|
539
|
+
? pathArray.join('/')
|
540
|
+
: false
|
541
|
+
;
|
542
|
+
}
|
543
|
+
},
|
544
|
+
|
545
|
+
setting: function(name, value) {
|
546
|
+
module.debug('Changing setting', name, value);
|
547
|
+
if( $.isPlainObject(name) ) {
|
548
|
+
$.extend(true, settings, name);
|
549
|
+
}
|
550
|
+
else if(value !== undefined) {
|
551
|
+
settings[name] = value;
|
552
|
+
}
|
553
|
+
else {
|
554
|
+
return settings[name];
|
555
|
+
}
|
556
|
+
},
|
557
|
+
internal: function(name, value) {
|
558
|
+
if( $.isPlainObject(name) ) {
|
559
|
+
$.extend(true, module, name);
|
560
|
+
}
|
561
|
+
else if(value !== undefined) {
|
562
|
+
module[name] = value;
|
563
|
+
}
|
564
|
+
else {
|
565
|
+
return module[name];
|
566
|
+
}
|
567
|
+
},
|
568
|
+
debug: function() {
|
569
|
+
if(settings.debug) {
|
570
|
+
if(settings.performance) {
|
571
|
+
module.performance.log(arguments);
|
572
|
+
}
|
573
|
+
else {
|
574
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
575
|
+
module.debug.apply(console, arguments);
|
576
|
+
}
|
577
|
+
}
|
578
|
+
},
|
579
|
+
verbose: function() {
|
580
|
+
if(settings.verbose && settings.debug) {
|
581
|
+
if(settings.performance) {
|
582
|
+
module.performance.log(arguments);
|
583
|
+
}
|
584
|
+
else {
|
585
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
586
|
+
module.verbose.apply(console, arguments);
|
587
|
+
}
|
588
|
+
}
|
589
|
+
},
|
590
|
+
error: function() {
|
591
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
592
|
+
module.error.apply(console, arguments);
|
593
|
+
},
|
594
|
+
performance: {
|
595
|
+
log: function(message) {
|
596
|
+
var
|
597
|
+
currentTime,
|
598
|
+
executionTime,
|
599
|
+
previousTime
|
600
|
+
;
|
601
|
+
if(settings.performance) {
|
602
|
+
currentTime = new Date().getTime();
|
603
|
+
previousTime = time || currentTime;
|
604
|
+
executionTime = currentTime - previousTime;
|
605
|
+
time = currentTime;
|
606
|
+
performance.push({
|
607
|
+
'Name' : message[0],
|
608
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
609
|
+
'Element' : element,
|
610
|
+
'Execution Time' : executionTime
|
611
|
+
});
|
612
|
+
}
|
613
|
+
clearTimeout(module.performance.timer);
|
614
|
+
module.performance.timer = setTimeout(module.performance.display, 100);
|
615
|
+
},
|
616
|
+
display: function() {
|
617
|
+
var
|
618
|
+
title = settings.name + ':',
|
619
|
+
totalTime = 0
|
620
|
+
;
|
621
|
+
time = false;
|
622
|
+
clearTimeout(module.performance.timer);
|
623
|
+
$.each(performance, function(index, data) {
|
624
|
+
totalTime += data['Execution Time'];
|
625
|
+
});
|
626
|
+
title += ' ' + totalTime + 'ms';
|
627
|
+
if(moduleSelector) {
|
628
|
+
title += ' \'' + moduleSelector + '\'';
|
629
|
+
}
|
630
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
631
|
+
console.groupCollapsed(title);
|
632
|
+
if(console.table) {
|
633
|
+
console.table(performance);
|
634
|
+
}
|
635
|
+
else {
|
636
|
+
$.each(performance, function(index, data) {
|
637
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
638
|
+
});
|
639
|
+
}
|
640
|
+
console.groupEnd();
|
641
|
+
}
|
642
|
+
performance = [];
|
643
|
+
}
|
644
|
+
},
|
645
|
+
invoke: function(query, passedArguments, context) {
|
646
|
+
var
|
647
|
+
object = instance,
|
648
|
+
maxDepth,
|
649
|
+
found,
|
650
|
+
response
|
651
|
+
;
|
652
|
+
passedArguments = passedArguments || queryArguments;
|
653
|
+
context = element || context;
|
654
|
+
if(typeof query == 'string' && object !== undefined) {
|
655
|
+
query = query.split(/[\. ]/);
|
656
|
+
maxDepth = query.length - 1;
|
657
|
+
$.each(query, function(depth, value) {
|
658
|
+
var camelCaseValue = (depth != maxDepth)
|
659
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
660
|
+
: query
|
661
|
+
;
|
662
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
663
|
+
object = object[camelCaseValue];
|
664
|
+
}
|
665
|
+
else if( object[camelCaseValue] !== undefined ) {
|
666
|
+
found = object[camelCaseValue];
|
667
|
+
return false;
|
668
|
+
}
|
669
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
670
|
+
object = object[value];
|
671
|
+
}
|
672
|
+
else if( object[value] !== undefined ) {
|
673
|
+
found = object[value];
|
674
|
+
return false;
|
675
|
+
}
|
676
|
+
else {
|
677
|
+
module.error(error.method, query);
|
678
|
+
return false;
|
679
|
+
}
|
680
|
+
});
|
681
|
+
}
|
682
|
+
if ( $.isFunction( found ) ) {
|
683
|
+
response = found.apply(context, passedArguments);
|
684
|
+
}
|
685
|
+
else if(found !== undefined) {
|
686
|
+
response = found;
|
687
|
+
}
|
688
|
+
if($.isArray(returnedValue)) {
|
689
|
+
returnedValue.push(response);
|
690
|
+
}
|
691
|
+
else if(returnedValue !== undefined) {
|
692
|
+
returnedValue = [returnedValue, response];
|
693
|
+
}
|
694
|
+
else if(response !== undefined) {
|
695
|
+
returnedValue = response;
|
696
|
+
}
|
697
|
+
return found;
|
698
|
+
}
|
699
|
+
};
|
700
|
+
if(methodInvoked) {
|
701
|
+
if(instance === undefined) {
|
702
|
+
module.initialize();
|
703
|
+
}
|
704
|
+
module.invoke(query);
|
705
|
+
}
|
706
|
+
else {
|
707
|
+
if(instance !== undefined) {
|
708
|
+
module.destroy();
|
709
|
+
}
|
710
|
+
module.initialize();
|
711
|
+
}
|
712
|
+
})
|
713
|
+
;
|
714
|
+
if(module && !methodInvoked) {
|
715
|
+
module.initializeHistory();
|
716
|
+
}
|
717
|
+
return (returnedValue !== undefined)
|
718
|
+
? returnedValue
|
719
|
+
: this
|
720
|
+
;
|
721
|
+
|
722
|
+
};
|
723
|
+
|
724
|
+
// shortcut for tabbed content with no defined navigation
|
725
|
+
$.tab = function() {
|
726
|
+
$(window).tab.apply(this, arguments);
|
727
|
+
};
|
728
|
+
|
729
|
+
$.fn.tab.settings = {
|
730
|
+
|
731
|
+
name : 'Tab',
|
732
|
+
namespace : 'tab',
|
733
|
+
|
734
|
+
debug : false,
|
735
|
+
verbose : true,
|
736
|
+
performance : true,
|
737
|
+
|
738
|
+
auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers
|
739
|
+
history : false, // use browser history
|
740
|
+
historyType : 'hash', // #/ or html5 state
|
741
|
+
path : false, // base path of url
|
742
|
+
|
743
|
+
context : false, // specify a context that tabs must appear inside
|
744
|
+
childrenOnly : false, // use only tabs that are children of context
|
745
|
+
maxDepth : 25, // max depth a tab can be nested
|
746
|
+
|
747
|
+
alwaysRefresh : false, // load tab content new every tab click
|
748
|
+
cache : true, // cache the content requests to pull locally
|
749
|
+
ignoreFirstLoad : false, // don't load remote content on first load
|
750
|
+
apiSettings : false, // settings for api call
|
751
|
+
|
752
|
+
onTabInit : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
|
753
|
+
onTabLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load
|
754
|
+
|
755
|
+
templates : {
|
756
|
+
determineTitle: function(tabArray) {} // returns page title for path
|
757
|
+
},
|
758
|
+
|
759
|
+
error: {
|
760
|
+
api : 'You attempted to load content without API module',
|
761
|
+
method : 'The method you called is not defined',
|
762
|
+
missingTab : 'Activated tab cannot be found for this context.',
|
763
|
+
noContent : 'The tab you specified is missing a content url.',
|
764
|
+
path : 'History enabled, but no path was specified',
|
765
|
+
recursion : 'Max recursive depth reached',
|
766
|
+
state : 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>'
|
767
|
+
},
|
768
|
+
|
769
|
+
metadata : {
|
770
|
+
tab : 'tab',
|
771
|
+
loaded : 'loaded',
|
772
|
+
promise: 'promise'
|
773
|
+
},
|
774
|
+
|
775
|
+
className : {
|
776
|
+
loading : 'loading',
|
777
|
+
active : 'active'
|
778
|
+
},
|
779
|
+
|
780
|
+
selector : {
|
781
|
+
tabs : '.ui.tab',
|
782
|
+
ui : '.ui'
|
783
|
+
}
|
784
|
+
|
785
|
+
};
|
786
|
+
|
787
|
+
})( jQuery, window , document );
|