@everymatrix/casino-games-category-section 0.0.233 → 0.0.237

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.233",
3
+ "version": "0.0.237",
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": "d7554673f55c9c428a1cf82bdecf5f2da81e373d"
39
+ "gitHead": "2e75c5dd54e711bed0fc8b8282d8aa284725cfcf"
40
40
  }
@@ -19,10 +19,12 @@
19
19
  export let favorites:string = '';
20
20
  export let clientstyling:string = '';
21
21
  export let clientstylingurl:string = '';
22
+ export let currency:string = 'EUR';
22
23
 
23
24
  export let categoryid:string = '';
24
25
  export let categoryindex:number = 0;
25
26
  export let categorygames:number = 0;
27
+ export let livecasino:string = 'false';
26
28
 
27
29
  export let once = true;
28
30
  export let top = 0;
@@ -73,7 +75,12 @@
73
75
  let customStylingContainer:HTMLElement;
74
76
  let validObservers:boolean = false;
75
77
 
76
- let thumbnailContainer:Array<HTMLElement> = new Array(1000);
78
+ let thumbnailContainer:Array<HTMLElement> = new Array(10000);
79
+ let intersectingIndexes:Object = {};
80
+ let visibilityconnect:string = '';
81
+ let hidden;
82
+ let visibilityChange;
83
+ let dataloaded;
77
84
 
78
85
  let favoriteGamesData:any = {
79
86
  items: [],
@@ -86,6 +93,17 @@
86
93
  addNewMessages(item, GamesCategorySectionTranslations[item]);
87
94
  });
88
95
 
96
+ if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support
97
+ hidden = 'hidden';
98
+ visibilityChange = 'visibilitychange';
99
+ } else if (typeof document.msHidden !== 'undefined') {
100
+ hidden = 'msHidden';
101
+ visibilityChange = 'msvisibilitychange';
102
+ } else if (typeof document.webkitHidden !== 'undefined') {
103
+ hidden = 'webkitHidden';
104
+ visibilityChange = 'webkitvisibilitychange';
105
+ }
106
+
89
107
  // IntersectionObserver used for loading more games
