vkhater-social_stream-base 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/.rspec +1 -0
- data/.yardopts +2 -0
- data/Gemfile +10 -0
- data/LICENSE +20 -0
- data/README.rdoc +68 -0
- data/Rakefile +35 -0
- data/app/assets/images/HTML5.png +0 -0
- data/app/assets/images/HTML5_Semantics.png +0 -0
- data/app/assets/images/HTML5_Styling.png +0 -0
- data/app/assets/images/Jcrop.gif +0 -0
- data/app/assets/images/arrow-end.png +0 -0
- data/app/assets/images/arrow-start.png +0 -0
- data/app/assets/images/arrow.png +0 -0
- data/app/assets/images/big-logo.png +0 -0
- data/app/assets/images/btn/1-facebook.png +0 -0
- data/app/assets/images/btn/_notes/btn_certificates.png.mno +4 -0
- data/app/assets/images/btn/activity.png +0 -0
- data/app/assets/images/btn/arrowBlue.png +0 -0
- data/app/assets/images/btn/arrow_session_change.png +0 -0
- data/app/assets/images/btn/arrows-ffffff.png +0 -0
- data/app/assets/images/btn/bold.png +0 -0
- data/app/assets/images/btn/btn_account.png +0 -0
- data/app/assets/images/btn/btn_activities.png +0 -0
- data/app/assets/images/btn/btn_bookmark.png +0 -0
- data/app/assets/images/btn/btn_browse.png +0 -0
- data/app/assets/images/btn/btn_check.png +0 -0
- data/app/assets/images/btn/btn_close.png +0 -0
- data/app/assets/images/btn/btn_comment.png +0 -0
- data/app/assets/images/btn/btn_comment_add.png +0 -0
- data/app/assets/images/btn/btn_config.png +0 -0
- data/app/assets/images/btn/btn_date.png +0 -0
- data/app/assets/images/btn/btn_delete.png +0 -0
- data/app/assets/images/btn/btn_down.png +0 -0
- data/app/assets/images/btn/btn_edit.png +0 -0
- data/app/assets/images/btn/btn_exit.png +0 -0
- data/app/assets/images/btn/btn_find.png +0 -0
- data/app/assets/images/btn/btn_follow.png +0 -0
- data/app/assets/images/btn/btn_foward.png +0 -0
- data/app/assets/images/btn/btn_friend.png +0 -0
- data/app/assets/images/btn/btn_gallery.png +0 -0
- data/app/assets/images/btn/btn_group.png +0 -0
- data/app/assets/images/btn/btn_help.png +0 -0
- data/app/assets/images/btn/btn_home.png +0 -0
- data/app/assets/images/btn/btn_inbox.png +0 -0
- data/app/assets/images/btn/btn_info.png +0 -0
- data/app/assets/images/btn/btn_invitation.png +0 -0
- data/app/assets/images/btn/btn_like.png +0 -0
- data/app/assets/images/btn/btn_next.png +0 -0
- data/app/assets/images/btn/btn_notification.png +0 -0
- data/app/assets/images/btn/btn_notification_delete.png +0 -0
- data/app/assets/images/btn/btn_notification_read.png +0 -0
- data/app/assets/images/btn/btn_notifications.png +0 -0
- data/app/assets/images/btn/btn_page_link.png +0 -0
- data/app/assets/images/btn/btn_partner.png +0 -0
- data/app/assets/images/btn/btn_photo.png +0 -0
- data/app/assets/images/btn/btn_play.png +0 -0
- data/app/assets/images/btn/btn_printer.png +0 -0
- data/app/assets/images/btn/btn_profile.png +0 -0
- data/app/assets/images/btn/btn_rank.png +0 -0
- data/app/assets/images/btn/btn_read.png +0 -0
- data/app/assets/images/btn/btn_security.png +0 -0
- data/app/assets/images/btn/btn_send.png +0 -0
- data/app/assets/images/btn/btn_spam.png +0 -0
- data/app/assets/images/btn/btn_star.png +0 -0
- data/app/assets/images/btn/btn_tag.png +0 -0
- data/app/assets/images/btn/btn_write.png +0 -0
- data/app/assets/images/btn/close.png +0 -0
- data/app/assets/images/btn/date.png +0 -0
- data/app/assets/images/btn/delete.png +0 -0
- data/app/assets/images/btn/download.png +0 -0
- data/app/assets/images/btn/edit.png +0 -0
- data/app/assets/images/btn/error.png +0 -0
- data/app/assets/images/btn/facebook.png +0 -0
- data/app/assets/images/btn/flag.png +0 -0
- data/app/assets/images/btn/group_left.png +0 -0
- data/app/assets/images/btn/group_right.png +0 -0
- data/app/assets/images/btn/header_notifications.png +0 -0
- data/app/assets/images/btn/index_71.png +0 -0
- data/app/assets/images/btn/info.png +0 -0
- data/app/assets/images/btn/italic.png +0 -0
- data/app/assets/images/btn/like.png +0 -0
- data/app/assets/images/btn/linkedin.png +0 -0
- data/app/assets/images/btn/message_conversation.png +0 -0
- data/app/assets/images/btn/message_inbox.png +0 -0
- data/app/assets/images/btn/message_new.png +0 -0
- data/app/assets/images/btn/message_sentbox.png +0 -0
- data/app/assets/images/btn/message_trash.png +0 -0
- data/app/assets/images/btn/new.png +0 -0
- data/app/assets/images/btn/next_conference.png +0 -0
- data/app/assets/images/btn/next_space.png +0 -0
- data/app/assets/images/btn/nolike.png +0 -0
- data/app/assets/images/btn/notifications.png +0 -0
- data/app/assets/images/btn/pixel.png +0 -0
- data/app/assets/images/btn/point_blue.png +0 -0
- data/app/assets/images/btn/point_gray.png +0 -0
- data/app/assets/images/btn/post.png +0 -0
- data/app/assets/images/btn/search.png +0 -0
- data/app/assets/images/btn/search_icon.png +0 -0
- data/app/assets/images/btn/shadow.png +0 -0
- data/app/assets/images/btn/share.png +0 -0
- data/app/assets/images/btn/subtime.png +0 -0
- data/app/assets/images/btn/success.png +0 -0
- data/app/assets/images/btn/tag_cloud.png +0 -0
- data/app/assets/images/btn/twitter-follow-icon.png +0 -0
- data/app/assets/images/btn/twitter.png +0 -0
- data/app/assets/images/btn/uno.png +0 -0
- data/app/assets/images/btn/viewer.png +0 -0
- data/app/assets/images/btn/warning.png +0 -0
- data/app/assets/images/cancel.png +0 -0
- data/app/assets/images/cleditor/buttons.gif +0 -0
- data/app/assets/images/cleditor/toolbar.gif +0 -0
- data/app/assets/images/frontpage/collaborate.png +0 -0
- data/app/assets/images/frontpage/comments.png +0 -0
- data/app/assets/images/frontpage/green_sq.png +0 -0
- data/app/assets/images/frontpage/meet.png +0 -0
- data/app/assets/images/frontpage/people.png +0 -0
- data/app/assets/images/frontpage/purple_sq.png +0 -0
- data/app/assets/images/frontpage/right_comments.gif +0 -0
- data/app/assets/images/frontpage/right_conference.png +0 -0
- data/app/assets/images/frontpage/right_organizers.gif +0 -0
- data/app/assets/images/frontpage/right_people.gif +0 -0
- data/app/assets/images/frontpage/right_social.gif +0 -0
- data/app/assets/images/frontpage/right_tags.gif +0 -0
- data/app/assets/images/frontpage/right_webcam.gif +0 -0
- data/app/assets/images/frontpage/share.png +0 -0
- data/app/assets/images/frontpage/tags.png +0 -0
- data/app/assets/images/frontpage/yellow_sq.png +0 -0
- data/app/assets/images/header-logo.png +0 -0
- data/app/assets/images/html5-badge-h-css3-semantics.png +0 -0
- data/app/assets/images/icon_checkbox.png +0 -0
- data/app/assets/images/icons/favicon.ico +0 -0
- data/app/assets/images/left.png +0 -0
- data/app/assets/images/lightbox-blank.gif +0 -0
- data/app/assets/images/lightbox-btn-close.gif +0 -0
- data/app/assets/images/lightbox-btn-next.gif +0 -0
- data/app/assets/images/lightbox-btn-prev.gif +0 -0
- data/app/assets/images/lightbox-ico-loading.gif +0 -0
- data/app/assets/images/loader.gif +0 -0
- data/app/assets/images/loading.gif +0 -0
- data/app/assets/images/logo.png +0 -0
- data/app/assets/images/logos/actor/group.png +0 -0
- data/app/assets/images/logos/actor/remote_subject.png +0 -0
- data/app/assets/images/logos/actor/remote_user.png +0 -0
- data/app/assets/images/logos/actor/user.png +0 -0
- data/app/assets/images/logos/contact/group.png +0 -0
- data/app/assets/images/logos/contact/user.png +0 -0
- data/app/assets/images/logos/original/group.png +0 -0
- data/app/assets/images/logos/original/user.png +0 -0
- data/app/assets/images/logos/profile/group.png +0 -0
- data/app/assets/images/logos/profile/user.png +0 -0
- data/app/assets/images/logos/representation/group.png +0 -0
- data/app/assets/images/logos/representation/user.png +0 -0
- data/app/assets/images/mini-loading.gif +0 -0
- data/app/assets/images/right.png +0 -0
- data/app/assets/images/tipsy.gif +0 -0
- data/app/assets/javascripts/activities.js.erb +250 -0
- data/app/assets/javascripts/activities_security_chosen-modified.jquery.js +767 -0
- data/app/assets/javascripts/cheesecake.js +6 -0
- data/app/assets/javascripts/contacts.js +4 -0
- data/app/assets/javascripts/conversations.js +3 -0
- data/app/assets/javascripts/groups.js +5 -0
- data/app/assets/javascripts/invitations.js +8 -0
- data/app/assets/javascripts/jquery.ad-gallery.js +850 -0
- data/app/assets/javascripts/jquery.ad-gallery.pack.js +10 -0
- data/app/assets/javascripts/layouts.js +21 -0
- data/app/assets/javascripts/messages.js +4 -0
- data/app/assets/javascripts/posts.js +1 -0
- data/app/assets/javascripts/preloader.js +6 -0
- data/app/assets/javascripts/profiles.js +9 -0
- data/app/assets/javascripts/relation_customs.js +32 -0
- data/app/assets/javascripts/search.js.erb +3 -0
- data/app/assets/javascripts/settings.js +14 -0
- data/app/assets/javascripts/social_stream-base.js +11 -0
- data/app/assets/javascripts/ties.js +67 -0
- data/app/assets/javascripts/toolbar.js +1 -0
- data/app/assets/javascripts/users.js +2 -0
- data/app/assets/stylesheets/0_devise_sign.css +28 -0
- data/app/assets/stylesheets/_colors.scss +25 -0
- data/app/assets/stylesheets/activities.css.scss +88 -0
- data/app/assets/stylesheets/base.css.scss +257 -0
- data/app/assets/stylesheets/cheesecake.css.scss +55 -0
- data/app/assets/stylesheets/contacts.css.scss +100 -0
- data/app/assets/stylesheets/conversations.css +4 -0
- data/app/assets/stylesheets/footer.css.scss +22 -0
- data/app/assets/stylesheets/frontpage.css.scss +70 -0
- data/app/assets/stylesheets/groups.css +4 -0
- data/app/assets/stylesheets/header.css.scss +203 -0
- data/app/assets/stylesheets/home.css.scss +53 -0
- data/app/assets/stylesheets/images/add-policy.png +0 -0
- data/app/assets/stylesheets/images/fcbkcomplete/close.gif +0 -0
- data/app/assets/stylesheets/images/loading.gif +0 -0
- data/app/assets/stylesheets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/stylesheets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/stylesheets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/stylesheets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/stylesheets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/stylesheets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/stylesheets/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/stylesheets/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/stylesheets/invitations.css +3 -0
- data/app/assets/stylesheets/location.css.scss +38 -0
- data/app/assets/stylesheets/menu.css.scss +19 -0
- data/app/assets/stylesheets/messages.css.scss +141 -0
- data/app/assets/stylesheets/opa75.png +0 -0
- data/app/assets/stylesheets/profiles.css +4 -0
- data/app/assets/stylesheets/relation_customs.css.scss +233 -0
- data/app/assets/stylesheets/search.css.scss +165 -0
- data/app/assets/stylesheets/settings.css +9 -0
- data/app/assets/stylesheets/social_stream-base.css +5 -0
- data/app/assets/stylesheets/ties.css.scss +12 -0
- data/app/assets/stylesheets/toolbar.css +10 -0
- data/app/assets/stylesheets/users.css +4 -0
- data/app/controllers/activities_controller.rb +19 -0
- data/app/controllers/api_controller.rb +38 -0
- data/app/controllers/authentications_controller.rb +17 -0
- data/app/controllers/cheesecake_controller.rb +9 -0
- data/app/controllers/comments_controller.rb +8 -0
- data/app/controllers/contacts_controller.rb +95 -0
- data/app/controllers/conversations_controller.rb +102 -0
- data/app/controllers/frontpage_controller.rb +23 -0
- data/app/controllers/groups_controller.rb +58 -0
- data/app/controllers/home_controller.rb +3 -0
- data/app/controllers/invitations_controller.rb +36 -0
- data/app/controllers/likes_controller.rb +41 -0
- data/app/controllers/messages_controller.rb +87 -0
- data/app/controllers/notifications_controller.rb +73 -0
- data/app/controllers/omniauth_callbacks_controller.rb +17 -0
- data/app/controllers/permissions_controller.rb +15 -0
- data/app/controllers/posts_controller.rb +3 -0
- data/app/controllers/profiles_controller.rb +9 -0
- data/app/controllers/relation/customs_controller.rb +6 -0
- data/app/controllers/search_controller.rb +79 -0
- data/app/controllers/settings_controller.rb +43 -0
- data/app/controllers/subjects_controller.rb +7 -0
- data/app/controllers/tags_controller.rb +15 -0
- data/app/controllers/ties_controller.rb +11 -0
- data/app/controllers/users_controller.rb +31 -0
- data/app/helpers/activities_helper.rb +37 -0
- data/app/helpers/contacts_helper.rb +24 -0
- data/app/helpers/groups_helper.rb +3 -0
- data/app/helpers/location_helper.rb +46 -0
- data/app/helpers/permissions_helper.rb +16 -0
- data/app/helpers/profiles_helper.rb +37 -0
- data/app/helpers/search_helper.rb +38 -0
- data/app/helpers/settings_helper.rb +9 -0
- data/app/helpers/sidebar_helper.rb +10 -0
- data/app/helpers/subjects_helper.rb +15 -0
- data/app/helpers/toolbar_helper.rb +109 -0
- data/app/helpers/users_helper.rb +4 -0
- data/app/mailers/invitation_mailer.rb +11 -0
- data/app/models/ability.rb +2 -0
- data/app/models/activity.rb +390 -0
- data/app/models/activity_object.rb +64 -0
- data/app/models/activity_object_activity.rb +14 -0
- data/app/models/activity_verb.rb +22 -0
- data/app/models/actor.rb +553 -0
- data/app/models/audience.rb +9 -0
- data/app/models/authentication.rb +3 -0
- data/app/models/comment.rb +10 -0
- data/app/models/contact.rb +209 -0
- data/app/models/group.rb +51 -0
- data/app/models/like.rb +49 -0
- data/app/models/permission.rb +52 -0
- data/app/models/post.rb +12 -0
- data/app/models/profile.rb +58 -0
- data/app/models/relation.rb +169 -0
- data/app/models/relation/custom.rb +112 -0
- data/app/models/relation/public.rb +11 -0
- data/app/models/relation/reject.rb +3 -0
- data/app/models/relation/single.rb +22 -0
- data/app/models/relation_permission.rb +4 -0
- data/app/models/tie.rb +147 -0
- data/app/models/user.rb +148 -0
- data/app/views/activities/_activity.html.erb +5 -0
- data/app/views/activities/_child.html.erb +18 -0
- data/app/views/activities/_comments.html.erb +3 -0
- data/app/views/activities/_filter.html.erb +83 -0
- data/app/views/activities/_index.html.erb +14 -0
- data/app/views/activities/_new.html.erb +56 -0
- data/app/views/activities/_options.html.erb +27 -0
- data/app/views/activities/_root.html.erb +37 -0
- data/app/views/activities/_wall.html.erb +5 -0
- data/app/views/activities/index.html.erb +0 -0
- data/app/views/activities/index.js.erb +3 -0
- data/app/views/activity_objects/_activity_object.html.erb +7 -0
- data/app/views/actors/_actor.html.erb +0 -0
- data/app/views/actors/_actor_cheesecake.html.erb +4 -0
- data/app/views/api/activity_atom_feed.atom.builder +40 -0
- data/app/views/avatars/index.html.erb +15 -0
- data/app/views/avatars/update.js.erb +15 -0
- data/app/views/cheesecake/_index.html.erb +38 -0
- data/app/views/cheesecake/index.html.erb +10 -0
- data/app/views/comments/_comment.html.erb +1 -0
- data/app/views/comments/_new.html.erb +47 -0
- data/app/views/comments/create.js.erb +10 -0
- data/app/views/comments/destroy.js.erb +1 -0
- data/app/views/contacts/_contact.html.erb +20 -0
- data/app/views/contacts/_form.html.erb +38 -0
- data/app/views/contacts/_index.html.erb +40 -0
- data/app/views/contacts/_link.html.erb +9 -0
- data/app/views/contacts/_pendings.html.erb +18 -0
- data/app/views/contacts/_suggestions.html.erb +15 -0
- data/app/views/contacts/_suggestions_and_pendings.html.erb +6 -0
- data/app/views/contacts/destroy.js.erb +6 -0
- data/app/views/contacts/edit.html.erb +6 -0
- data/app/views/contacts/index.html.erb +37 -0
- data/app/views/contacts/index.js.erb +3 -0
- data/app/views/contacts/new.html.erb +5 -0
- data/app/views/contacts/suggestion.html.erb +1 -0
- data/app/views/contacts/suggestion.js.erb +1 -0
- data/app/views/conversations/_conversation.html.erb +38 -0
- data/app/views/conversations/_conversation_full.html.erb +71 -0
- data/app/views/conversations/_conversations.html.erb +5 -0
- data/app/views/conversations/_index.html.erb +11 -0
- data/app/views/conversations/_show.html.erb +13 -0
- data/app/views/conversations/edit.html.erb +10 -0
- data/app/views/conversations/index.html.erb +15 -0
- data/app/views/conversations/index.js.erb +6 -0
- data/app/views/conversations/show.html.erb +33 -0
- data/app/views/conversations/show.js.erb +26 -0
- data/app/views/devise/passwords/edit.html.erb +21 -0
- data/app/views/devise/passwords/new.html.erb +27 -0
- data/app/views/devise/registrations/_delete_account.html.erb +20 -0
- data/app/views/devise/registrations/_edit_user.html.erb +113 -0
- data/app/views/devise/registrations/edit.html.erb +20 -0
- data/app/views/devise/registrations/new.html.erb +44 -0
- data/app/views/devise/sessions/new.html.erb +35 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/frontpage/_caracteristics.html.erb +23 -0
- data/app/views/frontpage/_social_networks.html.erb +3 -0
- data/app/views/frontpage/_sponsor.html.erb +12 -0
- data/app/views/frontpage/host_meta.xml.builder +11 -0
- data/app/views/frontpage/index.html.erb +69 -0
- data/app/views/groups/_group.html.erb +4 -0
- data/app/views/groups/_group_focus_search.html.erb +2 -0
- data/app/views/groups/_group_global_search.html.erb +2 -0
- data/app/views/groups/_group_with_details.html.erb +2 -0
- data/app/views/groups/_index.html.erb +19 -0
- data/app/views/groups/_new.html.erb +81 -0
- data/app/views/groups/_show.html.erb +33 -0
- data/app/views/groups/_tag_cloud.html.erb +25 -0
- data/app/views/groups/index.html.erb +57 -0
- data/app/views/groups/index.js.erb +1 -0
- data/app/views/groups/new.html.erb +9 -0
- data/app/views/groups/show.html.erb +1 -0
- data/app/views/groups/show.js.erb +2 -0
- data/app/views/home/_groups.html.erb +24 -0
- data/app/views/home/index.html.erb +19 -0
- data/app/views/home/index.js.erb +5 -0
- data/app/views/invitation_mailer/send_invitation.html.erb +79 -0
- data/app/views/invitation_mailer/send_invitation.text.erb +21 -0
- data/app/views/invitations/_new.html.erb +28 -0
- data/app/views/invitations/new.html.erb +9 -0
- data/app/views/invitations/new.js.erb +4 -0
- data/app/views/layouts/_account.html.erb +18 -0
- data/app/views/layouts/_flash.html.erb +5 -0
- data/app/views/layouts/_footer.html.erb +16 -0
- data/app/views/layouts/_header.erb +5 -0
- data/app/views/layouts/_header_dropdown_menu.html.erb +19 -0
- data/app/views/layouts/_header_dropdown_menu_sessions.html.erb +14 -0
- data/app/views/layouts/_header_signed_in.erb +45 -0
- data/app/views/layouts/_header_signed_out.erb +34 -0
- data/app/views/layouts/_representation.html.erb +28 -0
- data/app/views/layouts/_search.html.erb +62 -0
- data/app/views/layouts/_settings.html.erb +18 -0
- data/app/views/layouts/application.html.erb +60 -0
- data/app/views/layouts/frontpage.html.erb +43 -0
- data/app/views/likes/create.js.erb +2 -0
- data/app/views/likes/destroy.js.erb +1 -0
- data/app/views/location/_location.html.erb +3 -0
- data/app/views/location/_location_body.html.erb +18 -0
- data/app/views/message_mailer/new_message_email.html.erb +35 -0
- data/app/views/message_mailer/new_message_email.text.erb +8 -0
- data/app/views/message_mailer/reply_message_email.html.erb +35 -0
- data/app/views/message_mailer/reply_message_email.text.erb +8 -0
- data/app/views/messages/_form.html.erb +39 -0
- data/app/views/messages/_message.html.erb +31 -0
- data/app/views/messages/_new.html.erb +10 -0
- data/app/views/messages/new.html.erb +37 -0
- data/app/views/messages/new.js.erb +28 -0
- data/app/views/notification_mailer/new_notification_email.html.erb +35 -0
- data/app/views/notification_mailer/new_notification_email.text.erb +9 -0
- data/app/views/notifications/_index.html.erb +21 -0
- data/app/views/notifications/_notification.html.erb +41 -0
- data/app/views/notifications/activities/_follow.html.erb +10 -0
- data/app/views/notifications/activities/_follow.text.erb +8 -0
- data/app/views/notifications/activities/_like.html.erb +30 -0
- data/app/views/notifications/activities/_like.text.erb +23 -0
- data/app/views/notifications/activities/_make-friend.html.erb +10 -0
- data/app/views/notifications/activities/_make-friend.text.erb +7 -0
- data/app/views/notifications/activities/_post.html.erb +22 -0
- data/app/views/notifications/activities/_post.text.erb +17 -0
- data/app/views/notifications/activities/_update.html.erb +18 -0
- data/app/views/notifications/activities/_update.text.erb +15 -0
- data/app/views/notifications/index.html.erb +13 -0
- data/app/views/notifications/index.js.erb +6 -0
- data/app/views/objects/_destroy.js.erb +2 -0
- data/app/views/objects/_new_activity.html.erb +8 -0
- data/app/views/objects/_show.html.erb +3 -0
- data/app/views/permissions/_index.html.erb +35 -0
- data/app/views/permissions/index.js.erb +15 -0
- data/app/views/posts/_new_activity.html.erb +1 -0
- data/app/views/posts/_new_activity_fields.erb +7 -0
- data/app/views/posts/_post.html.erb +3 -0
- data/app/views/posts/_post_focus_search.html.erb +37 -0
- data/app/views/posts/_post_global_search.html.erb +18 -0
- data/app/views/posts/_post_with_details.html.erb +3 -0
- data/app/views/posts/create.js.erb +7 -0
- data/app/views/posts/destroy.js.erb +1 -0
- data/app/views/posts/show.html.erb +10 -0
- data/app/views/profiles/_contact.html.erb +81 -0
- data/app/views/profiles/_experience.html.erb +22 -0
- data/app/views/profiles/_personal.html.erb +74 -0
- data/app/views/profiles/_profile.html.erb +40 -0
- data/app/views/profiles/_tags.html.erb +22 -0
- data/app/views/profiles/edit.html.erb +205 -0
- data/app/views/profiles/show.html.erb +22 -0
- data/app/views/profiles/update.js.erb +20 -0
- data/app/views/relation/customs/_form.html.erb +29 -0
- data/app/views/relation/customs/_list.html.erb +63 -0
- data/app/views/relation/customs/_update_rules.js.erb +5 -0
- data/app/views/relation/customs/create.js.erb +21 -0
- data/app/views/relation/customs/index.html.erb +43 -0
- data/app/views/relation/customs/update.js.erb +11 -0
- data/app/views/search/_extended_search.html.erb +19 -0
- data/app/views/search/_form.html.erb +54 -0
- data/app/views/search/_header_search.html.erb +16 -0
- data/app/views/search/_index.html.erb +12 -0
- data/app/views/search/index.html.erb +9 -0
- data/app/views/search/index.js.erb +22 -0
- data/app/views/settings/_api_key.html.erb +26 -0
- data/app/views/settings/_destroy.html.erb +17 -0
- data/app/views/settings/_index.html.erb +8 -0
- data/app/views/settings/_notifications.html.erb +34 -0
- data/app/views/settings/index.html.erb +16 -0
- data/app/views/settings/index.js.erb +7 -0
- data/app/views/subjects/_contacts.html.erb +18 -0
- data/app/views/subjects/_show.js.erb +5 -0
- data/app/views/subjects/_subject.html.erb +8 -0
- data/app/views/subjects/_subject_with_details.html.erb +17 -0
- data/app/views/ties/index.html.erb +8 -0
- data/app/views/toolbar/_home.html.erb +15 -0
- data/app/views/toolbar/_logo.html.erb +23 -0
- data/app/views/toolbar/_messages.html.erb +11 -0
- data/app/views/toolbar/_profile.html.erb +24 -0
- data/app/views/toolbar/_subject.html.erb +10 -0
- data/app/views/users/_groups.html.erb +22 -0
- data/app/views/users/_index.html.erb +19 -0
- data/app/views/users/_show.html.erb +34 -0
- data/app/views/users/_user.html.erb +2 -0
- data/app/views/users/_user_focus_search.html.erb +2 -0
- data/app/views/users/_user_global_search.html.erb +2 -0
- data/app/views/users/_user_with_details.html.erb +2 -0
- data/app/views/users/index.html.erb +41 -0
- data/app/views/users/index.js.erb +1 -0
- data/app/views/users/info.html.erb +0 -0
- data/app/views/users/show.html.erb +1 -0
- data/app/views/users/show.js.erb +2 -0
- data/app/views/users/show.xml.builder +15 -0
- data/config/locales/en.yml +472 -0
- data/config/locales/es.yml +470 -0
- data/config/routes.rb +102 -0
- data/db/migrate/20110610112023_create_social_stream.rb +319 -0
- data/db/migrate/20110705103202_empty_ties_count.rb +17 -0
- data/db/migrate/20110712090343_remove_spheres.rb +30 -0
- data/db/migrate/20110712142140_remove_permission_function.rb +26 -0
- data/db/migrate/20110912074426_add_reject_relation.rb +29 -0
- data/db/migrate/20111124100618_object_actors.rb +52 -0
- data/db/migrate/20111221103509_add_language_field.rb +13 -0
- data/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb +37 -0
- data/lib/acts_as_taggable_on/social_stream.rb +58 -0
- data/lib/generators/social_stream/base/install_generator.rb +66 -0
- data/lib/generators/social_stream/base/templates/initializer.rb +32 -0
- data/lib/generators/social_stream/base/templates/navigation.rb +4 -0
- data/lib/generators/social_stream/base/templates/relations.yml +39 -0
- data/lib/generators/social_stream/base/templates/sphinx.yml +9 -0
- data/lib/paperclip/social_stream.rb +6 -0
- data/lib/social_stream-base.rb +104 -0
- data/lib/social_stream/ability.rb +7 -0
- data/lib/social_stream/ability/base.rb +101 -0
- data/lib/social_stream/base/dependencies.rb +47 -0
- data/lib/social_stream/base/engine.rb +69 -0
- data/lib/social_stream/base/version.rb +5 -0
- data/lib/social_stream/controllers/cancan_devise_integration.rb +33 -0
- data/lib/social_stream/controllers/helpers.rb +135 -0
- data/lib/social_stream/controllers/objects.rb +39 -0
- data/lib/social_stream/d3.rb +53 -0
- data/lib/social_stream/migrations/base.rb +58 -0
- data/lib/social_stream/migrations/components.rb +19 -0
- data/lib/social_stream/models/object.rb +133 -0
- data/lib/social_stream/models/subject.rb +118 -0
- data/lib/social_stream/models/supertype.rb +37 -0
- data/lib/social_stream/populate.rb +26 -0
- data/lib/social_stream/test_helpers.rb +11 -0
- data/lib/social_stream/test_helpers/controllers.rb +122 -0
- data/lib/social_stream/toolbar_config/base.rb +94 -0
- data/lib/social_stream/views/list.rb +17 -0
- data/lib/social_stream/views/settings/base.rb +43 -0
- data/lib/social_stream/views/sidebar/base.rb +27 -0
- data/lib/tasks/db/populate.rake +241 -0
- data/lib/tasks/workers.rake +163 -0
- data/social_stream-base.gemspec +83 -0
- data/spec/controllers/comments_controller_spec.rb +66 -0
- data/spec/controllers/contacts_controller_spec.rb +111 -0
- data/spec/controllers/frontpage_controller_spec.rb +16 -0
- data/spec/controllers/groups_controller_spec.rb +178 -0
- data/spec/controllers/home_controller_spec.rb +56 -0
- data/spec/controllers/invitations_controller_spec.rb +34 -0
- data/spec/controllers/likes_controller_spec.rb +48 -0
- data/spec/controllers/notifications_controller_spec.rb +46 -0
- data/spec/controllers/permissions_controller_spec.rb +45 -0
- data/spec/controllers/posts_controller_spec.rb +233 -0
- data/spec/controllers/profiles_controller_spec.rb +102 -0
- data/spec/controllers/relation_customs_controller_spec.rb +139 -0
- data/spec/controllers/representations_spec.rb +74 -0
- data/spec/controllers/settings_controller_spec.rb +41 -0
- data/spec/controllers/subjects_controller.rb +14 -0
- data/spec/controllers/users_controller_spec.rb +98 -0
- data/spec/dummy/.gitignore +5 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +8 -0
- data/spec/dummy/app/assets/stylesheets/application.css +8 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +44 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +40 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +54 -0
- data/spec/dummy/config/environments/test.rb +40 -0
- data/spec/dummy/config/environments/test_pg.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +220 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mailboxer.rb +8 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/social_stream.rb +32 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/navigation.rb +4 -0
- data/spec/dummy/config/relations.yml +39 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/db/schema.rb +5 -0
- data/spec/dummy/db/seeds.rb +8 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/activity.rb +52 -0
- data/spec/factories/comment.rb +6 -0
- data/spec/factories/contact.rb +16 -0
- data/spec/factories/group.rb +5 -0
- data/spec/factories/post.rb +11 -0
- data/spec/factories/relation_custom.rb +4 -0
- data/spec/factories/tie.rb +43 -0
- data/spec/factories/user.rb +6 -0
- data/spec/integration/navigation_spec.rb +33 -0
- data/spec/models/activity_authorization_spec.rb +350 -0
- data/spec/models/activity_spec.rb +131 -0
- data/spec/models/actor_spec.rb +80 -0
- data/spec/models/contact_spec.rb +53 -0
- data/spec/models/group_spec.rb +28 -0
- data/spec/models/like_spec.rb +68 -0
- data/spec/models/post_spec.rb +63 -0
- data/spec/models/profile_spec.rb +39 -0
- data/spec/models/relation_spec.rb +78 -0
- data/spec/models/tie_spec.rb +169 -0
- data/spec/models/user_spec.rb +109 -0
- data/spec/social_stream_spec.rb +7 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/cancan.rb +1 -0
- data/spec/support/db.rb +7 -0
- data/spec/support/devise.rb +4 -0
- data/spec/support/mock.rb +4 -0
- data/vendor/assets/javascripts/ajax.paginate.js +46 -0
- data/vendor/assets/javascripts/d3.geom.js +825 -0
- data/vendor/assets/javascripts/d3.js +4013 -0
- data/vendor/assets/javascripts/d3.layout.js +1865 -0
- data/vendor/assets/javascripts/hoverIntent.js +84 -0
- data/vendor/assets/javascripts/jqcloud-0.1.3.js +87 -0
- data/vendor/assets/javascripts/jquery.ae.image.resize.js +69 -0
- data/vendor/assets/javascripts/jquery.ba-url.js +1091 -0
- data/vendor/assets/javascripts/jquery.cleditor.min.js +31 -0
- data/vendor/assets/javascripts/jquery.fcbkcomplete.js +553 -0
- data/vendor/assets/javascripts/jquery.lightbox-with-resize-plugin.js +533 -0
- data/vendor/assets/javascripts/jquery.livequery.js +250 -0
- data/vendor/assets/javascripts/jquery.screw.js +186 -0
- data/vendor/assets/javascripts/jquery.scrollTo.min.js +11 -0
- data/vendor/assets/javascripts/jquery.tipsy.js +263 -0
- data/vendor/assets/javascripts/jquery.validate.js +1166 -0
- data/vendor/assets/javascripts/jquery.validate.old.js +1132 -0
- data/vendor/assets/javascripts/jquery.watermarkinput.js +81 -0
- data/vendor/assets/javascripts/menu.js +25 -0
- data/vendor/assets/javascripts/superfish.js +121 -0
- data/vendor/assets/stylesheets/carousel.css +23 -0
- data/vendor/assets/stylesheets/chosen-sprite.png +0 -0
- data/vendor/assets/stylesheets/chosen.css +317 -0
- data/vendor/assets/stylesheets/fcbkComplete.css +44 -0
- data/vendor/assets/stylesheets/jqcloud.css +15 -0
- data/vendor/assets/stylesheets/jquery-ui.css +620 -0
- data/vendor/assets/stylesheets/jquery.cleditor.css +24 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/stylesheets/smoothness/jquery-ui-1.7.3.custom.css +405 -0
- data/vendor/assets/stylesheets/smoothness/jquery-ui-1.8.4.custom.css +572 -0
- data/vendor/assets/stylesheets/tipsy.css +25 -0
- metadata +997 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
window.requestAnimFrame = (function(callback) {
|
2
|
+
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
|
3
|
+
function(callback) {
|
4
|
+
window.setTimeout(callback, 1000 / 60);
|
5
|
+
};
|
6
|
+
})();
|
@@ -0,0 +1,8 @@
|
|
1
|
+
//= require jquery.validate
|
2
|
+
|
3
|
+
$(function() {
|
4
|
+
jQuery.validator.addMethod("emails", function(value, element){
|
5
|
+
return this.optional(element) || /^((, *)*((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)+$/i.test(value);
|
6
|
+
}," Please enter valid email addresses.");
|
7
|
+
$(".invitation_form").validate({errorClass: "validation_error"});
|
8
|
+
});
|
@@ -0,0 +1,850 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2010 Anders Ekdahl (http://coffeescripter.com/)
|
3
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
4
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
5
|
+
*
|
6
|
+
* Version: 1.2.4
|
7
|
+
*
|
8
|
+
* Demo and documentation: http://coffeescripter.com/code/ad-gallery/
|
9
|
+
*/
|
10
|
+
(function($) {
|
11
|
+
$.fn.adGallery = function(options) {
|
12
|
+
var defaults = { loader_image: 'loader.gif',
|
13
|
+
start_at_index: 0,
|
14
|
+
description_wrapper: false,
|
15
|
+
thumb_opacity: 0.7,
|
16
|
+
animate_first_image: false,
|
17
|
+
animation_speed: 400,
|
18
|
+
width: false,
|
19
|
+
height: false,
|
20
|
+
display_next_and_prev: true,
|
21
|
+
display_back_and_forward: true,
|
22
|
+
scroll_jump: 0, // If 0, it jumps the width of the container
|
23
|
+
slideshow: {
|
24
|
+
enable: true,
|
25
|
+
autostart: false,
|
26
|
+
speed: 5000,
|
27
|
+
start_label: 'Start',
|
28
|
+
stop_label: 'Stop',
|
29
|
+
stop_on_scroll: true,
|
30
|
+
countdown_prefix: '(',
|
31
|
+
countdown_sufix: ')',
|
32
|
+
onStart: false,
|
33
|
+
onStop: false
|
34
|
+
},
|
35
|
+
effect: 'slide-hori', // or 'slide-vert', 'fade', or 'resize', 'none'
|
36
|
+
enable_keyboard_move: true,
|
37
|
+
cycle: true,
|
38
|
+
callbacks: {
|
39
|
+
init: false,
|
40
|
+
afterImageVisible: false,
|
41
|
+
beforeImageVisible: false
|
42
|
+
}
|
43
|
+
};
|
44
|
+
var settings = $.extend(false, defaults, options);
|
45
|
+
if(options && options.slideshow) {
|
46
|
+
settings.slideshow = $.extend(false, defaults.slideshow, options.slideshow);
|
47
|
+
};
|
48
|
+
if(!settings.slideshow.enable) {
|
49
|
+
settings.slideshow.autostart = false;
|
50
|
+
};
|
51
|
+
var galleries = [];
|
52
|
+
$(this).each(function() {
|
53
|
+
var gallery = new AdGallery(this, settings);
|
54
|
+
galleries[galleries.length] = gallery;
|
55
|
+
});
|
56
|
+
// Sorry, breaking the jQuery chain because the gallery instances
|
57
|
+
// are returned so you can fiddle with them
|
58
|
+
return galleries;
|
59
|
+
};
|
60
|
+
|
61
|
+
function VerticalSlideAnimation(img_container, direction, desc) {
|
62
|
+
var current_top = parseInt(img_container.css('top'), 10);
|
63
|
+
if(direction == 'left') {
|
64
|
+
var old_image_top = '-'+ this.image_wrapper_height +'px';
|
65
|
+
img_container.css('top', this.image_wrapper_height +'px');
|
66
|
+
} else {
|
67
|
+
var old_image_top = this.image_wrapper_height +'px';
|
68
|
+
img_container.css('top', '-'+ this.image_wrapper_height +'px');
|
69
|
+
};
|
70
|
+
if(desc) {
|
71
|
+
desc.css('bottom', '-'+ desc[0].offsetHeight +'px');
|
72
|
+
desc.animate({bottom: 0}, this.settings.animation_speed * 2);
|
73
|
+
};
|
74
|
+
if(this.current_description) {
|
75
|
+
this.current_description.animate({bottom: '-'+ this.current_description[0].offsetHeight +'px'}, this.settings.animation_speed * 2);
|
76
|
+
};
|
77
|
+
return {old_image: {top: old_image_top},
|
78
|
+
new_image: {top: current_top}};
|
79
|
+
};
|
80
|
+
|
81
|
+
function HorizontalSlideAnimation(img_container, direction, desc) {
|
82
|
+
var current_left = parseInt(img_container.css('left'), 10);
|
83
|
+
if(direction == 'left') {
|
84
|
+
var old_image_left = '-'+ this.image_wrapper_width +'px';
|
85
|
+
img_container.css('left',this.image_wrapper_width +'px');
|
86
|
+
} else {
|
87
|
+
var old_image_left = this.image_wrapper_width +'px';
|
88
|
+
img_container.css('left','-'+ this.image_wrapper_width +'px');
|
89
|
+
};
|
90
|
+
if(desc) {
|
91
|
+
desc.css('bottom', '-'+ desc[0].offsetHeight +'px');
|
92
|
+
desc.animate({bottom: 0}, this.settings.animation_speed * 2);
|
93
|
+
};
|
94
|
+
if(this.current_description) {
|
95
|
+
this.current_description.animate({bottom: '-'+ this.current_description[0].offsetHeight +'px'}, this.settings.animation_speed * 2);
|
96
|
+
};
|
97
|
+
return {old_image: {left: old_image_left},
|
98
|
+
new_image: {left: current_left}};
|
99
|
+
};
|
100
|
+
|
101
|
+
function ResizeAnimation(img_container, direction, desc) {
|
102
|
+
var image_width = img_container.width();
|
103
|
+
var image_height = img_container.height();
|
104
|
+
var current_left = parseInt(img_container.css('left'), 10);
|
105
|
+
var current_top = parseInt(img_container.css('top'), 10);
|
106
|
+
img_container.css({width: 0, height: 0, top: this.image_wrapper_height / 2, left: this.image_wrapper_width / 2});
|
107
|
+
return {old_image: {width: 0,
|
108
|
+
height: 0,
|
109
|
+
top: this.image_wrapper_height / 2,
|
110
|
+
left: this.image_wrapper_width / 2},
|
111
|
+
new_image: {width: image_width,
|
112
|
+
height: image_height,
|
113
|
+
top: current_top,
|
114
|
+
left: current_left}};
|
115
|
+
};
|
116
|
+
|
117
|
+
function FadeAnimation(img_container, direction, desc) {
|
118
|
+
img_container.css('opacity', 0);
|
119
|
+
return {old_image: {opacity: 0},
|
120
|
+
new_image: {opacity: 1}};
|
121
|
+
};
|
122
|
+
|
123
|
+
// Sort of a hack, will clean this up... eventually
|
124
|
+
function NoneAnimation(img_container, direction, desc) {
|
125
|
+
img_container.css('opacity', 0);
|
126
|
+
return {old_image: {opacity: 0},
|
127
|
+
new_image: {opacity: 1},
|
128
|
+
speed: 0};
|
129
|
+
};
|
130
|
+
|
131
|
+
function AdGallery(wrapper, settings) {
|
132
|
+
this.init(wrapper, settings);
|
133
|
+
};
|
134
|
+
AdGallery.prototype = {
|
135
|
+
// Elements
|
136
|
+
wrapper: false,
|
137
|
+
image_wrapper: false,
|
138
|
+
gallery_info: false,
|
139
|
+
nav: false,
|
140
|
+
loader: false,
|
141
|
+
preloads: false,
|
142
|
+
thumbs_wrapper: false,
|
143
|
+
scroll_back: false,
|
144
|
+
scroll_forward: false,
|
145
|
+
next_link: false,
|
146
|
+
prev_link: false,
|
147
|
+
|
148
|
+
slideshow: false,
|
149
|
+
image_wrapper_width: 0,
|
150
|
+
image_wrapper_height: 0,
|
151
|
+
current_index: 0,
|
152
|
+
current_image: false,
|
153
|
+
current_description: false,
|
154
|
+
nav_display_width: 0,
|
155
|
+
settings: false,
|
156
|
+
images: false,
|
157
|
+
in_transition: false,
|
158
|
+
animations: false,
|
159
|
+
init: function(wrapper, settings) {
|
160
|
+
var context = this;
|
161
|
+
this.wrapper = $(wrapper);
|
162
|
+
this.settings = settings;
|
163
|
+
this.setupElements();
|
164
|
+
this.setupAnimations();
|
165
|
+
if(this.settings.width) {
|
166
|
+
this.image_wrapper_width = this.settings.width;
|
167
|
+
this.image_wrapper.width(this.settings.width);
|
168
|
+
this.wrapper.width(this.settings.width);
|
169
|
+
} else {
|
170
|
+
this.image_wrapper_width = this.image_wrapper.width();
|
171
|
+
};
|
172
|
+
if(this.settings.height) {
|
173
|
+
this.image_wrapper_height = this.settings.height;
|
174
|
+
this.image_wrapper.height(this.settings.height);
|
175
|
+
} else {
|
176
|
+
this.image_wrapper_height = this.image_wrapper.height();
|
177
|
+
};
|
178
|
+
this.nav_display_width = this.nav.width();
|
179
|
+
this.current_index = 0;
|
180
|
+
this.current_image = false;
|
181
|
+
this.current_description = false;
|
182
|
+
this.in_transition = false;
|
183
|
+
this.findImages();
|
184
|
+
if(this.settings.display_next_and_prev) {
|
185
|
+
this.initNextAndPrev();
|
186
|
+
};
|
187
|
+
// The slideshow needs a callback to trigger the next image to be shown
|
188
|
+
// but we don't want to give it access to the whole gallery instance
|
189
|
+
var nextimage_callback = function(callback) {
|
190
|
+
return context.nextImage(callback);
|
191
|
+
};
|
192
|
+
this.slideshow = new AdGallerySlideshow(nextimage_callback, this.settings.slideshow);
|
193
|
+
this.controls.append(this.slideshow.create());
|
194
|
+
if(this.settings.slideshow.enable) {
|
195
|
+
this.slideshow.enable();
|
196
|
+
} else {
|
197
|
+
this.slideshow.disable();
|
198
|
+
};
|
199
|
+
if(this.settings.display_back_and_forward) {
|
200
|
+
this.initBackAndForward();
|
201
|
+
};
|
202
|
+
if(this.settings.enable_keyboard_move) {
|
203
|
+
this.initKeyEvents();
|
204
|
+
};
|
205
|
+
var start_at = parseInt(this.settings.start_at_index, 10);
|
206
|
+
if(window.location.hash && window.location.hash.indexOf('#ad-image') === 0) {
|
207
|
+
start_at = window.location.hash.replace(/[^0-9]+/g, '');
|
208
|
+
// Check if it's a number
|
209
|
+
if((start_at * 1) != start_at) {
|
210
|
+
start_at = this.settings.start_at_index;
|
211
|
+
};
|
212
|
+
};
|
213
|
+
|
214
|
+
this.loading(true);
|
215
|
+
this.showImage(start_at,
|
216
|
+
function() {
|
217
|
+
// We don't want to start the slideshow before the image has been
|
218
|
+
// displayed
|
219
|
+
if(context.settings.slideshow.autostart) {
|
220
|
+
context.preloadImage(start_at + 1);
|
221
|
+
context.slideshow.start();
|
222
|
+
};
|
223
|
+
}
|
224
|
+
);
|
225
|
+
this.fireCallback(this.settings.callbacks.init);
|
226
|
+
},
|
227
|
+
setupAnimations: function() {
|
228
|
+
this.animations = {
|
229
|
+
'slide-vert': VerticalSlideAnimation,
|
230
|
+
'slide-hori': HorizontalSlideAnimation,
|
231
|
+
'resize': ResizeAnimation,
|
232
|
+
'fade': FadeAnimation,
|
233
|
+
'none': NoneAnimation
|
234
|
+
};
|
235
|
+
},
|
236
|
+
setupElements: function() {
|
237
|
+
this.controls = this.wrapper.find('.ad-controls');
|
238
|
+
this.gallery_info = $('<p class="ad-info"></p>');
|
239
|
+
this.controls.append(this.gallery_info);
|
240
|
+
this.image_wrapper = this.wrapper.find('.ad-image-wrapper');
|
241
|
+
this.image_wrapper.empty();
|
242
|
+
this.nav = this.wrapper.find('.ad-nav');
|
243
|
+
this.thumbs_wrapper = this.nav.find('.ad-thumbs');
|
244
|
+
this.preloads = $('<div class="ad-preloads"></div>');
|
245
|
+
this.loader = $('<img class="ad-loader" src="'+ this.settings.loader_image +'">');
|
246
|
+
this.image_wrapper.append(this.loader);
|
247
|
+
this.loader.hide();
|
248
|
+
$(document.body).append(this.preloads);
|
249
|
+
},
|
250
|
+
loading: function(bool) {
|
251
|
+
if(bool) {
|
252
|
+
this.loader.show();
|
253
|
+
} else {
|
254
|
+
this.loader.hide();
|
255
|
+
};
|
256
|
+
},
|
257
|
+
addAnimation: function(name, fn) {
|
258
|
+
if($.isFunction(fn)) {
|
259
|
+
this.animations[name] = fn;
|
260
|
+
};
|
261
|
+
},
|
262
|
+
findImages: function() {
|
263
|
+
var context = this;
|
264
|
+
this.images = [];
|
265
|
+
var thumb_wrapper_width = 0;
|
266
|
+
var thumbs_loaded = 0;
|
267
|
+
var thumbs = this.thumbs_wrapper.find('a');
|
268
|
+
var thumb_count = thumbs.length;
|
269
|
+
if(this.settings.thumb_opacity < 1) {
|
270
|
+
thumbs.find('img').css('opacity', this.settings.thumb_opacity);
|
271
|
+
};
|
272
|
+
thumbs.each(
|
273
|
+
function(i) {
|
274
|
+
var link = $(this);
|
275
|
+
var image_src = link.attr('href');
|
276
|
+
var thumb = link.find('img');
|
277
|
+
// Check if the thumb has already loaded
|
278
|
+
if(!context.isImageLoaded(thumb[0])) {
|
279
|
+
thumb.load(
|
280
|
+
function() {
|
281
|
+
thumb_wrapper_width += this.parentNode.parentNode.offsetWidth;
|
282
|
+
thumbs_loaded++;
|
283
|
+
}
|
284
|
+
);
|
285
|
+
} else{
|
286
|
+
thumb_wrapper_width += thumb[0].parentNode.parentNode.offsetWidth;
|
287
|
+
thumbs_loaded++;
|
288
|
+
};
|
289
|
+
link.addClass('ad-thumb'+ i);
|
290
|
+
link.click(
|
291
|
+
function() {
|
292
|
+
context.showImage(i);
|
293
|
+
context.slideshow.stop();
|
294
|
+
return false;
|
295
|
+
}
|
296
|
+
).hover(
|
297
|
+
function() {
|
298
|
+
if(!$(this).is('.ad-active') && context.settings.thumb_opacity < 1) {
|
299
|
+
$(this).find('img').fadeTo(300, 1);
|
300
|
+
};
|
301
|
+
context.preloadImage(i);
|
302
|
+
},
|
303
|
+
function() {
|
304
|
+
if(!$(this).is('.ad-active') && context.settings.thumb_opacity < 1) {
|
305
|
+
$(this).find('img').fadeTo(300, context.settings.thumb_opacity);
|
306
|
+
};
|
307
|
+
}
|
308
|
+
);
|
309
|
+
var link = false;
|
310
|
+
if(thumb.data('ad-link')) {
|
311
|
+
link = thumb.data('ad-link');
|
312
|
+
} else if(thumb.attr('longdesc') && thumb.attr('longdesc').length) {
|
313
|
+
link = thumb.attr('longdesc');
|
314
|
+
};
|
315
|
+
var desc = false;
|
316
|
+
if(thumb.data('ad-desc')) {
|
317
|
+
desc = thumb.data('ad-desc');
|
318
|
+
} else if(thumb.attr('alt') && thumb.attr('alt').length) {
|
319
|
+
desc = thumb.attr('alt');
|
320
|
+
};
|
321
|
+
var title = false;
|
322
|
+
if(thumb.data('ad-title')) {
|
323
|
+
title = thumb.data('ad-title');
|
324
|
+
} else if(thumb.attr('title') && thumb.attr('title').length) {
|
325
|
+
title = thumb.attr('title');
|
326
|
+
};
|
327
|
+
context.images[i] = { thumb: thumb.attr('src'), image: image_src, error: false,
|
328
|
+
preloaded: false, desc: desc, title: title, size: false,
|
329
|
+
link: link };
|
330
|
+
}
|
331
|
+
);
|
332
|
+
// Wait until all thumbs are loaded, and then set the width of the ul
|
333
|
+
var inter = setInterval(
|
334
|
+
function() {
|
335
|
+
if(thumb_count == thumbs_loaded) {
|
336
|
+
thumb_wrapper_width -= 100;
|
337
|
+
var list = context.nav.find('.ad-thumb-list');
|
338
|
+
list.css('width', thumb_wrapper_width +'px');
|
339
|
+
var i = 1;
|
340
|
+
var last_height = list.height();
|
341
|
+
while(i < 201) {
|
342
|
+
list.css('width', (thumb_wrapper_width + i) +'px');
|
343
|
+
if(last_height != list.height()) {
|
344
|
+
break;
|
345
|
+
}
|
346
|
+
last_height = list.height();
|
347
|
+
i++;
|
348
|
+
}
|
349
|
+
clearInterval(inter);
|
350
|
+
};
|
351
|
+
},
|
352
|
+
100
|
353
|
+
);
|
354
|
+
},
|
355
|
+
initKeyEvents: function() {
|
356
|
+
var context = this;
|
357
|
+
$(document).keydown(
|
358
|
+
function(e) {
|
359
|
+
if(e.keyCode == 39) {
|
360
|
+
// right arrow
|
361
|
+
context.nextImage();
|
362
|
+
context.slideshow.stop();
|
363
|
+
} else if(e.keyCode == 37) {
|
364
|
+
// left arrow
|
365
|
+
context.prevImage();
|
366
|
+
context.slideshow.stop();
|
367
|
+
};
|
368
|
+
}
|
369
|
+
);
|
370
|
+
},
|
371
|
+
initNextAndPrev: function() {
|
372
|
+
this.next_link = $('<div class="ad-next"><div class="ad-next-image"></div></div>');
|
373
|
+
this.prev_link = $('<div class="ad-prev"><div class="ad-prev-image"></div></div>');
|
374
|
+
this.image_wrapper.append(this.next_link);
|
375
|
+
this.image_wrapper.append(this.prev_link);
|
376
|
+
var context = this;
|
377
|
+
this.prev_link.add(this.next_link).mouseover(
|
378
|
+
function(e) {
|
379
|
+
// IE 6 hides the wrapper div, so we have to set it's width
|
380
|
+
$(this).css('height', context.image_wrapper_height);
|
381
|
+
$(this).find('div').show();
|
382
|
+
}
|
383
|
+
).mouseout(
|
384
|
+
function(e) {
|
385
|
+
$(this).find('div').hide();
|
386
|
+
}
|
387
|
+
).click(
|
388
|
+
function() {
|
389
|
+
if($(this).is('.ad-next')) {
|
390
|
+
context.nextImage();
|
391
|
+
context.slideshow.stop();
|
392
|
+
} else {
|
393
|
+
context.prevImage();
|
394
|
+
context.slideshow.stop();
|
395
|
+
};
|
396
|
+
}
|
397
|
+
).find('div').css('opacity', 0.7);
|
398
|
+
},
|
399
|
+
initBackAndForward: function() {
|
400
|
+
var context = this;
|
401
|
+
this.scroll_forward = $('<div class="ad-forward"></div>');
|
402
|
+
this.scroll_back = $('<div class="ad-back"></div>');
|
403
|
+
this.nav.append(this.scroll_forward);
|
404
|
+
this.nav.prepend(this.scroll_back);
|
405
|
+
var has_scrolled = 0;
|
406
|
+
var thumbs_scroll_interval = false;
|
407
|
+
$(this.scroll_back).add(this.scroll_forward).click(
|
408
|
+
function() {
|
409
|
+
// We don't want to jump the whole width, since an image
|
410
|
+
// might be cut at the edge
|
411
|
+
var width = context.nav_display_width - 50;
|
412
|
+
if(context.settings.scroll_jump > 0) {
|
413
|
+
var width = context.settings.scroll_jump;
|
414
|
+
};
|
415
|
+
if($(this).is('.ad-forward')) {
|
416
|
+
var left = context.thumbs_wrapper.scrollLeft() + width;
|
417
|
+
} else {
|
418
|
+
var left = context.thumbs_wrapper.scrollLeft() - width;
|
419
|
+
};
|
420
|
+
if(context.settings.slideshow.stop_on_scroll) {
|
421
|
+
context.slideshow.stop();
|
422
|
+
};
|
423
|
+
context.thumbs_wrapper.animate({scrollLeft: left +'px'});
|
424
|
+
return false;
|
425
|
+
}
|
426
|
+
).css('opacity', 0.6).hover(
|
427
|
+
function() {
|
428
|
+
var direction = 'left';
|
429
|
+
if($(this).is('.ad-forward')) {
|
430
|
+
direction = 'right';
|
431
|
+
};
|
432
|
+
thumbs_scroll_interval = setInterval(
|
433
|
+
function() {
|
434
|
+
has_scrolled++;
|
435
|
+
// Don't want to stop the slideshow just because we scrolled a pixel or two
|
436
|
+
if(has_scrolled > 30 && context.settings.slideshow.stop_on_scroll) {
|
437
|
+
context.slideshow.stop();
|
438
|
+
};
|
439
|
+
var left = context.thumbs_wrapper.scrollLeft() + 1;
|
440
|
+
if(direction == 'left') {
|
441
|
+
left = context.thumbs_wrapper.scrollLeft() - 1;
|
442
|
+
};
|
443
|
+
context.thumbs_wrapper.scrollLeft(left);
|
444
|
+
},
|
445
|
+
10
|
446
|
+
);
|
447
|
+
$(this).css('opacity', 1);
|
448
|
+
},
|
449
|
+
function() {
|
450
|
+
has_scrolled = 0;
|
451
|
+
clearInterval(thumbs_scroll_interval);
|
452
|
+
$(this).css('opacity', 0.6);
|
453
|
+
}
|
454
|
+
);
|
455
|
+
},
|
456
|
+
_afterShow: function() {
|
457
|
+
this.gallery_info.html((this.current_index + 1) +' / '+ this.images.length);
|
458
|
+
if(!this.settings.cycle) {
|
459
|
+
// Needed for IE
|
460
|
+
this.prev_link.show().css('height', this.image_wrapper_height);
|
461
|
+
this.next_link.show().css('height', this.image_wrapper_height);
|
462
|
+
if(this.current_index == (this.images.length - 1)) {
|
463
|
+
this.next_link.hide();
|
464
|
+
};
|
465
|
+
if(this.current_index == 0) {
|
466
|
+
this.prev_link.hide();
|
467
|
+
};
|
468
|
+
};
|
469
|
+
this.fireCallback(this.settings.callbacks.afterImageVisible);
|
470
|
+
},
|
471
|
+
/**
|
472
|
+
* Checks if the image is small enough to fit inside the container
|
473
|
+
* If it's not, shrink it proportionally
|
474
|
+
*/
|
475
|
+
_getContainedImageSize: function(image_width, image_height) {
|
476
|
+
if(image_height > this.image_wrapper_height) {
|
477
|
+
var ratio = image_width / image_height;
|
478
|
+
image_height = this.image_wrapper_height;
|
479
|
+
image_width = this.image_wrapper_height * ratio;
|
480
|
+
};
|
481
|
+
if(image_width > this.image_wrapper_width) {
|
482
|
+
var ratio = image_height / image_width;
|
483
|
+
image_width = this.image_wrapper_width;
|
484
|
+
image_height = this.image_wrapper_width * ratio;
|
485
|
+
};
|
486
|
+
return {width: image_width, height: image_height};
|
487
|
+
},
|
488
|
+
/**
|
489
|
+
* If the image dimensions are smaller than the wrapper, we position
|
490
|
+
* it in the middle anyway
|
491
|
+
*/
|
492
|
+
_centerImage: function(img_container, image_width, image_height) {
|
493
|
+
img_container.css('top', '0px');
|
494
|
+
if(image_height < this.image_wrapper_height) {
|
495
|
+
var dif = this.image_wrapper_height - image_height;
|
496
|
+
img_container.css('top', (dif / 2) +'px');
|
497
|
+
};
|
498
|
+
img_container.css('left', '0px');
|
499
|
+
if(image_width < this.image_wrapper_width) {
|
500
|
+
var dif = this.image_wrapper_width - image_width;
|
501
|
+
img_container.css('left', (dif / 2) +'px');
|
502
|
+
};
|
503
|
+
},
|
504
|
+
_getDescription: function(image) {
|
505
|
+
var desc = false;
|
506
|
+
if(image.desc.length || image.title.length) {
|
507
|
+
var title = '';
|
508
|
+
if(image.title.length) {
|
509
|
+
title = '<strong class="ad-description-title">'+ image.title +'</strong>';
|
510
|
+
};
|
511
|
+
var desc = '';
|
512
|
+
if(image.desc.length) {
|
513
|
+
desc = '<span>'+ image.desc +'</span>';
|
514
|
+
};
|
515
|
+
desc = $('<p class="ad-image-description">'+ title + desc +'</p>');
|
516
|
+
};
|
517
|
+
return desc;
|
518
|
+
},
|
519
|
+
/**
|
520
|
+
* @param function callback Gets fired when the image has loaded, is displaying
|
521
|
+
* and it's animation has finished
|
522
|
+
*/
|
523
|
+
showImage: function(index, callback) {
|
524
|
+
if(this.images[index] && !this.in_transition) {
|
525
|
+
var context = this;
|
526
|
+
var image = this.images[index];
|
527
|
+
this.in_transition = true;
|
528
|
+
if(!image.preloaded) {
|
529
|
+
this.loading(true);
|
530
|
+
this.preloadImage(index, function() {
|
531
|
+
context.loading(false);
|
532
|
+
context._showWhenLoaded(index, callback);
|
533
|
+
});
|
534
|
+
} else {
|
535
|
+
this._showWhenLoaded(index, callback);
|
536
|
+
};
|
537
|
+
};
|
538
|
+
},
|
539
|
+
/**
|
540
|
+
* @param function callback Gets fired when the image has loaded, is displaying
|
541
|
+
* and it's animation has finished
|
542
|
+
*/
|
543
|
+
_showWhenLoaded: function(index, callback) {
|
544
|
+
if(this.images[index]) {
|
545
|
+
var context = this;
|
546
|
+
var image = this.images[index];
|
547
|
+
var img_container = $(document.createElement('div')).addClass('ad-image');
|
548
|
+
var img = $(new Image()).attr('src', image.image);
|
549
|
+
if(image.link) {
|
550
|
+
var link = $('<a href="'+ image.link +'" target="_blank"></a>');
|
551
|
+
link.append(img);
|
552
|
+
img_container.append(link);
|
553
|
+
} else {
|
554
|
+
img_container.append(img);
|
555
|
+
}
|
556
|
+
this.image_wrapper.prepend(img_container);
|
557
|
+
var size = this._getContainedImageSize(image.size.width, image.size.height);
|
558
|
+
img.attr('width', size.width);
|
559
|
+
img.attr('height', size.height);
|
560
|
+
img_container.css({width: size.width +'px', height: size.height +'px'});
|
561
|
+
this._centerImage(img_container, size.width, size.height);
|
562
|
+
var desc = this._getDescription(image, img_container);
|
563
|
+
if(desc) {
|
564
|
+
if(!this.settings.description_wrapper) {
|
565
|
+
img_container.append(desc);
|
566
|
+
var width = size.width - parseInt(desc.css('padding-left'), 10) - parseInt(desc.css('padding-right'), 10);
|
567
|
+
desc.css('width', width +'px');
|
568
|
+
} else {
|
569
|
+
this.settings.description_wrapper.append(desc);
|
570
|
+
}
|
571
|
+
};
|
572
|
+
this.highLightThumb(this.nav.find('.ad-thumb'+ index));
|
573
|
+
|
574
|
+
var direction = 'right';
|
575
|
+
if(this.current_index < index) {
|
576
|
+
direction = 'left';
|
577
|
+
};
|
578
|
+
this.fireCallback(this.settings.callbacks.beforeImageVisible);
|
579
|
+
if(this.current_image || this.settings.animate_first_image) {
|
580
|
+
var animation_speed = this.settings.animation_speed;
|
581
|
+
var easing = 'swing';
|
582
|
+
var animation = this.animations[this.settings.effect].call(this, img_container, direction, desc);
|
583
|
+
if(typeof animation.speed != 'undefined') {
|
584
|
+
animation_speed = animation.speed;
|
585
|
+
};
|
586
|
+
if(typeof animation.easing != 'undefined') {
|
587
|
+
easing = animation.easing;
|
588
|
+
};
|
589
|
+
if(this.current_image) {
|
590
|
+
var old_image = this.current_image;
|
591
|
+
var old_description = this.current_description;
|
592
|
+
old_image.animate(animation.old_image, animation_speed, easing,
|
593
|
+
function() {
|
594
|
+
old_image.remove();
|
595
|
+
if(old_description) old_description.remove();
|
596
|
+
}
|
597
|
+
);
|
598
|
+
};
|
599
|
+
img_container.animate(animation.new_image, animation_speed, easing,
|
600
|
+
function() {
|
601
|
+
context.current_index = index;
|
602
|
+
context.current_image = img_container;
|
603
|
+
context.current_description = desc;
|
604
|
+
context.in_transition = false;
|
605
|
+
context._afterShow();
|
606
|
+
context.fireCallback(callback);
|
607
|
+
}
|
608
|
+
);
|
609
|
+
} else {
|
610
|
+
this.current_index = index;
|
611
|
+
this.current_image = img_container;
|
612
|
+
context.current_description = desc;
|
613
|
+
this.in_transition = false;
|
614
|
+
context._afterShow();
|
615
|
+
this.fireCallback(callback);
|
616
|
+
};
|
617
|
+
};
|
618
|
+
},
|
619
|
+
nextIndex: function() {
|
620
|
+
if(this.current_index == (this.images.length - 1)) {
|
621
|
+
if(!this.settings.cycle) {
|
622
|
+
return false;
|
623
|
+
};
|
624
|
+
var next = 0;
|
625
|
+
} else {
|
626
|
+
var next = this.current_index + 1;
|
627
|
+
};
|
628
|
+
return next;
|
629
|
+
},
|
630
|
+
nextImage: function(callback) {
|
631
|
+
var next = this.nextIndex();
|
632
|
+
if(next === false) return false;
|
633
|
+
this.preloadImage(next + 1);
|
634
|
+
this.showImage(next, callback);
|
635
|
+
return true;
|
636
|
+
},
|
637
|
+
prevIndex: function() {
|
638
|
+
if(this.current_index == 0) {
|
639
|
+
if(!this.settings.cycle) {
|
640
|
+
return false;
|
641
|
+
};
|
642
|
+
var prev = this.images.length - 1;
|
643
|
+
} else {
|
644
|
+
var prev = this.current_index - 1;
|
645
|
+
};
|
646
|
+
return prev;
|
647
|
+
},
|
648
|
+
prevImage: function(callback) {
|
649
|
+
var prev = this.prevIndex();
|
650
|
+
if(prev === false) return false;
|
651
|
+
this.preloadImage(prev - 1);
|
652
|
+
this.showImage(prev, callback);
|
653
|
+
return true;
|
654
|
+
},
|
655
|
+
preloadAll: function() {
|
656
|
+
var context = this;
|
657
|
+
var i = 0;
|
658
|
+
function preloadNext() {
|
659
|
+
if(i < context.images.length) {
|
660
|
+
i++;
|
661
|
+
context.preloadImage(i, preloadNext);
|
662
|
+
};
|
663
|
+
};
|
664
|
+
context.preloadImage(i, preloadNext);
|
665
|
+
},
|
666
|
+
preloadImage: function(index, callback) {
|
667
|
+
if(this.images[index]) {
|
668
|
+
var image = this.images[index];
|
669
|
+
if(!this.images[index].preloaded) {
|
670
|
+
var img = $(new Image());
|
671
|
+
img.attr('src', image.image);
|
672
|
+
if(!this.isImageLoaded(img[0])) {
|
673
|
+
this.preloads.append(img);
|
674
|
+
var context = this;
|
675
|
+
img.load(
|
676
|
+
function() {
|
677
|
+
image.preloaded = true;
|
678
|
+
image.size = { width: this.width, height: this.height };
|
679
|
+
context.fireCallback(callback);
|
680
|
+
}
|
681
|
+
).error(
|
682
|
+
function() {
|
683
|
+
image.error = true;
|
684
|
+
image.preloaded = false;
|
685
|
+
image.size = false;
|
686
|
+
}
|
687
|
+
);
|
688
|
+
} else {
|
689
|
+
image.preloaded = true;
|
690
|
+
image.size = { width: img[0].width, height: img[0].height };
|
691
|
+
this.fireCallback(callback);
|
692
|
+
};
|
693
|
+
} else {
|
694
|
+
this.fireCallback(callback);
|
695
|
+
};
|
696
|
+
};
|
697
|
+
},
|
698
|
+
isImageLoaded: function(img) {
|
699
|
+
if(typeof img.complete != 'undefined' && !img.complete) {
|
700
|
+
return false;
|
701
|
+
};
|
702
|
+
if(typeof img.naturalWidth != 'undefined' && img.naturalWidth == 0) {
|
703
|
+
return false;
|
704
|
+
};
|
705
|
+
return true;
|
706
|
+
},
|
707
|
+
highLightThumb: function(thumb) {
|
708
|
+
this.thumbs_wrapper.find('.ad-active').removeClass('ad-active');
|
709
|
+
thumb.addClass('ad-active');
|
710
|
+
if(this.settings.thumb_opacity < 1) {
|
711
|
+
this.thumbs_wrapper.find('a:not(.ad-active) img').fadeTo(300, this.settings.thumb_opacity);
|
712
|
+
thumb.find('img').fadeTo(300, 1);
|
713
|
+
};
|
714
|
+
var left = thumb[0].parentNode.offsetLeft;
|
715
|
+
left -= (this.nav_display_width / 2) - (thumb[0].offsetWidth / 2);
|
716
|
+
this.thumbs_wrapper.animate({scrollLeft: left +'px'});
|
717
|
+
},
|
718
|
+
fireCallback: function(fn) {
|
719
|
+
if($.isFunction(fn)) {
|
720
|
+
fn.call(this);
|
721
|
+
};
|
722
|
+
}
|
723
|
+
};
|
724
|
+
|
725
|
+
function AdGallerySlideshow(nextimage_callback, settings) {
|
726
|
+
this.init(nextimage_callback, settings);
|
727
|
+
};
|
728
|
+
AdGallerySlideshow.prototype = {
|
729
|
+
start_link: false,
|
730
|
+
stop_link: false,
|
731
|
+
countdown: false,
|
732
|
+
controls: false,
|
733
|
+
|
734
|
+
settings: false,
|
735
|
+
nextimage_callback: false,
|
736
|
+
enabled: false,
|
737
|
+
running: false,
|
738
|
+
countdown_interval: false,
|
739
|
+
init: function(nextimage_callback, settings) {
|
740
|
+
var context = this;
|
741
|
+
this.nextimage_callback = nextimage_callback;
|
742
|
+
this.settings = settings;
|
743
|
+
},
|
744
|
+
create: function() {
|
745
|
+
this.start_link = $('<span class="ad-slideshow-start">'+ this.settings.start_label +'</span>');
|
746
|
+
this.stop_link = $('<span class="ad-slideshow-stop">'+ this.settings.stop_label +'</span>');
|
747
|
+
this.countdown = $('<span class="ad-slideshow-countdown"></span>');
|
748
|
+
this.controls = $('<div class="ad-slideshow-controls"></div>');
|
749
|
+
this.controls.append(this.start_link).append(this.stop_link).append(this.countdown);
|
750
|
+
this.countdown.hide();
|
751
|
+
|
752
|
+
var context = this;
|
753
|
+
this.start_link.click(
|
754
|
+
function() {
|
755
|
+
context.start();
|
756
|
+
}
|
757
|
+
);
|
758
|
+
this.stop_link.click(
|
759
|
+
function() {
|
760
|
+
context.stop();
|
761
|
+
}
|
762
|
+
);
|
763
|
+
$(document).keydown(
|
764
|
+
function(e) {
|
765
|
+
if(e.keyCode == 83) {
|
766
|
+
// 's'
|
767
|
+
if(context.running) {
|
768
|
+
context.stop();
|
769
|
+
} else {
|
770
|
+
context.start();
|
771
|
+
};
|
772
|
+
};
|
773
|
+
}
|
774
|
+
);
|
775
|
+
return this.controls;
|
776
|
+
},
|
777
|
+
disable: function() {
|
778
|
+
this.enabled = false;
|
779
|
+
this.stop();
|
780
|
+
this.controls.hide();
|
781
|
+
},
|
782
|
+
enable: function() {
|
783
|
+
this.enabled = true;
|
784
|
+
this.controls.show();
|
785
|
+
},
|
786
|
+
toggle: function() {
|
787
|
+
if(this.enabled) {
|
788
|
+
this.disable();
|
789
|
+
} else {
|
790
|
+
this.enable();
|
791
|
+
};
|
792
|
+
},
|
793
|
+
start: function() {
|
794
|
+
if(this.running || !this.enabled) return false;
|
795
|
+
var context = this;
|
796
|
+
this.running = true;
|
797
|
+
this.controls.addClass('ad-slideshow-running');
|
798
|
+
this._next();
|
799
|
+
this.fireCallback(this.settings.onStart);
|
800
|
+
return true;
|
801
|
+
},
|
802
|
+
stop: function() {
|
803
|
+
if(!this.running) return false;
|
804
|
+
this.running = false;
|
805
|
+
this.countdown.hide();
|
806
|
+
this.controls.removeClass('ad-slideshow-running');
|
807
|
+
clearInterval(this.countdown_interval);
|
808
|
+
this.fireCallback(this.settings.onStop);
|
809
|
+
return true;
|
810
|
+
},
|
811
|
+
_next: function() {
|
812
|
+
var context = this;
|
813
|
+
var pre = this.settings.countdown_prefix;
|
814
|
+
var su = this.settings.countdown_sufix;
|
815
|
+
clearInterval(context.countdown_interval);
|
816
|
+
this.countdown.show().html(pre + (this.settings.speed / 1000) + su);
|
817
|
+
var slide_timer = 0;
|
818
|
+
this.countdown_interval = setInterval(
|
819
|
+
function() {
|
820
|
+
slide_timer += 1000;
|
821
|
+
if(slide_timer >= context.settings.speed) {
|
822
|
+
var whenNextIsShown = function() {
|
823
|
+
// A check so the user hasn't stoped the slideshow during the
|
824
|
+
// animation
|
825
|
+
if(context.running) {
|
826
|
+
context._next();
|
827
|
+
};
|
828
|
+
slide_timer = 0;
|
829
|
+
};
|
830
|
+
if(!context.nextimage_callback(whenNextIsShown)) {
|
831
|
+
context.stop();
|
832
|
+
};
|
833
|
+
slide_timer = 0;
|
834
|
+
};
|
835
|
+
var sec = parseInt(context.countdown.text().replace(/[^0-9]/g, ''), 10);
|
836
|
+
sec--;
|
837
|
+
if(sec > 0) {
|
838
|
+
context.countdown.html(pre + sec + su);
|
839
|
+
};
|
840
|
+
},
|
841
|
+
1000
|
842
|
+
);
|
843
|
+
},
|
844
|
+
fireCallback: function(fn) {
|
845
|
+
if($.isFunction(fn)) {
|
846
|
+
fn.call(this);
|
847
|
+
};
|
848
|
+
}
|
849
|
+
};
|
850
|
+
})(jQuery);
|