Файловый менеджер - Редактировать - /var/www/fetish/assets/js/idle.js
Назад
(function() { var Idle; Idle = {}; Idle = (function() { Idle.isAway = false; Idle.awayTimeout = 3000; Idle.awayTimestamp = 0; Idle.awayTimer = null; Idle.onAway = null; Idle.onAwayBack = null; Idle.onVisible = null; Idle.onHidden = null; function Idle(options) { var activeMethod, activity; if (options) { this.awayTimeout = parseInt(options.awayTimeout, 10); this.onAway = options.onAway; this.onAwayBack = options.onAwayBack; this.onVisible = options.onVisible; this.onHidden = options.onHidden; } activity = this; activeMethod = function() { return activity.onActive(); }; window.onclick = activeMethod; window.onmousemove = activeMethod; window.onmouseenter = activeMethod; window.onkeydown = activeMethod; window.onscroll = activeMethod; this.startAwayTimeout(); document.addEventListener("visibilitychange", (function() { return activity.handleVisibilityChange(); }), false); document.addEventListener("webkitvisibilitychange", (function() { return activity.handleVisibilityChange(); }), false); document.addEventListener("msvisibilitychange", (function() { return activity.handleVisibilityChange(); }), false); } Idle.prototype.onActive = function() { this.awayTimestamp = new Date().getTime() + this.awayTimeout; if (this.isAway) { if (this.onAwayBack) this.onAwayBack(); this.startAwayTimeout(); } this.isAway = false; return true; }; Idle.prototype.startAwayTimeout = function() { var activity; this.awayTimestamp = new Date().getTime() + this.awayTimeout; if (this.awayTimer !== null) clearTimeout(this.awayTimer); activity = this; return this.awayTimer = setTimeout((function() { return activity.checkAway(); }), this.awayTimeout + 100); }; Idle.prototype.setAwayTimeout = function(ms) { this.awayTimeout = parseInt(ms, 10); return this.startAwayTimeout(); }; Idle.prototype.checkAway = function() { var activity, t; t = new Date().getTime(); if (t < this.awayTimestamp) { this.isAway = false; activity = this; this.awayTimer = setTimeout((function() { return activity.checkAway(); }), this.awayTimestamp - t + 100); return; } if (this.awayTimer !== null) clearTimeout(this.awayTimer); this.isAway = true; if (this.onAway) return this.onAway(); }; Idle.prototype.handleVisibilityChange = function() { if (document.hidden || document.msHidden || document.webkitHidden) { if (this.onHidden) return this.onHidden(); } else { if (this.onVisible) return this.onVisible(); } }; return Idle; })(); window.Idle = Idle; }).call(this);
| ver. 1.4 |
Github
|
.
| PHP 7.0.33-0ubuntu0.16.04.16 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка