web-launch-kit 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +37 -3
- package/README.md +37 -2
- package/dist/index.d.ts +3 -1
- package/dist/launch-kit.cjs +177 -59
- package/dist/launch-kit.cjs.map +1 -1
- package/dist/launch-kit.min.cjs +1 -1
- package/dist/launch-kit.min.cjs.map +1 -1
- package/dist/launch-kit.min.mjs +1 -1
- package/dist/launch-kit.min.mjs.map +1 -1
- package/dist/launch-kit.mjs +177 -59
- package/dist/launch-kit.mjs.map +1 -1
- package/dist/launch-kit.umd.js +177 -59
- package/dist/launch-kit.umd.js.map +1 -1
- package/dist/launch-kit.umd.min.js +1 -1
- package/dist/launch-kit.umd.min.js.map +1 -1
- package/dist/utils/get-id.d.ts +2 -2
- package/package.json +2 -2
package/dist/launch-kit.umd.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LaunchKit = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
var version$3 = "0.0.
|
|
7
|
+
var version$3 = "0.0.10";
|
|
8
8
|
var packageJSON$3 = {
|
|
9
9
|
version: version$3};
|
|
10
10
|
|
|
@@ -1286,7 +1286,7 @@
|
|
|
1286
1286
|
return element;
|
|
1287
1287
|
}
|
|
1288
1288
|
|
|
1289
|
-
var version = "0.0.
|
|
1289
|
+
var version = "0.0.6";
|
|
1290
1290
|
var packageJSON = {
|
|
1291
1291
|
version: version};
|
|
1292
1292
|
|
|
@@ -1415,6 +1415,27 @@
|
|
|
1415
1415
|
chain.push(segments.slice(0, i).join('-'));
|
|
1416
1416
|
return freeze(chain);
|
|
1417
1417
|
}
|
|
1418
|
+
function maximizeTag(tag) {
|
|
1419
|
+
var parsed = parseTag(tag);
|
|
1420
|
+
if (parsed === null)
|
|
1421
|
+
return null;
|
|
1422
|
+
if (parsed.script !== null && parsed.region !== null)
|
|
1423
|
+
return parsed;
|
|
1424
|
+
var IntlLocale = getIntlLocaleConstructor();
|
|
1425
|
+
if (typeof IntlLocale === 'undefined')
|
|
1426
|
+
return parsed;
|
|
1427
|
+
try {
|
|
1428
|
+
var intlLocale = new IntlLocale(parsed.baseName);
|
|
1429
|
+
if (typeof intlLocale.maximize === 'function') {
|
|
1430
|
+
var reparsed = parseTag(intlLocale.maximize().toString());
|
|
1431
|
+
if (reparsed !== null)
|
|
1432
|
+
return reparsed;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
catch (_) {
|
|
1436
|
+
}
|
|
1437
|
+
return parsed;
|
|
1438
|
+
}
|
|
1418
1439
|
function toLookupKey(tag) {
|
|
1419
1440
|
var parsed = parseTag(tag);
|
|
1420
1441
|
return (parsed === null ? tag : parsed.baseName).toLowerCase();
|
|
@@ -1457,6 +1478,11 @@
|
|
|
1457
1478
|
catch (_) {
|
|
1458
1479
|
}
|
|
1459
1480
|
}
|
|
1481
|
+
if (primary.script === null) {
|
|
1482
|
+
var maximized = maximizeTag(primary.baseName);
|
|
1483
|
+
if (maximized !== null && maximized.script !== null)
|
|
1484
|
+
return contains(RTL_SCRIPTS, maximized.script);
|
|
1485
|
+
}
|
|
1460
1486
|
return isRTL(primary);
|
|
1461
1487
|
}
|
|
1462
1488
|
var subtags = null;
|
|
@@ -1556,6 +1582,9 @@
|
|
|
1556
1582
|
expand: function (tag) {
|
|
1557
1583
|
return expandTag(tag);
|
|
1558
1584
|
},
|
|
1585
|
+
maximize: function (tag) {
|
|
1586
|
+
return maximizeTag(tag);
|
|
1587
|
+
},
|
|
1559
1588
|
lookup: function (supported, fallback) {
|
|
1560
1589
|
return lookupTag(supported, languages, typeof fallback === 'undefined' ? null : fallback);
|
|
1561
1590
|
},
|
|
@@ -1568,6 +1597,7 @@
|
|
|
1568
1597
|
var TRACK_ID = 'track-id';
|
|
1569
1598
|
var PRODUCT_ID = 'product-id';
|
|
1570
1599
|
var TRACK_ID_CACHE_TTL = 1000 * 60 * 60;
|
|
1600
|
+
var ALPHA2_REGION_PATTERN$1 = /^[A-Z]{2}$/;
|
|
1571
1601
|
function toCacheKey(mode, query) {
|
|
1572
1602
|
return CACHE_PREFIX + mode + ':' + query;
|
|
1573
1603
|
}
|
|
@@ -1700,27 +1730,34 @@
|
|
|
1700
1730
|
}
|
|
1701
1731
|
}
|
|
1702
1732
|
}
|
|
1703
|
-
function
|
|
1704
|
-
var
|
|
1705
|
-
var
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
var
|
|
1714
|
-
if (
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1733
|
+
function resolveMarket(language, country) {
|
|
1734
|
+
var locale = language;
|
|
1735
|
+
var market;
|
|
1736
|
+
if (typeof country !== 'undefined' && ALPHA2_REGION_PATTERN$1.test(country.toUpperCase()))
|
|
1737
|
+
market = country.toUpperCase();
|
|
1738
|
+
if (typeof market === 'undefined') {
|
|
1739
|
+
var source = typeof locale !== 'undefined'
|
|
1740
|
+
? locale
|
|
1741
|
+
: (LocaleKit.language === null ? undefined : LocaleKit.language);
|
|
1742
|
+
if (typeof source !== 'undefined') {
|
|
1743
|
+
var maximized = LocaleKit.maximize(source);
|
|
1744
|
+
if (maximized !== null && maximized.region !== null && ALPHA2_REGION_PATTERN$1.test(maximized.region))
|
|
1745
|
+
market = maximized.region;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
if (typeof locale === 'undefined' && LocaleKit.language !== null)
|
|
1749
|
+
locale = LocaleKit.language;
|
|
1750
|
+
if (typeof locale === 'undefined')
|
|
1751
|
+
locale = 'en-US';
|
|
1752
|
+
if (typeof market === 'undefined')
|
|
1753
|
+
market = 'US';
|
|
1754
|
+
return [locale, market];
|
|
1755
|
+
}
|
|
1756
|
+
function resolveGetProductIdURL(packageFamilyName, language, country) {
|
|
1757
|
+
var resolved = resolveMarket(language, country);
|
|
1758
|
+
var locale = resolved[0];
|
|
1759
|
+
var market = resolved[1];
|
|
1760
|
+
return 'https://displaycatalog.md.mp.microsoft.com/v7.0/products/lookup?value=' + encodeURIComponent(packageFamilyName) + '&market=' + encodeURIComponent(market) + '&languages=' + encodeURIComponent(locale) + '&alternateId=PackageFamilyName';
|
|
1724
1761
|
}
|
|
1725
1762
|
function resolveGetTrackIdURL(bundleId) {
|
|
1726
1763
|
return 'https://itunes.apple.com/lookup?bundleId=' + encodeURIComponent(bundleId);
|
|
@@ -1748,12 +1785,12 @@
|
|
|
1748
1785
|
return undefined;
|
|
1749
1786
|
return '' + result.trackId;
|
|
1750
1787
|
}
|
|
1751
|
-
function getProductId(packageFamilyName) {
|
|
1788
|
+
function getProductId(packageFamilyName, language, country) {
|
|
1752
1789
|
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
1753
1790
|
if (typeof cache !== 'undefined')
|
|
1754
1791
|
return cache;
|
|
1755
1792
|
try {
|
|
1756
|
-
var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName)));
|
|
1793
|
+
var productId = parseGetProductIdResponse(requestGet(resolveGetProductIdURL(packageFamilyName, language, country)));
|
|
1757
1794
|
if (typeof productId === 'undefined')
|
|
1758
1795
|
return undefined;
|
|
1759
1796
|
idCache.set(PRODUCT_ID, packageFamilyName, productId);
|
|
@@ -1778,12 +1815,12 @@
|
|
|
1778
1815
|
return undefined;
|
|
1779
1816
|
}
|
|
1780
1817
|
}
|
|
1781
|
-
function getProductIdAsync(packageFamilyName) {
|
|
1818
|
+
function getProductIdAsync(packageFamilyName, language, country) {
|
|
1782
1819
|
var cache = idCache.get(PRODUCT_ID, packageFamilyName);
|
|
1783
1820
|
if (typeof cache !== 'undefined')
|
|
1784
1821
|
return Promise.resolve(cache);
|
|
1785
1822
|
try {
|
|
1786
|
-
return requestGet(resolveGetProductIdURL(packageFamilyName), true)
|
|
1823
|
+
return requestGet(resolveGetProductIdURL(packageFamilyName, language, country), true)
|
|
1787
1824
|
.then(parseGetProductIdResponse)
|
|
1788
1825
|
.then(function (productId) {
|
|
1789
1826
|
if (typeof productId === 'undefined')
|
|
@@ -1898,6 +1935,7 @@
|
|
|
1898
1935
|
var DEFAULT_TIMEOUT = 750;
|
|
1899
1936
|
var GLOBAL = getGlobal$1();
|
|
1900
1937
|
var NAVIGATOR = GLOBAL.navigator;
|
|
1938
|
+
var ALPHA2_REGION_PATTERN = /^[A-Z]{2}$/;
|
|
1901
1939
|
var CLEANUP_INPUT_ELEMENT = null;
|
|
1902
1940
|
var DEBUG = false;
|
|
1903
1941
|
var APP_IN_FLIGHT = null;
|
|
@@ -2117,6 +2155,13 @@
|
|
|
2117
2155
|
};
|
|
2118
2156
|
}
|
|
2119
2157
|
}
|
|
2158
|
+
function resolveEventBinding(config) {
|
|
2159
|
+
return {
|
|
2160
|
+
configured: typeof config.target !== 'undefined' && typeof config.type !== 'undefined',
|
|
2161
|
+
target: config.target,
|
|
2162
|
+
type: config.type,
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2120
2165
|
function openURL(tried, url, timeout, terminal) {
|
|
2121
2166
|
if (terminal === void 0) { terminal = false; }
|
|
2122
2167
|
var config = resolveFocusEventConfig();
|
|
@@ -2190,6 +2235,9 @@
|
|
|
2190
2235
|
return new Promise(function (resolve, reject) {
|
|
2191
2236
|
if (DEBUG)
|
|
2192
2237
|
debugger;
|
|
2238
|
+
var blurBinding = resolveEventBinding(config.blur);
|
|
2239
|
+
var focusBinding = resolveEventBinding(config.focus);
|
|
2240
|
+
var visibilityBinding = resolveEventBinding(config.visibilitychange);
|
|
2193
2241
|
var timeoutId;
|
|
2194
2242
|
var resolved = false;
|
|
2195
2243
|
function cleanup() {
|
|
@@ -2198,12 +2246,14 @@
|
|
|
2198
2246
|
timeoutId = undefined;
|
|
2199
2247
|
}
|
|
2200
2248
|
try {
|
|
2201
|
-
if (
|
|
2202
|
-
EventKit.remove(
|
|
2203
|
-
if (
|
|
2204
|
-
EventKit.remove(
|
|
2205
|
-
if (
|
|
2206
|
-
EventKit.remove(
|
|
2249
|
+
if (blurBinding.configured)
|
|
2250
|
+
EventKit.remove(blurBinding.target, blurBinding.type, onblur);
|
|
2251
|
+
if (focusBinding.configured)
|
|
2252
|
+
EventKit.remove(focusBinding.target, focusBinding.type, onfocus);
|
|
2253
|
+
if (visibilityBinding.configured)
|
|
2254
|
+
EventKit.remove(visibilityBinding.target, visibilityBinding.type, onvisibilitychange);
|
|
2255
|
+
if (navigationPagehide)
|
|
2256
|
+
EventKit.remove(top, 'pagehide', onpagehide);
|
|
2207
2257
|
}
|
|
2208
2258
|
catch (_) {
|
|
2209
2259
|
}
|
|
@@ -2237,10 +2287,10 @@
|
|
|
2237
2287
|
clearTimeout(timeoutId);
|
|
2238
2288
|
timeoutId = undefined;
|
|
2239
2289
|
}
|
|
2240
|
-
if (
|
|
2241
|
-
EventKit.remove(
|
|
2242
|
-
if (
|
|
2243
|
-
EventKit.add(
|
|
2290
|
+
if (blurBinding.configured)
|
|
2291
|
+
EventKit.remove(blurBinding.target, blurBinding.type, onblur);
|
|
2292
|
+
if (focusBinding.configured)
|
|
2293
|
+
EventKit.add(focusBinding.target, focusBinding.type, onfocus);
|
|
2244
2294
|
}
|
|
2245
2295
|
function onfocus() {
|
|
2246
2296
|
done(true);
|
|
@@ -2251,13 +2301,19 @@
|
|
|
2251
2301
|
else
|
|
2252
2302
|
onfocus();
|
|
2253
2303
|
}
|
|
2304
|
+
function onpagehide() {
|
|
2305
|
+
done(true);
|
|
2306
|
+
}
|
|
2307
|
+
var navigationPagehide = config.blur.type !== 'pagehide';
|
|
2254
2308
|
timeoutId = setTimeout(function () {
|
|
2255
2309
|
done(false);
|
|
2256
2310
|
}, timeout);
|
|
2257
|
-
if (
|
|
2258
|
-
EventKit.add(
|
|
2259
|
-
if (
|
|
2260
|
-
EventKit.add(
|
|
2311
|
+
if (blurBinding.configured)
|
|
2312
|
+
EventKit.add(blurBinding.target, blurBinding.type, onblur);
|
|
2313
|
+
if (visibilityBinding.configured)
|
|
2314
|
+
EventKit.add(visibilityBinding.target, visibilityBinding.type, onvisibilitychange);
|
|
2315
|
+
if (navigationPagehide)
|
|
2316
|
+
EventKit.add(top, 'pagehide', onpagehide);
|
|
2261
2317
|
if (!hasFocus(topDocument))
|
|
2262
2318
|
restoreFocus();
|
|
2263
2319
|
try {
|
|
@@ -2347,6 +2403,8 @@
|
|
|
2347
2403
|
var allowScheme;
|
|
2348
2404
|
var assumeAllowedInApp;
|
|
2349
2405
|
var timeout;
|
|
2406
|
+
var language;
|
|
2407
|
+
var country;
|
|
2350
2408
|
var intent;
|
|
2351
2409
|
var packageName;
|
|
2352
2410
|
var allowIntent = true;
|
|
@@ -2369,6 +2427,8 @@
|
|
|
2369
2427
|
allowWebStore = option.android.allowWebStore;
|
|
2370
2428
|
allowScheme = canOpenScheme(assumeAllowedInApp);
|
|
2371
2429
|
timeout = option.android.timeout;
|
|
2430
|
+
language = option.android.language;
|
|
2431
|
+
country = option.android.country;
|
|
2372
2432
|
if (typeof intent !== 'undefined' && (typeof scheme === 'undefined' || typeof packageName === 'undefined' || typeof fallback === 'undefined')) {
|
|
2373
2433
|
var parsed = parseIntentURL(intent);
|
|
2374
2434
|
if (typeof parsed.scheme !== 'undefined' && typeof scheme === 'undefined')
|
|
@@ -2392,7 +2452,7 @@
|
|
|
2392
2452
|
if (allowAppStore && allowScheme)
|
|
2393
2453
|
resolved.push(['store', createAppStoreURL(packageName, os)]);
|
|
2394
2454
|
if (allowWebStore)
|
|
2395
|
-
resolved.push(['store', createWebStoreURL(packageName, os)]);
|
|
2455
|
+
resolved.push(['store', createWebStoreURL(packageName, os, language, country)]);
|
|
2396
2456
|
}
|
|
2397
2457
|
return [resolved, timeout];
|
|
2398
2458
|
case 'ios':
|
|
@@ -2408,6 +2468,8 @@
|
|
|
2408
2468
|
allowWebStore = option.ios.allowWebStore;
|
|
2409
2469
|
allowScheme = canOpenScheme(assumeAllowedInApp);
|
|
2410
2470
|
timeout = option.ios.timeout;
|
|
2471
|
+
language = option.ios.language;
|
|
2472
|
+
country = option.ios.country;
|
|
2411
2473
|
if (typeof bundleId !== 'undefined' && typeof trackId === 'undefined')
|
|
2412
2474
|
trackId = getTrackId(bundleId);
|
|
2413
2475
|
if (typeof timeout === 'undefined')
|
|
@@ -2422,7 +2484,7 @@
|
|
|
2422
2484
|
if (allowAppStore && allowScheme)
|
|
2423
2485
|
resolved.push(['store', createAppStoreURL(trackId, os)]);
|
|
2424
2486
|
if (allowWebStore)
|
|
2425
|
-
resolved.push(['store', createWebStoreURL(trackId, os)]);
|
|
2487
|
+
resolved.push(['store', createWebStoreURL(trackId, os, language, country)]);
|
|
2426
2488
|
}
|
|
2427
2489
|
return [resolved, timeout];
|
|
2428
2490
|
case 'windows':
|
|
@@ -2435,8 +2497,10 @@
|
|
|
2435
2497
|
allowAppStore = option.windows.allowAppStore;
|
|
2436
2498
|
allowWebStore = option.windows.allowWebStore;
|
|
2437
2499
|
timeout = option.windows.timeout;
|
|
2500
|
+
language = option.windows.language;
|
|
2501
|
+
country = option.windows.country;
|
|
2438
2502
|
if (typeof packageFamilyName !== 'undefined' && typeof productId === 'undefined')
|
|
2439
|
-
productId = getProductId(packageFamilyName);
|
|
2503
|
+
productId = getProductId(packageFamilyName, language, country);
|
|
2440
2504
|
if (typeof timeout === 'undefined')
|
|
2441
2505
|
timeout = WINDOWS_DEFAULT_TIMEOUT;
|
|
2442
2506
|
if (typeof scheme !== 'undefined')
|
|
@@ -2447,7 +2511,7 @@
|
|
|
2447
2511
|
if (allowAppStore)
|
|
2448
2512
|
resolved.push(['store', createAppStoreURL(productId, os)]);
|
|
2449
2513
|
if (allowWebStore)
|
|
2450
|
-
resolved.push(['store', createWebStoreURL(productId, os)]);
|
|
2514
|
+
resolved.push(['store', createWebStoreURL(productId, os, language, country)]);
|
|
2451
2515
|
}
|
|
2452
2516
|
return [resolved, timeout];
|
|
2453
2517
|
case 'macos':
|
|
@@ -2460,6 +2524,8 @@
|
|
|
2460
2524
|
allowAppStore = option.macos.allowAppStore;
|
|
2461
2525
|
allowWebStore = option.macos.allowWebStore;
|
|
2462
2526
|
timeout = option.macos.timeout;
|
|
2527
|
+
language = option.macos.language;
|
|
2528
|
+
country = option.macos.country;
|
|
2463
2529
|
if (typeof bundleId !== 'undefined' && typeof trackId === 'undefined')
|
|
2464
2530
|
trackId = getTrackId(bundleId);
|
|
2465
2531
|
if (typeof timeout === 'undefined')
|
|
@@ -2472,7 +2538,7 @@
|
|
|
2472
2538
|
if (allowAppStore)
|
|
2473
2539
|
resolved.push(['store', createAppStoreURL(trackId, os)]);
|
|
2474
2540
|
if (allowWebStore)
|
|
2475
|
-
resolved.push(['store', createWebStoreURL(trackId, os)]);
|
|
2541
|
+
resolved.push(['store', createWebStoreURL(trackId, os, language, country)]);
|
|
2476
2542
|
}
|
|
2477
2543
|
return [resolved, timeout];
|
|
2478
2544
|
}
|
|
@@ -2639,19 +2705,69 @@
|
|
|
2639
2705
|
return os;
|
|
2640
2706
|
}
|
|
2641
2707
|
}
|
|
2642
|
-
function createWebStoreURL(id, os) {
|
|
2708
|
+
function createWebStoreURL(id, os, language, country) {
|
|
2709
|
+
var resolved = resolveCountry(language, country);
|
|
2710
|
+
var countryPath = typeof resolved !== 'undefined' ? resolved.toLowerCase() + '/' : '';
|
|
2711
|
+
var url;
|
|
2643
2712
|
switch (os) {
|
|
2644
2713
|
case 'android':
|
|
2645
|
-
|
|
2714
|
+
url = 'https://play.google.com/store/apps/details?id=' + id;
|
|
2715
|
+
if (typeof language !== 'undefined')
|
|
2716
|
+
url = appendURLParameter(url, 'hl=' + escapeURIComponentString(language));
|
|
2717
|
+
if (typeof resolved !== 'undefined')
|
|
2718
|
+
url = appendURLParameter(url, 'gl=' + resolved);
|
|
2719
|
+
break;
|
|
2646
2720
|
case 'ios':
|
|
2647
|
-
|
|
2721
|
+
url = 'https://itunes.apple.com/' + countryPath + 'app/id' + id + '?mt=8';
|
|
2722
|
+
if (typeof language !== 'undefined')
|
|
2723
|
+
url = appendURLParameter(url, 'l=' + escapeURIComponentString(language));
|
|
2724
|
+
break;
|
|
2648
2725
|
case 'windows':
|
|
2649
|
-
|
|
2726
|
+
url = 'https://apps.microsoft.com/detail/' + id;
|
|
2727
|
+
if (typeof language !== 'undefined')
|
|
2728
|
+
url = appendURLParameter(url, 'hl=' + escapeURIComponentString(language));
|
|
2729
|
+
if (typeof resolved !== 'undefined')
|
|
2730
|
+
url = appendURLParameter(url, 'gl=' + resolved);
|
|
2731
|
+
break;
|
|
2650
2732
|
case 'macos':
|
|
2651
|
-
|
|
2733
|
+
url = 'https://apps.apple.com/' + countryPath + 'app/id' + id + '?mt=12';
|
|
2734
|
+
if (typeof language !== 'undefined')
|
|
2735
|
+
url = appendURLParameter(url, 'l=' + escapeURIComponentString(language));
|
|
2736
|
+
break;
|
|
2652
2737
|
default:
|
|
2653
2738
|
return os;
|
|
2654
2739
|
}
|
|
2740
|
+
return url;
|
|
2741
|
+
}
|
|
2742
|
+
function extractRegion(tag) {
|
|
2743
|
+
var parts = tag.replace(/_/g, '-').split('-');
|
|
2744
|
+
for (var i = 1; i < parts.length; i++) {
|
|
2745
|
+
if (/^[A-Za-z]{2}$/.test(parts[i]))
|
|
2746
|
+
return parts[i].toUpperCase();
|
|
2747
|
+
}
|
|
2748
|
+
return undefined;
|
|
2749
|
+
}
|
|
2750
|
+
function resolveCountry(language, country) {
|
|
2751
|
+
if (typeof country !== 'undefined' && ALPHA2_REGION_PATTERN.test(country.toUpperCase()))
|
|
2752
|
+
return country.toUpperCase();
|
|
2753
|
+
if (typeof language === 'undefined')
|
|
2754
|
+
return undefined;
|
|
2755
|
+
var region = extractRegion(language);
|
|
2756
|
+
if (typeof region !== 'undefined')
|
|
2757
|
+
return region;
|
|
2758
|
+
if (typeof Intl !== 'undefined' && typeof Intl.Locale === 'function') {
|
|
2759
|
+
try {
|
|
2760
|
+
var locale = new Intl.Locale(language);
|
|
2761
|
+
if (typeof locale.maximize === 'function') {
|
|
2762
|
+
var maximized = locale.maximize();
|
|
2763
|
+
if (typeof maximized !== 'undefined' && maximized !== null && typeof maximized.region === 'string' && ALPHA2_REGION_PATTERN.test(maximized.region.toUpperCase()))
|
|
2764
|
+
return maximized.region.toUpperCase();
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
catch (_) {
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
return undefined;
|
|
2655
2771
|
}
|
|
2656
2772
|
function appendURLParameter(url, parameter) {
|
|
2657
2773
|
var index = url.indexOf('#');
|
|
@@ -2801,6 +2917,8 @@
|
|
|
2801
2917
|
});
|
|
2802
2918
|
}
|
|
2803
2919
|
function resolveInput(module, resolve) {
|
|
2920
|
+
var focusBinding = resolveEventBinding(config.focus);
|
|
2921
|
+
var visibilityBinding = resolveEventBinding(config.visibilitychange);
|
|
2804
2922
|
var resolved = false;
|
|
2805
2923
|
function done(success) {
|
|
2806
2924
|
if (resolved)
|
|
@@ -2838,10 +2956,10 @@
|
|
|
2838
2956
|
}
|
|
2839
2957
|
else {
|
|
2840
2958
|
module.onclick = function () {
|
|
2841
|
-
if (
|
|
2842
|
-
EventKit.add(
|
|
2843
|
-
if (
|
|
2844
|
-
EventKit.add(
|
|
2959
|
+
if (focusBinding.configured)
|
|
2960
|
+
EventKit.add(focusBinding.target, focusBinding.type, onfocus);
|
|
2961
|
+
if (visibilityBinding.configured)
|
|
2962
|
+
EventKit.add(visibilityBinding.target, visibilityBinding.type, onvisibilitychange);
|
|
2845
2963
|
setTimeout(function () {
|
|
2846
2964
|
EventKit.add(topDocument, 'click', onclick);
|
|
2847
2965
|
}, 100);
|
|
@@ -2853,10 +2971,10 @@
|
|
|
2853
2971
|
function cleanup() {
|
|
2854
2972
|
CLEANUP_INPUT_ELEMENT = null;
|
|
2855
2973
|
try {
|
|
2856
|
-
if (
|
|
2857
|
-
EventKit.remove(
|
|
2858
|
-
if (
|
|
2859
|
-
EventKit.remove(
|
|
2974
|
+
if (focusBinding.configured)
|
|
2975
|
+
EventKit.remove(focusBinding.target, focusBinding.type, onfocus);
|
|
2976
|
+
if (visibilityBinding.configured)
|
|
2977
|
+
EventKit.remove(visibilityBinding.target, visibilityBinding.type, onvisibilitychange);
|
|
2860
2978
|
EventKit.remove(topDocument, 'click', onclick);
|
|
2861
2979
|
}
|
|
2862
2980
|
catch (_) {
|