Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5957007
bracketedPixelRatio.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
699 B
Referenced Files
None
Subscribers
None
bracketedPixelRatio.js
View Options
/**
* @module bracketedPixelRatio
* @private
*/
/**
* Normalizes a user's device pixel ratio to either 1, 1.5, or 2.
*
* This is important when the server resizes images on the fly in order to
* reduce the work it has to do for device pixel ratios that deviate from a
* set of common ratios.
*
* Adapted from mediawiki/core /resources/src/jquery/jquery.hidpi.js
*
* @param {number} [dpr=window.devicePixelRatio]
* @return {number} The bracketed device pixel ratio
*/
export
default
function
(
dpr
=
window
.
devicePixelRatio
)
{
if
(
!
dpr
)
{
// Probably legacy browser so assume 1
return
1
;
}
if
(
dpr
>
1.5
)
{
return
2
;
}
if
(
dpr
>
1
)
{
return
1.5
;
}
return
1
;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 3, 04:48 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
12/f4/567b76621822f95f3cf6e0a1fc56
Default Alt Text
bracketedPixelRatio.js (699 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment