2017-02-18 01:56:23 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								'use strict' ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 21:55:19 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 18:55:33 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								var  app  =  window . app  ||  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								app . isFocused  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								app . currentRoom  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								app . widgets  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								app . cacheBuster  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								( function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-05 13:18:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									var  params  =  utils . params ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									var  showWelcomeMessage  =  ! ! params . loggedin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									var  registerMessage  =  params . register ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									var  isTouchDevice  =  utils . isTouchDevice ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-24 17:26:50 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									require ( [ 'benchpress' ] ,  function  ( Benchpress )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Benchpress . setGlobal ( 'config' ,  config ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( Object . defineProperty )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Object . defineProperty ( window ,  'templates' ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												configurable :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												enumerable :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												get :  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-25 15:53:35 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													console . warn ( '[deprecated] Accessing benchpress (formerly known as templates.js) globally is deprecated. Use `require(["benchpress"], function (Benchpress) { ... })` instead' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-24 17:26:50 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													return  Benchpress ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											window . templates  =  Benchpress ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-18 10:58:32 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . cacheBuster  =  config [ 'cache-buster' ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-09-18 10:58:32 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bootbox . setDefaults ( { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										locale :  config . userLang , 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-18 10:58:32 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . load  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										app . loadProgressiveStylesheet ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 21:11:33 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										overrides . overrideTimeago ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-20 13:39:08 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  url  =  ajaxify . start ( window . location . pathname . slice ( 1 )  +  window . location . search  +  window . location . hash ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ajaxify . updateHistory ( url ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-26 16:39:03 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ajaxify . parseData ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ajaxify . end ( url ,  app . template ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										handleStatusChange ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( config . searchEnabled )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											app . handleSearch ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-20 08:51:04 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( 'body' ) . on ( 'click' ,  '#new_topic' ,  function  ( e )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											e . preventDefault ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											app . newTopic ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-07 12:34:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '#header-menu .container' ) . on ( 'click' ,  '[component="user/logout"]' ,  app . logout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-25 21:34:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Visibility . change ( function  ( event ,  state )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( state  ===  'visible' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												app . isFocused  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												app . alternatingTitle ( '' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( state  ===  'hidden' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												app . isFocused  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 12:20:17 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										createHeaderTooltips ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . showEmailConfirmWarning ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-01 12:59:51 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										app . showCookieWarning ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 12:20:17 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										socket . removeAllListeners ( 'event:nodebb.ready' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										socket . on ( 'event:nodebb.ready' ,  function  ( data )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-20 15:32:44 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ( data . hostname  ===  app . upstreamHost )  &&  ( ! app . cacheBuster  ||  app . cacheBuster  !==  data [ 'cache-buster' ] ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-20 18:43:24 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . cacheBuster  =  data [ 'cache-buster' ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 12:21:51 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . alert ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													alert _id :  'forum_updated' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													title :  '[[global:updated.title]]' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													message :  '[[global:updated.message]]' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													clickfn :  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														window . location . reload ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} , 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													type :  'warning' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-25 16:41:32 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										socket . on ( 'event:livereload' ,  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-25 15:16:55 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( app . user . isAdmin  &&  ! ajaxify . currentPage . match ( /admin/ ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												window . location . reload ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-07 16:13:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										require ( [ 'taskbar' ,  'helpers' ,  'forum/pagination' ] ,  function  ( taskbar ,  helpers ,  pagination )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											taskbar . init ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											helpers . register ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											pagination . init ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											$ ( window ) . trigger ( 'action:app.load' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-18 10:58:32 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-22 12:21:51 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-07 12:34:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . updateHeader  =  function  ( data ,  callback )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/ * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *  data : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *    header  ( obj ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *    config  ( obj ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *    next  ( string ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 * / 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 19:43:35 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										require ( [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											'benchpress' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											'translator' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											'forum/unread' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											'forum/header/notifications' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											'forum/header/chat' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										] ,  function  ( Benchpress ,  translator ,  Unread ,  Notifications ,  Chat )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-07 12:34:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											app . user  =  data . header . user ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											data . header . config  =  data . config ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											config  =  data . config ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Benchpress . setGlobal ( 'config' ,  config ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 11:45:29 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											var  htmlEl  =  $ ( 'html' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											htmlEl . attr ( 'data-dir' ,  data . header . languageDirection ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											htmlEl . css ( 'direction' ,  data . header . languageDirection ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-07 12:34:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Manually reconnect socket.io
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											socket . close ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											socket . open ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Re-render top bar menu
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											var  toRender  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												menu :  $ ( '#header-menu .container' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												'chats-menu' :  $ ( '#chats-menu' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												'slideout-menu' :  $ ( '.slideout-menu' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Promise . all ( Object . keys ( toRender ) . map ( function  ( tpl )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  Benchpress . render ( 'partials/'  +  tpl ,  data . header ) . then ( function  ( render )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  translator . Translator . create ( ) . translate ( render ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ) . then ( function  ( html )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												Object . values ( toRender ) . forEach ( function  ( element ,  idx )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													element . html ( html [ idx ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 19:43:35 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Unread . initUnreadTopics ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-07 12:34:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Notifications . prepareDOM ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												Chat . prepareDOM ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:06:13 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . reskin ( data . config . bootswatchSkin ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-07 11:29:20 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												translator . switchTimeagoLanguage ( callback ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-20 13:59:34 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												bootbox . setLocale ( config . userLang ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												$ ( window ) . trigger ( 'action:app.updateHeader' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-07 12:34:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-20 08:51:04 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . logout  =  function  ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-08 15:36:25 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( e )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											e . preventDefault ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-28 15:46:10 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( window ) . trigger ( 'action:app.logout' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-11 16:47:59 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/ * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Set  session  refresh  flag  ( otherwise  the  session  check  will  trip  and  throw  invalid  session  modal ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											We  know  the  session  is / will  be  invalid  ( uid  mismatch )  because  the  user  is  logging  out 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										* / 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . flags  =  app . flags  ||  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . flags . _sessionRefresh  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-14 21:44:33 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ . ajax ( config . relative _path  +  '/logout' ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											type :  'POST' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											headers :  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												'x-csrf-token' :  config . csrf _token , 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-14 21:44:33 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} , 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-07 12:34:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											success :  function  ( data )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-05 13:11:20 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// ACP logouts go to frontend via page load, not ajaxify
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ajaxify . data . template . name . startsWith ( 'admin/' ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													$ ( window ) . trigger ( 'action:app.loggedOut' ,  data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													window . location . href  =  config . relative _path  +  ( data . next  ||  '/' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-07 12:34:12 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . updateHeader ( data ,  function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													// Overwrite in hook (below) to redirect elsewhere
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													data . next  =  data . next  ||  undefined ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													$ ( window ) . trigger ( 'action:app.loggedOut' ,  data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( data . next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														ajaxify . go ( data . next ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														ajaxify . refresh ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									app . alert  =  function  ( params )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										require ( [ 'alerts' ] ,  function  ( alerts )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											alerts . alert ( params ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . removeAlert  =  function  ( id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										require ( [ 'alerts' ] ,  function  ( alerts )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											alerts . remove ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									app . alertSuccess  =  function  ( message ,  timeout )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . alert ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											title :  '[[global:alert.success]]' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											message :  message , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											type :  'success' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 12:59:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											timeout :  timeout  ||  5000 , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									app . alertError  =  function  ( message ,  timeout )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-17 18:21:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										message  =  message . message  ||  message ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-17 18:08:44 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-16 13:48:53 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( message  ===  '[[error:invalid-session]]' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  app . handleInvalidSession ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										app . alert ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											title :  '[[global:alert.error]]' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											message :  message , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											type :  'danger' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 12:59:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											timeout :  timeout  ||  10000 , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . handleInvalidSession  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-16 13:48:53 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( app . flags  &&  app . flags . _sessionRefresh )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . flags  =  app . flags  ||  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . flags . _sessionRefresh  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										require ( [ 'translator' ] ,  function  ( translator )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											translator . translate ( '[[error:invalid-session-text]]' ,  function  ( translated )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-16 13:48:53 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												bootbox . alert ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													title :  '[[error:invalid-session]]' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													message :  translated , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													closeButton :  false , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													callback :  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-16 13:48:53 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														window . location . reload ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} , 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-16 13:48:53 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . enterRoom  =  function  ( room ,  callback )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										callback  =  callback  ||  function  ( )  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-05 14:39:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( socket  &&  app . user . uid  &&  app . currentRoom  !==  room )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 09:31:52 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											var  previousRoom  =  app . currentRoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											app . currentRoom  =  room ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											socket . emit ( 'meta.rooms.enter' ,  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												enter :  room , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} ,  function  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 09:31:52 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													app . currentRoom  =  previousRoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-20 17:53:44 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													return  app . alertError ( err . message ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-12 09:31:52 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-05 14:39:52 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												callback ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . leaveCurrentRoom  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-20 17:53:44 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! socket )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-01 21:38:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  previousRoom  =  app . currentRoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . currentRoom  =  '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										socket . emit ( 'meta.rooms.leaveCurrent' ,  function  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-20 17:53:44 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-01 21:38:03 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . currentRoom  =  previousRoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-20 17:53:44 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												return  app . alertError ( err . message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 13:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-20 17:53:44 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									function  highlightNavigationLink ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-19 16:16:35 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '#main-nav li' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											. removeClass ( 'active' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											. find ( 'a' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											. filter ( function  ( i ,  x )  {  return  window . location . pathname . startsWith ( x . getAttribute ( 'href' ) ) ;  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											. parent ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											. addClass ( 'active' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . createUserTooltips  =  function  ( els ,  placement )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( isTouchDevice )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-04 01:13:47 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										els  =  els  ||  $ ( 'body' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										els . find ( '.avatar,img[title].teaser-pic,img[title].user-img,div.user-icon,span.user-icon' ) . each ( function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											$ ( this ) . tooltip ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												placement :  placement  ||  $ ( this ) . attr ( 'title-placement' )  ||  'top' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												title :  $ ( this ) . attr ( 'title' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . createStatusTooltips  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! isTouchDevice )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-02 11:16:31 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											$ ( 'body' ) . tooltip ( { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 01:27:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												selector :  '.fa-circle.status' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												placement :  'top' , 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-02 11:16:31 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									app . processPage  =  function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										highlightNavigationLink ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 16:26:35 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '.timeago' ) . timeago ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										utils . makeNumbersHumanReadable ( $ ( '.human-readable-number' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										utils . addCommasToNumbers ( $ ( '.formatted-number' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . createUserTooltips ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										app . createStatusTooltips ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Scroll back to top of page
 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-06 12:31:55 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! ajaxify . isCold ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											window . scrollTo ( 0 ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 14:14:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . showMessages  =  function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var  messages  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											login :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												format :  'alert' , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												title :  '[[global:welcome_back]] '  +  app . user . username  +  '!' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												message :  '[[global:you_have_successfully_logged_in]]' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 14:14:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} , 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-05 13:18:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											register :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												format :  'modal' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 14:14:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-12-05 13:18:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										function  showAlert ( type ,  message )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 14:14:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											switch  ( messages [ type ] . format )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 02:38:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											case  'alert' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												app . alert ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													type :  'success' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													title :  messages [ type ] . title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													message :  messages [ type ] . message , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													timeout :  5000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  'modal' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												require ( [ 'translator' ] ,  function  ( translator )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-05 13:18:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													translator . translate ( message  ||  messages [ type ] . message ,  function  ( translated )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 02:38:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														bootbox . alert ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															title :  messages [ type ] . title , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															message :  translated , 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 14:14:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 02:38:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 14:14:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( showWelcomeMessage )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											showWelcomeMessage  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-10 15:59:16 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											$ ( document ) . ready ( function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 14:14:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												showAlert ( 'login' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-10 15:59:08 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-27 14:14:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-05 13:18:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( registerMessage )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											$ ( document ) . ready ( function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												showAlert ( 'register' ,  decodeURIComponent ( registerMessage ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												registerMessage  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-02 15:17:22 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . openChat  =  function  ( roomId ,  uid )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! app . user . uid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  app . alertError ( '[[error:not-logged-in]]' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										require ( [ 'chat' ] ,  function  ( chat )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											function  loadAndCenter ( chatModal )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-30 16:29:52 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												chat . load ( chatModal . attr ( 'data-uuid' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												chat . center ( chatModal ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												chat . focusInput ( chatModal ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 13:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( chat . modalExists ( roomId ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 10:09:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												loadAndCenter ( chat . getModal ( roomId ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 13:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 12:30:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												socket . emit ( 'modules.chats.loadRoom' ,  {  roomId :  roomId ,  uid :  uid  ||  app . user . uid  } ,  function  ( err ,  roomData )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 13:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( err )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														return  app . alertError ( err . message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													roomData . users  =  roomData . users . filter ( function  ( user )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 13:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														return  user  &&  parseInt ( user . uid ,  10 )  !==  parseInt ( app . user . uid ,  10 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-02 15:17:22 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													roomData . uid  =  uid  ||  app . user . uid ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-23 11:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													chat . createModal ( roomData ,  loadAndCenter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 13:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-17 16:32:53 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . newChat  =  function  ( touid ,  callback )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-14 10:08:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										function  createChat ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											socket . emit ( 'modules.chats.newRoom' ,  {  touid :  touid  } ,  function  ( err ,  roomId )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( err )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  app . alertError ( err . message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! ajaxify . data . template . chats )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													app . openChat ( roomId ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ajaxify . go ( 'chats/'  +  roomId ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												callback ( false ,  roomId ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										callback  =  callback  ||  function  ( )  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 11:30:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! app . user . uid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  app . alertError ( '[[error:not-logged-in]]' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-22 10:22:05 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( parseInt ( touid ,  10 )  ===  parseInt ( app . user . uid ,  10 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  app . alertError ( '[[error:cant-chat-with-yourself]]' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-14 10:08:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										socket . emit ( 'modules.chats.isDnD' ,  touid ,  function  ( err ,  isDnD )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 13:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( err )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  app . alertError ( err . message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-14 10:08:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! isDnD )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  createChat ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-08 23:01:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-14 10:08:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											bootbox . confirm ( '[[modules:chat.confirm-chat-with-dnd-user]]' ,  function  ( ok )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ok )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													createChat ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 13:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-16 11:30:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									var 	titleObj  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 02:38:03 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										active :  false , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										interval :  undefined , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										titles :  [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									app . alternatingTitle  =  function  ( title )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( typeof  title  !==  'string' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( title . length  >  0  &&  ! app . isFocused )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! titleObj . titles [ 0 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												titleObj . titles [ 0 ]  =  window . document . title ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											require ( [ 'translator' ] ,  function  ( translator )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												translator . translate ( title ,  function  ( translated )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													titleObj . titles [ 1 ]  =  translated ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( titleObj . interval )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														clearInterval ( titleObj . interval ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													titleObj . interval  =  setInterval ( function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														var  title  =  titleObj . titles [ titleObj . titles . indexOf ( window . document . title )  ^  1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														if  ( title )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															window . document . title  =  $ ( '<div/>' ) . html ( title ) . text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} ,  2000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( titleObj . interval )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												clearInterval ( titleObj . interval ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( titleObj . titles [ 0 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												window . document . title  =  $ ( '<div/>' ) . html ( titleObj . titles [ 0 ] ) . text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . refreshTitle  =  function  ( title )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-23 01:59:13 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! title )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										require ( [ 'translator' ] ,  function  ( translator )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-22 11:19:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											title  =  config . titleLayout . replace ( /{/g ,  '{' ) . replace ( /}/g ,  '}' ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												. replace ( '{pageTitle}' ,  function  ( )  {  return  title ;  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												. replace ( '{browserTitle}' ,  function  ( )  {  return  config . browserTitle ;  } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-22 11:19:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-13 12:09:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Allow translation strings in title on ajaxify (#5927)
 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-13 17:06:00 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											title  =  translator . unescape ( title ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-13 12:09:31 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											translator . translate ( title ,  function  ( translated )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-26 15:54:54 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												titleObj . titles [ 0 ]  =  translated ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												app . alternatingTitle ( '' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . toggleNavbar  =  function  ( state )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  navbarEl  =  $ ( '.navbar' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( navbarEl )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 12:51:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											navbarEl . toggleClass ( 'hidden' ,  ! state ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									function  createHeaderTooltips ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-11 13:19:25 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  env  =  utils . findBootstrapEnvironment ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( env  ===  'xs'  ||  env  ===  'sm'  ||  isTouchDevice )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '#header-menu li a[title]' ) . each ( function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											$ ( this ) . tooltip ( { 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-02 11:16:31 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												placement :  'bottom' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-18 23:34:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												trigger :  'hover' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												title :  $ ( this ) . attr ( 'title' ) , 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-02 11:16:31 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 14:07:48 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										$ ( '#search-form' ) . parent ( ) . tooltip ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											placement :  'bottom' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											trigger :  'hover' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											title :  $ ( '#search-button i' ) . attr ( 'title' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										$ ( '#user_dropdown' ) . tooltip ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											placement :  'bottom' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											trigger :  'hover' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											title :  $ ( '#user_dropdown' ) . attr ( 'title' ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									app . handleSearch  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 01:56:23 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  searchButton  =  $ ( '#search-button' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var  searchFields  =  $ ( '#search-fields' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 20:20:42 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  searchInput  =  $ ( '#search-fields input' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '#search-form .advanced-search-link' ) . on ( 'mousedown' ,  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-11 17:13:44 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ajaxify . go ( '/search' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '#search-form' ) . on ( 'submit' ,  dismissSearch ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										searchInput . on ( 'blur' ,  dismissSearch ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-25 21:34:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										function  dismissSearch ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-31 15:46:55 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											searchFields . addClass ( 'hidden' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											searchButton . removeClass ( 'hidden' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										searchButton . on ( 'click' ,  function  ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-28 11:29:37 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! config . loggedIn  &&  ! app . user . privileges [ 'search:content' ] )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . alert ( { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 01:27:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													message :  '[[error:search-requires-login]]' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													timeout :  3000 , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ajaxify . go ( 'login' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											e . stopPropagation ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											app . prepareSearch ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										$ ( '#search-form' ) . on ( 'submit' ,  function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											var  input  =  $ ( this ) . find ( 'input' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											require ( [ 'search' ] ,  function  ( search )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-17 12:40:14 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												var  data  =  search . getSearchPreferences ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												data . term  =  input . val ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												search . query ( data ,  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													input . val ( '' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . prepareSearch  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 01:56:23 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '#search-fields' ) . removeClass ( 'hidden' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										$ ( '#search-button' ) . addClass ( 'hidden' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '#search-fields input' ) . focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									function  handleStatusChange ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( '[component="header/usercontrol"] [data-status]' ) . off ( 'click' ) . on ( 'click' ,  function  ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											var  status  =  $ ( this ) . attr ( 'data-status' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											socket . emit ( 'user.setStatus' ,  status ,  function  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 01:52:56 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													return  app . alertError ( err . message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2015-09-13 09:26:34 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												$ ( '[data-uid="'  +  app . user . uid  +  '"] [component="user/status"], [component="header/profilelink"] [component="user/status"]' ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-27 14:07:24 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													. removeClass ( 'away online dnd offline' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													. addClass ( status ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-10 22:46:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												$ ( '[component="header/usercontrol"] [data-status]' ) . each ( function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													$ ( this ) . find ( 'span' ) . toggleClass ( 'bold' ,  $ ( this ) . attr ( 'data-status' )  ===  status ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-30 15:14:02 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . user . status  =  status ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											e . preventDefault ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . updateUserStatus  =  function  ( el ,  status )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! el . length )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										require ( [ 'translator' ] ,  function  ( translator )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											translator . translate ( '[[global:'  +  status  +  ']]' ,  function  ( translated )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-17 12:29:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												el . removeClass ( 'online offline dnd away' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													. addClass ( status ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													. attr ( 'title' ,  translated ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													. attr ( 'data-original-title' ,  translated ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-09-08 14:01:20 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . newTopic  =  function  ( cid ,  tags )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-27 19:06:56 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										$ ( window ) . trigger ( 'action:composer.topic.new' ,  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-08 14:01:20 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											cid :  cid  ||  ajaxify . data . cid  ||  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											tags :  tags  ||  ( ajaxify . data . tag  ?  [ ajaxify . data . tag ]  :  [ ] ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-27 19:06:56 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-19 19:23:18 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . loadJQueryUI  =  function  ( callback )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( typeof  $ ( ) . autocomplete  ===  'function' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  callback ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-03 13:10:39 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  scriptEl  =  document . createElement ( 'script' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scriptEl . type  =  'text/javascript' ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-18 14:42:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										scriptEl . src  =  config . relative _path  +  '/assets/vendor/jquery/js/jquery-ui.js?'  +  config [ 'cache-buster' ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-03 13:10:39 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										scriptEl . onload  =  callback ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										document . head . appendChild ( scriptEl ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . showEmailConfirmWarning  =  function  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! config . requireEmailConfirmation  ||  ! app . user . uid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 16:26:27 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  msg  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											alert _id :  'email_confirm' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											type :  'warning' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-17 19:31:21 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											timeout :  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 16:26:27 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! app . user . email )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 16:26:27 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											msg . message  =  '[[error:no-email-to-confirm]]' ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											msg . clickfn  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 16:26:27 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . removeAlert ( 'email_confirm' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ajaxify . go ( 'user/'  +  app . user . userslug  +  '/edit' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											app . alert ( msg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( ! app . user [ 'email:confirmed' ]  &&  ! app . user . isEmailConfirmSent )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											msg . message  =  err  ?  err . message  :  '[[error:email-not-confirmed]]' ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											msg . clickfn  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 16:26:27 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												app . removeAlert ( 'email_confirm' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												socket . emit ( 'user.emailConfirm' ,  { } ,  function  ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 16:26:27 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( err )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														return  app . alertError ( err . message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													app . alertSuccess ( '[[notifications:email-confirm-sent]]' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											app . alert ( msg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( ! app . user [ 'email:confirmed' ]  &&  app . user . isEmailConfirmSent )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											msg . message  =  '[[error:email-not-confirmed-email-sent]]' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											app . alert ( msg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . parseAndTranslate  =  function  ( template ,  blockName ,  data ,  callback )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 10:51:25 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										require ( [ 'translator' ,  'benchpress' ] ,  function  ( translator ,  Benchpress )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-12 15:29:41 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											function  translate ( html ,  callback )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												translator . translate ( html ,  function  ( translatedHTML )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-12 15:29:41 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													translatedHTML  =  translator . unescape ( translatedHTML ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													callback ( $ ( translatedHTML ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-20 16:00:11 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( typeof  blockName  ===  'string' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 10:51:25 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Benchpress . parse ( template ,  blockName ,  data ,  function  ( html )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-12 15:29:41 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													translate ( html ,  callback ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-29 23:58:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-20 16:00:11 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-12 15:29:41 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												callback  =  data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												data  =  blockName ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 10:51:25 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Benchpress . parse ( template ,  data ,  function  ( html )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-12 15:29:41 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													translate ( html ,  callback ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-29 23:58:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-20 16:00:11 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-29 23:58:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-13 11:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									app . loadProgressiveStylesheet  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										var  linkEl  =  document . createElement ( 'link' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										linkEl . rel  =  'stylesheet' ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-27 11:56:38 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										linkEl . href  =  config . relative _path  +  '/assets/js-enabled.css?'  +  app . cacheBuster ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-27 18:56:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										document . head . appendChild ( linkEl ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-27 19:06:56 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-01 12:59:51 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									app . showCookieWarning  =  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-19 20:33:03 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										require ( [ 'translator' ,  'storage' ] ,  function  ( translator ,  storage )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! config . cookies . enabled  ||  ! navigator . cookieEnabled )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Skip warning if cookie consent subsystem disabled (obviously), or cookies not in use
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( window . location . pathname . startsWith ( config . relative _path  +  '/admin' ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// No need to show cookie consent warning in ACP
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( storage . getItem ( 'cookieconsent' )  ===  '1' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 15:11:34 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											config . cookies . message  =  translator . unescape ( config . cookies . message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											config . cookies . dismiss  =  translator . unescape ( config . cookies . dismiss ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 17:50:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											config . cookies . link  =  translator . unescape ( config . cookies . link ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 15:11:34 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											app . parseAndTranslate ( 'partials/cookie-consent' ,  config . cookies ,  function  ( html )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												$ ( document . body ) . append ( html ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-23 17:23:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												$ ( document . body ) . addClass ( 'cookie-consent-open' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 15:11:34 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												var  warningEl  =  $ ( '.cookie-consent' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												var  dismissEl  =  warningEl . find ( 'button' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												dismissEl . on ( 'click' ,  function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													// Save consent cookie and remove warning element
 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-19 20:33:03 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													storage . setItem ( 'cookieconsent' ,  '1' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 15:11:34 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													warningEl . remove ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-23 17:23:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													$ ( document . body ) . removeClass ( 'cookie-consent-open' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 15:11:34 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-10 13:50:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-01 12:59:51 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:06:13 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									app . reskin  =  function  ( skinName )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var  clientEl  =  Array . prototype . filter . call ( document . querySelectorAll ( 'link[rel="stylesheet"]' ) ,  function  ( el )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  el . href . indexOf ( config . relative _path  +  '/assets/client' )  !==  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) [ 0 ]  ||  null ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 11:16:49 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! clientEl )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:06:13 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Update client.css link element to point to selected skin variant
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										clientEl . href  =  config . relative _path  +  '/assets/client'  +  ( skinName  ?  '-'  +  skinName  :  '' )  +  '.css' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var  currentSkinClassName  =  $ ( 'body' ) . attr ( 'class' ) . split ( /\s+/ ) . filter ( function  ( className )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  className . startsWith ( 'skin-' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										$ ( 'body' ) . removeClass ( currentSkinClassName . join ( ' ' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( skinName )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											$ ( 'body' ) . addClass ( 'skin-'  +  skinName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-21 11:23:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} ( ) ) ;