PageSourceSearch

https://starofmysore.com/wp-content/themes/citynews/assets/js/citynews.js

js starofmysore.com collected 2026-10-02 04:03:56 UTC 10,392 bytes, 352 lines download raw bytes

1/* CityNews functions */ 
2
3var jQuery,
4    stickyHeader=1;
5
6jQuery(document).ready(function($){
7	 "use strict";
8    
9    /*Show the popup*/
10    function showPopup(button,content){
11       $(button).click(function(){
12	    $('#popup_window,.page_mask').add(content).fadeIn();
13	    var popup_height=$('#popup_window').height();
14	    $('#popup_window').css('margin-top',-popup_height/2);
15	   });
16    }
17    showPopup('.search_btn','#popup_search');
18    showPopup('.cart_btn','#popup_cart');
19    showPopup('.user_btn','#popup_login');
20    showPopup('.user_btn_logged','#popup_dashboard');
21    showPopup('.languages_btn','#popup_lang');
22    
23    /*Close the popup*/
24    $('.close_popup,.page_mask').on('click',function(){
25	    $('#popup_window,.popup_content,.page_mask').fadeOut();
26    })
27	
28	//Primary Menu
29	$("#primary_menu ul.sf-menu").superfish({
30	       pathLevels:    3 ,
31		   delay:         100
32    });
33    
34    $('.menu_button').toggle(function(){
35	    $(this).find('i').removeClass('fa-bars').addClass('fa-close');
36    },function(){
37	    $(this).find('i').removeClass('fa-close').addClass('fa-bars');
38    });
39    
40    $('.site-overlay').on('click',function(){
41	    $('.menu_button').find('i').removeClass('fa-close').addClass('fa-bars');
42    });
43    
44    /*Mega menu
45    /*Just can use hover function, because it's depended on jquery.hoverdelay.js */
46    $('#primary_menu ul li').hover(function(e) {
47      $(this).find('.mega-menu').fadeIn(); 
48    }, function() {
49      $(this).find('.mega-menu').fadeOut();
50    }, 250);
51
52	    
53    $('#primary_menu > ul > li > ul.sub-menu').prepend('<li class="up-arrow"></li>');
54    $('#primary_menu > ul > li > div.mega-menu').prepend('<div class="up-arrow"></div>');
55    
56    $("#top_menu ul.sf-menu").superfish({
57	       pathLevels:    3 ,
58		   delay:         100,
59		   autoArrows:    true
60    });
61    
62    $('.menu_button').on('click',function(){
63	    /*$(".pushy").niceScroll({
64				   cursorcolor:"#000",
65				   scrollspeed:70,
66				   horizrailenabled:false,
67				   autohidemode:true,
68				   cursorwidth:5,
69				   zindex:99999
70		}); */
71	    $('.pushy').css('overflow','auto');
72    }); 
73
74		
75	$(window).on('scroll',function() {
76	   if($(this).width()>767 && stickyHeader==1){
77	
78	        /*Shrinking the header*/
79	        if($(document).scrollTop() > $('#cn_content').offset().top - parseFloat($('#cn_content').css('marginTop').replace(/auto/, 100))){
80		      $('#top').addClass('shrinked');
81		      $('#backtoTop').fadeIn();
82			}else{
83			  $('#top').removeClass('shrinked');
84			  $('#backtoTop').fadeOut();
85			}
86			
87		}
88		
89	 });
90	 
91	 $('#start-read').on('click',function(){
92		 $('body').animate({scrollTop:$('#main').offset().top-40},'slow');
93	 });
94	 
95	 /*Set the overlay size*/
96	 function overlay_size(){
97		 $('.post .thumbnail').each(function(){
98		     $('#masonry_blog .post,#masonry_channel_3col .channel,.masonry_channel .channel').show();
99			 var overlay_width,overlay_height,marginTop,marginLeft;
100		     var wrapper_width=$(this).width();
101		     var wrapper_height=$(this).height();
102			 
103			 if($(this).children('img').height()<wrapper_height){
104			   $(window).load(function(){
105				wrapper_height=$(this).children('img').height();
106			    if(wrapper_height==0){
107				    wrapper_height=200;
108			    }
109				$(this).css('height',wrapper_height);
110			   })
111			   
112			 }
113			 
114			 if($(window).width()>800){
115		       overlay_width=wrapper_width-20;
116			   overlay_height=wrapper_height-20;
117			 }else{
118			   overlay_width=wrapper_width;
119			   overlay_height=wrapper_height;
120			 }
121			   marginTop=overlay_height/2;
122			   marginLeft=overlay_width/2;
123			 
124		     $(this).children('.overlay').css({
125			   width:overlay_width+'px',
126			   height:overlay_height+'px',
127			   marginTop:'-'+marginTop+'px',
128			   marginLeft:'-'+marginLeft+'px'
129		     });
130			 $(this).children('.overlay').children('i').css({
131			   width:'20px',
132			   height:'20px',
133			   display:'block',
134			   left:'50%',
135			   top:'50%',
136			   position:'absolute',
137			   marginTop:'-10px',
138			   marginLeft:'-10px'
139		     });
140		 });
141	 }
142	
143	 
144	 /*Masonry Channel*/
145	 $('.masonry_channel .channel').addClass('omega').addClass('alph
145a');
146		var columns = 2,
147		setColumns = function() { columns = $( window ).width() > 640 ? 2 : $(window).width() > 320 ? 2 : 1; };
148		setColumns();
149		$(window).resize(setColumns);
150	 
151		var $masonry_channel=$( '.masonry_channel' ).masonry(
152		{
153			itemSelector: '.channel',
154			columnWidth:  function( containerWidth ) { return containerWidth / columns;}
155		});
156		
157		$masonry_channel.imagesLoaded( function(){
158			$masonry_channel.masonry();
159		    $('.channel').fadeIn();
160		    $('.alaya_loader').fadeOut();
161		});
162	
163	/*Masonry Channel 3 columns*/
164	var channel_columns = 3,
165		setChannelColumns = function() { channel_columns = $( window ).width() > 640 ? 3 : $(window).width() > 320 ? 3 : 1; };
166		setChannelColumns();
167		$(window).resize(setChannelColumns);
168	 
169		var $masonry_channel_3col=$( '.masonry_channel_3col' ).masonry(
170		{
171			itemSelector: '.channel',
172			columnWidth:  function( containerWidth ) { return containerWidth / channel_columns;}
173		});
174		
175		$masonry_channel_3col.imagesLoaded( function(){
176			$masonry_channel_3col.masonry();	
177		    $('.channel').fadeIn();
178		    $('.alaya_loader').fadeOut();
179		});
180	
181	    /*Masonry blog 2 columns*/
182		var post_columns_2 = 2,
183		setPostColumns_2 = function() { post_columns_2 = $( window ).width() > 640 ? 2 : $(window).width() > 320 ? 2 : 1; };
184		setPostColumns_2();
185		$(window).resize(setPostColumns_2);
186	    
187		
188		var $masonry_blog_2=$( '.masonry_blog_2').masonry(
189		{
190			itemSelector: '.post',
191			columnWidth:  function( containerWidth ) { return containerWidth / post_columns_2;},
192		});
193		
194		$masonry_blog_2.imagesLoaded( function(){
195			$masonry_blog_2.masonry();	
196		    $('.post').fadeIn();
197		    $('.alaya_loader').fadeOut();
198		}); 
199	
200	    /*Masonry blog 3 columns*/		
201		var post_columns = 3,
202		setPostColumns = function() { post_columns = $( window ).width() > 640 ? 3 : $(window).width() > 320 ? 3 : 1; };
203		setPostColumns();
204		$(window).resize(setPostColumns);
205	 
206		var $masonry_blog=$( '.masonry_blog' ).masonry(
207		{
208			itemSelector: '.post',
209			columnWidth:  function( containerWidth ) { return containerWidth / post_columns;}
210		});
211		$masonry_blog.imagesLoaded( function(){
212			$masonry_blog.masonry();
213		    $('.post').fadeIn();
214			$('.alaya_loader').fadeOut();
215		});
216
217	/*Back to Top*/
218	$('#backtoTop').on('click',function(){
219		$("html, body").animate({scrollTop:0},'slow');
220		return false;
221	});
222	
223	if($(window).width()<=959){
224	  $("#topbar").sticky({topSpacing:0});
225	}
226	
227	/*View Map*/
228	$('#map_toggle').toggle(function(){
229		$('.contact_content').slideUp();
230		$('#map_toggle i').removeClass('fa-angle-up').addClass('fa-angle-down');
231	},function(){
232		$('.contact_content').slideDown();
233		$('#map_toggle i').removeClass('fa-angle-down').addClass('fa-angle-up');
234	})
235	
236	/*colorbox*/
237	$('.lightbox').colorbox({maxWidth:"98%",maxHeight:"98%"});
238	//$('.attachment a').colorbox({maxWidth:"98%",maxHeight:"98%"});
239	$('.gallery-icon a').colorbox({maxWidth:"98%",maxHeight:"98%"});
240	//$('.wp-caption a').colorbox({maxWidth:"98%",maxHeight:"98%"});
241	
242	/*Gallery*/
243	$("#gallery").justifiedGallery({
244		  captions:true,
245		  rowHeight:400,
246		  lastRow : 'nojustify',
247		  sizeRangeSuffixes:{'lt100':'', 
248			'lt240':'', 
249			'lt320':'', 
250			'lt500':'', 
251			'lt640':'', 
252			'lt1024':''}
253	}).on('jg.complete', function (){
254	    $("#gallery").fadeIn();
255		$('#gallery a').colorbox({maxWidth:"98%",maxHeight:"98%"});
256	});;	
257	
258	$('.sticky').prepend('<div class="sign">Featured</div>');
259	    
260	$('.woocommerce ul.products li.product a img').hover(function(){
261		$(this).parent().next().show();
262	},function(){
263		$(this).parent().next().hide();
264	});
265	$('.woocommerce ul.products li.product .button.add_to_cart_button').hover(function(){
266		$(this).show();
267	},function(){
268		$(this).hide();
269	});
270	
271	
272	/* Ajax Comment */
273    var commentform=$('#commentform'); 
274    commentform.prepend('<div id="comment-status" ></div>'); 
275    var statusdiv=$('#comment-status'); 
276	var list ;
277	
278    $('a.comment-reply-link').click(function(){
279	  list = $(this).parent().parent().parent().attr('id');
280    });
281	
282	 
283    commentform.submit(function(){
284		if($('#comments').length==0){
285		  $('#respond').before('<section id="comments"><h2 class="comment-title">'+comment_title+'</h2></section>');
286		}
287		
288        var formdata=commentform.serialize();
289        statusdiv.html('<p>Processing...</p>');
290        var formurl=commentform.attr('action');
291        
292        $.ajax({
293            type: 'post',
294            url: formurl,
295            data: formdata,
296            error: function(XMLHttpRequest, textStatus, errorThrown)
297                {
298                    statusdiv.html('<p class="ajax-error" >You might have left one of the fields blank, or be posting too quickly</p>');
299                },
300            success: function(data, textStatus){
301              if(data == "success" || textStatus == "success"){
302                    statusdiv.html('<p class="ajax-success" >Thanks for your comment. We appreciate your response.</p>').delay(2000).fadeOut('slow');
303					data=data.replace("success","");
304                    
305					if($("#comments").has("ol.comment-list").length > 0){
306							if(list != null){
307								$('div.rounded').prepend(data);
308							}
309							else{
310								$('ol.comment-list').append(data);                 
311							}
312					} 
313					else{
314					   $("#comments").append('<ol class="comment-list"></ol>');
315					   $('ol.comment-list').html(data);
316					}
317			  }else{
318						statusdiv.html('<p class="ajax-error" >Please wait a while before posting your next comment</p>');
319						commentform.find('textarea[name=comment]').val('');
320			  }
321            }
322        });
323        return false;
324    });
325    
326   /*Weather geoplugin_city()*/
327   var html,city;
328   
329   jQuery.ajax( { 
330	  url: '//freegeoip.net/json/', 
331	  type: 'POST', 
332	  dataType: 'jsonp',
333	  success: function(location) {
334	    // example where I update content on the page.
335	     $.simpleWeather({
336		    location: 'mysore,karnataka',
337		    woeid: '',
338		    unit: temperature_unit,
339		    success: function(weather) {
340		      html = '<span><i class="icon-'+weather.code+'"></i> '+weather.temp+'&deg;'+weather.units.temp+' '+weather.city+'</span>';
341		  
342		      $("#weather").html(html);
343		    },
344		    error: function(error) {
345		      $("#weather").html('<p>'+error+'</p>');
346		    }
347		   });
348	  }
349	});
350	
351
352});

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.