@everymatrix/casino-games-category-section 0.0.191 → 0.0.195
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/casino-games-category-section",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.195",
|
|
4
4
|
"main": "dist/casino-games-category-section.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "12c5cb5e4f2310b2fa559d0a1c99f4cf29de70c8"
|
|
40
40
|
}
|
|
@@ -71,6 +71,9 @@
|
|
|
71
71
|
let getFavoredGamesCache:any = undefined;
|
|
72
72
|
let mostPlayedScreen:Boolean = false;
|
|
73
73
|
let customStylingContainer:HTMLElement;
|
|
74
|
+
let validObservers:boolean = false;
|
|
75
|
+
|
|
76
|
+
let thumbnailContainer:Array<HTMLElement> = new Array(1000);
|
|
74
77
|
|
|
75
78
|
let favoriteGamesData:any = {
|
|
76
79
|
items: [],
|
|
@@ -83,6 +86,19 @@
|
|
|
83
86
|
addNewMessages(item, GamesCategorySectionTranslations[item]);
|
|
84
87
|
});
|
|
85
88
|
|
|
89
|
+
// IntersectionObserver used for loading more games
|
|
90
|
+
let observer = new IntersectionObserver((entries, observerRef) => {
|
|
91
|
+
entries.forEach(async (entry) => {
|
|
92
|
+
let index = entry.target.elems_index; // eslint-disable-line
|
|
93
|
+
|
|
94
|
+
if (entry.isIntersecting) {
|
|
95
|
+
if (index * 1.2 > limit ) {
|
|
96
|
+
loadMoreGames(categoryid);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
86
102
|
// Start favored games section
|
|
87
103
|
const getFavoredGames = (url:string, sessionId:string, userId:string) => {
|
|
88
104
|
let options = {
|
|
@@ -241,6 +257,7 @@
|
|
|
241
257
|
showLoadCategory = true;
|
|
242
258
|
searchItem = false;
|
|
243
259
|
mostPlayedScreen = false;
|
|
260
|
+
validObservers = false;
|
|
244
261
|
|
|
245
262
|
if (e.data.receivedFavoriteResults) {
|
|
246
263
|
favoriteGames = e.data.receivedFavoriteResults.items;
|
|
@@ -268,6 +285,7 @@
|
|
|
268
285
|
searchItem = false;
|
|
269
286
|
mostPlayedScreen = false;
|
|
270
287
|
showLoadCategory = false;
|
|
288
|
+
validObservers = true;
|
|
271
289
|
categoryid = e.data.itemId;
|
|
272
290
|
|
|
273
291
|
getData(categoryid, 0, limit).then((res:any) => {
|
|
@@ -345,9 +363,9 @@
|
|
|
345
363
|
|
|
346
364
|
// @TODO categoryId type fix
|
|
347
365
|
const loadMoreGames = (categoryId:any) => {
|
|
348
|
-
limit +=
|
|
349
|
-
if (limit <= maxTotal) {
|
|
366
|
+
limit += 10;
|
|
350
367
|
|
|
368
|
+
if (limit <= maxTotal) {
|
|
351
369
|
getData(categoryId, offset, limit).then((res:any) => {
|
|
352
370
|
categoryData = res;
|
|
353
371
|
// @TODO categoryData type fix
|
|
@@ -410,36 +428,28 @@
|
|
|
410
428
|
});
|
|
411
429
|
}
|
|
412
430
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const containerDimensions = container.getBoundingClientRect();
|
|
421
|
-
|
|
422
|
-
intersecting = (
|
|
423
|
-
(containerDimensions.bottom + bottom) > 0 &&
|
|
424
|
-
(containerDimensions.right + right) > 0 &&
|
|
425
|
-
(containerDimensions.top - top) < window.innerHeight &&
|
|
426
|
-
(containerDimensions.left - left) < window.innerWidth
|
|
427
|
-
);
|
|
428
|
-
|
|
429
|
-
if (intersecting && once && !lobbyView) {
|
|
430
|
-
loadMoreGames(categoryid);
|
|
431
|
+
const setupObserver = () => {
|
|
432
|
+
if (validObservers) {
|
|
433
|
+
thumbnailContainer.forEach((item, index) => {
|
|
434
|
+
if (item) {
|
|
435
|
+
// Hack to make sure that I can identify the thumbnail index
|
|
436
|
+
item.elems_index = index;
|
|
437
|
+
observer.observe(item);
|
|
431
438
|
}
|
|
432
|
-
}
|
|
439
|
+
});
|
|
433
440
|
}
|
|
441
|
+
}
|
|
434
442
|
|
|
435
|
-
|
|
443
|
+
onMount(() => {
|
|
444
|
+
window.addEventListener('message', messageHandler, false);
|
|
445
|
+
window.postMessage({ type: 'GetFavoredGame' }, window.location.href);
|
|
436
446
|
|
|
437
447
|
return () => {
|
|
438
|
-
window.removeEventListener('scroll', handler);
|
|
439
448
|
window.removeEventListener('message', messageHandler);
|
|
440
449
|
}
|
|
441
450
|
});
|
|
442
451
|
|
|
452
|
+
$: thumbnailContainer && setupObserver();
|
|
443
453
|
$: lang && initialSetup();
|
|
444
454
|
$: clientstyling && setClientStyling();
|
|
445
455
|
$: clientstylingurl && setClientStylingURL();
|
|
@@ -456,7 +466,7 @@
|
|
|
456
466
|
{:else}
|
|
457
467
|
{#if searched}
|
|
458
468
|
<div class="CasinoGamesContainer">
|
|
459
|
-
<div class="CasinoGamesHeader Searched">
|
|
469
|
+
<div class="CasinoGamesHeader Searched {isMobile(userAgent) ? 'CasinoGamesHeaderMobile' : ''}">
|
|
460
470
|
{#if recentSearched}
|
|
461
471
|
<h3 class="StatusText">
|
|
462
472
|
{$_('gamesCategorySection.recentSearchedItems')}
|
|
@@ -475,7 +485,7 @@
|
|
|
475
485
|
</div>
|
|
476
486
|
{#if shownCategoryData}
|
|
477
487
|
{#if !showItems}
|
|
478
|
-
<p class="NoSearchResults NoRecentSearches NoRecentSearchesCenter">{$_('gamesCategorySection.noRecentSearch')}</p>
|
|
488
|
+
<p class="NoSearchResults NoRecentSearches NoRecentSearchesCenter {isMobile(userAgent) ? 'NoRecentSearchesMobile' : ''}">{$_('gamesCategorySection.noRecentSearch')}</p>
|
|
479
489
|
{/if}
|
|
480
490
|
<ul class="CasinoGamesGrid">
|
|
481
491
|
{#each shownCategoryData as gameprops, index}
|
|
@@ -517,9 +527,9 @@
|
|
|
517
527
|
{#if showLoadCategory}
|
|
518
528
|
<!-- svelte-ignore a11y-missing-attribute -->
|
|
519
529
|
<a class="CategoryNameLink" on:click="{e => showCategory(categoryData.id, categoryData)}">
|
|
520
|
-
<
|
|
530
|
+
<span class="CategoryLoadMore">
|
|
521
531
|
{$_('gamesCategorySection.viewAll')} ({categoryData.games.total})
|
|
522
|
-
</
|
|
532
|
+
</span>
|
|
523
533
|
</a>
|
|
524
534
|
{/if}
|
|
525
535
|
</div>
|
|
@@ -542,6 +552,7 @@
|
|
|
542
552
|
gameid={gameprops.id}
|
|
543
553
|
gamefunmode={gameprops.hasFunMode}
|
|
544
554
|
gamefavorite={gameprops.isFavorite}
|
|
555
|
+
bind:this={thumbnailContainer[index]}
|
|
545
556
|
{clientstyling}
|
|
546
557
|
{clientstylingurl}
|
|
547
558
|
{endpoint}
|
|
@@ -656,21 +667,28 @@
|
|
|
656
667
|
@return $value * $multiplicator;
|
|
657
668
|
}
|
|
658
669
|
|
|
670
|
+
:host {
|
|
671
|
+
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
|
|
672
|
+
}
|
|
673
|
+
|
|
659
674
|
*, *::before, *::after {
|
|
660
675
|
margin: 0;
|
|
661
676
|
padding: 0;
|
|
662
677
|
box-sizing: border-box;
|
|
663
|
-
font-family: 'Helvetica Neue', 'Helvetica', sans-serif;
|
|
664
678
|
}
|
|
665
679
|
|
|
666
680
|
$grid-gap: ttp(1);
|
|
667
681
|
$grid-cell-size: ttp(12);
|
|
668
682
|
|
|
669
683
|
.CategoryName,
|
|
670
|
-
.CategoryLoadMore ,
|
|
671
684
|
.StatusText {
|
|
672
685
|
color: #fff;
|
|
673
|
-
font-size:
|
|
686
|
+
font-size: 22px;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
.CategoryLoadMore {
|
|
690
|
+
font-size: 14px;
|
|
691
|
+
color: #fff;
|
|
674
692
|
}
|
|
675
693
|
|
|
676
694
|
.NoSearchResults {
|
|
@@ -687,6 +705,9 @@
|
|
|
687
705
|
|
|
688
706
|
.NoRecentSearchesCenter {
|
|
689
707
|
text-align: center;
|
|
708
|
+
&.NoRecentSearchesMobile {
|
|
709
|
+
text-align: left;
|
|
710
|
+
}
|
|
690
711
|
}
|
|
691
712
|
|
|
692
713
|
.NoFavoriteGames {
|
|
@@ -742,6 +763,9 @@
|
|
|
742
763
|
&.Searched {
|
|
743
764
|
justify-content: center;
|
|
744
765
|
}
|
|
766
|
+
&.CasinoGamesHeaderMobile.Searched {
|
|
767
|
+
justify-content: flex-start;
|
|
768
|
+
}
|
|
745
769
|
}
|
|
746
770
|
|
|
747
771
|
.CasinoGamesContainer {
|