HEX
Server: Apache/2.4.59 (Debian)
System: Linux skycube.cz 4.19.0-25-amd64 #1 SMP Debian 4.19.289-2 (2023-08-08) x86_64
User: ilya (534)
PHP: 7.3.31-1~deb10u7
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/ilya/data/www/irkboard.ru/public/js/ips.search.js
/************************************************/
/* IPB3 Javascript								*/
/* -------------------------------------------- */
/* ips.board.js - Board index code				*/
/* (c) IPS, Inc 2008							*/
/* -------------------------------------------- */
/* Author: Rikki Tissier						*/
/************************************************/

var _search = window.IPBoard;

_search.prototype.search = {
	checks: [],
	
	/*------------------------------*/
	/* Constructor 					*/
	init: function()
	{
		Debug.write("Initializing ips.search.js");
		
		document.observe("dom:loaded", function(){
			// set up calendars
			if( $('date_start') && $('date_start_icon') )
			{
				$('date_start_icon').observe('click', function(e){
					ipb.search.calendar_start = new CalendarDateSelect( $('date_start'), { year_range: 6, time: true, close_on_click: true } );
				});
			}
			
			if( $('date_end') && $('date_end_icon') )
			{
				$('date_end_icon').observe('click', function(e){
					ipb.search.calendar_start = new CalendarDateSelect( $('date_end'), { year_range: 6, time: true, close_on_click: true } );
				});
			}
		});
	},
	
	initSearchForm: function()
	{		
		// Get all checkboxes
		$$('input.filter').each( function(check){
			appID = check.identify().match('select_app_(.*)')[1];
			if( appID && appID != 'all' )
			{
				if( $('app_filter_' + appID) )
				{
					$('app_filter_' + appID ).wrap('div', { id: 'app_filter_' + appID + '_wrap' } ).hide(); //Wrap it in a div because scriptaculous is funky with fieldsets
				}
				ipb.search.checks.push( appID );
			}
			$( check ).observe('click', ipb.search.doFilters );
		});
		
		if( $('author') )
		{
			// Autocomplete stuff
			document.observe("dom:loaded", function(){
				var url = ipb.vars['base_url'] + 'app=core&module=ajax&section=findnames&do=get-member-names&name=';
				var ac = new ipb.Autocomplete( $('author'), { multibox: false, url: url, templates: { wrap: ipb.templates['autocomplete_wrap'], item: ipb.templates['autocomplete_item'] } } );
			});
		}
	},
	
	doFilters: function(e)
	{
		elem = Event.element(e);
		appid = elem.id.replace('select_app_', '');
		
		//if( !ipb.search.checks.length ){ return; }
		
		if( $( elem ) && $( elem ).id == 'select_app_all' )
		{
			if( $('select_app_all').checked )
			{
				ipb.search.checks.each( function(check){
					if(	$('select_app_' + check) ){
						$('select_app_' + check).checked = false;
					}
					if(	$('app_filter_' + check + '_wrap') )
					{
						new Effect.BlindUp( $('app_filter_' + check + '_wrap' ), { duration: 0.3 } );
					}
				});
			}
			else
			{
				// No change
			}
		}
		else if( $( elem ) )
		{
			if( $(elem).checked )
			{
				// Uncheck everything
				$('select_app_all').checked = false;
				
				if( $('app_filter_' + appid + '_wrap' ) && !$('app_filter_' + appid + '_wrap').visible() )
				{
					new Effect.BlindDown( $('app_filter_' + appid + '_wrap' ), { duration: 0.3 } );
				}
			}
			else
			{
				if( $('app_filter_' + appid + '_wrap' ) && $('app_filter_' + appid + '_wrap' ).visible() )
				{
					new Effect.BlindUp( $('app_filter_' + appid + '_wrap' ), { duration: 0.3 } );
				}
			}
		}
	}
}
ipb.search.init();