𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/tdhomesa/public_html/wp-content/plugins/SW_Win_Classified/assets/js//script.js
jQuery(document).ready(function($) {
if (typeof google === 'undefined' || typeof google.maps == 'undefined') {
// variable is undefined
initialize_sw_win();
}
else if(typeof google.maps != 'undefined' && typeof google.maps.event != 'undefined')
{
google.maps.event.addDomListener(window, 'load', initialize_sw_win);
}
/* start filter section template */
$('.sw_search-section .section-field .sec_f-header').on('click', function(e){
e.preventDefault();
var that = $(this).closest('.section-field').find('.sec_f-body');
$('.section-field').find('.sec_f-body').not(that).slideUp();
$(this).closest('.section-field').find('.sec_f-body').slideToggle();
})
//filters
$('.sw_search-section .section-field .sec_f-body input,.sw_search-section .section-field .sec_f-body select').on('change', function(e){
var count = 0;
$(this).closest('.sec_f-body').find('input').each(function(){
if(($(this).attr('type')!='checkbox' && $(this).val() != '') || $(this).prop('checked') )
count++;
});
$(this).closest('.section-field').find('.sec_f-header .count .cur').html(count);
})
$('.sw_search-section .section-field .sec_f-body').each(function(){
var count = 0;
$(this).find('input,select').each(function(){
if(($(this).attr('type')!='checkbox' && $(this).val() != '') || $(this).prop('checked') )
count++;
});
$(this).closest('.section-field').find('.sec_f-header .count .cur').html(count);
})
/* end filter section template */
});
function initialize_sw_win()
{
jQuery.each(jQuery('.sw_win_map'), function( index, value ) {
var options = {};
if (typeof sw_map_style !== 'undefined') {
options = {style:sw_map_style, styledEnabled: true};
}
if (typeof sw_marker !== 'undefined') {
options.markerUrl = sw_marker;
}
jQuery(this).Swmap(options);
});
}
function sw_setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function sw_getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}