var marquee; var marqueeTimeout; var currentPage = -1; var showImageTimeout; var locationCounter = 0; var excludeIgnored = false; // locationPopupCallback var locationPopupCallbackFunction = function() { var countryId = $('#locationPopupCountry') ? $('#locationPopupCountry').val() : false; var regionId = $('#locationPopupRegion') ? $('#locationPopupRegion').val() : false; var cityId = $('#locationPopupCity') ? $('#locationPopupCity').val() : false; var metroId = $('#locationPopupMetro') ? $('#locationPopupMetro').val() : false; var country = $('#locationPopupCountry') ? $('#locationPopupCountry option:selected').text() : false; var region = $('#locationPopupRegion') ? $('#locationPopupRegion option:selected').text() : false; var city = $('#locationPopupCity') ? $('#locationPopupCity option:selected').text() : false; var metro = $('#locationPopupMetro') ? $('#locationPopupMetro option:selected').text() : false; var address = country; if(regionId && regionId != '0') address += ', ' + region; if(cityId && cityId != '0') address += ', ' + city; if(metroId && metroId != '0') address += ', ' + metro; var id = countryId; if(regionId) id += '_' + regionId; if(cityId) id += '_' + cityId; if(metroId) id += '_' + metroId; if (countryId) { if($('div#' + id).length) { flushSpinnerMessage(Travvi.s('js.region_is_on_search_params_alredy')); return false; } var html = '
' + address + ''; html += ''; if(regionId && regionId != '0') html += ''; if(cityId && cityId != '0') html += ''; if(metroId && metroId != '0') html += ''; html += '
'; $('div.region').append(html); locationCounter++; if($('#advancedCollapser').is(':visible')) $('#regionSearch').show(); } else { flushSpinnerMessage(Travvi.s('js.please_select_country')); } return false; }; Array.prototype.remove= function(){ var what, a= arguments, L= a.length, ax; while(L && this.length){ what= a[--L]; while((ax= this.indexOf(what))!= -1){ this.splice(ax, 1); } } return this; } var reloadContactsPanel = function() { Spinner.show(); $('#dialog-searchForm').dialog('open'); var data = $('#dialog-searchForm form :visible, #dialog-searchForm form input.location').serializeArray(); $('#dialog-searchForm').dialog('close'); data.push({name: 'page', value: currentPage}); $('#friends_panel').load('/' + $('#user_id').val() + '/friends_filter', data, function(){ Spinner.hide(); }); }; jQuery(function($) { $('#dialog-searchForm').dialog({ autoOpen: false, width: 'auto', position: ['center', 'center'], height: 'auto', modal: true, resizable: false, draggable: false }); $('#dialog-confirmIgnored a.submit').button().click(function(){ return false; }); $('#dialog-confirmIgnored a.cancel').click(function(){ $('#dialog-confirmIgnored').dialog('close'); return false; }); $(window).resize(function() { $('.ui-dialog-content').dialog('option', {position: ['center', 'center']}); }); $('#search_panel ul a.inList').button().click(function(){ $('#dialog-searchForm').dialog('open'); return false; }); $('#search_panel ul a.onSite').button(); $('#mass_action a').button({disabled: true}); $('#mass_action a#select_all').button('option', 'disabled', false); $('#photo_panel img').live('mouseenter', function(){ var el = this; showImageTimeout = setTimeout(function(){ $(el).addClass('selected'); }, 500); }).live('mouseleave', function(){ clearTimeout(showImageTimeout); $(this).removeClass('selected'); }); $('#avatars_tile .thumbnail').live('mouseenter', function(){ var obj = this; clearTimeout(marqueeTimeout); marqueeTimeout = setTimeout(function(){ marquee = $('.name a', obj).marquee('marqueed') }, 1000); }).live('mouseleave', function(){ clearTimeout(marqueeTimeout); $(marquee).trigger('stop'); $('.marqueed div', this).wrapInner(''); $('.marqueed a', this).unwrap().unwrap(); }); $('#action').button({disabled : true}); $.history.init(function(hash){ var urlParams = /^(\d+)?\/?$/.exec(hash); if (currentPage == -1) { currentPage = 0; $.history.load('1'); $.history.check(); return; } if(!urlParams) return false; var prevPage = currentPage; currentPage = urlParams[1] ? urlParams[1] : 1; if(prevPage != currentPage) { reloadContactsPanel(); } }, { unescape: ",/" }); $('#dialog-searchForm a.submit').button(); $('#dialog-searchForm input:checkbox').checkbox({cls:'jquery-checkbox-white', empty: '/skin/images/empty.png'}); $('#dialog-searchForm input:radio').checkbox({cls:'jquery-radiobutton-white', empty: '/skin/images/empty.png'}); $('a.locationPopupCaller').click(function(){ locationPopupDefaultCountry = 0; locationPopupDefaultRegion = 0; locationPopupDefaultCity = 0; locationPopupDefaultMetro = 0; $('#dialog-locationPopup').dialog('open'); return false; }); $('div.region a.delete').live('click', function(){ $(this).closest('div').remove(); if($('div.searchRegion').length == 0) $('#regionSearch').hide(); return false; }); $('#dialog-searchForm a.submit').button(); $('#dialog-searchForm a.submit.cancel').click(function(){ $('#dialog-searchForm').dialog('close'); return false; }); $('#dialog-searchForm a.submit.ok').click(function(){ Spinner.show(); $.history.load('1'); $.history.check(); $('#dialog-searchForm').dialog('close'); return false; }); $('#dialog-searchForm a.submit.reset').click(function(){ $('#dialog-searchForm div.region div').remove(); $('#dialog-searchForm input#name, #dialog-searchForm input#email, #dialog-searchForm input#phone').val(''); $('#hobbiesContent input, #mass_check').attr('checked', true); $('#hobbiesContainer, #hobbiesHeader, #searchHobbiesContainer').hide(); $('#myGroupsContainer, #groupsHeader').hide(); $('#myHobbies, #myGroups').show(); $('#dialog-searchForm #searchArea_travvi,#dialog-searchForm #sort_name, #dialog-searchForm #order_asc, #dialog-searchForm #search_region_both').attr('checked', true); $('#dialog-searchForm div.sex input').attr('checked', false); $('#dialog-searchForm #hide_offline, #dialog-searchForm #hide_teens, #dialog-searchForm #show_subscribers, #dialog-searchForm #show_blacklisted').attr('checked', false); $(window).resize(); return false; }); });