virgo 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/tinymce/manifest.coffee +1 -0
- data/app/assets/javascripts/tinymce/plugins/image_manager/plugin.coffee +234 -0
- data/app/assets/javascripts/virgo/admin/page_modules/edit_form.coffee +4 -0
- data/app/assets/javascripts/virgo/admin/page_modules/edit_subject_form.coffee +29 -0
- data/app/assets/javascripts/virgo/admin/posts/edit_locking.coffee +35 -0
- data/app/assets/javascripts/virgo/admin/posts/form.coffee +183 -0
- data/app/assets/javascripts/virgo/admin/slides/form.coffee +27 -0
- data/app/assets/javascripts/virgo/admin/slideshows/form.coffee +26 -0
- data/app/assets/javascripts/virgo/admin_only.coffee +1 -0
- data/app/assets/javascripts/virgo/application.coffee +51 -0
- data/app/assets/javascripts/virgo/common.coffee +83 -0
- data/app/assets/javascripts/virgo/common/character_counter.coffee +27 -0
- data/app/assets/javascripts/virgo/components/header.coffee +47 -0
- data/app/assets/javascripts/virgo/components/media_modal.coffee +151 -0
- data/app/assets/javascripts/virgo/components/share_bar.coffee +53 -0
- data/app/assets/javascripts/virgo/components/slideshow.coffee +35 -0
- data/app/assets/javascripts/virgo/lib/jquery-ui-multiselect.js +342 -0
- data/app/assets/javascripts/virgo/lib/jquery.browser.js +184 -0
- data/app/assets/javascripts/virgo/lib/jquery.cookie.js +114 -0
- data/app/assets/javascripts/virgo/lib/jquery.pjax.js +932 -0
- data/app/assets/javascripts/virgo/lib/jquery_ext.coffee +0 -0
- data/app/assets/javascripts/virgo/lib/manifest.coffee +5 -0
- data/app/assets/javascripts/virgo/lib/ouibounce.js +194 -0
- data/app/assets/javascripts/virgo/page_modules.coffee +175 -0
- data/app/assets/javascripts/virgo/posts/show.coffee +32 -0
- data/app/assets/stylesheets/tinymce/skin.sass +2 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/content.min.sass +82 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce-small.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce-small.svg +62 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce-small.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce-small.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce.eot +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce.svg +63 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce.ttf +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/fonts/tinymce.woff +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/img/anchor.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/img/loader.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/img/object.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/img/trans.gif +0 -0
- data/app/assets/stylesheets/tinymce/skins/railspress/skin.min.sass +1703 -0
- data/app/assets/stylesheets/virgo/_common.sass +65 -0
- data/app/assets/stylesheets/virgo/admin.sass +301 -0
- data/app/assets/stylesheets/virgo/admin/columns.sass +3 -0
- data/app/assets/stylesheets/virgo/admin/images.sass +14 -0
- data/app/assets/stylesheets/virgo/admin/media_modal.sass +72 -0
- data/app/assets/stylesheets/virgo/admin/post.sass +102 -0
- data/app/assets/stylesheets/virgo/admin/slideshow.sass +35 -0
- data/app/assets/stylesheets/virgo/admin/users.sass +2 -0
- data/app/assets/stylesheets/virgo/admin_only.sass +1 -0
- data/app/assets/stylesheets/virgo/application.sass +605 -0
- data/app/assets/stylesheets/virgo/columns.sass +51 -0
- data/app/assets/stylesheets/virgo/install.sass +15 -0
- data/app/assets/stylesheets/virgo/lib/bootstrap/bootstrap-imports.sass +9 -0
- data/app/assets/stylesheets/virgo/lib/bootstrap/bootstrap-overrides.sass +51 -0
- data/app/assets/stylesheets/virgo/lib/bootstrap/bootstrap-variables.sass +27 -0
- data/app/assets/stylesheets/virgo/lib/jquery-ui-multiselect.css +30 -0
- data/app/assets/stylesheets/virgo/lib/manifest.sass +3 -0
- data/app/assets/stylesheets/virgo/lib/ouibounce.css +222 -0
- data/app/assets/stylesheets/virgo/lib/select2-imports.sass +8 -0
- data/app/assets/stylesheets/virgo/page_modules.sass +54 -0
- data/app/assets/stylesheets/virgo/pages/authors.sass +30 -0
- data/app/assets/stylesheets/virgo/posts.sass +782 -0
- data/app/assets/stylesheets/virgo/search.sass +36 -0
- data/app/assets/stylesheets/virgo/ui.sass +434 -0
- data/app/assets/stylesheets/virgo/users.sass +9 -0
- data/app/controllers/virgo/admin/base_controller.rb +22 -0
- data/app/controllers/virgo/admin/categories_controller.rb +90 -0
- data/app/controllers/virgo/admin/columns_controller.rb +65 -0
- data/app/controllers/virgo/admin/images_controller.rb +89 -0
- data/app/controllers/virgo/admin/media_modal_controller.rb +101 -0
- data/app/controllers/virgo/admin/newsletters_controller.rb +37 -0
- data/app/controllers/virgo/admin/page_modules_controller.rb +62 -0
- data/app/controllers/virgo/admin/pages_controller.rb +6 -0
- data/app/controllers/virgo/admin/posts_controller.rb +173 -0
- data/app/controllers/virgo/admin/sites_controller.rb +31 -0
- data/app/controllers/virgo/admin/slides_controller.rb +71 -0
- data/app/controllers/virgo/admin/slideshows_controller.rb +66 -0
- data/app/controllers/virgo/admin/tags_controller.rb +98 -0
- data/app/controllers/virgo/admin/users/sessions_controller.rb +21 -0
- data/app/controllers/virgo/admin/users_controller.rb +84 -0
- data/app/controllers/virgo/application_controller.rb +151 -0
- data/app/controllers/virgo/categories_controller.rb +20 -0
- data/app/controllers/virgo/columns_controller.rb +24 -0
- data/app/controllers/virgo/images_controller.rb +9 -0
- data/app/controllers/virgo/install_controller.rb +46 -0
- data/app/controllers/virgo/page_modules_controller.rb +23 -0
- data/app/controllers/virgo/pages_controller.rb +29 -0
- data/app/controllers/virgo/posts_controller.rb +101 -0
- data/app/controllers/virgo/search_controller.rb +35 -0
- data/app/controllers/virgo/subscribers_controller.rb +54 -0
- data/app/controllers/virgo/tags_controller.rb +15 -0
- data/app/controllers/virgo/users/confirmations_controller.rb +18 -0
- data/app/controllers/virgo/users/passwords_controller.rb +31 -0
- data/app/controllers/virgo/users/registrations_controller.rb +41 -0
- data/app/controllers/virgo/users/sessions_controller.rb +32 -0
- data/app/controllers/virgo/users_controller.rb +15 -0
- data/app/helpers/virgo/admin/post_helper.rb +54 -0
- data/app/helpers/virgo/admin_helper.rb +15 -0
- data/app/helpers/virgo/application_helper.rb +124 -0
- data/app/helpers/virgo/hooks_helper.rb +30 -0
- data/app/helpers/virgo/page_modules_helper.rb +4 -0
- data/app/helpers/virgo/post_helper.rb +159 -0
- data/app/helpers/virgo/render_helper.rb +33 -0
- data/app/helpers/virgo/search_helper.rb +49 -0
- data/app/helpers/virgo/shortcode_helper.rb +7 -0
- data/app/helpers/virgo/text_helper.rb +12 -0
- data/app/helpers/virgo/video_helper.rb +34 -0
- data/app/models/concerns/virgo/common/slug_history.rb +36 -0
- data/app/models/concerns/virgo/common/uuid.rb +22 -0
- data/app/models/concerns/virgo/post/recommendations.rb +15 -0
- data/app/models/concerns/virgo/post/search.rb +100 -0
- data/app/models/concerns/virgo/user/search.rb +39 -0
- data/app/models/virgo/ability.rb +59 -0
- data/app/models/virgo/category.rb +44 -0
- data/app/models/virgo/column.rb +25 -0
- data/app/models/virgo/form_model.rb +19 -0
- data/app/models/virgo/image.rb +63 -0
- data/app/models/virgo/page_module.rb +42 -0
- data/app/models/virgo/page_module_post.rb +8 -0
- data/app/models/virgo/post.rb +391 -0
- data/app/models/virgo/post_category.rb +8 -0
- data/app/models/virgo/post_search.rb +7 -0
- data/app/models/virgo/post_tag.rb +10 -0
- data/app/models/virgo/site.rb +36 -0
- data/app/models/virgo/slide.rb +23 -0
- data/app/models/virgo/slideshow.rb +37 -0
- data/app/models/virgo/slug_history.rb +5 -0
- data/app/models/virgo/subscriber.rb +5 -0
- data/app/models/virgo/tag.rb +34 -0
- data/app/models/virgo/user.rb +145 -0
- data/app/uploaders/virgo/application_uploader.rb +11 -0
- data/app/uploaders/virgo/avatar_uploader.rb +21 -0
- data/app/uploaders/virgo/featured_image_uploader.rb +28 -0
- data/app/uploaders/virgo/image_uploader.rb +40 -0
- data/app/uploaders/virgo/slide_uploader.rb +19 -0
- data/app/views/layouts/virgo/admin.haml +16 -0
- data/app/views/layouts/virgo/admin/site_settings.haml +14 -0
- data/app/views/layouts/virgo/application.haml +63 -0
- data/app/views/layouts/virgo/errors.haml +42 -0
- data/app/views/layouts/virgo/main.haml +5 -0
- data/app/views/layouts/virgo/posts.haml +10 -0
- data/app/views/virgo/admin/categories/_form.haml +19 -0
- data/app/views/virgo/admin/categories/edit.haml +7 -0
- data/app/views/virgo/admin/categories/index.haml +38 -0
- data/app/views/virgo/admin/categories/modal_form.haml +11 -0
- data/app/views/virgo/admin/categories/new.haml +7 -0
- data/app/views/virgo/admin/categories/success_modal.haml +14 -0
- data/app/views/virgo/admin/columns/_form.haml +30 -0
- data/app/views/virgo/admin/columns/edit.haml +1 -0
- data/app/views/virgo/admin/columns/index.haml +30 -0
- data/app/views/virgo/admin/columns/new.haml +1 -0
- data/app/views/virgo/admin/images/_form.haml +46 -0
- data/app/views/virgo/admin/images/edit.haml +1 -0
- data/app/views/virgo/admin/images/index.haml +32 -0
- data/app/views/virgo/admin/images/new.haml +1 -0
- data/app/views/virgo/admin/media_modal/_image_settings.haml +17 -0
- data/app/views/virgo/admin/media_modal/_library_panel.haml +26 -0
- data/app/views/virgo/admin/media_modal/_upload_panel.haml +21 -0
- data/app/views/virgo/admin/media_modal/_upload_success.haml +7 -0
- data/app/views/virgo/admin/media_modal/index.haml +19 -0
- data/app/views/virgo/admin/newsletters/changelog.haml +25 -0
- data/app/views/virgo/admin/newsletters/edit.haml +6 -0
- data/app/views/virgo/admin/page_modules/edit.haml +33 -0
- data/app/views/virgo/admin/page_modules/edit_subject.haml +43 -0
- data/app/views/virgo/admin/pages/help.haml +114 -0
- data/app/views/virgo/admin/posts/_author_dropdown.haml +1 -0
- data/app/views/virgo/admin/posts/_categories_form.haml +7 -0
- data/app/views/virgo/admin/posts/_category.haml +22 -0
- data/app/views/virgo/admin/posts/_form.haml +201 -0
- data/app/views/virgo/admin/posts/_revisions.haml +40 -0
- data/app/views/virgo/admin/posts/edit.haml +9 -0
- data/app/views/virgo/admin/posts/index.haml +59 -0
- data/app/views/virgo/admin/posts/new.haml +1 -0
- data/app/views/virgo/admin/posts/revision_detail.haml +28 -0
- data/app/views/virgo/admin/posts/revisions.haml +3 -0
- data/app/views/virgo/admin/sites/edit.haml +12 -0
- data/app/views/virgo/admin/slides/_form.haml +41 -0
- data/app/views/virgo/admin/slides/edit.haml +1 -0
- data/app/views/virgo/admin/slides/new.haml +1 -0
- data/app/views/virgo/admin/slideshows/_form.haml +49 -0
- data/app/views/virgo/admin/slideshows/edit.haml +1 -0
- data/app/views/virgo/admin/slideshows/index.haml +43 -0
- data/app/views/virgo/admin/slideshows/new.haml +1 -0
- data/app/views/virgo/admin/tags/_form.haml +16 -0
- data/app/views/virgo/admin/tags/edit.haml +7 -0
- data/app/views/virgo/admin/tags/index.haml +33 -0
- data/app/views/virgo/admin/tags/modal_form.haml +12 -0
- data/app/views/virgo/admin/tags/new.haml +7 -0
- data/app/views/virgo/admin/tags/success_modal.haml +14 -0
- data/app/views/virgo/admin/users/_form.haml +62 -0
- data/app/views/virgo/admin/users/edit.haml +1 -0
- data/app/views/virgo/admin/users/index.haml +34 -0
- data/app/views/virgo/admin/users/new.haml +1 -0
- data/app/views/virgo/application/sitemap.xml.builder +0 -0
- data/app/views/virgo/authors/_profile_long.haml +13 -0
- data/app/views/virgo/authors/_profile_short.haml +10 -0
- data/app/views/virgo/categories/show.haml +24 -0
- data/app/views/virgo/columns/index.haml +19 -0
- data/app/views/virgo/columns/show.haml +18 -0
- data/app/views/virgo/common/_admin_navbar.haml +100 -0
- data/app/views/virgo/common/_alerts.haml +40 -0
- data/app/views/virgo/common/_analytics.html.erb +1 -0
- data/app/views/virgo/common/_base_errors.haml +8 -0
- data/app/views/virgo/common/_category_heading.haml +26 -0
- data/app/views/virgo/common/_disqus.html.erb +24 -0
- data/app/views/virgo/common/_disqus_comment_count.html.erb +12 -0
- data/app/views/virgo/common/_fb_api.html.erb +30 -0
- data/app/views/virgo/common/_fonts.html.erb +1 -0
- data/app/views/virgo/common/_footer.haml +13 -0
- data/app/views/virgo/common/_footer_javascript.html.erb +0 -0
- data/app/views/virgo/common/_header_analytics.html.erb +9 -0
- data/app/views/virgo/common/_list_signup.haml +20 -0
- data/app/views/virgo/common/_ouibounce_modal.haml +26 -0
- data/app/views/virgo/common/_public_nav.haml +58 -0
- data/app/views/virgo/common/_search_form.haml +8 -0
- data/app/views/virgo/common/_share_bar.haml +45 -0
- data/app/views/virgo/common/_user_vars.haml +2 -0
- data/app/views/virgo/errors/404.haml +10 -0
- data/app/views/virgo/errors/500.haml +10 -0
- data/app/views/virgo/images/_shortcode.haml +4 -0
- data/app/views/virgo/install/index.haml +58 -0
- data/app/views/virgo/install/success.haml +12 -0
- data/app/views/virgo/page_modules/_latest_posts.haml +29 -0
- data/app/views/virgo/page_modules/_popular_posts.haml +51 -0
- data/app/views/virgo/pages/authors.haml +8 -0
- data/app/views/virgo/pages/home.haml +0 -0
- data/app/views/virgo/pages/show.haml +6 -0
- data/app/views/virgo/posts/_author_info.haml +16 -0
- data/app/views/virgo/posts/_post_full.haml +63 -0
- data/app/views/virgo/posts/_post_short.haml +30 -0
- data/app/views/virgo/posts/_post_thumb_box.haml +13 -0
- data/app/views/virgo/posts/_recommendations.haml +12 -0
- data/app/views/virgo/posts/_sidebar_thumb.haml +4 -0
- data/app/views/virgo/posts/index.haml +22 -0
- data/app/views/virgo/posts/latest.haml +16 -0
- data/app/views/virgo/posts/more.haml +10 -0
- data/app/views/virgo/posts/rss.xml.builder +17 -0
- data/app/views/virgo/posts/show.haml +17 -0
- data/app/views/virgo/search/_form.haml +5 -0
- data/app/views/virgo/search/_item.haml +22 -0
- data/app/views/virgo/search/index.haml +11 -0
- data/app/views/virgo/search/new.haml +4 -0
- data/app/views/virgo/shortcode_templates/blockquote.haml +9 -0
- data/app/views/virgo/shortcode_templates/h1.haml +1 -0
- data/app/views/virgo/shortcode_templates/h2.haml +1 -0
- data/app/views/virgo/shortcode_templates/h3.haml +1 -0
- data/app/views/virgo/shortcode_templates/h4.haml +1 -0
- data/app/views/virgo/shortcode_templates/image.haml +17 -0
- data/app/views/virgo/shortcode_templates/pullquote.haml +3 -0
- data/app/views/virgo/shortcode_templates/slideshow.haml +35 -0
- data/app/views/virgo/shortcode_templates/tweet.haml +3 -0
- data/app/views/virgo/shortcode_templates/video.haml +8 -0
- data/app/views/virgo/subscribers/_success_modal.haml +13 -0
- data/app/views/virgo/subscribers/modal.haml +15 -0
- data/app/views/virgo/tags/show.haml +16 -0
- data/app/views/virgo/users/confirmations/new.html.haml +10 -0
- data/app/views/virgo/users/devise_mailer/confirmation_instructions.html.erb +7 -0
- data/app/views/virgo/users/devise_mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/virgo/users/devise_mailer/unlock_instructions.html.haml +5 -0
- data/app/views/virgo/users/passwords/edit.html.haml +14 -0
- data/app/views/virgo/users/passwords/new.html.haml +14 -0
- data/app/views/virgo/users/registrations/edit.html.haml +30 -0
- data/app/views/virgo/users/registrations/new.html.haml +13 -0
- data/app/views/virgo/users/sessions/new.html.haml +12 -0
- data/app/views/virgo/users/shared/_links.haml +26 -0
- data/app/views/virgo/users/show.haml +11 -0
- data/app/views/virgo/users/unlocks/new.html.haml +9 -0
- data/config/initializers/action_mailer.rb +7 -0
- data/config/initializers/active_record.rb +72 -0
- data/config/initializers/active_record_symbolize.rb +18 -0
- data/config/initializers/assets.rb +17 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/carrierwave.rb +36 -0
- data/config/initializers/cookies_serializer.rb +3 -0
- data/config/initializers/devise.rb +257 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/hash.rb +5 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +4 -0
- data/config/initializers/nil_class.rb +13 -0
- data/config/initializers/non_digest_assets.rb +3 -0
- data/config/initializers/paper_trail.rb +30 -0
- data/config/initializers/schema_plus.rb +5 -0
- data/config/initializers/session_store.rb +3 -0
- data/config/initializers/shortcode.rb +12 -0
- data/config/initializers/simple_form.rb +170 -0
- data/config/initializers/simple_form_bootstrap.rb +136 -0
- data/config/initializers/string.rb +5 -0
- data/config/initializers/time_formatting.rb +23 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/devise.en.yml +60 -0
- data/config/routes.rb +96 -0
- data/config/schedule.rb +3 -0
- data/db/migrate/20150729174510_create_virgo_schema.rb +225 -0
- data/lib/generators/virgo/install/install_generator.rb +16 -0
- data/lib/generators/virgo/views/views_generator.rb +22 -0
- data/lib/tasks/virgo_tasks.rake +7 -0
- data/lib/virgo.rb +4 -0
- data/lib/virgo/development_mail_interceptor.rb +6 -0
- data/lib/virgo/email_validator.rb +6 -0
- data/lib/virgo/engine.rb +73 -0
- data/lib/virgo/reduce_validator.rb +6 -0
- data/lib/virgo/upload_helpers.rb +89 -0
- data/lib/virgo/version.rb +3 -0
- data/lib/virgo/view_help.rb +3 -0
- metadata +1051 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class Slideshow
|
|
2
|
+
constructor: ->
|
|
3
|
+
self = @
|
|
4
|
+
|
|
5
|
+
$('.js-expand-slideshow-box').on 'click', (e) ->
|
|
6
|
+
$wrap = $(this).parents(".slideshow-box-wrapper").first()
|
|
7
|
+
$('body').prepend($wrap)
|
|
8
|
+
$wrap.addClass('expanded')
|
|
9
|
+
$wrap.css("height", "#{$(document).height()}px")
|
|
10
|
+
target_top_offset = $(document).scrollTop() + 25
|
|
11
|
+
$wrap.find(".slideshow-box").css("top", "#{target_top_offset}px")
|
|
12
|
+
|
|
13
|
+
$('.js-collapse-slideshow-box').on 'click', (e) ->
|
|
14
|
+
$wrap = $(this).parents(".slideshow-box-wrapper").first()
|
|
15
|
+
$slideshow = $wrap.find(".carousel")
|
|
16
|
+
$anchor = $(".slideshow-box-anchor[data-target='##{$slideshow.attr('id')}']")
|
|
17
|
+
$wrap.css("height", "auto")
|
|
18
|
+
$anchor.append($wrap)
|
|
19
|
+
$wrap.removeClass('expanded')
|
|
20
|
+
$wrap.find(".slideshow-box").css("top", "auto")
|
|
21
|
+
|
|
22
|
+
$('.slideshow-box .carousel').on 'slide.bs.carousel', (e) ->
|
|
23
|
+
$slide_info_box = $(this).find('.slide-info')
|
|
24
|
+
slide_idx = $(e.relatedTarget).index() + 1
|
|
25
|
+
|
|
26
|
+
if slide_idx > $(this).find(".item").length
|
|
27
|
+
slide_idx = 1
|
|
28
|
+
|
|
29
|
+
$slide_info_box.find(".active-slide-num").html(slide_idx)
|
|
30
|
+
|
|
31
|
+
$ ->
|
|
32
|
+
unless window.slideshows_initialized
|
|
33
|
+
if $('.slideshow-box').length
|
|
34
|
+
new Slideshow if $('.slideshow-box').length
|
|
35
|
+
window.slideshows_initialized = true
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* jQuery UI Multiselect
|
|
3
|
+
*
|
|
4
|
+
* Authors:
|
|
5
|
+
* Michael Aufreiter (quasipartikel.at)
|
|
6
|
+
* Yanick Rochon (yanick.rochon[at]gmail[dot]com)
|
|
7
|
+
*
|
|
8
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
|
9
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
|
10
|
+
*
|
|
11
|
+
* http://www.quasipartikel.at/multiselect/
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* Depends:
|
|
15
|
+
* ui.core.js
|
|
16
|
+
* ui.sortable.js
|
|
17
|
+
*
|
|
18
|
+
* Optional:
|
|
19
|
+
* localization (http://plugins.jquery.com/project/localisation)
|
|
20
|
+
* scrollTo (http://plugins.jquery.com/project/ScrollTo)
|
|
21
|
+
*
|
|
22
|
+
* Todo:
|
|
23
|
+
* Make batch actions faster
|
|
24
|
+
* Implement dynamic insertion through remote calls
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
(function($) {
|
|
29
|
+
|
|
30
|
+
$.widget("ui.multiselect", {
|
|
31
|
+
options: {
|
|
32
|
+
sortable: true,
|
|
33
|
+
searchable: true,
|
|
34
|
+
doubleClickable: true,
|
|
35
|
+
animated: 'fast',
|
|
36
|
+
show: 'slideDown',
|
|
37
|
+
hide: 'slideUp',
|
|
38
|
+
dividerLocation: 0.6,
|
|
39
|
+
availableFirst: false,
|
|
40
|
+
nodeComparator: function(node1,node2) {
|
|
41
|
+
var text1 = node1.text(),
|
|
42
|
+
text2 = node2.text();
|
|
43
|
+
return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
_create: function() {
|
|
47
|
+
this.element.hide();
|
|
48
|
+
this.id = this.element.attr("id");
|
|
49
|
+
this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
|
|
50
|
+
this.count = 0; // number of currently selected options
|
|
51
|
+
this.selectedContainer = $('<div class="selected"></div>').appendTo(this.container);
|
|
52
|
+
this.availableContainer = $('<div class="available"></div>')[this.options.availableFirst?'prependTo': 'appendTo'](this.container);
|
|
53
|
+
this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a></div>').appendTo(this.selectedContainer);
|
|
54
|
+
this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a></div>').appendTo(this.availableContainer);
|
|
55
|
+
this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
|
|
56
|
+
this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
|
|
57
|
+
|
|
58
|
+
var that = this;
|
|
59
|
+
|
|
60
|
+
// set dimensions
|
|
61
|
+
this.container.width(this.element.width()+1);
|
|
62
|
+
this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));
|
|
63
|
+
this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));
|
|
64
|
+
|
|
65
|
+
// fix list height to match <option> depending on their individual header's heights
|
|
66
|
+
this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
|
|
67
|
+
this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
|
|
68
|
+
|
|
69
|
+
if ( !this.options.animated ) {
|
|
70
|
+
this.options.show = 'show';
|
|
71
|
+
this.options.hide = 'hide';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// init lists
|
|
75
|
+
this._populateLists(this.element.find('option'));
|
|
76
|
+
|
|
77
|
+
// make selection sortable
|
|
78
|
+
if (this.options.sortable) {
|
|
79
|
+
this.selectedList.sortable({
|
|
80
|
+
placeholder: 'ui-state-highlight',
|
|
81
|
+
axis: 'y',
|
|
82
|
+
update: function(event, ui) {
|
|
83
|
+
// apply the new sort order to the original selectbox
|
|
84
|
+
that.selectedList.find('li').each(function() {
|
|
85
|
+
if ($(this).data('optionLink'))
|
|
86
|
+
$(this).data('optionLink').remove().appendTo(that.element);
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
receive: function(event, ui) {
|
|
90
|
+
ui.item.data('optionLink').attr('selected', true);
|
|
91
|
+
// increment count
|
|
92
|
+
that.count += 1;
|
|
93
|
+
that._updateCount();
|
|
94
|
+
// workaround, because there's no way to reference
|
|
95
|
+
// the new element, see http://dev.jqueryui.com/ticket/4303
|
|
96
|
+
that.selectedList.children('.ui-draggable').each(function() {
|
|
97
|
+
$(this).removeClass('ui-draggable');
|
|
98
|
+
$(this).data('optionLink', ui.item.data('optionLink'));
|
|
99
|
+
$(this).data('idx', ui.item.data('idx'));
|
|
100
|
+
that._applyItemState($(this), true);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// workaround according to http://dev.jqueryui.com/ticket/4088
|
|
104
|
+
setTimeout(function() { ui.item.remove(); }, 1);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// set up livesearch
|
|
110
|
+
if (this.options.searchable) {
|
|
111
|
+
this._registerSearchEvents(this.availableContainer.find('input.search'));
|
|
112
|
+
} else {
|
|
113
|
+
$('.search').hide();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// batch actions
|
|
117
|
+
this.container.find(".remove-all").click(function() {
|
|
118
|
+
that._populateLists(that.element.find('option').removeAttr('selected'));
|
|
119
|
+
return false;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
this.container.find(".add-all").click(function() {
|
|
123
|
+
var options = that.element.find('option').not(":selected");
|
|
124
|
+
if (that.availableList.children('li:hidden').length > 1) {
|
|
125
|
+
that.availableList.children('li').each(function(i) {
|
|
126
|
+
if ($(this).is(":visible")) $(options[i-1]).attr('selected', 'selected');
|
|
127
|
+
});
|
|
128
|
+
} else {
|
|
129
|
+
options.attr('selected', 'selected');
|
|
130
|
+
}
|
|
131
|
+
that._populateLists(that.element.find('option'));
|
|
132
|
+
return false;
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
destroy: function() {
|
|
136
|
+
this.element.show();
|
|
137
|
+
this.container.remove();
|
|
138
|
+
|
|
139
|
+
$.Widget.prototype.destroy.apply(this, arguments);
|
|
140
|
+
},
|
|
141
|
+
_populateLists: function(options) {
|
|
142
|
+
this.selectedList.children('.ui-element').remove();
|
|
143
|
+
this.availableList.children('.ui-element').remove();
|
|
144
|
+
this.count = 0;
|
|
145
|
+
|
|
146
|
+
var that = this;
|
|
147
|
+
var items = $(options.map(function(i) {
|
|
148
|
+
var item = that._getOptionNode(this).appendTo(this.selected ? that.selectedList : that.availableList).show();
|
|
149
|
+
|
|
150
|
+
if (this.selected) that.count += 1;
|
|
151
|
+
that._applyItemState(item, this.selected);
|
|
152
|
+
item.data('idx', i);
|
|
153
|
+
return item[0];
|
|
154
|
+
}));
|
|
155
|
+
|
|
156
|
+
// update count
|
|
157
|
+
this._updateCount();
|
|
158
|
+
that._filter.apply(this.availableContainer.find('input.search'), [that.availableList]);
|
|
159
|
+
},
|
|
160
|
+
_updateCount: function() {
|
|
161
|
+
this.element.trigger('change');
|
|
162
|
+
this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
|
|
163
|
+
},
|
|
164
|
+
_getOptionNode: function(option) {
|
|
165
|
+
option = $(option);
|
|
166
|
+
var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
|
|
167
|
+
node.data('optionLink', option);
|
|
168
|
+
return node;
|
|
169
|
+
},
|
|
170
|
+
// clones an item with associated data
|
|
171
|
+
// didn't find a smarter away around this
|
|
172
|
+
_cloneWithData: function(clonee) {
|
|
173
|
+
var clone = clonee.clone(false,false);
|
|
174
|
+
clone.data('optionLink', clonee.data('optionLink'));
|
|
175
|
+
clone.data('idx', clonee.data('idx'));
|
|
176
|
+
return clone;
|
|
177
|
+
},
|
|
178
|
+
_setSelected: function(item, selected) {
|
|
179
|
+
item.data('optionLink').attr('selected', selected);
|
|
180
|
+
|
|
181
|
+
if (selected) {
|
|
182
|
+
var selectedItem = this._cloneWithData(item);
|
|
183
|
+
item[this.options.hide](this.options.animated, function() { $(this).remove(); });
|
|
184
|
+
selectedItem.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);
|
|
185
|
+
|
|
186
|
+
this._applyItemState(selectedItem, true);
|
|
187
|
+
return selectedItem;
|
|
188
|
+
} else {
|
|
189
|
+
|
|
190
|
+
// look for successor based on initial option index
|
|
191
|
+
var items = this.availableList.find('li'), comparator = this.options.nodeComparator;
|
|
192
|
+
var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i]));
|
|
193
|
+
|
|
194
|
+
// TODO: test needed for dynamic list populating
|
|
195
|
+
if ( direction ) {
|
|
196
|
+
while (i>=0 && i<items.length) {
|
|
197
|
+
direction > 0 ? i++ : i--;
|
|
198
|
+
if ( direction != comparator(item, $(items[i])) ) {
|
|
199
|
+
// going up, go back one item down, otherwise leave as is
|
|
200
|
+
succ = items[direction > 0 ? i : i+1];
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
} else {
|
|
205
|
+
succ = items[i];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
var availableItem = this._cloneWithData(item);
|
|
209
|
+
succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo(this.availableList);
|
|
210
|
+
item[this.options.hide](this.options.animated, function() { $(this).remove(); });
|
|
211
|
+
availableItem.hide()[this.options.show](this.options.animated);
|
|
212
|
+
|
|
213
|
+
this._applyItemState(availableItem, false);
|
|
214
|
+
return availableItem;
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
_applyItemState: function(item, selected) {
|
|
218
|
+
if (selected) {
|
|
219
|
+
if (this.options.sortable)
|
|
220
|
+
item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon');
|
|
221
|
+
else
|
|
222
|
+
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
|
|
223
|
+
item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
|
|
224
|
+
this._registerRemoveEvents(item.find('a.action'));
|
|
225
|
+
|
|
226
|
+
} else {
|
|
227
|
+
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
|
|
228
|
+
item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
|
|
229
|
+
this._registerAddEvents(item.find('a.action'));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this._registerDoubleClickEvents(item);
|
|
233
|
+
this._registerHoverEvents(item);
|
|
234
|
+
},
|
|
235
|
+
// taken from John Resig's liveUpdate script
|
|
236
|
+
_filter: function(list) {
|
|
237
|
+
var input = $(this);
|
|
238
|
+
var rows = list.children('li'),
|
|
239
|
+
cache = rows.map(function(){
|
|
240
|
+
|
|
241
|
+
return $(this).text().toLowerCase();
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
var term = $.trim(input.val().toLowerCase()), scores = [];
|
|
245
|
+
|
|
246
|
+
if (!term) {
|
|
247
|
+
rows.show();
|
|
248
|
+
} else {
|
|
249
|
+
rows.hide();
|
|
250
|
+
|
|
251
|
+
cache.each(function(i) {
|
|
252
|
+
if (this.indexOf(term)>-1) { scores.push(i); }
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
$.each(scores, function() {
|
|
256
|
+
$(rows[this]).show();
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
_registerDoubleClickEvents: function(elements) {
|
|
261
|
+
if (!this.options.doubleClickable) return;
|
|
262
|
+
elements.dblclick(function(ev) {
|
|
263
|
+
if ($(ev.target).closest('.action').length === 0) {
|
|
264
|
+
// This may be triggered with rapid clicks on actions as well. In that
|
|
265
|
+
// case don't trigger an additional click.
|
|
266
|
+
elements.find('a.action').click();
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
},
|
|
270
|
+
_registerHoverEvents: function(elements) {
|
|
271
|
+
elements.removeClass('ui-state-hover');
|
|
272
|
+
elements.mouseover(function() {
|
|
273
|
+
$(this).addClass('ui-state-hover');
|
|
274
|
+
});
|
|
275
|
+
elements.mouseout(function() {
|
|
276
|
+
$(this).removeClass('ui-state-hover');
|
|
277
|
+
});
|
|
278
|
+
},
|
|
279
|
+
_registerAddEvents: function(elements) {
|
|
280
|
+
var that = this;
|
|
281
|
+
elements.click(function() {
|
|
282
|
+
var item = that._setSelected($(this).parent(), true);
|
|
283
|
+
that.count += 1;
|
|
284
|
+
that._updateCount();
|
|
285
|
+
return false;
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// make draggable
|
|
289
|
+
if (this.options.sortable) {
|
|
290
|
+
elements.each(function() {
|
|
291
|
+
$(this).parent().draggable({
|
|
292
|
+
connectToSortable: that.selectedList,
|
|
293
|
+
helper: function() {
|
|
294
|
+
var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50);
|
|
295
|
+
selectedItem.width($(this).width());
|
|
296
|
+
return selectedItem;
|
|
297
|
+
},
|
|
298
|
+
appendTo: that.container,
|
|
299
|
+
containment: that.container,
|
|
300
|
+
revert: 'invalid'
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
_registerRemoveEvents: function(elements) {
|
|
306
|
+
var that = this;
|
|
307
|
+
elements.click(function() {
|
|
308
|
+
that._setSelected($(this).parent(), false);
|
|
309
|
+
that.count -= 1;
|
|
310
|
+
that._updateCount();
|
|
311
|
+
return false;
|
|
312
|
+
});
|
|
313
|
+
},
|
|
314
|
+
_registerSearchEvents: function(input) {
|
|
315
|
+
var that = this;
|
|
316
|
+
|
|
317
|
+
input.focus(function() {
|
|
318
|
+
$(this).addClass('ui-state-active');
|
|
319
|
+
})
|
|
320
|
+
.blur(function() {
|
|
321
|
+
$(this).removeClass('ui-state-active');
|
|
322
|
+
})
|
|
323
|
+
.keypress(function(e) {
|
|
324
|
+
if (e.keyCode == 13)
|
|
325
|
+
return false;
|
|
326
|
+
})
|
|
327
|
+
.keyup(function() {
|
|
328
|
+
that._filter.apply(this, [that.availableList]);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
$.extend($.ui.multiselect, {
|
|
334
|
+
locale: {
|
|
335
|
+
addAll:'Add all',
|
|
336
|
+
removeAll:'Remove all',
|
|
337
|
+
itemsCount:'items selected'
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
})(jQuery);
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* jQuery Browser Plugin 0.0.7
|
|
3
|
+
* https://github.com/gabceb/jquery-browser-plugin
|
|
4
|
+
*
|
|
5
|
+
* Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
|
|
6
|
+
* http://jquery.org/license
|
|
7
|
+
*
|
|
8
|
+
* Modifications Copyright 2015 Gabriel Cebrian
|
|
9
|
+
* https://github.com/gabceb
|
|
10
|
+
*
|
|
11
|
+
* Released under the MIT license
|
|
12
|
+
*
|
|
13
|
+
* Date: 19-05-2015
|
|
14
|
+
*/
|
|
15
|
+
/*global window: false */
|
|
16
|
+
|
|
17
|
+
(function (factory) {
|
|
18
|
+
if (typeof define === 'function' && define.amd) {
|
|
19
|
+
// AMD. Register as an anonymous module.
|
|
20
|
+
define(['jquery'], function($) {
|
|
21
|
+
factory($);
|
|
22
|
+
});
|
|
23
|
+
} else if (typeof module === 'object' && typeof module.exports === 'object') {
|
|
24
|
+
// Node-like environment
|
|
25
|
+
module.exports = factory(require('jquery'));
|
|
26
|
+
} else {
|
|
27
|
+
// Browser globals
|
|
28
|
+
factory(window.jQuery);
|
|
29
|
+
}
|
|
30
|
+
}(function(jQuery) {
|
|
31
|
+
"use strict";
|
|
32
|
+
|
|
33
|
+
function uaMatch( ua ) {
|
|
34
|
+
// If an UA is not provided, default to the current browser UA.
|
|
35
|
+
if ( ua === undefined ) {
|
|
36
|
+
ua = window.navigator.userAgent;
|
|
37
|
+
}
|
|
38
|
+
ua = ua.toLowerCase();
|
|
39
|
+
|
|
40
|
+
var match = /(edge)\/([\w.]+)/.exec( ua ) ||
|
|
41
|
+
/(opr)[\/]([\w.]+)/.exec( ua ) ||
|
|
42
|
+
/(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
|
43
|
+
/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
|
|
44
|
+
/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
|
|
45
|
+
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
|
46
|
+
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
|
47
|
+
/(msie) ([\w.]+)/.exec( ua ) ||
|
|
48
|
+
ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) ||
|
|
49
|
+
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
|
50
|
+
[];
|
|
51
|
+
|
|
52
|
+
var virgo_match = /(ipad)/.exec( ua ) ||
|
|
53
|
+
/(ipod)/.exec( ua ) ||
|
|
54
|
+
/(iphone)/.exec( ua ) ||
|
|
55
|
+
/(kindle)/.exec( ua ) ||
|
|
56
|
+
/(silk)/.exec( ua ) ||
|
|
57
|
+
/(android)/.exec( ua ) ||
|
|
58
|
+
/(windows phone)/.exec( ua ) ||
|
|
59
|
+
/(win)/.exec( ua ) ||
|
|
60
|
+
/(mac)/.exec( ua ) ||
|
|
61
|
+
/(linux)/.exec( ua ) ||
|
|
62
|
+
/(cros)/.exec( ua ) ||
|
|
63
|
+
/(playbook)/.exec( ua ) ||
|
|
64
|
+
/(bb)/.exec( ua ) ||
|
|
65
|
+
/(blackberry)/.exec( ua ) ||
|
|
66
|
+
[];
|
|
67
|
+
|
|
68
|
+
var browser = {},
|
|
69
|
+
matched = {
|
|
70
|
+
browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "",
|
|
71
|
+
version: match[ 2 ] || match[ 4 ] || "0",
|
|
72
|
+
versionNumber: match[ 4 ] || match[ 2 ] || "0",
|
|
73
|
+
virgo: virgo_match[ 0 ] || ""
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
if ( matched.browser ) {
|
|
77
|
+
browser[ matched.browser ] = true;
|
|
78
|
+
browser.version = matched.version;
|
|
79
|
+
browser.versionNumber = parseInt(matched.versionNumber, 10);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if ( matched.virgo ) {
|
|
83
|
+
browser[ matched.virgo ] = true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// These are all considered mobile virgos, meaning they run a mobile browser
|
|
87
|
+
if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
|
|
88
|
+
browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) {
|
|
89
|
+
browser.mobile = true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// These are all considered desktop virgos, meaning they run a desktop browser
|
|
93
|
+
if ( browser.cros || browser.mac || browser.linux || browser.win ) {
|
|
94
|
+
browser.desktop = true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Chrome, Opera 15+ and Safari are webkit based browsers
|
|
98
|
+
if ( browser.chrome || browser.opr || browser.safari ) {
|
|
99
|
+
browser.webkit = true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// IE11 has a new token so we will assign it msie to avoid breaking changes
|
|
103
|
+
// IE12 disguises itself as Chrome, but adds a new Edge token.
|
|
104
|
+
if ( browser.rv || browser.edge ) {
|
|
105
|
+
var ie = "msie";
|
|
106
|
+
|
|
107
|
+
matched.browser = ie;
|
|
108
|
+
browser[ie] = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Blackberry browsers are marked as Safari on BlackBerry
|
|
112
|
+
if ( browser.safari && browser.blackberry ) {
|
|
113
|
+
var blackberry = "blackberry";
|
|
114
|
+
|
|
115
|
+
matched.browser = blackberry;
|
|
116
|
+
browser[blackberry] = true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Playbook browsers are marked as Safari on Playbook
|
|
120
|
+
if ( browser.safari && browser.playbook ) {
|
|
121
|
+
var playbook = "playbook";
|
|
122
|
+
|
|
123
|
+
matched.browser = playbook;
|
|
124
|
+
browser[playbook] = true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// BB10 is a newer OS version of BlackBerry
|
|
128
|
+
if ( browser.bb ) {
|
|
129
|
+
var bb = "blackberry";
|
|
130
|
+
|
|
131
|
+
matched.browser = bb;
|
|
132
|
+
browser[bb] = true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Opera 15+ are identified as opr
|
|
136
|
+
if ( browser.opr ) {
|
|
137
|
+
var opera = "opera";
|
|
138
|
+
|
|
139
|
+
matched.browser = opera;
|
|
140
|
+
browser[opera] = true;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Stock Android browsers are marked as Safari on Android.
|
|
144
|
+
if ( browser.safari && browser.android ) {
|
|
145
|
+
var android = "android";
|
|
146
|
+
|
|
147
|
+
matched.browser = android;
|
|
148
|
+
browser[android] = true;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Kindle browsers are marked as Safari on Kindle
|
|
152
|
+
if ( browser.safari && browser.kindle ) {
|
|
153
|
+
var kindle = "kindle";
|
|
154
|
+
|
|
155
|
+
matched.browser = kindle;
|
|
156
|
+
browser[kindle] = true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Kindle Silk browsers are marked as Safari on Kindle
|
|
160
|
+
if ( browser.safari && browser.silk ) {
|
|
161
|
+
var silk = "silk";
|
|
162
|
+
|
|
163
|
+
matched.browser = silk;
|
|
164
|
+
browser[silk] = true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Assign the name and virgo variable
|
|
168
|
+
browser.name = matched.browser;
|
|
169
|
+
browser.virgo = matched.virgo;
|
|
170
|
+
return browser;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Run the matching process, also assign the function to the returned object
|
|
174
|
+
// for manual, jQuery-free use if desired
|
|
175
|
+
window.jQBrowser = uaMatch( window.navigator.userAgent );
|
|
176
|
+
window.jQBrowser.uaMatch = uaMatch;
|
|
177
|
+
|
|
178
|
+
// Only assign to jQuery.browser if jQuery is loaded
|
|
179
|
+
if ( jQuery ) {
|
|
180
|
+
jQuery.browser = window.jQBrowser;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return window.jQBrowser;
|
|
184
|
+
}));
|