Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($) {
  2.     $(function() {
  3.         var userOptions = $('#userOptions');
  4.         if (userOptions.length) {
  5.             var bookForms = userOptions.find('.addToBookForm, .createBookForm');
  6.  
  7.             //recipe book
  8.             userOptions.delegate('.book a', 'click keypress', function(e) {
  9.                 e.preventDefault();
  10.                 var $this = $(this);
  11.                 if (!$this.hasClass('active')) {
  12.                     $this.addClass('active');
  13.                     bookForms.css({
  14.                         'opacity': '0'
  15.                     }).slideDown(function() {
  16.                         $(this).animate({
  17.                             'opacity': '1'
  18.                         });
  19.                     });
  20.                 } else {
  21.                     bookForms.animate({
  22.                         'opacity': '0'
  23.                     }, function() {
  24.                         $(this).slideUp();
  25.                         $this.removeClass('active');
  26.                     });
  27.                 }
  28.             });
  29.         }
  30.     });
  31.  
  32.     window.addToBook = function(data, $this) {
  33.         var result = window.GlobalFn.serviceLogged(data);
  34.         if (result.logged === false) {
  35.             //call modal with login
  36.             console.log(window.GlobalFn.modalWindow())
  37.             window.GlobalFn.modalWindow($this.attr('class'));
  38.         } else if (result.logged == true && result.success == true) {
  39.             //ok call service and add it
  40.         } else {
  41.             //something went wrong, show error
  42.         }
  43.     }
  44.  
  45.     $(function() {
  46.         //hide panels
  47.         $('#userOptions').find('.addToBookForm, .createBookForm').hide();
  48.  
  49.         //short url
  50.         if ($('#socialShare').length) {
  51.             ZeroClipboard.setMoviePath(window.GlobalFn.URLData.basePath + '/assets/flash/ZeroClipboard10.swf');
  52.             var clip = new ZeroClipboard.Client();
  53.             $('#shortURL').val(document.location.href).focus(function() {
  54.                 $(this).select();
  55.             });
  56.             clip.glue('copyClipboard', 'clipboardContainer');
  57.             clip.setText($('#shortURL').val());
  58.             clip.setHandCursor(true);
  59.         }
  60.     });
  61. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement