PageSourceSearch

https://svetsadpark.ru/bitrix/js/main/session.js

js svetsadpark.ru collected 2026-09-26 04:41:23 UTC 3,642 bytes, 134 lines download raw bytes

1function CBXSession()
2{
3	var _this = this;
4	this.mess = {};
5	this.timeout = null;
6	this.sessid = null;
7	this.bShowMess = true;
8	this.dateStart = new Date();
9	this.dateInput = new Date();
10	this.dateCheck = new Date();
11	this.activityInterval = 0;
12	this.notifier = null;
13	
14	this.Expand = function(timeout, sessid, bShowMess, key)
15	{
16		this.timeout = timeout;
17		this.sessid = sessid;
18		this.bShowMess = bShowMess;
19		this.key = key;
20		
21		BX.ready(function(){
22			BX.bind(document, "keypress", _this.OnUserInput);
23			BX.bind(document.body, "mousemove", _this.OnUserInput);
24			BX.bind(document.body, "click", _this.OnUserInput);
25			
26			setTimeout(_this.CheckSession, (_this.timeout-60)*1000);
27		})
28	};
29		
30	this.OnUserInput = function()
31	{
32		var curr = new Date();
33		_this.dateInput.setTime(curr.valueOf());
34	};
35	
36	this.CheckSession = function()
37	{
38		var curr = new Date();
39		if(curr.valueOf() - _this.dateCheck.valueOf() < 30000)
40			return;
41
42		_this.activityInterval = Math.round((_this.dateInput.valueOf() - _this.dateStart.valueOf())/1000);
43		_this.dateStart.setTime(_this.dateInput.valueOf());
44		var interval = (_this.activityInterval > _this.timeout? (_this.timeout-60) : _this.activityInterval);
45
46		var config = {
47			'method': 'GET',
48			'dataType': 'html',
49			'url': '/bitrix/tools/public_session.php?sessid='+_this.sessid+'&interval='+interval+'&k='+_this.key,
50			'data':  '',
51			'onsuccess': function(data){_this.CheckResult(data)},
52			'lsId': 'sess_expand', //caching the result in the local storage for multiple tabs
53			'lsTimeout': 60
54		};
55		if(interval > 0)
56		{
57			//forced request
58			config.lsForce = true;
59		}
60		BX.ajax(config);
61	};
62	
63	this.CheckResult = function(data)
64	{
65		if(data == 'SESSION_EXPIRED')
66		{
67			if(_this.bShowMess)
68			{
69				if(!_this.notifier)
70				{
71					_this.notifier = document.body.appendChild(BX.create('DIV', {
72						props: {className: 'bx-session-message'},
73						style: {
74							top: '0px',
75							backgroundColor: '#FFEB41',
76							border: '1px solid #EDDA3C',
77							width: '630px',
78							fontFamily: 'Arial,Helvetica,sans-serif',
79							fontSize: '13px',
80							fontWeight: 'bold',
81							textAlign: 'center',
82							color: 'black',
83							position: 'absolute',
84							zIndex: '10000',
85							padding: '10px'
86						},
87						html: '<a class="bx-session-message-close" style="display:block; width:12px; height:12px; background:url(/bitrix/js/main/core/images/close.gif) center no-repeat; float:right;" href="javascript:bxSession.Close()"></a>'+_this.mess.messSessExpired
88					}));
89
90					var windowScroll = BX.GetWindowScrollPos();
91					var windowSize = BX.GetWindowInnerSize();
92
93					_this.notifier.style.left = parseInt(windowScroll.scrollLeft + windowSize.innerWidth / 2 - parseInt(_this.notifier.clientWidth) / 2) + 'px';
94
95					if(BX.browser.IsIE())
96					{
97						_this.notifier.style.top = windowScroll.scrollTop + 'px';
98
99						BX.bind(window, 'scroll', function()
100						{
101							var windowScroll = BX.GetWindowScrollPos();
102							_this.notifier.style.top = windowScroll.scrollTop + 'px';
103						});
104					}
105					else
106					{
107						_this.notifier.style.position='fixed';
108					}
109				}
110
111				_this.notifier.style.display = '';
112			}
113		}
114		else
115		{
116			var timeout;
117			if(data == 'SESSION_CHANGED')
118				timeout = (_this.timeout-60);
119			else
120				timeout = (_this.activityInterval < 60? 60 : (_this.activityInterval > _this.timeout? (_this.timeout-60) : _this.activityInterval));
121
122			var curr = new Date();
123			_this.dateCheck.setTime(curr.valueOf());
124			setTimeout(_this.CheckSession, timeout*1000);
125		}
126	};
127	
128	this.Close = function()
129	{
130		this.notifier.style.display = 'none';
131	}
132}
133
134var bxSession = new CBXSession();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.