Advertisement
Guest User

Untitled

a guest
Apr 16th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Drupal.behaviors.mygallery = function (context) {
  2.  
  3.   $(".grid-video").each(function() {
  4.     console.log("Hey, we're being run after each ajax call!");
  5.   });
  6.  
  7.   // Load video on click, apply css (for png overlay)
  8.   $(".grid-video:not(.pv-processed)",context).each(function() {
  9.     $(this).addClass("pv-processed");
  10.     $(this).click(function() {
  11.       //if this is nowplaying, return. -- Prevents reloading a video.
  12.       if ( $(this).hasClass("nowplaying") ) {
  13.         return;
  14.       }
  15.       $(".nowplaying").removeClass("nowplaying");
  16.       var vidID = $(this).attr("data-ytid");
  17.       thismyytplayer = document.getElementById("myytplayer");
  18.       thismyytplayer.loadVideoById(vidID);
  19.       $("#player-body").html($(this).children(".videoInformation").html() );
  20.       $(this).addClass("nowplaying");
  21.     });
  22.   });
  23.  
  24.   // on exposed filter change, submit the form
  25.   $(".page-videos select[name='type']:not(.pv-processed)").each(function() {
  26.     $(this).addClass("pv-processed");
  27.     $(this).change( function() {
  28.       $("#views-exposed-form-product-video-gallery-default").submit();
  29.     });
  30.   });
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement