PageSourceSearch

https://biblio-vidnoe.ru/bitrix/js/main/session.js?1302163491

js biblio-vidnoe.ru collected 2026-10-02 10:00:11 UTC 3,157 bytes, 114 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		BX.ajax.get('/bitrix/tools/public_session.php?sessid='+_this.sessid+'&interval='+interval+'&k='+_this.key, function(data){_this.CheckResult(data)});
46	}
47	
48	this.CheckResult = function(data)
49	{
50		if(data == 'SESSION_EXPIRED')
51		{
52			if(_this.bShowMess)
53			{
54				_this.notifier = document.body.appendChild(BX.create('DIV', {
55					props: {className: 'bx-session-message'},
56					style: {top: '-1000px'},
57					html: '<a class="bx-session-message-close" href="javascript:bxSession.Close()"></a>'+_this.mess.messSessExpired
58				}));
59	
60				var windowScroll = BX.GetWindowScrollPos();
61				var windowSize = BX.GetWindowInnerSize();
62
63				_this.notifier.style.left = parseInt(windowScroll.scrollLeft + windowSize.innerWidth / 2 - parseInt(_this.notifier.clientWidth) / 2) + 'px';
64
65				var fxStart = windowScroll.scrollTop - _this.notifier.offsetHeight;
66				var fxFinish = windowScroll.scrollTop;
67	
68				(new BX.fx({
69					time: 0.5,
70					step: 0.01,
71					type: 'accelerated',
72					start: fxStart,
73					finish: fxFinish,
74					callback: function(top){_this.notifier.style.top = top + 'px';},
75					callback_complete: function()
76					{
77						if(BX.browser.IsIE())
78						{
79							BX.bind(window, 'scroll', function()
80							{
81								var windowScroll = BX.GetWindowScrollPos();
82								_this.notifier.style.top = windowScroll.scrollTop + 'px';
83							});
84						}
85						else
86						{
87							_this.notifier.style.top='0px';
88							_this.notifier.style.position='fixed';
89						}
90					}
91				})).start();
92			}
93		}
94		else
95		{
96			var timeout;
97			if(data == 'SESSION_CHANGED')
98				timeout = (_this.timeout-60);
99			else
100				timeout = (_this.activityInterval < 60? 60 : (_this.activityInterval > _this.timeout? (_this.timeout-60) : _this.activityInterval));
101
102			var curr = new Date();
103			_this.dateCheck.setTime(curr.valueOf());
104			setTimeout(_this.CheckSession, timeout*1000);
105		}
106	}
107	
108	this.Close = function()
109	{
110		this.notifier.style.display = 'none';
111	}
112}
113
114var 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.