intesys_asset_manager 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +127 -0
- data/Rakefile +31 -0
- data/app/assets/images/loader.gif +0 -0
- data/app/assets/javascripts/asset_manager.js.coffee +149 -0
- data/app/assets/stylesheets/asset_manager.css.sass +85 -0
- data/app/assets/stylesheets/asset_manager/base/colors.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/base/fonts.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/controllers/asset_categories.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/controllers/assets.css.sass +104 -0
- data/app/assets/stylesheets/asset_manager/controllers/index.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/layout/footer.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/layout/generic.css.sass +17 -0
- data/app/assets/stylesheets/asset_manager/layout/header.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/layout/main.css.sass +26 -0
- data/app/assets/stylesheets/asset_manager/modules/alerts.css.sass +3 -0
- data/app/assets/stylesheets/asset_manager/modules/btn_group.css.sass +3 -0
- data/app/assets/stylesheets/asset_manager/modules/page_header.sass +12 -0
- data/app/assets/stylesheets/asset_manager/modules/quick_upload.css.sass +26 -0
- data/app/assets/stylesheets/asset_manager/modules/translations.css.sass +4 -0
- data/app/assets/stylesheets/asset_manager/plugins/plugins.css.sass +7 -0
- data/app/assets/stylesheets/asset_manager/resources/asset_categories/asset_category.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/resources/asset_instances/asset_instance.css.sass +4 -0
- data/app/assets/stylesheets/asset_manager/resources/assets/asset.css.sass +35 -0
- data/app/assets/stylesheets/asset_manager/resources/resource/resource.css.sass +0 -0
- data/app/controllers/asset_manager/application_controller.rb +4 -0
- data/app/controllers/asset_manager/asset_categories_controller.rb +56 -0
- data/app/controllers/asset_manager/asset_instances_controller.rb +22 -0
- data/app/controllers/asset_manager/assets_controller.rb +122 -0
- data/app/controllers/asset_manager/index_controller.rb +8 -0
- data/app/helpers/asset_manager/application_helper.rb +9 -0
- data/app/helpers/asset_manager/asset_instances_helper.rb +59 -0
- data/app/helpers/asset_manager/assets_helper.rb +145 -0
- data/app/helpers/asset_manager/links_helper.rb +21 -0
- data/app/inputs/asset_manager_input.rb +27 -0
- data/app/models/asset_manager/asset.rb +99 -0
- data/app/models/asset_manager/asset_association.rb +15 -0
- data/app/models/asset_manager/asset_category.rb +22 -0
- data/app/models/asset_manager/asset_instance.rb +33 -0
- data/app/models/asset_manager/asset_private_instance.rb +6 -0
- data/app/models/asset_manager/asset_public_instance.rb +6 -0
- data/app/uploaders/asset_manager/asset_private_uploader.rb +9 -0
- data/app/uploaders/asset_manager/asset_public_uploader.rb +12 -0
- data/app/uploaders/asset_manager/asset_uploader.rb +36 -0
- data/app/views/admin/asset_manager/assets/_asset.html.haml +7 -0
- data/app/views/admin/asset_manager/assets/_assets.html.haml +2 -0
- data/app/views/asset_manager/asset_categories/_form.html.haml +10 -0
- data/app/views/asset_manager/asset_categories/_translated_fields.html.haml +3 -0
- data/app/views/asset_manager/asset_categories/edit.html.haml +8 -0
- data/app/views/asset_manager/asset_categories/index.html.haml +43 -0
- data/app/views/asset_manager/asset_categories/new.html.haml +4 -0
- data/app/views/asset_manager/asset_categories/show.html.haml +30 -0
- data/app/views/asset_manager/asset_instances/_asset_instance.html.haml +14 -0
- data/app/views/asset_manager/asset_instances/_asset_instance_as_flag.html.haml +3 -0
- data/app/views/asset_manager/asset_instances/_asset_instances.html.haml +5 -0
- data/app/views/asset_manager/asset_instances/_asset_instances_as_flag.html.haml +12 -0
- data/app/views/asset_manager/assets/_asset.html.haml +3 -0
- data/app/views/asset_manager/assets/_asset_draggable.html.haml +8 -0
- data/app/views/asset_manager/assets/_asset_group_by_instance_context.html.haml +7 -0
- data/app/views/asset_manager/assets/_asset_instance_fields.haml +10 -0
- data/app/views/asset_manager/assets/_assets.html.haml +4 -0
- data/app/views/asset_manager/assets/_assets_draggable.html.haml +7 -0
- data/app/views/asset_manager/assets/_form.html.haml +63 -0
- data/app/views/asset_manager/assets/_new_actions.html.haml +8 -0
- data/app/views/asset_manager/assets/_quick_upload.html.haml +20 -0
- data/app/views/asset_manager/assets/_translated_fields.html.haml +4 -0
- data/app/views/asset_manager/assets/edit.html.haml +6 -0
- data/app/views/asset_manager/assets/index.html.haml +68 -0
- data/app/views/asset_manager/assets/new.html.haml +4 -0
- data/app/views/asset_manager/assets/quick_upload.js.erb +7 -0
- data/app/views/asset_manager/assets/select.html.haml +57 -0
- data/app/views/asset_manager/assets/select.js.erb +1 -0
- data/app/views/asset_manager/assets/show.html.haml +51 -0
- data/app/views/asset_manager/index/index.html.haml +6 -0
- data/app/views/asset_manager/partials/_form_errors.html.haml +7 -0
- data/app/views/asset_manager/partials/_locales_tabs.html.haml +4 -0
- data/app/views/asset_manager/partials/_pagination_status.html.haml +2 -0
- data/app/views/layouts/asset_manager/_base.html.haml +6 -0
- data/app/views/layouts/asset_manager/application.html.haml +15 -0
- data/app/views/layouts/asset_manager/partials/_flash_messages.html.haml +4 -0
- data/app/views/layouts/asset_manager/partials/_head.html.haml +11 -0
- data/app/views/layouts/asset_manager/partials/_header.html.haml +15 -0
- data/app/views/layouts/asset_manager/simple.html.haml +4 -0
- data/config/locales/en.yml +179 -0
- data/config/locales/it.yml +181 -0
- data/config/routes.rb +20 -0
- data/db/migrate/20120919130657_asset_manager_init.rb +44 -0
- data/db/migrate/20121005072255_acts_as_taggable_on_migration.rb +30 -0
- data/db/migrate/20121102141009_add_file_type_to_asset.rb +5 -0
- data/db/migrate/20130417082644_asset_manager_add_index_to_foreign_keys.rb +5 -0
- data/db/migrate/20140512090936_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/db/migrate/20140512090937_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/lib/asset_manager.rb +57 -0
- data/lib/asset_manager/all.rb +5 -0
- data/lib/asset_manager/engine.rb +29 -0
- data/lib/asset_manager/extensions/active_record.rb +152 -0
- data/lib/asset_manager/extensions/all.rb +1 -0
- data/lib/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
- data/lib/assets/images/bootstrap/glyphicons-halflings.png +0 -0
- data/lib/assets/javascripts/bootstrap2/bootstrap.js +2280 -0
- data/lib/assets/stylesheets/bootstrap2/bootstrap-responsive.css +1109 -0
- data/lib/assets/stylesheets/bootstrap2/bootstrap.css.erb +6167 -0
- data/lib/custom_versions.rb +20 -0
- data/lib/deprecated.rb +61 -0
- data/lib/intesys_asset_manager.rb +1 -0
- data/lib/intesys_asset_manager/version.rb +3 -0
- data/lib/tasks/asset_manager_tasks.rake +32 -0
- data/lib/touch_translation.rb +18 -0
- data/lib/translations.rb +19 -0
- data/spec/controllers/asset_manager/asset_categories_controller_spec.rb +164 -0
- data/spec/controllers/asset_manager/assets_controller_spec.rb +164 -0
- data/spec/controllers/asset_manager/index_controller_spec.rb +12 -0
- data/spec/factories/asset_manager_asset_associations.rb +10 -0
- data/spec/factories/asset_manager_asset_categories.rb +7 -0
- data/spec/factories/asset_manager_asset_instances.rb +9 -0
- data/spec/factories/asset_manager_assets.rb +8 -0
- data/spec/helpers/asset_manager/asset_categories_helper_spec.rb +5 -0
- data/spec/helpers/asset_manager/assets_helper_spec.rb +5 -0
- data/spec/helpers/asset_manager/index_helper_spec.rb +5 -0
- data/spec/models/asset_manager/asset_association_spec.rb +5 -0
- data/spec/models/asset_manager/asset_category_spec.rb +5 -0
- data/spec/models/asset_manager/asset_instance_spec.rb +7 -0
- data/spec/models/asset_manager/asset_spec.rb +5 -0
- data/spec/requests/asset_manager/asset_manager_asset_categories_spec.rb +11 -0
- data/spec/requests/asset_manager/asset_manager_assets_spec.rb +11 -0
- data/spec/routing/asset_manager/asset_categories_routing_spec.rb +35 -0
- data/spec/routing/asset_manager/assets_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/capybara.rb +8 -0
- data/spec/views/asset_manager/asset_categories/edit.html.haml_spec.rb +15 -0
- data/spec/views/asset_manager/asset_categories/index.html.haml_spec.rb +15 -0
- data/spec/views/asset_manager/asset_categories/new.html.haml_spec.rb +15 -0
- data/spec/views/asset_manager/asset_categories/show.html.haml_spec.rb +12 -0
- data/spec/views/asset_manager/assets/edit.html.haml_spec.rb +20 -0
- data/spec/views/asset_manager/assets/index.html.haml_spec.rb +23 -0
- data/spec/views/asset_manager/assets/new.html.haml_spec.rb +20 -0
- data/spec/views/asset_manager/assets/show.html.haml_spec.rb +17 -0
- data/spec/views/asset_manager/index/index.html.haml_spec.rb +5 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/aac.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/ai.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/aif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/asp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/aspx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/avi.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/bin.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/bmp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/css.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/db.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/default.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/dll.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/dll2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/doc.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/eps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/exe1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/exe2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/fav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericBlue.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericGray.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericOrange.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericRed.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericTurquesa.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/gif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/gz.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/help.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/help2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/hqx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/html.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/htmlFirefox.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/htmlIE.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/htmlSafari1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/htmlSafari2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/jpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/js.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mov.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mov2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mp2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mp3.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mp4.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/pdf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/php.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/pic.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/png.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/pps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/ppt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/psd.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/rar.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/rb.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/rtf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/template.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/tif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/ttf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/txt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/vbs.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/vbs2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/warning.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/wav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/xls.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/xml.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/zip.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/zip2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/aac.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/ai.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/aif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/asp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/aspx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/avi.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/bin.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/bmp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/css.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/db.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/default.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/dll.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/dll2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/doc.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/eps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/exe1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/exe2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/fav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericBlue.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericGray.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericOrange.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericRed.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericTurquesa.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/gif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/gz.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/help.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/help2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/hqx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/html.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/htmlFirefox.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/htmlIE.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/htmlSafari1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/htmlSafari2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/jpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/js.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mov.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mov2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mp2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mp3.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mp4.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/pdf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/php.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/pic.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/png.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/pps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/ppt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/psd.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/rar.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/rb.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/rtf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/template.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/tif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/ttf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/txt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/vbs.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/vbs2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/warning.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/wav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/xls.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/xml.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/zip.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/zip2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/aac.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/ai.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/aif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/asp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/aspx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/avi.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/bin.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/bmp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/css.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/db.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/default.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/dll.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/dll2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/doc.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/eps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/exe1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/exe2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/fav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericBlue.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericGray.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericOrange.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericRed.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericTurquesa.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/gif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/gz.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/help.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/help2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/hqx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/html.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/htmlFirefox.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/htmlIE.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/htmlSafari1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/htmlSafari2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/jpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/js.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mov.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mov2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mp2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mp3.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mp4.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/pdf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/php.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/pic.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/png.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/pps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/ppt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/psd.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/rar.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/rb.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/rtf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/tif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/ttf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/txt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/vbs.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/vbs2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/warning.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/wav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/xls.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/xml.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/zip.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/zip2.png +0 -0
- data/vendor/assets/images/blank.gif +0 -0
- data/vendor/assets/images/clippy.swf +0 -0
- data/vendor/assets/images/fancybox_buttons.png +0 -0
- data/vendor/assets/images/fancybox_loading.gif +0 -0
- data/vendor/assets/images/fancybox_loading@2x.gif +0 -0
- data/vendor/assets/images/fancybox_overlay.png +0 -0
- data/vendor/assets/images/fancybox_sprite.png +0 -0
- data/vendor/assets/images/fancybox_sprite@2x.png +0 -0
- data/vendor/assets/images/ias/loader.gif +0 -0
- data/vendor/assets/javascripts/ias/jquery.ias.js +620 -0
- data/vendor/assets/stylesheets/ias/jquery.ias.css +8 -0
- metadata +748 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,620 @@
|
|
1
|
+
/*!
|
2
|
+
* Infinite Ajax Scroll, a jQuery plugin
|
3
|
+
* Version v0.1.6
|
4
|
+
* http://webcreate.nl/
|
5
|
+
*
|
6
|
+
* Copyright (c) 2011-2012 Jeroen Fiege
|
7
|
+
* Licensed under the MIT License:
|
8
|
+
* http://webcreate.nl/license
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function($) {
|
12
|
+
$.ias = function(options)
|
13
|
+
{
|
14
|
+
// setup
|
15
|
+
var opts = $.extend({}, $.ias.defaults, options);
|
16
|
+
var util = new $.ias.util(); // utilities module
|
17
|
+
var paging = new $.ias.paging(opts.scrollContainer); // paging module
|
18
|
+
var hist = (opts.history ? new $.ias.history() : false); // history module
|
19
|
+
var _self = this;
|
20
|
+
|
21
|
+
// initialize
|
22
|
+
init();
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Initialize
|
26
|
+
*
|
27
|
+
* - tracks scrolling through pages
|
28
|
+
* - remembers current page with the history module
|
29
|
+
* - setup scroll event and hides pagination element
|
30
|
+
* - loads and scrolls to previous page when we have something in our history
|
31
|
+
*
|
32
|
+
* @return self
|
33
|
+
*/
|
34
|
+
function init()
|
35
|
+
{
|
36
|
+
// track page number changes
|
37
|
+
paging.onChangePage(function(pageNum, scrollOffset, pageUrl) {
|
38
|
+
if (hist) hist.setPage(pageNum, pageUrl);
|
39
|
+
|
40
|
+
// call onPageChange event
|
41
|
+
opts.onPageChange.call(this, pageNum, pageUrl, scrollOffset);
|
42
|
+
});
|
43
|
+
|
44
|
+
// setup scroll and hide pagination
|
45
|
+
reset();
|
46
|
+
|
47
|
+
// load and scroll to previous page
|
48
|
+
if (hist && hist.havePage()) {
|
49
|
+
stop_scroll();
|
50
|
+
|
51
|
+
pageNum = hist.getPage();
|
52
|
+
|
53
|
+
util.forceScrollTop(function() {
|
54
|
+
if (pageNum > 1) {
|
55
|
+
paginateToPage(pageNum);
|
56
|
+
|
57
|
+
curTreshold = get_scroll_treshold(true);
|
58
|
+
$("html,body").scrollTop(curTreshold);
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
reset();
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
|
66
|
+
return _self;
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Reset scrolling and hide pagination links
|
71
|
+
*
|
72
|
+
* @return void
|
73
|
+
*/
|
74
|
+
function reset()
|
75
|
+
{
|
76
|
+
hide_pagination();
|
77
|
+
|
78
|
+
opts.scrollContainer.scroll(scroll_handler);
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Scroll event handler
|
83
|
+
*
|
84
|
+
* @return void
|
85
|
+
*/
|
86
|
+
function scroll_handler()
|
87
|
+
{
|
88
|
+
// the way we calculate if have to load the next page depend on which container we have
|
89
|
+
if (opts.scrollContainer == $.ias.defaults.scrollContainer){
|
90
|
+
scrTop = opts.scrollContainer.scrollTop();
|
91
|
+
} else{
|
92
|
+
scrTop = opts.scrollContainer.offset().top;
|
93
|
+
}
|
94
|
+
|
95
|
+
wndHeight = opts.scrollContainer.height();
|
96
|
+
|
97
|
+
curScrOffset = scrTop + wndHeight;
|
98
|
+
|
99
|
+
if (curScrOffset >= get_scroll_treshold()) {
|
100
|
+
paginate(curScrOffset);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Cancel scrolling
|
106
|
+
*
|
107
|
+
* @return void
|
108
|
+
*/
|
109
|
+
function stop_scroll()
|
110
|
+
{
|
111
|
+
opts.scrollContainer.unbind('scroll', scroll_handler);
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Hide pagination
|
116
|
+
*
|
117
|
+
* @return void
|
118
|
+
*/
|
119
|
+
function hide_pagination()
|
120
|
+
{
|
121
|
+
$(opts.pagination).hide();
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Get scroll treshold based on the last item element
|
126
|
+
*
|
127
|
+
* @param boolean pure indicates if the tresholdMargin should be applied
|
128
|
+
* @return integer treshold
|
129
|
+
*/
|
130
|
+
function get_scroll_treshold(pure)
|
131
|
+
{
|
132
|
+
el = $(opts.container).find(opts.item).last();
|
133
|
+
|
134
|
+
if (el.size() == 0) return 0;
|
135
|
+
|
136
|
+
treshold = el.offset().top + el.height();
|
137
|
+
|
138
|
+
if (!pure)
|
139
|
+
treshold += opts.tresholdMargin;
|
140
|
+
|
141
|
+
return treshold;
|
142
|
+
}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Load the items from the next page.
|
146
|
+
*
|
147
|
+
* @param int curScrOffset current scroll offset
|
148
|
+
* @param function onCompleteHandler callback function
|
149
|
+
* @return void
|
150
|
+
*/
|
151
|
+
function paginate(curScrOffset, onCompleteHandler)
|
152
|
+
{
|
153
|
+
urlNextPage = $(opts.next).attr("href");
|
154
|
+
if (!urlNextPage) return stop_scroll();
|
155
|
+
|
156
|
+
if (opts.beforePageChange && $.isFunction(opts.beforePageChange)) {
|
157
|
+
if (opts.beforePageChange(curScrOffset, urlNextPage) === false) return;
|
158
|
+
}
|
159
|
+
|
160
|
+
paging.pushPages(curScrOffset, urlNextPage);
|
161
|
+
|
162
|
+
stop_scroll();
|
163
|
+
show_loader();
|
164
|
+
|
165
|
+
loadItems(urlNextPage, function(data, items) {
|
166
|
+
// call the onLoadItems callback
|
167
|
+
result = opts.onLoadItems.call(this, items);
|
168
|
+
|
169
|
+
if (result !== false) {
|
170
|
+
$(items).hide(); // at first, hide it so we can fade it in later
|
171
|
+
|
172
|
+
// insert them after the last item with a nice fadeIn effect
|
173
|
+
curLastItem = $(opts.container).find(opts.item).last();
|
174
|
+
curLastItem.after(items);
|
175
|
+
$(items).fadeIn();
|
176
|
+
}
|
177
|
+
|
178
|
+
// update pagination
|
179
|
+
$(opts.pagination).replaceWith($(opts.pagination, data));
|
180
|
+
|
181
|
+
remove_loader();
|
182
|
+
reset();
|
183
|
+
|
184
|
+
// call the onRenderComplete callback
|
185
|
+
opts.onRenderComplete.call(this, items);
|
186
|
+
|
187
|
+
if (onCompleteHandler) onCompleteHandler.call(this);
|
188
|
+
});
|
189
|
+
}
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Loads items from certain url, triggers
|
193
|
+
* onComplete handler when finished
|
194
|
+
*
|
195
|
+
* @param string the url to load
|
196
|
+
* @param function the callback function
|
197
|
+
* @return void
|
198
|
+
*/
|
199
|
+
function loadItems(url, onCompleteHandler)
|
200
|
+
{
|
201
|
+
var items = [];
|
202
|
+
|
203
|
+
$.get(url, null, function(data) {
|
204
|
+
// walk through the items on the next page
|
205
|
+
// and add them to the items array
|
206
|
+
container = $(opts.container, data).eq(0);
|
207
|
+
if (0 == container.length) {
|
208
|
+
// incase the element is a root element (body > element),
|
209
|
+
// try to filter it
|
210
|
+
container = $(data).filter(opts.container).eq(0);
|
211
|
+
}
|
212
|
+
|
213
|
+
if (container) {
|
214
|
+
container.find(opts.item).each(function() {
|
215
|
+
items.push(this);
|
216
|
+
});
|
217
|
+
}
|
218
|
+
|
219
|
+
if (onCompleteHandler) onCompleteHandler.call(this, data, items);
|
220
|
+
}, "html");
|
221
|
+
}
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Paginate to a certain page number.
|
225
|
+
*
|
226
|
+
* - keeps paginating till the pageNum is reached
|
227
|
+
*
|
228
|
+
* @return void
|
229
|
+
*/
|
230
|
+
function paginateToPage(pageNum)
|
231
|
+
{
|
232
|
+
curTreshold = get_scroll_treshold(true);
|
233
|
+
|
234
|
+
if (curTreshold > 0) {
|
235
|
+
paginate(curTreshold, function() {
|
236
|
+
stop_scroll();
|
237
|
+
|
238
|
+
if ((paging.getCurPageNum(curTreshold) + 1) < pageNum) {
|
239
|
+
paginateToPage(pageNum);
|
240
|
+
|
241
|
+
$("html,body").animate({"scrollTop": curTreshold}, 400, "swing");
|
242
|
+
}
|
243
|
+
else {
|
244
|
+
$("html,body").animate({"scrollTop": curTreshold}, 1000, "swing");
|
245
|
+
|
246
|
+
reset();
|
247
|
+
}
|
248
|
+
});
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Return the active loader or creates a new loader
|
254
|
+
*
|
255
|
+
* @return object loader jquery object
|
256
|
+
*/
|
257
|
+
function get_loader()
|
258
|
+
{
|
259
|
+
loader = $(".ias_loader");
|
260
|
+
|
261
|
+
if (loader.size() == 0) {
|
262
|
+
loader = $("<div class='ias_loader'>"+opts.loader+"</div>");
|
263
|
+
loader.hide();
|
264
|
+
}
|
265
|
+
return loader;
|
266
|
+
}
|
267
|
+
|
268
|
+
/**
|
269
|
+
* Inserts the loader and does a fadeIn.
|
270
|
+
*
|
271
|
+
* @return void
|
272
|
+
*/
|
273
|
+
function show_loader()
|
274
|
+
{
|
275
|
+
loader = get_loader();
|
276
|
+
|
277
|
+
if (opts.customLoaderProc !== false) {
|
278
|
+
opts.customLoaderProc(loader);
|
279
|
+
} else {
|
280
|
+
el = $(opts.container).find(opts.item).last();
|
281
|
+
el.after(loader);
|
282
|
+
loader.fadeIn();
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
/**
|
287
|
+
* Removes the loader.
|
288
|
+
*
|
289
|
+
* return void
|
290
|
+
*/
|
291
|
+
function remove_loader()
|
292
|
+
{
|
293
|
+
loader = get_loader();
|
294
|
+
loader.remove();
|
295
|
+
}
|
296
|
+
};
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Debug to console when available
|
300
|
+
*
|
301
|
+
* @param object $obj
|
302
|
+
* @return
|
303
|
+
*/
|
304
|
+
function debug($obj)
|
305
|
+
{
|
306
|
+
if (window.console && window.console.log)
|
307
|
+
window.console.log($obj);
|
308
|
+
};
|
309
|
+
|
310
|
+
// plugin defaults
|
311
|
+
$.ias.defaults = {
|
312
|
+
container: '#container',
|
313
|
+
scrollContainer: $(window),
|
314
|
+
item: '.item',
|
315
|
+
pagination: '#pagination',
|
316
|
+
next: '.next',
|
317
|
+
loader: '<img src="images/loader.gif"/>',
|
318
|
+
tresholdMargin: 0,
|
319
|
+
history : true,
|
320
|
+
onPageChange: function() {},
|
321
|
+
beforePageChange: function() {},
|
322
|
+
onLoadItems: function() {},
|
323
|
+
onRenderComplete: function() {},
|
324
|
+
customLoaderProc: false
|
325
|
+
};
|
326
|
+
|
327
|
+
// utility module
|
328
|
+
$.ias.util = function()
|
329
|
+
{
|
330
|
+
// setup
|
331
|
+
var wndIsLoaded = false;
|
332
|
+
var forceScrollTopIsCompleted = false;
|
333
|
+
var self = this;
|
334
|
+
|
335
|
+
// initialize
|
336
|
+
init();
|
337
|
+
|
338
|
+
/**
|
339
|
+
* Initialize
|
340
|
+
*
|
341
|
+
* @return void
|
342
|
+
*/
|
343
|
+
function init()
|
344
|
+
{
|
345
|
+
$(window).load(function () {
|
346
|
+
wndIsLoaded = true;
|
347
|
+
});
|
348
|
+
}
|
349
|
+
|
350
|
+
/**
|
351
|
+
* Force browsers to scroll to top.
|
352
|
+
*
|
353
|
+
* - When you hit back in you browser, it automatically scrolls
|
354
|
+
* back to the last position. There is no way to stop this
|
355
|
+
* in a nice way, so this function does it the hard way.
|
356
|
+
*
|
357
|
+
* @param function onComplete callback function
|
358
|
+
* @return void
|
359
|
+
*/
|
360
|
+
this.forceScrollTop = function(onCompleteHandler)
|
361
|
+
{
|
362
|
+
$("html,body").scrollTop(0);
|
363
|
+
|
364
|
+
if (!forceScrollTopIsCompleted) {
|
365
|
+
if (!wndIsLoaded) {
|
366
|
+
setTimeout(function() {self.forceScrollTop(onCompleteHandler); }, 1);
|
367
|
+
} else {
|
368
|
+
onCompleteHandler.call();
|
369
|
+
forceScrollTopIsCompleted = true;
|
370
|
+
}
|
371
|
+
}
|
372
|
+
};
|
373
|
+
};
|
374
|
+
|
375
|
+
// paging module
|
376
|
+
$.ias.paging = function()
|
377
|
+
{
|
378
|
+
// setup
|
379
|
+
var pagebreaks = [[0, document.location.toString()]];
|
380
|
+
var changePageHandler = function() {};
|
381
|
+
var lastPageNum = 1;
|
382
|
+
|
383
|
+
// initialize
|
384
|
+
init();
|
385
|
+
|
386
|
+
/**
|
387
|
+
* Initialize
|
388
|
+
*
|
389
|
+
* @return void
|
390
|
+
*/
|
391
|
+
function init()
|
392
|
+
{
|
393
|
+
$(window).scroll(scroll_handler);
|
394
|
+
}
|
395
|
+
|
396
|
+
/**
|
397
|
+
* Scroll handler
|
398
|
+
*
|
399
|
+
* - Triggers changePage event
|
400
|
+
*
|
401
|
+
* @return void
|
402
|
+
*/
|
403
|
+
function scroll_handler()
|
404
|
+
{
|
405
|
+
scrTop = $(window).scrollTop();
|
406
|
+
wndHeight = $(window).height();
|
407
|
+
|
408
|
+
curScrOffset = scrTop + wndHeight;
|
409
|
+
|
410
|
+
curPageNum = getCurPageNum(curScrOffset);
|
411
|
+
curPagebreak = getCurPagebreak(curScrOffset);
|
412
|
+
|
413
|
+
if (lastPageNum != curPageNum) {
|
414
|
+
changePageHandler.call(this, curPageNum, curPagebreak[0]/*scrOffset*/, curPagebreak[1]/*urlPage*/); // @todo fix for window height
|
415
|
+
}
|
416
|
+
|
417
|
+
lastPageNum = curPageNum;
|
418
|
+
}
|
419
|
+
|
420
|
+
/**
|
421
|
+
* Returns current page number based on scroll offset
|
422
|
+
*
|
423
|
+
* @param int scroll offset
|
424
|
+
* @return int current page number
|
425
|
+
*/
|
426
|
+
function getCurPageNum(scrollOffset)
|
427
|
+
{
|
428
|
+
for(i=(pagebreaks.length-1);i>0;i--) {
|
429
|
+
if (scrollOffset > pagebreaks[i][0]) {
|
430
|
+
return i + 1;
|
431
|
+
}
|
432
|
+
}
|
433
|
+
return 1;
|
434
|
+
}
|
435
|
+
|
436
|
+
/**
|
437
|
+
* Public function for getCurPageNum
|
438
|
+
*
|
439
|
+
* @return int current page number
|
440
|
+
*/
|
441
|
+
this.getCurPageNum = function(scrollOffset)
|
442
|
+
{
|
443
|
+
return getCurPageNum(scrollOffset);
|
444
|
+
};
|
445
|
+
|
446
|
+
/**
|
447
|
+
* Returns current pagebreak information based on scroll offset
|
448
|
+
*
|
449
|
+
* @param int scroll offset
|
450
|
+
* @return array pagebreak information
|
451
|
+
*/
|
452
|
+
function getCurPagebreak(scrollOffset)
|
453
|
+
{
|
454
|
+
for(i=(pagebreaks.length-1);i>=0;i--) {
|
455
|
+
if (scrollOffset > pagebreaks[i][0]) {
|
456
|
+
return pagebreaks[i];
|
457
|
+
}
|
458
|
+
}
|
459
|
+
return null;
|
460
|
+
};
|
461
|
+
|
462
|
+
/**
|
463
|
+
* Sets onchangePage event handler
|
464
|
+
*
|
465
|
+
* @param function event handler
|
466
|
+
* @return void
|
467
|
+
*/
|
468
|
+
this.onChangePage = function(fn)
|
469
|
+
{
|
470
|
+
changePageHandler = fn;
|
471
|
+
};
|
472
|
+
|
473
|
+
/**
|
474
|
+
* pushes the pages tracker
|
475
|
+
*
|
476
|
+
* @param int scroll offset for the new page
|
477
|
+
* @return void
|
478
|
+
*/
|
479
|
+
this.pushPages = function(scrollOffset, urlNextPage)
|
480
|
+
{
|
481
|
+
pagebreaks.push([scrollOffset, urlNextPage]);
|
482
|
+
};
|
483
|
+
};
|
484
|
+
|
485
|
+
// history module
|
486
|
+
$.ias.history = function()
|
487
|
+
{
|
488
|
+
// setup
|
489
|
+
var isPushed = false;
|
490
|
+
var isHtml5 = false;
|
491
|
+
|
492
|
+
// initialize
|
493
|
+
init();
|
494
|
+
|
495
|
+
/**
|
496
|
+
* Initialize
|
497
|
+
*
|
498
|
+
* @return void
|
499
|
+
*/
|
500
|
+
function init()
|
501
|
+
{
|
502
|
+
isHtml5 = !!(window.history && history.pushState && history.replaceState);
|
503
|
+
isHtml5 = false; // html5 functions disabled due to problems in chrome
|
504
|
+
};
|
505
|
+
|
506
|
+
/**
|
507
|
+
* Sets page to history
|
508
|
+
*
|
509
|
+
* @return void;
|
510
|
+
*/
|
511
|
+
this.setPage = function(pageNum, pageUrl)
|
512
|
+
{
|
513
|
+
this.updateState({page : pageNum}, "", pageUrl);
|
514
|
+
};
|
515
|
+
|
516
|
+
/**
|
517
|
+
* Checks if we have a page set in the history
|
518
|
+
*
|
519
|
+
* @return bool returns true when we have a previous page, false otherwise
|
520
|
+
*/
|
521
|
+
this.havePage = function()
|
522
|
+
{
|
523
|
+
return (this.getState() != false);
|
524
|
+
};
|
525
|
+
|
526
|
+
/**
|
527
|
+
* Gets the previous page from history
|
528
|
+
*
|
529
|
+
* @return int page number of previous page
|
530
|
+
*/
|
531
|
+
this.getPage = function()
|
532
|
+
{
|
533
|
+
if (this.havePage()) {
|
534
|
+
stateObj = this.getState();
|
535
|
+
return stateObj.page;
|
536
|
+
}
|
537
|
+
return 1;
|
538
|
+
};
|
539
|
+
|
540
|
+
/**
|
541
|
+
* Returns current state
|
542
|
+
*
|
543
|
+
* @return object stateObj
|
544
|
+
*/
|
545
|
+
this.getState = function()
|
546
|
+
{
|
547
|
+
if (isHtml5) {
|
548
|
+
stateObj = history.state;
|
549
|
+
if (stateObj && stateObj.ias) return stateObj.ias;
|
550
|
+
}
|
551
|
+
else {
|
552
|
+
haveState = (window.location.hash.substring(0, 7) == "#/page/");
|
553
|
+
if (haveState) {
|
554
|
+
pageNum = parseInt(window.location.hash.replace("#/page/", ""));
|
555
|
+
return { page : pageNum };
|
556
|
+
}
|
557
|
+
}
|
558
|
+
|
559
|
+
return false;
|
560
|
+
};
|
561
|
+
|
562
|
+
/**
|
563
|
+
* Pushes state when not pushed already, otherwise
|
564
|
+
* replaces the state.
|
565
|
+
*
|
566
|
+
* @param obj stateObj
|
567
|
+
* @param string title
|
568
|
+
* @param string url
|
569
|
+
* @return void
|
570
|
+
*/
|
571
|
+
this.updateState = function(stateObj, title, url)
|
572
|
+
{
|
573
|
+
if (isPushed) {
|
574
|
+
this.replaceState(stateObj, title, url);
|
575
|
+
}
|
576
|
+
else {
|
577
|
+
this.pushState(stateObj, title, url);
|
578
|
+
}
|
579
|
+
};
|
580
|
+
|
581
|
+
/**
|
582
|
+
* Pushes state to history.
|
583
|
+
*
|
584
|
+
* @param obj stateObj
|
585
|
+
* @param string title
|
586
|
+
* @param string url
|
587
|
+
* @return void
|
588
|
+
*/
|
589
|
+
this.pushState = function(stateObj, title, url)
|
590
|
+
{
|
591
|
+
if (isHtml5) {
|
592
|
+
history.pushState({ ias : stateObj }, title, url);
|
593
|
+
}
|
594
|
+
else {
|
595
|
+
hash = (stateObj.page > 0 ? "#/page/" + stateObj.page : "");
|
596
|
+
window.location.hash = hash;
|
597
|
+
}
|
598
|
+
|
599
|
+
isPushed = true;
|
600
|
+
};
|
601
|
+
|
602
|
+
/**
|
603
|
+
* Replaces current history state.
|
604
|
+
*
|
605
|
+
* @param obj stateObj
|
606
|
+
* @param string title
|
607
|
+
* @param string url
|
608
|
+
* @return void
|
609
|
+
*/
|
610
|
+
this.replaceState = function(stateObj, title, url)
|
611
|
+
{
|
612
|
+
if (isHtml5) {
|
613
|
+
history.replaceState({ ias : stateObj }, title, url);
|
614
|
+
}
|
615
|
+
else {
|
616
|
+
this.pushState(stateObj, title, url);
|
617
|
+
}
|
618
|
+
};
|
619
|
+
};
|
620
|
+
})(jQuery);
|