/******************************************************************************* CSS on Sails Framework Title: Pocketlistings Author: XHTMLized (http://www.xhtmlized.com/) Date: February 2024 *******************************************************************************/ $(document).ready(function() { GHH.init(); $(".navbar-toggle").click(function() { var flag = 0; if(!$(this).hasClass('open')) { var flag = 1; $(this).toggleClass('open'); } $( "#navigation" ).slideToggle( "slow", function() { if(flag == 0) { $(".navbar-toggle").toggleClass('open'); } // Animation complete. }); return false; }); }); $(".node-type-gallery-image .field-gallery a").html("« Back to album"); $(".node-type-gallery-image .field-gallery").css('display', 'block'); $(".field-gallery-image").addClass("cursor-pointer"); var aux = $(".node-type-gallery-image .browse.right").attr('href'); $(".field-gallery-image").attr("onClick", "location.href='"+aux+"'"); $(".button-print").attr('target', '_blank'); var GHH = { init: function() { GHH.likeButton(); GHH.fixesIE(); GHH.featuredSlideshow(); GHH.articleSlideshow(); GHH.tabs(); GHH.tooltips(); GHH.lightbox(); GHH.newsletterPlaceholder(); GHH.followButton(); }, likeButton: function(){ var nid=$("#nid").val(); if(typeof FB!='undefined'){ FB.Event.subscribe('edge.create', function(response) { $.get('/facebook/like/' + nid); } ); } }, followButton: function(){ $("#anonymous-follow").click(function(){ var array=$('body').attr('class').split(' '); var nid=''; for(var element in array){ if(array[element].match('^og-context-')){ var desired_element = array[element]; nid = desired_element.replace("og-context-",""); } } var link = $('#login').find('.item-list').find('.first').find('a'); $.get('/follow/anonymous/'+nid); }); }, fixesIE: function() { //Add Stuff Dropdown $('#add-stuff, #left li, button').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); }); }, featuredSlideshow: function() { var container = $('#featured .view'), carousel = null, items = null; items = container.find('.items'); var itemWidth = 290; // Exist carousel initialization if there aren't more than 3 items //if (items.find('.featured-item').size() < 4) return; carousel = items.jcarousel({ scroll: 1, speed: 'slow', width: 257, itemFallbackDimension:257, setupCallback: function(carousel) { container.addClass('jcarousel-processed'); carousel.reload(); }, reloadCallback: function(carousel) { var num = Math.floor(carousel.clipping() / itemWidth); carousel.options.scroll = num; carousel.options.visible = num; carousel.options.itemFallbackDimension = 257; } }); }, articleSlideshow: function() { var s = $('.slideshow > div.scrollable').scrollable({ onSeek: function(el,ind){ this.getRoot().siblings('.title').html(this.getItems().eq(ind).attr('title')); } }).data('scrollable'); if(s){ s.seekTo(0); } // Enlarge functionality $('.slideshow .enlarge').click(function(){ var currentPhoto = $('.slideshow .scrollable .items a').get(s.getIndex()) $(currentPhoto).trigger('click'); return false; }); }, tabs: function() { $('.block .tabs').each(function(){ $('ul',this).tabs($(this).siblings('.block-content').children('div'),{ tabs: 'li', current: 'active' }); }); }, tooltipOver: function(){ var api = $(this).data('tooltip'); if(!api.isShown(true)){ api.show(); } }, tooltipLeave: function(){ var api = $(this).data('tooltip'); api.hide(); }, tooltipLeaveSlow: function(){ var api = $(this).data('tooltip'); api.hide(1000); }, tooltips: function() { if(!(/iPhone|iPod|Android|iPad|Blackberry|webOS/i.test(navigator.userAgent))){ $('ul a[title]').each(function(i, e){ // cannot trust only in 'ul a[title]' selector, need to verify // one by one if title is set, otherwise this causes a bug if ($(e).attr('title') != ''){ $(e).tooltip({ position: 'bottom center', delay: 0, layout: '
' }).hover(GHH.tooltipOver, GHH.tooltipLeave); } }); } }, lightbox: function(){ // see mc.module @ mc_init for Drupal.settings.mc_overlays. if( !$('html').hasClass('touch') ){ $("#login-button").livequery(function(e){ $(this).colorbox({width:"410", height:"380", inline:true, href:"#login", opacity:0.6, onComplete:function () { $(".ui-tooltip").hide(); $('#login input[name=name]').focus(); }}); }); $("#register-button").livequery(function(e){ $(this).colorbox({width:Drupal.settings.mc_overlays.join.width, height:Drupal.settings.mc_overlays.join.height, inline:true,href:"#register", opacity:0.6, onComplete:function () { $(".ui-tooltip").hide(); $('#register input[name=mail]').focus(); }}); }); } $('a[rel=lightbox]').colorbox({ opacity: 0.6, loop: false, minWidth: "50%", minHeight: "50%", maxWidth: "95%", maxHeight: "95%", onComplete: function(){ var wrapper = null; var img = null; wrapper = $('#cboxLoadedContent'); img = wrapper.find('img'); img.css('margin-top', (wrapper.height() - img.height()) / 2); } }); }, newsletterPlaceholder: function () { $('#newsletter-block input').one('focus',function(){ $(this).val(''); $(this).css('color','#000'); }); } }; function follow_group(uid){ $.get('/follow/'+uid); $('#follow').hide(); $('#unfollow').css('display', 'block'); $('#text-follow').html('You are now following this group'); } function follow_group_comments(uid){ node = window.location; $.get( '/follow/'+uid, null,function(response){ $('.subscribe').remove(); window.location = node; }); } function openColorboxLogin(){ $(".ui-tooltip").hide(); $.colorbox({width:"410", height:"380", inline:true, href:"#login", opacity:0.6, onComplete:function () { $('#login input[name=name]').focus(); }}); } function openColorboxJoin(){ $(".ui-tooltip").hide(); $.colorbox({width:"720", height:"400", inline:true,href:"#register", opacity:0.6, onComplete:function () { $('#register input[name=mail]').focus(); }}); } var cboxOptions = { width: '95%', height: '95%', maxWidth: '960px', maxHeight: '960px', } $('.cbox-link').colorbox(cboxOptions); $(window).resize(function(){ $.colorbox.resize({ width: window.innerWidth > parseInt(cboxOptions.maxWidth) ? cboxOptions.maxWidth : cboxOptions.width, height: window.innerHeight > parseInt(cboxOptions.maxHeight) ? cboxOptions.maxHeight : cboxOptions.height }); }); Drupal.behaviors.directoryMapEqual = function (context) { return; height = $("body.mc-directory-map #page > .limiter #right").height(); $("body.mc-directory-map #page > .limiter #main").height(height); }; Drupal.behaviors.row_tools_slider = function (context) { return; $(".view .row",context).hover( function(e){ $(this).find(".row-tools-sidebar").find(".rate-widget").show(1,function(){ $(this).parents(".row").addClass('hover-in'); }); }, function(e){ $(this).find(".row-tools-sidebar").find(".rate-widget").animate({top: 0}, 1000).hide(1,function(){ $(this).parents(".row").removeClass('hover-in'); }); } ); }; //end of staringtooltips