90
108
  let observer = new IntersectionObserver((entries, observerRef) => {
91
109
  entries.forEach(async (entry) => {
@@ -174,6 +192,7 @@
174
192
  fetch(url)
175
193
  .then((res:any) => res.json())
176
194
  .then((data:any) => {
195
+ dataloaded = true
177
196
  hasErrors = false;
178
197
  maxTotal = data.games.total;
179
198
 
@@ -428,6 +447,14 @@
428
447
  });
429
448
  }
430
449
 
450
+ const handleVisibilityChange = () => {
451
+ if (!document[hidden]) {
452
+ visibilityconnect = 'connect';
453
+ } else {
454
+ visibilityconnect = 'disconnect';
455
+ }
456
+ }
457
+
431
458
  const setupObserver = () => {
432
459
  if (validObservers) {
433
460
  thumbnailContainer.forEach((item, index) => {
@@ -440,6 +467,12 @@
440
467
  }
441
468
  }
442
469
 
470
+ // const setupVisibility = (customStylingContainer, dataloaded) => {
471
+ // if (customStylingContainer && dataloaded && hidden) {
472
+ // document.addEventListener(visibilityChange, handleVisibilityChange, false);
473
+ // }
474
+ // }
475
+
443
476
  onMount(() => {
444
477
  window.addEventListener('message', messageHandler, false);
445
478
  window.postMessage({ type: 'GetFavoredGame' }, window.location.href);
@@ -449,7 +482,7 @@
449
482
  }
450
483
  });
451
484
 
452
- $: thumbnailContainer && setupObserver();
485
+ $: dataloaded && thumbnailContainer && setupObserver();
453
486
  $: lang && initialSetup();
454
487
  $: clientstyling && setClientStyling();
455
488
  $: clientstylingurl && setClientStylingURL();
@@ -494,6 +527,7 @@
494
527
  session={session}
495
528
  userid={userid}
496
529
  lang={lang}
530
+ currency={currency}
497
531
  searchitem={searchItem}
498
532
  favorites={favorites}
499
533
  gamethumbnail={gameprops.thumbnail}
@@ -505,9 +539,11 @@
505
539
  gameid={gameprops.id}
506
540
  gamefunmode={gameprops.hasFunMode}
507
541
  gamefavorite={gameprops.isFavorite}
542
+ livelobbyendpoint={gameprops.details ? gameprops.href : ''}
508
543
  {clientstyling}
509
544
  {clientstylingurl}
510
545
  {endpoint}
546
+ {livecasino}
511
547
  ></casino-game-thumbnail>
512
548
  {/each}
513
549
  </ul>
@@ -534,13 +570,14 @@
534
570
  {/if}
535
571
  </div>
536
572
  {#if shownCategoryData.length !== 0}
537
- <ul class="{(favoriteGamesData.items.length === 0 && showFavGamesCategory) ? '' : 'CasinoGamesGrid'} GamesListIncreasedGap" bind:this={container}>
573
+ <ul class="{(favoriteGamesData.items.length === 0 && showFavGamesCategory) ? '' : 'CasinoGamesGrid'} GamesListIncreasedGap" bind:this={container}>
538
574
  {#each shownCategoryData as gameprops, index}
539
575
  {#if intersecting || nativeLoading}
540
576
  <casino-game-thumbnail
541
577
  session={session}
542
578
  userid={userid}
543
579
  lang={lang}
580
+ currency={currency}
544
581
  class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
545
582
  favorites={favorites}
546
583
  gamethumbnail={gameprops.thumbnail}
@@ -553,13 +590,17 @@
553
590
  gamefunmode={gameprops.hasFunMode}
554
591
  gamefavorite={gameprops.isFavorite}
555
592
  bind:this={thumbnailContainer[index]}
593
+ connectlive={intersectingIndexes[gameprops.id] == 1 ? 'connect' : 'disconnect'}
594
+ visibilityconnect={visibilityconnect}
595
+ livelobbyendpoint={gameprops.details ? gameprops.href : ''}
556
596
  {clientstyling}
557
597
  {clientstylingurl}
558
598
  {endpoint}
599
+ {livecasino}
559
600
  ></casino-game-thumbnail>
560
601
  {/if}
561
602
  {/each}
562
- </ul>
603
+ </ul>
563
604
  {:else}
564
605
  <p class="NoSearchResults">You don't have any games in this category.</p>
565
606
  {/if}
@@ -579,34 +620,38 @@
579
620
  {#if intersecting || nativeLoading}
580
621
  {#if isMobile(userAgent)}
581
622
  {#if (gameprops.gameModel.platform.includes("iPad") || gameprops.gameModel.platform.includes("iPhone") || gameprops.gameModel.platform.includes("Android"))}
582
- <casino-game-thumbnail
583
- class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
584
- session={session}
585
- userid={userid}
586
- lang={lang}
587
- favorites={favorites}
588
- gamethumbnail={gameprops.gameModel.thumbnail}
589
- gamename={gameprops.gameModel.name}
590
- gamevendor={gameprops.gameModel.vendor.name}
591
- gameisnew={gameprops.gameModel.isNew}
592
- gamepopularity={gameprops.gameModel.popularity}
593
- gamecellsize={gameprops.gameModel.cellSize}
594
- gameid={gameprops.gameModel.id}
595
- gamefunmode={gameprops.gameModel.hasFunMode}
596
- gamefavorite={gameprops.gameModel.isFavorite}
597
- showfavoredcategory={showFavGamesCategory}
598
- {clientstyling}
599
- {clientstylingurl}
600
- {endpoint}
601
- ></casino-game-thumbnail>
623
+ <casino-game-thumbnail
624
+ class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
625
+ session={session}
626
+ userid={userid}
627
+ lang={lang}
628
+ currency={currency}
629
+ favorites={favorites}
630
+ gamethumbnail={gameprops.gameModel.thumbnail}
631
+ gamename={gameprops.gameModel.name}
632
+ gamevendor={gameprops.gameModel.vendor.name}
633
+ gameisnew={gameprops.gameModel.isNew}
634
+ gamepopularity={gameprops.gameModel.popularity}
635
+ gamecellsize={gameprops.gameModel.cellSize}
636
+ gameid={gameprops.gameModel.id}
637
+ gamefunmode={gameprops.gameModel.hasFunMode}
638
+ gamefavorite={gameprops.gameModel.isFavorite}
639
+ showfavoredcategory={showFavGamesCategory}
640
+ livelobbyendpoint={gameprops.gameModel.details ? gameprops.gameModel.href : ''}
641
+ {clientstyling}
642
+ {clientstylingurl}
643
+ {endpoint}
644
+ {livecasino}
645
+ ></casino-game-thumbnail>
602
646
  {/if}
603
647
  {:else if gameprops.gameModel.platform.includes("PC")}
604
648
  <!-- <p style="color: var(--emfe-w-color-white, #FFFFFF)">{gameprops.gameModel.isFavorite}</p> -->
605
- <casino-game-thumbnail
649
+ <casino-game-thumbnail
606
650
  class="{MASONRY_CLASS_PREFIX}{gameprops.cellSize ? gameprops.cellSize : '1x1'}"
607
651
  session={session}
608
652
  userid={userid}
609
653
  lang={lang}
654
+ currency={currency}
610
655
  favorites={favorites}
611
656
  gamethumbnail={gameprops.gameModel.thumbnail}
612
657
  gamename={gameprops.gameModel.name}
@@ -618,9 +663,11 @@
618
663
  gamefunmode={gameprops.gameModel.hasFunMode}
619
664
  gamefavorite={gameprops.gameModel.isFavorite}
620
665
  showfavoredcategory={showFavGamesCategory}
666
+ livelobbyendpoint={gameprops.gameModel.details ? gameprops.gameModel.href : ''}
621
667
  {clientstyling}
622
668
  {clientstylingurl}
623
669
  {endpoint}
670
+ {livecasino}
624
671
  ></casino-game-thumbnail>
625
672
  {/if}
626
673
  {/if}