| Server IP : 156.238.232.47 / Your IP : 216.73.216.150 Web Server : nginx/1.25.3 System : Linux C202504152095410 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : www ( 1000) PHP Version : 8.3.25 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /www/data/wwwroot/2025_06_30_01/m/js/ |
Upload File : |
/*
FlameViewportScale. 0.12. Facilitates a simple viewport scale query.
Optic Swerve, opticswerve.com
Documented at http://menacingcloud.com/?c=viewportScale
*/
/*--------------------------|
| FlameViewportScale |
|--------------------------*/
function FlameViewportScale() {
this.delay = 600; // Delay after calling update to account for viewport bounce
this.orientation;
this.screenWidth; // Screen width corrected for orientation
this.timeout;
this.viewportScale;
// Get current scale
//-------------------
this.getScale = function() {
this.viewportScale = undefined;
// Get viewport width
var viewportWidth = document.documentElement.clientWidth;
// Abort. Screen width is greater than the viewport width (not fullscreen).
if(screen.width > viewportWidth) {
console.log('Aborted viewport scale measurement. Screen width > viewport width');
return;
}
// Get the orientation corrected screen width
this.updateOrientation();
this.screenWidth = screen.width;
if(this.orientation === 'portrait') {
// Take smaller of the two dimensions
if(screen.width > screen.height) this.screenWidth = screen.height;
}
else {
// Take larger of the two dimensions
if(screen.width < screen.height) this.screenWidth = screen.height;
}
// Calculate viewport scale
this.viewportScale = this.screenWidth / window.innerWidth;
return this.viewportScale;
};
// Update viewport orientation
//-----------------------------
this.updateOrientation = function() {
this.orientation = window.orientation;
if(this.orientation === undefined) {
// No JavaScript orientation support. Work it out.
if(document.documentElement.clientWidth > document.documentElement.clientHeight) this.orientation = 'landscape';
else this.orientation = 'portrait';
}
else if(this.orientation === 0 || this.orientation === 180) this.orientation = 'portrait';
else this.orientation = 'landscape'; // Assumed default, most laptop and PC screens.
};
// Update
//--------
this.update = function(callback) {
// Clear timeout if already set
if(this.timeout !== undefined) {
clearTimeout(this.timeout);
this.timeout = undefined;
}
if(this.delay > 0) {
// Delay compensates for viewport bounce
var viewScale = this;
this.timeout = setTimeout(function() {
viewScale.getScale();
if(callback !== undefined) callback();
}, this.delay);
}
else {
// Immediate scale update
this.getScale();
if(callback !== undefined) callback();
}
};
return true;
}