@everymatrix/casino-slider 1.0.11 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/casino-slider.js +1 -1
- package/dist/casino-slider.js.map +1 -1
- package/package.json +2 -2
- package/src/CasinoSlider.svelte +41 -14
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@everymatrix/casino-slider",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.14",
|
4
4
|
"main": "dist/casino-slider.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": "5da9a4e3b1b2d635a921ce3981f56157191f5aa7"
|
40
40
|
}
|
package/src/CasinoSlider.svelte
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
export let clientstyling:string = '';
|
17
17
|
export let clientstylingurl:string = '';
|
18
18
|
export let identity:string = '';
|
19
|
+
export let translationUrl:string = '';
|
19
20
|
export let containermaxwidth:string = '';
|
20
21
|
export let isprimarymenu:boolean = false;
|
21
22
|
export let issecondarymenu:boolean = false;
|
@@ -25,6 +26,20 @@
|
|
25
26
|
|
26
27
|
setupI18n({ withLocale: 'en', translations: {}});
|
27
28
|
|
29
|
+
const setTranslationUrl = ():void => {
|
30
|
+
let url:string = translationUrl;
|
31
|
+
|
32
|
+
fetch(url).then((res:any) => res.json())
|
33
|
+
.then((res) => {
|
34
|
+
Object.keys(res).forEach((item:any):void => {
|
35
|
+
addNewMessages(item, res[item]);
|
36
|
+
});
|
37
|
+
}).catch((err:any) => {
|
38
|
+
console.log(err);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
|
28
43
|
Object.keys(CasinoSlider).forEach((item:any) => {
|
29
44
|
addNewMessages(item, CasinoSlider[item]);
|
30
45
|
});
|
@@ -34,7 +49,9 @@
|
|
34
49
|
|
35
50
|
let carousel:any;
|
36
51
|
let activeIndex:number;
|
52
|
+
let activeSubIndex:number;
|
37
53
|
let prevIndex:number;
|
54
|
+
let prevSubIndex:number;
|
38
55
|
let customStylingContainer:HTMLElement;
|
39
56
|
let sliderdata:Array<any> = [];
|
40
57
|
let subGroupsData: any;
|
@@ -43,12 +60,23 @@
|
|
43
60
|
|
44
61
|
// Clicking on the slider item will trigger this method and send a postmessage on window
|
45
62
|
// @TODO itemId type fix
|
46
|
-
let handleClick = (item:any, index:number):void => {
|
63
|
+
let handleClick = (item:any, index:number, subItem:any, subIndex:number, itemType:string):void => {
|
47
64
|
scrollHandler();
|
48
65
|
activeIndex = index;
|
49
66
|
activeIndex = activeIndex;
|
50
67
|
prevIndex = activeIndex;
|
51
|
-
|
68
|
+
|
69
|
+
if(itemType != 'secondary') {
|
70
|
+
getSubGroups(item, index, 'navigation');
|
71
|
+
activeSubIndex = null;
|
72
|
+
prevSubIndex = null;
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
|
76
|
+
activeSubIndex = subIndex;
|
77
|
+
activeSubIndex = activeSubIndex;
|
78
|
+
prevSubIndex = activeSubIndex;
|
79
|
+
getSubGroups(subItem, subIndex, 'navigation');
|
52
80
|
};
|
53
81
|
|
54
82
|
let scrollLeft = ():void => {
|
@@ -107,7 +135,6 @@
|
|
107
135
|
|
108
136
|
const getSubGroups = (item:string, index?:number, trigger?:string):void => {
|
109
137
|
if(location == 'secondaryMenu' && endpoint && datasource && lang && item.id) {
|
110
|
-
|
111
138
|
let url:URL = new URL(`${endpoint}/casino/groups/${datasource}/${item.id}/subGroups?language=${lang}`);
|
112
139
|
fetch(url.href)
|
113
140
|
.then((res:any) => res.json())
|
@@ -190,6 +217,7 @@
|
|
190
217
|
})
|
191
218
|
|
192
219
|
$: activeindex && setActiveIndex();
|
220
|
+
$: translationUrl && setTranslationUrl();
|
193
221
|
$: clientstyling && customStylingContainer && setClientStyling();
|
194
222
|
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
195
223
|
$: lang && setActiveLanguage();
|
@@ -211,7 +239,7 @@
|
|
211
239
|
<li class="CarouselItem {activeIndex == index || prevIndex == index ? 'active': ''}
|
212
240
|
{location == 'headerMain' ? '' : 'SecondaryMenu'}"
|
213
241
|
part="CarouselItem"
|
214
|
-
on:click={e => { handleClick(category, index); e.preventDefault()}}>
|
242
|
+
on:click={e => { handleClick(category, index, null, null, 'main'); e.preventDefault()}}>
|
215
243
|
{#if location === 'headerMain'}
|
216
244
|
<a href="#">{category.label}</a>
|
217
245
|
{:else}
|
@@ -221,10 +249,10 @@
|
|
221
249
|
{#if subGroupsData?.count > 0}
|
222
250
|
{#if subGroupsData && showsubgroups == 'true'}
|
223
251
|
<ul class="DropDown">
|
224
|
-
{#each subGroupsData?.items as subGroupsData}
|
252
|
+
{#each subGroupsData?.items as subGroupsData, subindex (subGroupsData.id)}
|
225
253
|
{#if subGroupsData.games.count}
|
226
|
-
<li on:click={e => { handleClick(subGroupsData,
|
227
|
-
<a class="SubDropDown">{subGroupsData?.name}</a>
|
254
|
+
<li on:click={e => { handleClick(category, index, subGroupsData, subindex, 'secondary'); e.stopPropagation();}}>
|
255
|
+
<a class="SubDropDown {activeSubIndex == subindex || prevSubIndex == subindex ? 'active': ''}">{subGroupsData?.name}</a>
|
228
256
|
</li>
|
229
257
|
{/if}
|
230
258
|
{/each}
|
@@ -424,7 +452,9 @@
|
|
424
452
|
top: 0;
|
425
453
|
opacity: 0;
|
426
454
|
transition: opacity 0.1s, left 0s 0.1s, top 0.1s;
|
427
|
-
background: var(--emfe-w-color-
|
455
|
+
background: var(--emfe-w-color-secondary, #FD2839); /* fallback for old browsers */
|
456
|
+
background: -webkit-linear-gradient(var(--emfe-w-color-secondary, #FD2839), var(--emfe-w-color-primary, #D0046C)); /* Chrome 10-25, Safari 5.1-6 */
|
457
|
+
background: linear-gradient(var(--emfe-w-color-secondary, #FD2839), var(--emfe-w-color-primary, #D0046C)); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
428
458
|
}
|
429
459
|
}
|
430
460
|
|
@@ -447,12 +477,9 @@
|
|
447
477
|
opacity:0;
|
448
478
|
}
|
449
479
|
|
450
|
-
.SubDropDown {
|
451
|
-
|
452
|
-
|
453
|
-
background: -webkit-linear-gradient(var(--emfe-w-color-contrast, #07072A), var(--emfe-w-color-primary, #D0046C)); /* Chrome 10-25, Safari 5.1-6 */
|
454
|
-
|
455
|
-
background: linear-gradient(var(--emfe-w-color-contrast, #07072A), var(--emfe-w-color-primary, #D0046C)); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
|
480
|
+
.SubDropDown:hover, .SubDropDown.active {
|
481
|
+
color: var(--emfe-w-color-black, #000);
|
482
|
+
background: var(--emfe-w-color-white, #FFF);
|
456
483
|
}
|
457
484
|
}
|
458
485
|
|