1/** 2 * @file 3 * Views Slideshow Xtra Javascript. 4 */ 5(function ($) { 6 Drupal.viewsSlideshowXtra = Drupal.viewsSlideshowXtra || {}; 7 var pageX = 0, pageY = 0, timeout; 8 Drupal.viewsSlideshowXtra.transitionBegin = function (options) { 9 10 // Find our views slideshow xtra elements 11 $('[id^="views-slideshow-xtra-"]:not(.views-slideshow-xtra-processed)').addClass('views-slideshow-xtra-processed').each(function() { 12 13 // Get the slide box. 14 var slideArea = $(this).parent().parent().find('.views_slideshow_main'); 15 16 // Remove the views slideshow xtra html from the dom 17 var xtraHTML = $(this).detach(); 18 19 // Attach the views slideshow xtra html to below the main slide. 20 $(xtraHTML).appendTo(slideArea); 21 22 // Get the offsets of the slide and the views slideshow xtra elements 23 var slideAreaOffset = slideArea.offset(); 24 var xtraOffset = $(this).offset(); 25 26 // Move the views slideshow xtra element over the top of the slide. 27 var marginMove = slideAreaOffset.top - xtraOffset.top; 28 $(this).css({'margin-top': marginMove + 'px'}); 29 30 // Move type=text slide elements into place. 31 var slideData = Drupal.settings.viewsSlideshowXtra[options.slideshowID].slideInfo.text; 32 var slideNum = 0; 33 for (slide in slideData) { 34 var items = slideData[slide]; 35 var itemNum = 0; 36 for (item in items) { 37 //alert('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-text-' + slideNum + '-' + itemNum); 38 $('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-text-' + slideNum + '-' + itemNum).css({ 39 'width': slideArea.width() 40 }); 41 itemNum++; 42 } 43 slideNum++; 44 } 45 46 // Move type=link slide elements into place. 47 var slideData = Drupal.settings.viewsSlideshowXtra[options.slideshowID].slideInfo.link; 48 var slideNum = 0; 49 for (slide in slideData) { 50 var items = slideData[slide]; 51 var itemNum = 0; 52 for (item in items) { 53 //alert('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-link-' + slideNum + '-' + itemNum); 54 $('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-link-' + slideNum + '-' + itemNum).css({ 55 'width': slideArea.width() 56 }); 57 itemNum++; 58 } 59 slideNum++; 60 } 61 62 // Move type=image slide elements into place. 63 var slideData = Drupal.settings.viewsSlideshowXtra[options.slideshowID].slideInfo.image; 64 var slideNum = 0; 65 for (slide in slideData) { 66 var items = slideData[slide]; 67 var itemNum = 0; 68 for (item in items) { 69 //alert('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-image-' + slideNum + '-' + itemNum); 70 $('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-image-' + slideNum + '-' + itemNum).css({ 71 'width': slideArea.width() 72 }); 73 itemNum++; 74 } 75 slideNum++; 76 } 77 78 var settings = Drupal.settings.viewsSlideshowXtra[options.slideshowID]; 79 if (settings.pauseAfterMouseMove) { 80 //if(true) { 81 slideArea.mousemove(function(e) { 82 if (pageX - e.pageX > 5 || pageY - e.pageY > 5) { 83 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": options.slideshowID }); 84 clearTimeout(timeout); 85 timeout = setTimeout(function() { 86 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": options.slideshowID }); 87 }, 2000); 88 } 89 pageX = e.pageX; 90 pageY = e.pageY; 91 }); 92 } 93 94 }); 95 96 // TODO Find a better way to detect if xtra module is enabled but this is not 97 // an xtra slideshow. This seems to work but its probably not the right way. 98 //if (Drupal.settings.viewsSlideshowXtra[options.slideshowID]) { THIS DOES NOT WORK! 99 if ('viewsSlideshowXtra' in Drupal.settings) { 100 var settings = Drupal.settings.viewsSlideshowXtra[options.slideshowID]; 101 102 // Hide elements either by fading or not 103 if (settings.displayDelayFade) {
104 $('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-row').fadeOut(); 105 } 106 else { 107 $('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-row').hide(); 108 } 109 110 settings.currentTransitioningSlide = options.slideNum; 111 112 // Pause from showing the text and links however long the user decides. 113 setTimeout(function() { 114 if (options.slideNum == settings.currentTransitioningSlide) { 115 if (settings.displayDelayFade) { 116 $('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-row-' + options.slideNum).fadeIn(); 117 } 118 else { 119 $('#views-slideshow-xtra-' + options.slideshowID + ' .views-slideshow-xtra-row-' + options.slideNum).show(); 120 } 121 } 122 }, 123 settings.displayDelay 124 ); 125 126 } 127 }; 128})(jQuery); 129 130/* 131*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.