@everymatrix/casino-sort 1.10.1 → 1.10.2
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/dist/casino-sort.js +102 -94
- package/dist/casino-sort.js.map +1 -1
- package/package.json +2 -2
- package/src/CasinoSort.svelte +92 -130
- package/src/translations.js +60 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/casino-sort",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"svelte": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "0608b5f0449d8bd54dcb9e847e35e9b91c4398a2"
|
|
39
39
|
}
|
package/src/CasinoSort.svelte
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<svelte:options tag={null} />
|
|
2
2
|
<script lang="ts">
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
import { _, addNewMessages, setupI18n, setLocale } from './i18n';
|
|
5
7
|
import { Translations } from './translations';
|
|
@@ -17,18 +19,11 @@
|
|
|
17
19
|
let isSorterActive:boolean = false;
|
|
18
20
|
let isLoading:boolean = true;
|
|
19
21
|
let sortedBy:string = '';
|
|
20
|
-
let vendorSortingBy:
|
|
21
|
-
let sorter:
|
|
22
|
+
let vendorSortingBy:string = 'All';
|
|
23
|
+
let sorter:string = '';
|
|
22
24
|
|
|
23
25
|
setupI18n({ withLocale: 'en', translations: {}});
|
|
24
26
|
|
|
25
|
-
const vendorMap = {
|
|
26
|
-
'All': 'All',
|
|
27
|
-
'name': 'A-Z',
|
|
28
|
-
'isNew': 'Newest',
|
|
29
|
-
'advancedTags(name(hot))': 'Hottest',
|
|
30
|
-
}
|
|
31
|
-
|
|
32
27
|
const setTranslationUrl = ():void => {
|
|
33
28
|
let url:string = translationurl;
|
|
34
29
|
|
|
@@ -46,6 +41,13 @@
|
|
|
46
41
|
addNewMessages(item, Translations[item]);
|
|
47
42
|
});
|
|
48
43
|
|
|
44
|
+
const vendorMap = {
|
|
45
|
+
'All': $_('Translations.all'),
|
|
46
|
+
'name': $_('Translations.az'),
|
|
47
|
+
'isNew': $_('Translations.newest'),
|
|
48
|
+
'advancedTags(name(hot))': $_('Translations.hottest'),
|
|
49
|
+
}
|
|
50
|
+
|
|
49
51
|
const setClientStyling = ():void => {
|
|
50
52
|
let sheet = document.createElement('style');
|
|
51
53
|
sheet.innerHTML = clientstyling;
|
|
@@ -65,13 +67,14 @@
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
const initialLoad = ():void => {
|
|
70
|
+
vendorSortingBy = 'All';
|
|
68
71
|
isLoading = false;
|
|
69
72
|
isSorterActive = false;
|
|
70
73
|
let parser = JSON.parse(localStorage.getItem('vendorSortingBy'))?.[categoryid];
|
|
71
74
|
if (parser) {
|
|
72
75
|
vendorSortingBy = parser;
|
|
73
76
|
} else {
|
|
74
|
-
vendorSortingBy = 'All'
|
|
77
|
+
vendorSortingBy = 'All';
|
|
75
78
|
}
|
|
76
79
|
vendorSortingBy = vendorMap[parser]
|
|
77
80
|
}
|
|
@@ -101,8 +104,23 @@
|
|
|
101
104
|
|
|
102
105
|
const toggleList = ():void => {
|
|
103
106
|
isSorterActive = !isSorterActive;
|
|
107
|
+
window.postMessage({ type: "SortingOpened"}, window.location.href);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const messageHandler = (e:any) => {
|
|
111
|
+
if (e.data.type == 'FilterOpened') {
|
|
112
|
+
isSorterActive = false;
|
|
113
|
+
}
|
|
104
114
|
}
|
|
105
115
|
|
|
116
|
+
onMount(() => {
|
|
117
|
+
window.addEventListener('message', messageHandler, false);
|
|
118
|
+
|
|
119
|
+
return () => {
|
|
120
|
+
window.removeEventListener('message', messageHandler);
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
|
|
106
124
|
$: categoryid && initialLoad();
|
|
107
125
|
$: clientstyling && customStylingContainer && setClientStyling();
|
|
108
126
|
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
@@ -115,7 +133,7 @@
|
|
|
115
133
|
<p class="SearchLoading" part="SearchLoading">{$_('casinoPage.500')}</p>
|
|
116
134
|
{:else}
|
|
117
135
|
{#if !isLoading}
|
|
118
|
-
<div class="SorterContainer
|
|
136
|
+
<div class="SorterContainer">
|
|
119
137
|
<div class="SorterSelector {isSorterActive ? 'SorterSelectorOpen' : ''}" on:click={() => toggleList()}>
|
|
120
138
|
<div class="SorterMainArea">
|
|
121
139
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 26.003 22.819">
|
|
@@ -128,9 +146,7 @@
|
|
|
128
146
|
<div class="SorterTextContainer">
|
|
129
147
|
<span class="SorterName">{$_('Translations.sortby')}</span>
|
|
130
148
|
<div class="SorterValueContainer">
|
|
131
|
-
{
|
|
132
|
-
<span>{vendorSortingBy}</span>
|
|
133
|
-
{/if}
|
|
149
|
+
<span>{vendorSortingBy || $_('Translations.all')}</span>
|
|
134
150
|
</div>
|
|
135
151
|
</div>
|
|
136
152
|
</div>
|
|
@@ -141,11 +157,11 @@
|
|
|
141
157
|
</span>
|
|
142
158
|
</div>
|
|
143
159
|
<div class="SorterDropdownContainer { isSorterActive ? 'SorterOpen' : ''}">
|
|
144
|
-
<ul class="SorterDropdown"
|
|
160
|
+
<ul class="SorterDropdown">
|
|
145
161
|
{#each Object.values(vendorMap) as sort}
|
|
146
|
-
<li class="
|
|
147
|
-
<label class="SorterLabel">
|
|
148
|
-
<input type="radio" name="
|
|
162
|
+
<li class="SorterItem" value={sort}>
|
|
163
|
+
<label class="SorterLabel CustomRadioButton">
|
|
164
|
+
<input type="radio" name="radio" value={sort} checked={vendorSortingBy == sort ? true : (vendorSortingBy == undefined && sort == $_('Translations.all') ? true : false)} on:click={() => sortBy(sort)}>
|
|
149
165
|
<span class="SortersCheckmark"></span>
|
|
150
166
|
<span>{sort}</span>
|
|
151
167
|
</label>
|
|
@@ -239,10 +255,11 @@
|
|
|
239
255
|
width: 100%;
|
|
240
256
|
max-height: fit-content;
|
|
241
257
|
transition: max-height 0.25s ease-in;
|
|
258
|
+
padding-top: 20px;
|
|
242
259
|
}
|
|
243
260
|
}
|
|
244
261
|
|
|
245
|
-
.
|
|
262
|
+
.SorterDropdown {
|
|
246
263
|
width: 100%;
|
|
247
264
|
max-height: 300px;
|
|
248
265
|
display: grid;
|
|
@@ -253,6 +270,10 @@
|
|
|
253
270
|
list-style: none;
|
|
254
271
|
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
255
272
|
scrollbar-width: none; /* Firefox */
|
|
273
|
+
list-style-type: none;
|
|
274
|
+
padding: 10px;
|
|
275
|
+
margin: 0;
|
|
276
|
+
box-sizing: border-box;
|
|
256
277
|
|
|
257
278
|
&::-webkit-scrollbar {
|
|
258
279
|
display: none; /* Safari and Chrome */
|
|
@@ -261,7 +282,7 @@
|
|
|
261
282
|
|
|
262
283
|
|
|
263
284
|
// custom checkmark
|
|
264
|
-
.
|
|
285
|
+
.SorterItem {
|
|
265
286
|
position: relative;
|
|
266
287
|
label {
|
|
267
288
|
font-size: 14px;
|
|
@@ -280,54 +301,59 @@
|
|
|
280
301
|
margin-right: 10px;
|
|
281
302
|
}
|
|
282
303
|
|
|
283
|
-
&:hover input ~ .SortersCheckmark {
|
|
284
|
-
background-color: transparent;
|
|
285
|
-
border: 1px solid #D0046C;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
input:checked ~ .SortersCheckmark {
|
|
289
|
-
background-color: #D0046C;
|
|
290
|
-
border: 1px solid #D0046C;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
304
|
.SortersCheckmark {
|
|
294
|
-
transition: all 0.05s ease-in;
|
|
295
305
|
margin: 0 15px;
|
|
296
306
|
}
|
|
297
307
|
|
|
298
308
|
/* unchecked checkmark */
|
|
299
|
-
|
|
300
|
-
|
|
309
|
+
|
|
310
|
+
.CustomRadioButton input[type="radio"] {
|
|
301
311
|
position: absolute;
|
|
302
|
-
left:
|
|
303
|
-
display: none;
|
|
312
|
+
left: -9999px
|
|
304
313
|
}
|
|
305
314
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
315
|
+
.CustomRadioButton input[type="radio"]+span {
|
|
316
|
+
position: relative;
|
|
317
|
+
padding: 0 0 0 30px;
|
|
318
|
+
cursor: pointer
|
|
309
319
|
}
|
|
310
320
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
border:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
transform: rotate(45deg);
|
|
321
|
+
.CustomRadioButton input[type="radio"]+span:before {
|
|
322
|
+
content: '';
|
|
323
|
+
background: transparent;
|
|
324
|
+
border: 1px solid #fff;
|
|
325
|
+
height: 18px;
|
|
326
|
+
width: 18px;
|
|
327
|
+
border-radius: 50%;
|
|
328
|
+
position: absolute;
|
|
329
|
+
top: -11px;
|
|
330
|
+
left: -1px;
|
|
322
331
|
}
|
|
323
|
-
}
|
|
324
332
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
333
|
+
.CustomRadioButton input[type="radio"]+span:after {
|
|
334
|
+
content: '';
|
|
335
|
+
background: var(--emfe-w-color-primary, #D0046C);
|
|
336
|
+
width: 14px;
|
|
337
|
+
height: 14px;
|
|
338
|
+
border-radius: 50%;
|
|
339
|
+
position: absolute;
|
|
340
|
+
top: -8px;
|
|
341
|
+
left: 2px;
|
|
342
|
+
opacity: 0;
|
|
343
|
+
transform: scale(2);
|
|
344
|
+
transition: transform 0.3s linear, opacity 0.3s linear;
|
|
345
|
+
@supports (-webkit-touch-callout: none) {
|
|
346
|
+
/* CSS specific to iOS devices */
|
|
347
|
+
position: absolute;
|
|
348
|
+
top: -7px;
|
|
349
|
+
left: 2.5px;
|
|
329
350
|
}
|
|
330
351
|
}
|
|
352
|
+
|
|
353
|
+
.CustomRadioButton input[type="radio"]:checked+span:after {
|
|
354
|
+
opacity: 1;
|
|
355
|
+
transform: scale(1)
|
|
356
|
+
}
|
|
331
357
|
}
|
|
332
358
|
|
|
333
359
|
.SorterLabel {
|
|
@@ -338,40 +364,12 @@
|
|
|
338
364
|
height: 0;
|
|
339
365
|
width: 0;
|
|
340
366
|
}
|
|
341
|
-
|
|
342
|
-
.SortersCheckmark {
|
|
343
|
-
border-radius: 8px;
|
|
344
|
-
position: relative;
|
|
345
|
-
height: 22px;
|
|
346
|
-
width: 22px;
|
|
347
|
-
min-width: 22px;
|
|
348
|
-
background-color: transparent;
|
|
349
|
-
border: 1px solid #fff;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.FilterItemWithLogos {
|
|
354
|
-
label {
|
|
355
|
-
height: 70px;
|
|
356
|
-
display: flex;
|
|
357
|
-
justify-content: space-evenly;
|
|
358
|
-
align-items: center;
|
|
359
|
-
img {
|
|
360
|
-
width: 70px;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
367
|
}
|
|
364
368
|
|
|
365
369
|
.SorterLabel input:checked + span {
|
|
366
370
|
font-weight: 600;
|
|
367
371
|
}
|
|
368
372
|
|
|
369
|
-
.FilterCounter {
|
|
370
|
-
display: inline-flex;
|
|
371
|
-
margin-left: 10px;
|
|
372
|
-
min-width: 17px;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
373
|
.ClearSorters {
|
|
376
374
|
margin: 20px auto;
|
|
377
375
|
border: 0;
|
|
@@ -394,64 +392,28 @@
|
|
|
394
392
|
}
|
|
395
393
|
}
|
|
396
394
|
|
|
395
|
+
|
|
396
|
+
|
|
397
397
|
@media only screen and (max-width: 768px) {
|
|
398
398
|
.SorterSelector {
|
|
399
399
|
max-width: initial;
|
|
400
|
+
padding: 7px 16px;
|
|
400
401
|
}
|
|
401
402
|
|
|
402
|
-
.
|
|
403
|
+
.SorterDropdownContainer {
|
|
403
404
|
width: 100%;
|
|
404
405
|
margin-bottom: 20px;
|
|
405
406
|
}
|
|
406
407
|
|
|
407
|
-
.
|
|
408
|
-
display: grid;
|
|
409
|
-
grid-template-columns: minmax(150px, 150px) minmax(150px, 150px);
|
|
410
|
-
gap: 30px;
|
|
411
|
-
margin-block-start: 0;;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
.FilterItemWithLogos {
|
|
415
|
-
label {
|
|
416
|
-
justify-content: center;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.SorterContainerSplitt {
|
|
421
|
-
.SorterSelector {
|
|
422
|
-
padding: 7px;
|
|
423
|
-
.FilterCounter {
|
|
424
|
-
margin-left: 0;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
.SorterMainArea svg {
|
|
428
|
-
margin: 0 10px;
|
|
429
|
-
}
|
|
430
|
-
.FilterDropdown {
|
|
431
|
-
grid-template-columns: 1fr;
|
|
432
|
-
}
|
|
433
|
-
.FilterDropdownContainer {
|
|
434
|
-
top: 42px;
|
|
435
|
-
}
|
|
436
|
-
.ClearSorters {
|
|
437
|
-
padding: 10px 25px;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.SorterLabel .SortersCheckmark {
|
|
442
|
-
margin-right: 15px;;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
.FilterItem.FilterItemWithLogos {
|
|
408
|
+
.SorterDropdown {
|
|
446
409
|
display: flex;
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
margin: 0 20px 0 0;
|
|
410
|
+
flex-direction: column;
|
|
411
|
+
gap: 12px;
|
|
412
|
+
margin-block-start: 0;
|
|
413
|
+
.SorterLabel {
|
|
414
|
+
line-height: 24px;
|
|
415
|
+
&> * {
|
|
416
|
+
pointer-events: none; // this fixes ios mobile devices top on selected item from the dropdown
|
|
455
417
|
}
|
|
456
418
|
}
|
|
457
419
|
}
|
package/src/translations.js
CHANGED
|
@@ -2,76 +2,136 @@ export const Translations = {
|
|
|
2
2
|
'en': {
|
|
3
3
|
'Translations': {
|
|
4
4
|
'sortby': 'Sort by:',
|
|
5
|
+
'all': 'All',
|
|
6
|
+
'az': 'A-Z',
|
|
7
|
+
'newest': 'Newest',
|
|
8
|
+
'hottest': 'Hottest'
|
|
5
9
|
}
|
|
6
10
|
},
|
|
7
11
|
'zh': {
|
|
8
12
|
'Translations': {
|
|
9
13
|
'sortby': 'Sort by',
|
|
14
|
+
'all': 'All',
|
|
15
|
+
'az': 'A-Z',
|
|
16
|
+
'newest': 'Newest',
|
|
17
|
+
'hottest': 'Hottest'
|
|
10
18
|
}
|
|
11
19
|
},
|
|
12
20
|
'de': {
|
|
13
21
|
'Translations': {
|
|
14
22
|
'sortby': 'Sort by:',
|
|
23
|
+
'all': 'All',
|
|
24
|
+
'az': 'A-Z',
|
|
25
|
+
'newest': 'Newest',
|
|
26
|
+
'hottest': 'Hottest'
|
|
15
27
|
}
|
|
16
28
|
},
|
|
17
29
|
'it': {
|
|
18
30
|
'Translations': {
|
|
19
31
|
'sortby': 'Sort by:',
|
|
32
|
+
'all': 'All',
|
|
33
|
+
'az': 'A-Z',
|
|
34
|
+
'newest': 'Newest',
|
|
35
|
+
'hottest': 'Hottest'
|
|
20
36
|
}
|
|
21
37
|
},
|
|
22
38
|
'fr': {
|
|
23
39
|
'Translations': {
|
|
24
40
|
'sortby': 'Sort by:',
|
|
41
|
+
'all': 'All',
|
|
42
|
+
'az': 'A-Z',
|
|
43
|
+
'newest': 'Newest',
|
|
44
|
+
'hottest': 'Hottest'
|
|
25
45
|
}
|
|
26
46
|
},
|
|
27
47
|
'es': {
|
|
28
48
|
'Translations': {
|
|
29
49
|
'sortby': 'Sort by:',
|
|
50
|
+
'all': 'All',
|
|
51
|
+
'az': 'A-Z',
|
|
52
|
+
'newest': 'Newest',
|
|
53
|
+
'hottest': 'Hottest'
|
|
30
54
|
}
|
|
31
55
|
},
|
|
32
56
|
'tr': {
|
|
33
57
|
'Translations': {
|
|
34
58
|
'sortby': 'Sort by:',
|
|
59
|
+
'all': 'All',
|
|
60
|
+
'az': 'A-Z',
|
|
61
|
+
'newest': 'Newest',
|
|
62
|
+
'hottest': 'Hottest'
|
|
35
63
|
}
|
|
36
64
|
},
|
|
37
65
|
'ru': {
|
|
38
66
|
'Translations': {
|
|
39
67
|
'sortby': 'Sort by:',
|
|
68
|
+
'all': 'All',
|
|
69
|
+
'az': 'A-Z',
|
|
70
|
+
'newest': 'Newest',
|
|
71
|
+
'hottest': 'Hottest'
|
|
40
72
|
}
|
|
41
73
|
},
|
|
42
74
|
'ro': {
|
|
43
75
|
'Translations': {
|
|
44
76
|
'sortby': 'Sort by:',
|
|
77
|
+
'all': 'All',
|
|
78
|
+
'az': 'A-Z',
|
|
79
|
+
'newest': 'Newest',
|
|
80
|
+
'hottest': 'Hottest'
|
|
45
81
|
}
|
|
46
82
|
},
|
|
47
83
|
'hr': {
|
|
48
84
|
'Translations': {
|
|
49
85
|
'sortby': 'Sort by:',
|
|
86
|
+
'all': 'All',
|
|
87
|
+
'az': 'A-Z',
|
|
88
|
+
'newest': 'Newest',
|
|
89
|
+
'hottest': 'Hottest'
|
|
50
90
|
}
|
|
51
91
|
},
|
|
52
92
|
'hu': {
|
|
53
93
|
'Translations': {
|
|
54
94
|
'sortby': 'Sort by:',
|
|
95
|
+
'all': 'All',
|
|
96
|
+
'az': 'A-Z',
|
|
97
|
+
'newest': 'Newest',
|
|
98
|
+
'hottest': 'Hottest'
|
|
55
99
|
}
|
|
56
100
|
},
|
|
57
101
|
'pl': {
|
|
58
102
|
'Translations': {
|
|
59
103
|
'sortby': 'Sort by:',
|
|
104
|
+
'all': 'All',
|
|
105
|
+
'az': 'A-Z',
|
|
106
|
+
'newest': 'Newest',
|
|
107
|
+
'hottest': 'Hottest'
|
|
60
108
|
}
|
|
61
109
|
},
|
|
62
110
|
'pt': {
|
|
63
111
|
'Translations': {
|
|
64
112
|
'sortby': 'Sort by:',
|
|
113
|
+
'all': 'All',
|
|
114
|
+
'az': 'A-Z',
|
|
115
|
+
'newest': 'Newest',
|
|
116
|
+
'hottest': 'Hottest'
|
|
65
117
|
}
|
|
66
118
|
},
|
|
67
119
|
'sl': {
|
|
68
120
|
'Translations': {
|
|
69
121
|
'sortby': 'Sort by:',
|
|
122
|
+
'all': 'All',
|
|
123
|
+
'az': 'A-Z',
|
|
124
|
+
'newest': 'Newest',
|
|
125
|
+
'hottest': 'Hottest'
|
|
70
126
|
}
|
|
71
127
|
},
|
|
72
128
|
'sr': {
|
|
73
129
|
'Translations': {
|
|
74
130
|
'sortby': 'Sort by:',
|
|
131
|
+
'all': 'All',
|
|
132
|
+
'az': 'A-Z',
|
|
133
|
+
'newest': 'Newest',
|
|
134
|
+
'hottest': 'Hottest'
|
|
75
135
|
}
|
|
76
136
|
}
|
|
77
137
|
};
|