PageSourceSearch

https://www.sanatoriumhera.at/web/jakarta.faces.resource/session-t…?ln=esvportaljs&v=2.0.27

js sanatoriumhera.at collected 2026-10-08 07:21:41 UTC 12,207 bytes, 440 lines download raw bytes

1var State = (function() {
2	function State(id, context) {
3		this.id = id;
4		this.context = context;
5	}
6
7	State.prototype.enter = function() {
8	};
9	State.prototype.refresh = function(context) {
10		this.context = context;
11	};
12	State.prototype.exit = function() {
13	};
14
15	return State;
16})();
17
18var StateContext = (function() {
19
20	function StateContext(initState) {
21		this._state = initState;
22	}
23
24	StateContext.prototype.change = function(state) {
25		if (inIframe()) {
26			return;
27		}
28		if (this._state.id === state.id) {
29			this._state.refresh(state.context);
30		}
31		if (this._state.id !== state.id) {
32			this._state.exit();
33			this._state = state;
34			this._state.enter();
35		}
36	}
37
38	return StateContext;
39})();
40
41/**
42 * State that does nothing.
43 */
44var NoopState = (function(State) {
45	function NoopState(context) {
46		State.call(this, 'noop', context);
47	}
48
49	NoopState.prototype = Object.create(State.prototype);
50	NoopState.prototype.constructor = NoopState;
51
52	NoopState.prototype.enter = function() {
53		State.prototype.enter.call(this);
54	};
55	NoopState.prototype.refresh = function(context) {
56		State.prototype.refresh.call(this, context);
57	};
58	NoopState.prototype.exit = function() {
59		State.prototype.exit.call(this);
60	};
61
62	return NoopState;
63})(State);
64
65var TimeoutState = (function(State) {
66	function TimeoutState(id, context, stateContext) {
67		State.call(this, id, context);
68		this._timer = new Timer(this.context.duration);
69		this._stateContext = stateContext;
70	}
71
72	TimeoutState.prototype = Object.create(State.prototype);
73	TimeoutState.prototype.constructor = TimeoutState;
74
75	/**
76	 * Start the timer and attach it on the display
77	 *
78	 * @param {Node}
79	 *            display
80	 * @param context
81	 * @param {Timer}
82	 *            timer
83	 */
84	function _startTimer(display, context, timer) {
85		var that = this;
86		this._timer.addListener('progress', function(tInfo) {
87			display.innerHTML = tInfo.minutes + ':' + tInfo.seconds;
88		});
89		this._timer.addListener('stop', function(tInfo) {
90			display.innerHTML = '';
91
92			if (tInfo.duration <= 0) {
93				that._stateContext.change(new FinishedCountdownState(context,
94						that._stateContext));
95			}
96		});
97
98		timer.start();
99	}
100
101	function _isCloseButton(event) {
102		return (event && event.target && event.target.className && event.target.className
103				.indexOf('featherlight-close') != -1);
104	}
105
106	TimeoutState.prototype.enter = function() {
107		State.prototype.enter.call(this);
108		var that = this, configuration = {
109			afterContent : function() {
110				var btn = document.querySelector('.featherlight .to_button');
111				btn.onclick = that.context.buttonAction;
112
113				_startTimer.call(that, document
114						.querySelector('.featherlight .to_timer'),
115						that.context, that._timer);
116			},
117			afterClose : function(event) {
118				if (_isCloseButton(event)) {
119					(that.context.exitAction || noop)(event);
120				}
121
122				if (that._timer && !that._timer.isStopped()) {
123					that._timer.stop();
124					that._timer = null;
125				}
126			},
127			closeOnEsc : false,
128			closeOnClick : false,
129		};
130
131		if (!this._dialog) {
132			this._dialog = new Dialog(Object.assign({
133				configuration : configuration
134			}, this.context));
135			this._dialog.open();
136		}
137	};
138	TimeoutState.prototype.refresh = function(context) {
139		State.prototype.refresh.call(this, context);
140		(this._timer || {
141			refreshDuration : noop
142		}).refreshDuration(context.duration);
143		(this._dialog || {
144			update : noop
145		}).update(context);
146	};
147	TimeoutState.prototype.exit = function() {
148		State.prototype.exit.call(this);
149		(this._dialog || {
150			close : noop
151		}).close();
152	};
153
154	return TimeoutState;
155})(State);
156
157var FinishedCountdownState = (function(State) {
158	function FinishedCountdownState(context) {
159		State.call(this, 'finished-countdown', context);
160	}
161
162	FinishedCountdownState.prototype = Object.create(State.prototype);
163	FinishedCountdownState.prototype.constructor = FinishedCountdownState;
164
165	FinishedCountdownState.prototype.enter = function() {
166		State.prototype.enter.call(this);
167		var that = this;
168
169		var configuration = {
170			afterContent : function() {
171				var btn = document.querySelector('.featherlight .to_button');
172				btn.onclick = function() {
173					window.location.href = that.context.redirectUrl;
174				};
175			},
176			closeOnEsc : false,
177			closeOnClick : false,
178			hideX : true,
179		};
180
181		if (!this._dialog) {
182			var context = Object
183					.assign(
184							this.context,
185							{
186								configuration : configuration,
187								contentText : 'Da die Zeit abgelaufen ist, wurden Sie automatisch abgemeldet und werden auf die Startseite weitergeleitet.',
188								buttonText : 'Verstanden'
189							});
190			this._dialog = new Dialog(context);
191			this._dialog.open();
192		}
193	};
194	FinishedCountdownState.prototype.refresh = function(context) {
195		State.prototype.refresh.call(this, context);
196		(this._dialog || {
197			update : noop
198		}).update(context);
199		var btn = document.querySelector('.featherlight .to_button');
200		btn.onclick = function() {
201			window.location.href = context.redirectUrl;
202		};
203	};
204	FinishedCountdownState.prototype.exit = function() {
205		State.prototype.exit.call(this);
206		(this._dialog || {
207			close : noop
208		}).close();
209	};
210	return FinishedCountdownState;
211})(State);
212
213var ActiveSessionCheckState = (function(State, StateContext) {
214
215	function ActiveSessionCheckState(context, service, stateContext) {
216		State.call(this, 'active-session-check-state', context);
217		this._ibsysService = service;
218		this._stateContext = stateContext;
219		this._baseStateContext = StateContext;
220		this._baseStateContext(new NoopState(context, this));
221		this._intervalRefreshId = null;
222	}
223
224	ActiveSessionCheckState.prototype = Object.create(State.prototype);
225	ActiveSessionCheckState.prototype.constructor = ActiveSessionCheckState;
226
227	ActiveSessionCheckState.ACTIVITY_TIMESTAMP_KEY = 'activity-timestamp';
228	ActiveSessionCheckState.INACTIVITY_TIMESTAMP_KEY = 'inactivity-timestamp';
229
230	ActiveSessionCheckState.prototype.change = function(state) {
231		this._baseStateContext.prototype.change.call(this, state);
232	}
233
234	ActiveSessionCheckState.prototype.enter = function() {
235		State.prototype.enter.call(this);
236		var that = this;
237		if (this._intervalRefreshId) {
238			return;
239		}
240		this._intervalRefreshId = setInterval(function() {
241			_checkStatus.call(that, that.context);
242		}, that.context.refreshPeriod);
243	};
244	ActiveSessionCheckState.prototype.refresh = function(context) {
245		State.prototype.refresh.call(this, context);
246	};
247	ActiveSessionCheckState.prototype.exit = function() {
248		State.prototype.exit.call(this);
249		if (this._intervalRefreshId) {
250			clearInterval(this._intervalRefreshId);
251			this._intervalRefreshId = null;
252		}
253	};
254
255	function _constructActivityTimeout(payload, context) {
256		var that = this, btnAction = function() {
257			sessionStorage.setItem(
258					ActiveSessionCheckState.ACTIVITY_TIMESTAMP_KEY, Date.now());
259			that.change(new NoopState(context, that));
260		}, ctx = {
261			contentText : 'Bitte setzen Sie den laufenden Prozess fort oder speichern Sie Ihre Daten.',
262			buttonText : 'Ok',
263			duration : payload.remainingSecondsActivity,
264			buttonAction : btnAction,
265			exitAction : btnAction,
266		};
267
268		return new TimeoutState('activity-timeout',
269				Object.assign(ctx, context), this);
270	}
271
272	function _constructInactivityTimeout(payload, context) {
273		var that = this, btnAction = function() {
274			that._ibsysService.prolongSession(function() {
275				that.change(new NoopState(context, that));
276			}, _errorStatus);
277		}, exitAction = function() {
278			sessionStorage.setItem(
279					ActiveSessionCheckState.INACTIVITY_TIMESTAMP_KEY, Date
280							.now());
281			that.change(new NoopState(context, that));
282		}, ctx = {
283			contentText : 'Wollen Sie weiter angemeldet bleiben?',
284			buttonText : 'Zeit verlängern',
285			duration : payload.remainingSecondsInactivity,
286			buttonAction : btnAction,
287			exitAction : exitAction,
288		};
289
290		return new TimeoutState('inactivity-timeout', Object.assign(ctx,
291				context), this);
292	}
293
294	/**
295	 * Resolve dialog status.
296	 *
297	 * @param {any}
298	 *            payload
299	 * @param {any}
300	 *            context
301	 */
302	ActiveSessionCheckState.prototype.resolveStatus = function(payload, context) {
303		var that = this;
304		if (_shouldActivityBeDisplayed(payload, context)) {
305			if (payload.remainingSecondsActivity <= 0) {
306				return new FinishedCountdownState(context, that);
307			} else {
308				return _constructActivityTimeout.call(that, payload, context);
309			}
310		}
311		if (_shouldInactivityBeDisplayed(payload, context)) {
312			if (payload.remainingSecondsInactivity <= 0) {
313				return new FinishedCountdownState(context, that);
314			} else {
315				return _constructInactivityTimeout.call(that, payload, context);
316			}
317		}
318
319		return new NoopState(context, this);
320	}
321
322	/**
323	 * Resolve success status.
324	 *
325	 * @param {any}
326	 *            payload
327	 * @param {any}
328	 *            context
329	 */
330	function _successStatus(payload, context) {
331		if (payload.isLoggedIn) {
332			var state = this.resolveStatus.call(this, payload, context);
333			this.change(state);
334		} else {
335			this._stateContext.change(new InactiveSessionCheckState(context));
336		}
337	}
338
339	/**
340	 * Check whether a timeout exists for the given stc context.
341	 *
342	 * @param {any}
343	 *            context
344	 * @param {String}
345	 *            timestampKey
346	 */
347	function _hasTimeout(context, timestampKey) {
348		return (sessionStorage.getItem(timestampKey) && Date.now()
349				- sessionStorage.getItem(timestampKey) < 60000 * context.cooldownPeriod);
350	}
351
352	/**
353	 * Check whether inactivity should be displayed.
354	 *
355	 * @param {any}
356	 *            payload
357	 * @param {any}
358	 *            context
359	 */
360	function _shouldInactivityBeDisplayed(payload, context) {
361		return (!_hasTimeout(context,
362				ActiveSessionCheckState.INACTIVITY_TIMESTAMP_KEY)
363				&& payload.displayWarningInactivity && !payload.displayWarningActivity);
364	}
365
366	/**
367	 * Check whether activity should be displayed.
368	 *
369	 * @param {any}
370	 *            payload
371	 * @param {any}
372	 *            context
373	 */
374	function _shouldActivityBeDisplayed(payload, context) {
375		return (!_hasTimeout(context,
376				ActiveSessionCheckState.ACTIVITY_TIMESTAMP_KEY) && payload.displayWarningActivity);
377	}
378
379	function _errorStatus(error) {
380		console.error(error);
381	}
382
383	function _checkStatus(context) {
384		var that = this;
385		var success = function(data) {
386			return _successStatus.call(that, data, context);
387		}, err = function(error) {
388			_errorStatus.call(that, error);
389		};
390		this._ibsysService.checkSession(success, err);
391	}
392
393	return ActiveSessionCheckState;
394})(State, StateContext);
395
396var InactiveSessionCheckState = (function(State) {
397
398	function InactiveSessionCheckState(context) {
399		State.call(this, 'inactive-session-check-state', context);
400	}
401
402	InactiveSessionCheckState.prototype = Object.create(State.prototype);
403	InactiveSessionCheckState.prototype.constructor = InactiveSessionCheckState;
404
405	InactiveSessionCheckState.prototype.enter = function() {
406		State.prototype.enter.call(this);
407	};
408	InactiveSessionCheckState.prototype.refresh = function(context) {
409		State.prototype.refresh.call(this, context);
410	};
411	InactiveSessionCheckState.prototype.exit = function() {
412		State.prototype.exit.call(this);
413	};
414
415	return InactiveSessionCheckState;
416})(State);
417
418var sessionTimeoutClue = (function(StateContext) {
419
420	function SessionTimeoutClue(context, service) {
421		StateContext.call(this, new InactiveSessionCheckState(context, this));
422		this._context = context;
423		this._service = service;
424	}
425
426	SessionTimeoutClue.prototype = Object.create(StateContext.prototype);
427	SessionTimeoutClue.prototype.constructor = SessionTimeoutClue;
428
429	SessionTimeoutClue.prototype.change = function(state) {
430		StateContext.prototype.change.call(this, state);
431	};
432
433	SessionTimeoutClue.prototype.startSessionCheck = function() {
434		this.change(new ActiveSessionCheckState(this._context, this._service,
435				this));
436	}
437
438	return SessionTimeoutClue;
439
440})(StateContext);

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.