aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jquery_gallery_view.module16
-rw-r--r--js/jquery_gallery_view.js2
2 files changed, 12 insertions, 6 deletions
diff --git a/jquery_gallery_view.module b/jquery_gallery_view.module
index 3faec25..4799101 100644
--- a/jquery_gallery_view.module
+++ b/jquery_gallery_view.module
@@ -13,7 +13,7 @@
* View data.
*/
function jquery_gallery_view_setup_photos($view, $field) {
- // Setup files folder
+ // Setup files folder.
$files = variable_get('file_directory_path', conf_path() .'/files');
foreach ($view->result as $result) {
@@ -28,9 +28,15 @@ function jquery_gallery_view_setup_photos($view, $field) {
}
}
- // Add needed javascript
+ // Add needed javascript.
drupal_add_js(array('jqueryGalleryView' => array('photos' => $photos)), 'setting');
- drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/jquery-galleryview.js');
- drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/jquery-galleryview/jquery.galleryview-2.1.1-pack.js');
- drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/jquery-galleryview/jquery.timers-1.2.js');
+}
+
+/**
+ * Load needed javascript files.
+ */
+function jquery_gallery_view_load() {
+ drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/jquery_gallery_view.js');
+ drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/galleryview/jquery.galleryview-2.1.1-pack.js');
+ drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/galleryview/jquery.timers-1.2.js');
}
diff --git a/js/jquery_gallery_view.js b/js/jquery_gallery_view.js
index 8ac3219..032c8e0 100644
--- a/js/jquery_gallery_view.js
+++ b/js/jquery_gallery_view.js
@@ -5,7 +5,7 @@ Drupal.behaviors.jqueryGalleryViewBehavior = function (context) {
$('.views-field-title').attr('class', 'views-field-site-title');
// Add photos
- if (Drupal.settings.jqueryGalleryView.photos != null) {
+ if (Drupal.settings.jqueryGalleryView != null && Drupal.settings.jqueryGalleryView.photos != null) {
var photos = Drupal.settings.jqueryGalleryView.photos;
// Image sizes