Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. // Fancybox Lightbox
  2. $('a[href*="youtu"]').each(function(){
  3. if($(this).attr('href').indexOf('somna') !== -1 || $(this).attr('href').indexOf('band') !== -1 || $(this).attr('href').indexOf('/channel/') !== -1 || $(this).attr('href').indexOf('/user/') !== -1){
  4. // Don't affect links to channel/user pages
  5. }else{
  6. $(this).attr('data-fancybox','video-gallery');
  7. }
  8. });
  9. $('a[href*="vimeo"]').each(function(){
  10. if($(this).attr('href').indexOf('somna') !== -1 || $(this).attr('href').indexOf('band') !== -1 || $(this).attr('href').indexOf('/channel/') !== -1 || $(this).attr('href').indexOf('/user/') !== -1){
  11. // Don't affect links to channel/user pages
  12. }else{
  13. $(this).attr('data-fancybox','video-gallery');
  14. }
  15. });
  16. $('a[href*=".jpg"],a[href*=".jpeg"],a[href*=".png"],a[href*=".gif"]').attr('data-fancybox','gallery');
  17. $('.gallery-item a').attr('data-fancybox','gallery');
  18. var imageTitle,imageAlt;
  19. $('a[href*=".jpg"],a[href*=".jpeg"],a[href*=".png"],a[href*=".gif"],a[data-fancybox]').each(function(){
  20. imageTitle = '';
  21. imageAlt = '';
  22. imageTitle = $(this).find('img').attr('title');
  23. imageAlt = $(this).find('img').attr('alt');
  24. if($(this).attr('data-caption') === ''){ // Don't replace existing captions
  25. if(typeof imageTitle !== 'undefined' && imageTitle !== ''){
  26. $(this).attr('data-caption',imageTitle);
  27. }else if(typeof imageAlt !== 'undefined' && imageAlt !== ''){
  28. $(this).attr('data-caption',imageAlt);
  29. }
  30. }
  31. });
  32. $.fancybox.defaults.loop = true;
  33. $.fancybox.defaults.smallBtn = true; // Use the small inline close button rather than relying on the toolbar
  34. $.fancybox.defaults.animationEffect = 'zoom';
  35. $.fancybox.defaults.transitionEffect = 'tube';
  36. $.fancybox.defaults.buttons = [
  37. 'zoom',
  38. 'share',
  39. 'slideShow',
  40. 'fullScreen',
  41. 'download',
  42. 'thumbs',
  43. 'close'
  44. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement