Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | 1x 1x 1x 1x 2x 1x 719x 1x 1x 1x 1x 719x 1x 1x 1x 1x 1x 1x 1x 1x 1x 12157x 1x 1x 1x 1x 1x 12157x 720x 1x 1x 1x 720x 759x 1x 1x 1x 1x 1x 759x 717x 1x 717x 1x 1x 1x 1x 1816x 1x 1816x 296x 1x 1x 1x 1x 1x 1x 296x 148x 1730x 1x 1729x 1x 1x 1x 3x 1x 2x 2x 2x 2x 2x 2x 2x 2x 1x 3457x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8x 1x 74x 1x 70x 1x 427x 1x 1x 1x 9x 1x 1x 1x 1x 39x | import Check from "./Check.js";
import defined from "./defined.js";
import DeveloperError from "./DeveloperError.js";
import Fullscreen from "./Fullscreen.js";
let theNavigator;
if (typeof navigator !== "undefined") {
theNavigator = navigator;
} else E{
theNavigator = {};
}
function extractVersion(versionString) {
const parts = versionString.split(".");
for (let i = 0, len = parts.length; i < len; ++i) {
parts[i] = parseInt(parts[i], 10);
}
return parts;
}
let isChromeResult;
let chromeVersionResult;
function isChrome() {
if (!defined(isChromeResult)) {
isChromeResult = false;
// Edge contains Chrome in the user agent too
Eif (!isEdge()) {
const fields = / Chrome\/([\.0-9]+)/.exec(theNavigator.userAgent);
Iif (fields !== null) {
isChromeResult = true;
chromeVersionResult = extractVersion(fields[1]);
}
}
}
return isChromeResult;
}
function chromeVersion() {
return isChrome() && chromeVersionResult;
}
let isSafariResult;
let safariVersionResult;
function isSafari() {
Eif (!defined(isSafariResult)) {
isSafariResult = false;
// Chrome and Edge contain Safari in the user agent too
Iif (
!isChrome() &&
!isEdge() &&
/ Safari\/[\.0-9]+/.test(theNavigator.userAgent)
) {
const fields = / Version\/([\.0-9]+)/.exec(theNavigator.userAgent);
if (fields !== null) {
isSafariResult = true;
safariVersionResult = extractVersion(fields[1]);
}
}
}
return isSafariResult;
}
function safariVersion() {
return isSafari() && safariVersionResult;
}
let isWebkitResult;
let webkitVersionResult;
function isWebkit() {
Eif (!defined(isWebkitResult)) {
isWebkitResult = false;
const fields = / AppleWebKit\/([\.0-9]+)(\+?)/.exec(theNavigator.userAgent);
Iif (fields !== null) {
isWebkitResult = true;
webkitVersionResult = extractVersion(fields[1]);
webkitVersionResult.isNightly = !!fields[2];
}
}
return isWebkitResult;
}
function webkitVersion() {
return isWebkit() && webkitVersionResult;
}
let isInternetExplorerResult;
let internetExplorerVersionResult;
function isInternetExplorer() {
if (!defined(isInternetExplorerResult)) {
isInternetExplorerResult = false;
let fields;
Iif (theNavigator.appName === "Microsoft Internet Explorer") {
fields = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent);
if (fields !== null) {
isInternetExplorerResult = true;
internetExplorerVersionResult = extractVersion(fields[1]);
}
} else Eif (theNavigator.appName === "Netscape") {
fields = /Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(
theNavigator.userAgent,
);
Iif (fields !== null) {
isInternetExplorerResult = true;
internetExplorerVersionResult = extractVersion(fields[1]);
}
}
}
return isInternetExplorerResult;
}
function internetExplorerVersion() {
return isInternetExplorer() && internetExplorerVersionResult;
}
let isEdgeResult;
let edgeVersionResult;
function isEdge() {
if (!defined(isEdgeResult)) {
isEdgeResult = false;
const fields = / Edg\/([\.0-9]+)/.exec(theNavigator.userAgent);
Iif (fields !== null) {
isEdgeResult = true;
edgeVersionResult = extractVersion(fields[1]);
}
}
return isEdgeResult;
}
function edgeVersion() {
return isEdge() && edgeVersionResult;
}
let isFirefoxResult;
let firefoxVersionResult;
function isFirefox() {
if (!defined(isFirefoxResult)) {
isFirefoxResult = false;
const fields = /Firefox\/([\.0-9]+)/.exec(theNavigator.userAgent);
Eif (fields !== null) {
isFirefoxResult = true;
firefoxVersionResult = extractVersion(fields[1]);
}
}
return isFirefoxResult;
}
let isWindowsResult;
function isWindows() {
if (!defined(isWindowsResult)) {
isWindowsResult = /Windows/i.test(theNavigator.appVersion);
}
return isWindowsResult;
}
let isIPadOrIOSResult;
function isIPadOrIOS() {
Eif (!defined(isIPadOrIOSResult)) {
isIPadOrIOSResult =
navigator.platform === "iPhone" ||
navigator.platform === "iPod" ||
navigator.platform === "iPad";
}
return isIPadOrIOSResult;
}
function firefoxVersion() {
return isFirefox() && firefoxVersionResult;
}
let hasPointerEvents;
function supportsPointerEvents() {
if (!defined(hasPointerEvents)) {
//While navigator.pointerEnabled is deprecated in the W3C specification
//we still need to use it if it exists in order to support browsers
//that rely on it, such as the Windows WebBrowser control which defines
//PointerEvent but sets navigator.pointerEnabled to false.
//Firefox disabled because of https://github.com/CesiumGS/cesium/issues/6372
hasPointerEvents =
!isFirefox() &&
typeof PointerEvent !== "undefined" &&
(!defined(theNavigator.pointerEnabled) || theNavigator.pointerEnabled);
}
return hasPointerEvents;
}
let imageRenderingValueResult;
let supportsImageRenderingPixelatedResult;
function supportsImageRenderingPixelated() {
if (!defined(supportsImageRenderingPixelatedResult)) {
const canvas = document.createElement("canvas");
canvas.setAttribute(
"style",
"image-rendering: -moz-crisp-edges;" + "image-rendering: pixelated;",
);
//canvas.style.imageRendering will be undefined, null or an empty string on unsupported browsers.
const tmp = canvas.style.imageRendering;
supportsImageRenderingPixelatedResult = defined(tmp) && tmp !== "";
Eif (supportsImageRenderingPixelatedResult) {
imageRenderingValueResult = tmp;
}
}
return supportsImageRenderingPixelatedResult;
}
function imageRenderingValue() {
return supportsImageRenderingPixelated()
? imageRenderingValueResult
: undefined;
}
function supportsWebP() {
//>>includeStart('debug', pragmas.debug);
if (!supportsWebP.initialized) {
throw new DeveloperError(
"You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP",
);
}
//>>includeEnd('debug');
return supportsWebP._result;
}
supportsWebP._promise = undefined;
supportsWebP._result = undefined;
supportsWebP.initialize = function () {
// From https://developers.google.com/speed/webp/faq#how_can_i_detect_browser_support_for_webp
if (defined(supportsWebP._promise)) {
return supportsWebP._promise;
}
supportsWebP._promise = new Promise((resolve) => {
const image = new Image();
image.onload = function () {
supportsWebP._result = image.width > 0 && image.height > 0;
resolve(supportsWebP._result);
};
image.onerror = function () {
supportsWebP._result = false;
resolve(supportsWebP._result);
};
image.src =
"data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
});
return supportsWebP._promise;
};
Object.defineProperties(supportsWebP, {
initialized: {
get: function () {
return defined(supportsWebP._result);
},
},
});
const typedArrayTypes = [];
Eif (typeof ArrayBuffer !== "undefined") {
typedArrayTypes.push(
Int8Array,
Uint8Array,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array,
);
Eif (typeof Uint8ClampedArray !== "undefined") {
typedArrayTypes.push(Uint8ClampedArray);
}
Eif (typeof Uint8ClampedArray !== "undefined") {
typedArrayTypes.push(Uint8ClampedArray);
}
Eif (typeof BigInt64Array !== "undefined") {
typedArrayTypes.push(BigInt64Array);
}
Eif (typeof BigUint64Array !== "undefined") {
typedArrayTypes.push(BigUint64Array);
}
}
/**
* A set of functions to detect whether the current browser supports
* various features.
*
* @namespace FeatureDetection
*/
const FeatureDetection = {
isChrome: isChrome,
chromeVersion: chromeVersion,
isSafari: isSafari,
safariVersion: safariVersion,
isWebkit: isWebkit,
webkitVersion: webkitVersion,
isInternetExplorer: isInternetExplorer,
internetExplorerVersion: internetExplorerVersion,
isEdge: isEdge,
edgeVersion: edgeVersion,
isFirefox: isFirefox,
firefoxVersion: firefoxVersion,
isWindows: isWindows,
isIPadOrIOS: isIPadOrIOS,
hardwareConcurrency: theNavigator.hardwareConcurrency ?? 3,
supportsPointerEvents: supportsPointerEvents,
supportsImageRenderingPixelated: supportsImageRenderingPixelated,
supportsWebP: supportsWebP,
imageRenderingValue: imageRenderingValue,
typedArrayTypes: typedArrayTypes,
};
/**
* Detects whether the current browser supports Basis Universal textures and the web assembly modules needed to transcode them.
*
* @param {Scene} scene
* @returns {boolean} true if the browser supports web assembly modules and the scene supports Basis Universal textures, false if not.
*/
FeatureDetection.supportsBasis = function (scene) {
return FeatureDetection.supportsWebAssembly() && scene.context.supportsBasis;
};
/**
* Detects whether the current browser supports the full screen standard.
*
* @returns {boolean} true if the browser supports the full screen standard, false if not.
*
* @see Fullscreen
* @see {@link http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html|W3C Fullscreen Living Specification}
*/
FeatureDetection.supportsFullscreen = function () {
return Fullscreen.supportsFullscreen();
};
/**
* Detects whether the current browser supports typed arrays.
*
* @returns {boolean} true if the browser supports typed arrays, false if not.
*
* @see {@link https://tc39.es/ecma262/#sec-typedarray-objects|Typed Array Specification}
*/
FeatureDetection.supportsTypedArrays = function () {
return typeof ArrayBuffer !== "undefined";
};
/**
* Detects whether the current browser supports BigInt64Array typed arrays.
*
* @returns {boolean} true if the browser supports BigInt64Array typed arrays, false if not.
*
* @see {@link https://tc39.es/ecma262/#sec-typedarray-objects|Typed Array Specification}
*/
FeatureDetection.supportsBigInt64Array = function () {
return typeof BigInt64Array !== "undefined";
};
/**
* Detects whether the current browser supports BigUint64Array typed arrays.
*
* @returns {boolean} true if the browser supports BigUint64Array typed arrays, false if not.
*
* @see {@link https://tc39.es/ecma262/#sec-typedarray-objects|Typed Array Specification}
*/
FeatureDetection.supportsBigUint64Array = function () {
return typeof BigUint64Array !== "undefined";
};
/**
* Detects whether the current browser supports BigInt.
*
* @returns {boolean} true if the browser supports BigInt, false if not.
*
* @see {@link https://tc39.es/ecma262/#sec-bigint-objects|BigInt Specification}
*/
FeatureDetection.supportsBigInt = function () {
return typeof BigInt !== "undefined";
};
/**
* Detects whether the current browser supports Web Workers.
*
* @returns {boolean} true if the browsers supports Web Workers, false if not.
*
* @see {@link http://www.w3.org/TR/workers/}
*/
FeatureDetection.supportsWebWorkers = function () {
return typeof Worker !== "undefined";
};
/**
* Detects whether the current browser supports Web Assembly.
*
* @returns {boolean} true if the browsers supports Web Assembly, false if not.
*
* @see {@link https://developer.mozilla.org/en-US/docs/WebAssembly}
*/
FeatureDetection.supportsWebAssembly = function () {
return typeof WebAssembly !== "undefined";
};
/**
* Detects whether the current browser supports a WebGL2 rendering context for the specified scene.
*
* @param {Scene} scene the Cesium scene specifying the rendering context
* @returns {boolean} true if the browser supports a WebGL2 rendering context, false if not.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext|WebGL2RenderingContext}
*/
FeatureDetection.supportsWebgl2 = function (scene) {
//>>includeStart('debug', pragmas.debug);
Check.defined("scene", scene);
//>>includeEnd('debug');
return scene.context.webgl2;
};
/**
* Detects whether the current browser supports ECMAScript modules in web workers.
* @returns {boolean} true if the browser supports ECMAScript modules in web workers.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Worker|Worker}
*/
FeatureDetection.supportsEsmWebWorkers = function () {
return !isFirefox() || parseInt(firefoxVersionResult) >= 114;
};
export default FeatureDetection;
|