Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function($) {
- $(function() {
- var userOptions = $('#userOptions');
- if (userOptions.length) {
- var bookForms = userOptions.find('.addToBookForm, .createBookForm');
- //recipe book
- userOptions.delegate('.book a', 'click keypress', function(e) {
- e.preventDefault();
- var $this = $(this);
- if (!$this.hasClass('active')) {
- $this.addClass('active');
- bookForms.css({
- 'opacity': '0'
- }).slideDown(function() {
- $(this).animate({
- 'opacity': '1'
- });
- });
- } else {
- bookForms.animate({
- 'opacity': '0'
- }, function() {
- $(this).slideUp();
- $this.removeClass('active');
- });
- }
- });
- }
- });
- window.addToBook = function(data, $this) {
- var result = window.GlobalFn.serviceLogged(data);
- if (result.logged === false) {
- //call modal with login
- console.log(window.GlobalFn.modalWindow())
- window.GlobalFn.modalWindow($this.attr('class'));
- } else if (result.logged == true && result.success == true) {
- //ok call service and add it
- } else {
- //something went wrong, show error
- }
- }
- $(function() {
- //hide panels
- $('#userOptions').find('.addToBookForm, .createBookForm').hide();
- //short url
- if ($('#socialShare').length) {
- ZeroClipboard.setMoviePath(window.GlobalFn.URLData.basePath + '/assets/flash/ZeroClipboard10.swf');
- var clip = new ZeroClipboard.Client();
- $('#shortURL').val(document.location.href).focus(function() {
- $(this).select();
- });
- clip.glue('copyClipboard', 'clipboardContainer');
- clip.setText($('#shortURL').val());
- clip.setHandCursor(true);
- }
- });
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement