aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-10-25 20:03:20 -0200
committerSilvio <silvio@devlet.com.br>2010-10-25 20:03:20 -0200
commit67f21bac493fb11384308f032500be62f7988fb4 (patch)
treebb7cef81ed8bc77f93bc0042716d827b032cbc20 /js
parente75c2551083d4a4dd524e443898dc17bb70eeaed (diff)
downloadjquery_gallery_view-67f21bac493fb11384308f032500be62f7988fb4.tar.gz
jquery_gallery_view-67f21bac493fb11384308f032500be62f7988fb4.tar.bz2
Code cleanup
Diffstat (limited to 'js')
-rw-r--r--js/jquery_gallery_view.js66
1 files changed, 18 insertions, 48 deletions
diff --git a/js/jquery_gallery_view.js b/js/jquery_gallery_view.js
index 032c8e0..e0faa8e 100644
--- a/js/jquery_gallery_view.js
+++ b/js/jquery_gallery_view.js
@@ -1,52 +1,22 @@
// $Id$
Drupal.behaviors.jqueryGalleryViewBehavior = function (context) {
- // Add custom site title class
- $('.views-field-title').attr('class', 'views-field-site-title');
-
- // Add photos
- if (Drupal.settings.jqueryGalleryView != null && Drupal.settings.jqueryGalleryView.photos != null) {
- var photos = Drupal.settings.jqueryGalleryView.photos;
-
- // Image sizes
- var width = 300;
- var height = 200;
-
- // Image paths
- var base_url = window.location.protocol + '//' + window.location.hostname;
- var files = Drupal.settings.jqueryGalleryView.photos;
- var base_location = base_url + '/' + Drupal.settings.basePath + files + '/';
- var imagecache = 'imagecache/' + width + 'x' + height + '/';
- var image_folder = base_location + imagecache + '/';
-
- // Other variables
- var panel = new String();
- var file = new String();
- var title = new String();
-
- // Setup panels and fimstrip
- for(i=0; i<photos.length; i++)
- {
- // Build elements
- file = photos[i]['filename'];
- title = photos[i]['title'];
- panel = '<li><span class="panel-overlay">' + title +
- '</span><img src="' + image_folder + file +'" /></li>';
-
- // Add to the gallery
- $('#jquery-gallery-view').append(panel);
- }
-
- // Add gallery view
- $('#jquery-gallery-view').galleryView({
- panel_width: 300,
- panel_height: 250,
- frame_width: 100,
- frame_height: 50,
- filmstrip_position: 'bottom',
- overlay_position: 'top',
- transition_interval: 0,
- fade_panels: false,
- });
- }
+ var width = 300;
+ var height = 200;
+ var base_url = window.location.protocol + '//' + window.location.hostname;
+
+ $('.jquery-gallery-view:not(.jquery-gallery-view-processed)', context).each(function () {
+ $(this).addClass('jquery-gallery-view-processed');
+ $('#jquery-gallery-view').load(base_url + '/jquery_gallery_view', function() {
+ $('#jquery-gallery-view').galleryView({
+ panel_width: 300,
+ panel_height: 100,
+ frame_width: 65,
+ frame_height: 40,
+ filmstrip_position: 'bottom',
+ overlay_position: 'top',
+ transition_interval: 0,
+ });
+ });
+ });
}