PageSourceSearch

https://ranchimunicipal.com/libs/js/jquery.custom.js

js ranchimunicipal.com collected 2026-10-02 22:06:21 UTC 16,856 bytes, 480 lines download raw bytes

1function isIE8() {
2	return jQuery.browser.msie && jQuery.browser.version == '8.0';
3}
4
5function isIE10() {
6    return jQuery.browser.msie && jQuery.browser.version == '10.0';
7}
8
9function isViewportBetween( high, low ) {
10    if( low == 'undefinied' )
11        { low = 0; }
12    
13    if( !low )
14        { return jQuery( window ).width() < high; }
15    else
16        { return jQuery( window ).width() < high && jQuery( window ).width() > low; }
17}
18
19function isLowResMonitor() {
20    return jQuery( window ).width() < 1200;
21}
22
23function isTablet() {
24    var device = jQuery( 'body' ).hasClass( 'responsive' ) || jQuery( 'body' ).hasClass( 'iPad' ) || jQuery( 'body' ).hasClass( 'Blakberrytablet' ) || jQuery( 'body' ).hasClass( 'isAndroidtablet' ) || jQuery( 'body' ).hasClass( 'isPalm' );
25    var size   = jQuery( window ).width() <= 1024 && jQuery( window ).width() >= 768;
26    
27    return device && size ; 
28}
29
30function isPhone() {
31    var device = jQuery( 'body' ).hasClass( 'responsive' ) || jQuery( 'body' ).hasClass( 'isIphone' ) || jQuery( 'body' ).hasClass( 'isWindowsphone' ) || jQuery( 'body' ).hasClass( 'isAndroid' ) || jQuery( 'body' ).hasClass( 'isBlackberry' );
32    var size   = jQuery( window ).width() <= 480 && jQuery( window ).width() >= 320;
33    
34    return device && size ;
35}
36
37function isMobile() {
38    return isTablet() || isPhone();
39}
40
41// In case we forget to take out console statements. IE becomes very unhappy when we forget. Let's not make IE unhappy
42if(typeof(console) === 'undefined') {
43    var console = {}
44    console.log = console.error = console.info = console.debug = console.warn = console.trace = console.dir = console.dirxml = console.group = console.groupEnd = console.time = console.timeEnd = console.assert = console.profile = function() {};
45}
46
47jQuery( document ).ready( function( $ ) {
48	$('body').removeClass('no_js').addClass('yes_js');
49    
50    if ( isIE8() ) {
51        $('*:last-child').addClass('last-child');
52    }
53    
54    if( isIE10() ) {
55        $( 'html' ).attr( 'id', 'ie10' ).addClass( 'ie' );
56    }
57    
58    //placeholder support
59    $('input[placeholder], textarea[placeholder]').placeholder();
60    $('input[placeholder], textarea[placeholder]').each(function(){
61    	$(this).focus(function(){
62    		$(this).data('placeholder', $(this).attr('placeholder'));
63    		$(this).attr('placeholder', '');
64    	}).blur(function(){
65    		$(this).attr('placeholder', $(this).data('placeholder'));
66    	});
67    });
68	
69	//iPad, iPhone hack
70	$('.ch-item').bind('hover', function(e){});
71    
72    //Form fields shadow
73    $( 'form input[type="text"], form textarea' ).focus(function() {
74        
75        //Hide label
76        $( this ).parent().find( 'label.hide-label' ).hide(); 
77    });
78    
79    $( 'form input[type="text"], form textarea' ).blur(function() {        
80        //Show label
81        if( $( this ).val() == '' )
82            { $( this ).parent().find( 'label.hide-label' ).show(); }
83    });
84    
85    $( 'form input[type="text"], form textarea' ).each( function() {
86        //Show label
87        
88        if( $( this ).val() != '' && $( this ).parent().find( 'label.hide-label' ).is( ':visible' ) )
89            { $( this ).parent().find( 'label.hide-label' ).hide(); }
90    } );
91    
92    //Contact form labels
93    $( '.contact-form [type="text"], .contact-form [type="password"], .contact-form textarea' ).focus( function() {
94        //Hide label
95        $( this ).parents( 'li' ).find( 'label' ).hide(); 
96    } );
97    
98    $( '.contact-form [type="text"], .contact-form [type="password"], .contact-form textarea' ).blur( function() {
99        //Show label
100        if( $( this ).val() == '' )
101            { $( this ).parents( 'li' ).find( 'label' ).show(); }
102    } );
103    
104    //Map handler
105    $( '#map-handler a' ).click( function() {
106        $( '#map iframe' ).slideToggle( 400, function() {
107            if( $( '#map iframe' ).is( ':visible' ) ) {
108                $( '#map-handler a' ).text( l10n_handler.map_close );
109            } else {
110                $( '#map-handler a' ).text( l10n_handler.map_open );
111            }
112        });
113    } );
114	
115	//social icon fade
116	$('div.fade-socials a, div.fade-socials-small a').hide();
117    $('div.fade-socials, div.fade-socials-small').hover(function(){
118       $(this).children('a').fadeIn('slow');
119    },
120    function(){
121       $(this).children('a').fadeOut('slow');
122    });
123
124	// socials tipsy
125	$('a.socials-square, a.socials-square-small').tipsy({fade:true, gravity:$.fn.tipsy.autoNS});
126	
127    var show_dropdown = function()
128    {        
129        var options;              
130             
131        containerWidth = $('#header').width();
132        marginRight = $('#nav ul.level-1 > li').css('margin-right');
133        submenuWidth = $(this).find('ul.sub-menu').outerWidth();
134        offsetMenuRight = $(this).position().left + submenuWidth;
135        leftPos = -18;
136        
137        if ( offsetMenuRight > containerWidth )
138            options = { left:leftPos - ( offsetMenuRight - containerWidth ) };    
139        else
140            options = {};
141        
142        $('ul.sub-menu:not(ul.sub-menu li > ul.sub-menu), ul.children:not(ul.children li > ul.children)', this).css(options).stop(true, true).fadeIn(300);    
143    }
144    
145    var hide_dropdown = function()
146    {                               
147        $('ul.sub-menu:not(ul.sub-menu li > ul.sub-menu), ul.children:not(ul.children li > ul.children)', this).fadeOut(300);    
148    }
149        
150    $('#nav ul > li').hover( show_dropdown, hide_dropdown );              
151    
152    $('#nav ul > li').each(function(){
153        if( $('ul', this).length > 0 )
154            $(this).children('a').append('<span class="sf-sub-indicator"> &raquo;</span>').css({ paddingRight:parseInt($(this).children('a').css('padding-right'))+16 });
155    }); 
156    
157    $('#nav li:not(.megamenu) ul.sub-menu li, #nav li:not(.megamenu) ul.children li').hover(
158        function()
159        {         
160            if ( $(this).closest('.megamenu').length > 0 )
161                return; 
162                        
163            var options;            
164            
165            containerWidth = $('#header').width();
166            containerOffsetRight = $('#header').offset().left + containerWidth;
167            submenuWidth = $('ul.sub-menu, ul.children', this).parent().width();
168            offsetMenuRight = $(this).offset().left + submenuWidth * 2;
169            leftPos = -10;
170            
171            if ( offsetMenuRight > containerOffsetRight )
172                $(this).addClass('left');
173                
174            $('ul.sub-menu, ul.children', this).stop(true, true).fadeIn(300);
175        },
176    
177        function()
178        {
179            if ( $(this).closest('.megamenu').length > 0 )
180                return; 
181                        
182            $('ul.sub-menu, ul.children', this).fadeOut(300);
183        }
184    );
185    
186    /* megamenu check position */
187    $('#nav .megamenu').mouseover(function(){
188	
189		var main_container_width = $('.container').width();
190		var main_container_offset = $('.container').offset();
191		var parent = $(this);
192		var megamenu = $(this).children('ul.sub-menu');
193		var width_megamenu = megamenu.outerWidth();
194		var position_megamenu = megamenu.offset();
195		var position_parent = parent.position();
196		
197		var position_right_megamenu = position_parent.left + width_megamenu;
198		
199		// adjust if the right position of megamenu is out of container
200		if ( position_right_megamenu > main_container_width ) {
201			megamenu.offset( { top:position_megamenu.top, left:main_container_offset.left + ( main_container_width - width_megamenu ) } );		
202		}		
203	});          
204	
205	if ( $('body').hasClass('isMobile') && ! $('body').hasClass('iphone') && ! $('body').hasClass('ipad') ) {
206        $('.sf-sub-indicator').parent().click(function(){   
207            $(this).parent().toggle( show_dropdown, function(){ document.location = $(this).children('a').attr('href') } )
208        });
209    }
210    
211    /* topbar login */
212	// cart
213	$('#topbar_login.not_logged_in a.topbar_login').click(function(e){
214		$('#fast-login').fadeToggle();
215		e.preventDefault();
216	});
217	
218	$('#fast-login').on( "clickoutside", function(event){
219		if( !$(this).is(':animated') && $(this).is(':visible') ) 
220			$('#fast-login').fadeOut();
221	});
222	
223	// remove margin from the slider, if the page is empty
224	if ( $('.slider').length != 0 && $.trim( $('#primary *, #page-meta').text() ) == '' ) {
225        $('.slider').css('margin-bottom', '0 !important');
226        $('#primary').remove();
227    }
228	
229    //play, zoom on image hover
230	var yit_lightbox;
231	(yit_lightbox = function(){
232	    jQuery('a.thumb.video, a.thumb.img, img.thumb.img, img.thumb.project, .work-thumbn
232ail a, .three-columns li a, .onlytitle, .overlay_a img, .nozoom img').hover(
233	        function()
234	        {
235	            jQuery(this).next('.overlay').fadeIn(500);
236	            jQuery(this).next('.overlay').children('.lightbox, .details, .lightbox-video').animate({
237	                bottom:'40%'
238	            }, 300);
239	            
240	            jQuery(this).next('.overlay').children('.title').animate({
241	                top:'30%'
242	            }, 300);
243	        }
244	    );
245	    
246	    // image lightbox
247	    $('a.thumb.video, a.thumb.img, a.thumb.videos, a.thumb.imgs, a.related_detail, a.related_proj, a.related_video, a.related_title, a.project, a.onlytitle').hover(function(){
248	        $('<a class="zoom"></a>').appendTo(this).css({
249	            dispay:'block', 
250	            opacity:0, 
251	            height:$(this).children('img').height(), 
252	            width:$(this).children('img').width(),
253	            'top': $(this).parents('.portfolio-filterable').length ? '-1px' : $(this).css('padding-top'),
254	            'left':$(this).parents('.portfolio-filterable').length ? '-1px' : $(this).css('padding-left'),
255	            padding:0}).append('<span class="title">' + $(this).attr('title') + '</span>')
256	            		   .append('<span class="subtitle">' + $(this).attr('data-subtitle') + '</span>').animate({opacity:0.7}, 500);
257	        },        
258	        function(){           
259	            $('.zoom').fadeOut(500, function(){$(this).remove()});
260	        }
261	    );
262	    
263	    $('.zoom').live('click', function(){
264	    	if( $.browser.msie ) {
265	    		$(this).attr('href', $(this).parent().attr('href'));
266	    	}
267	    });
268	    
269	    if( jQuery( 'body' ).hasClass( 'isMobile' ) ) {
270	        jQuery("a.thumb.img, .overlay_img, .section .related_proj, a.ch-info-lightbox").colorbox({
271	            transition:'elastic',
272	            rel:'lightbox',
273	    		fixed:true,
274	    		maxWidth: '100%',
275	    		maxHeight: '100%',
276	    		opacity : 0.7
277	        });
278	        
279	        jQuery(".section .related_lightbox").colorbox({
280	            transition:'elastic',
281	            rel:'lightbox2',
282	    		fixed:true,
283	    		maxWidth: '100%',
284	    		maxHeight: '100%',
285	    		opacity : 0.7
286	        });
287	    } else {
288	        jQuery("a.thumb.img, .overlay_img, .section.portfolio .related_proj, a.ch-info-lightbox, a.ch-info-lightbox").colorbox({
289	            transition:'elastic',
290	            rel:'lightbox',
291	    		fixed:true,
292	    		maxWidth: '80%',
293	    		maxHeight: '80%',
294	    		opacity : 0.7
295	        });   
296	        
297	        jQuery(".section.portfolio .related_lightbox").colorbox({
298	            transition:'elastic',
299	            rel:'lightbox2',
300	    		fixed:true,
301	    		maxWidth: '80%',
302	    		maxHeight: '80%',
303	    		opacity : 0.7
304	        });   
305	    }
306	    
307	    jQuery("a.thumb.video, .overlay_video, .section.portfolio .related_video, a.ch-info-lightbox-video").colorbox({
308	        transition:'elastic',
309	        rel:'lightbox',
310			fixed:true,
311			maxWidth: '60%',
312			maxHeight: '80%',
313	        innerWidth: '60%',
314	        innerHeight: '80%',
315			opacity : 0.7,
316	        iframe: true,
317	        onOpen: function() { $( '#cBoxContent' ).css({ "-webkit-overflow-scrolling": "touch" }) }
318	    });
319	    jQuery(".section.portfolio .lightbox_related_video").colorbox({
320	        transition:'elastic',
321	        rel:'lightbox2',
322			fixed:true,
323			maxWidth: '60%',
324			maxHeight: '80%',
325	        innerWidth: '60%',
326	        innerHeight: '80%',
327			opacity : 0.7,
328	        iframe: true,
329	        onOpen: function() { $( '#cBoxContent' ).css({ "-webkit-overflow-scrolling": "touch" }) }
330	    });
331	})();      
332            
333              
334    //FILTERABLE
335    if( $('.portfolio-filterable').length > 0 ) {
336    	$('.gallery-categories-disabled, .portfolio-categories-disabled').addClass('gallery-categories-quicksand');
337    }
338    
339    
340    $(".gallery-wrap .internal_page_item .overlay, .section .related_project .overlay").css({opacity:0});
341	$(".gallery-wrap .internal_page_item, .section .related_project > div").live( 'mouseover mouseout', function(event){ 
342		if ( event.type == 'mouseover' ) $('.overlay', this).show().stop(true,fal
342se).animate({ opacity: .7 }, "fast"); 
343		if ( event.type == 'mouseout' )  $('.overlay', this).animate({ opacity: 0 }, "fast", function(){ $(this).hide() }); 
344	});
345	
346  	$('.picture_overlay').hover(function(){
347  		
348	  	var width = $(this).find('.overlay div').innerWidth();
349	  	var height =  $(this).find('.overlay div').innerHeight();
350	  	var div = $(this).find('.overlay div').css({
351	  		'margin-top' : - height / 2,
352	  		'margin-left' : - width / 2
353	  	});
354  		
355		if(isIE8()) {
356  			$(this).find('.overlay > div').show();
357  		}
358  	}, function(){
359  		
360  		if(isIE8()) {
361  			$(this).find('.overlay > div').hide();
362  		}
363  	}).each(function(){
364	  	var width = $(this).find('.overlay div').innerWidth();
365	  	var height =  $(this).find('.overlay div').innerHeight();
366	  	var div = $(this).find('.overlay div').css({
367	  		'margin-top' : - height / 2,
368	  		'margin-left' : - width / 2
369	  	});
370	});
371
372
373	//masonry pinterest blog style
374	if ( $.fn.masonry ) {
375    	var container = $('#pinterest-container');
376    	container.imagesLoaded( function(){
377    		container.masonry({
378    		  itemSelector: '.post'
379    		});
380    	});
381    	
382    	$(window).resize(function(){
383    		$('#pinterest-container').masonry({
384    		  itemSelector: '.post'
385    		});
386    	});
387    }
388    
389    $( '.yit_toggle_menu ul.menu.open_first > li:first-child' ).addClass( 'opened' );
390    
391    //toggle menu widget
392    $( '.yit_toggle_menu ul li.dropdown > a' ).click( function( e ) {
393        e.preventDefault();
394        var dropdown = $( this ).next( 'ul' );
395        var dropdown_parent = dropdown.parent( '.dropdown' );
396        
397        dropdown.width( dropdown_parent.width() );
398        dropdown_parent.width( dropdown_parent.parent().width() );
399        
400        if( dropdown_parent.hasClass( 'opened' ) )
401            { dropdown_parent.removeClass( 'opened' ); }
402        else
403            { dropdown_parent.addClass( 'opened' ); }
404        
405        dropdown.slideToggle();
406    }); 
407    
408    //Sticky Footer
409    $( '#primary' ).imagesLoaded( function() {
410        if( $( '#footer' ).length > 0 )
411            { $( '#footer' ).stickyFooter(); }
412        else
413            { $( '#copyright' ).stickyFooter(); }
414    } );
415
416    // hide #back-top first
417    $("#back-top").hide();
418
419    // fade in #back-top
420    $(function () {
421        $(window).scroll(function () {
422            if ($(this).scrollTop() > 100) {
423                $('#back-top').fadeIn();
424            } else {
425                $('#back-top').fadeOut();
426            }
427        });
428
429        // scroll body to 0px on click
430        $('#back-top a').click(function () {
431            $('body,html').animate({
432                scrollTop: 0
433            }, 800);
434            return false;
435        });
436    });
437        
438});
439
440// sticky footer plugin
441(function($){
442  var footer;
443 
444  $.fn.extend({
445    stickyFooter: function(options) {
446      footer = this;
447       
448      positionFooter();
449 
450      $(window)
451        .scroll(positionFooter)
452        .resize(positionFooter);
453 
454      function positionFooter() {
455        var docHeight = $(document.body).height() - $("#sticky-footer-push").height();
456        
457        if(docHeight < $(window).height()){
458          var diff = $(window).height() - docHeight;
459          if (!$("#sticky-footer-push").length > 0) {
460            $(footer).before('<div id="sticky-footer-push"></div>');
461          }
462          
463          if( $('#wpadminbar').length > 0 ) {
464            diff -= 28;
465          }
466          $("#sticky-footer-push").height(diff);
467        }
468      }
469    }
470  });
471})(jQuery);
472
473
474
475(function($){
476	$("#header-sidebar li.dropdown").hover(
477		function(){ $('ul',this).fadeIn(); }, 
478		function(){ $('ul',this).fadeOut(); }
479	);
480})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.