@everymatrix/casino-tournaments-controller 0.0.411 → 0.0.412

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-tournaments-controller",
3
- "version": "0.0.411",
3
+ "version": "0.0.412",
4
4
  "main": "dist/casino-tournaments-controller.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": "0a732da40cdcdccc1f26ebb3fabac6e0b6e8976b"
39
+ "gitHead": "915e53c91820558c3cedd66aa2fa8a4343a6d67b"
40
40
  }
@@ -30,6 +30,9 @@
30
30
  export let sorttype: string = '';
31
31
  export let starttimeafter: string = '' // start time after how many days
32
32
 
33
+ export let clientstyling:string = '';
34
+ export let clientstylingurl:string = '';
35
+
33
36
  // Variables of topics for communication
34
37
  let hasErrors:boolean = false;
35
38
  let error:string = '';
@@ -41,6 +44,9 @@
41
44
  let filtersLoaded:boolean = false;
42
45
  let startingTournamentUpdater:boolean = false;
43
46
 
47
+ let customStylingContainer: HTMLElement;
48
+ let displayNone:boolean = false;
49
+
44
50
  let filtersArray = 'All,Scheduled,Ongoing,Finished';
45
51
  let tournamentsNumber:number = 0;
46
52
 
@@ -289,6 +295,30 @@
289
295
  playerID = userid;
290
296
  }
291
297
 
298
+ const setClientStyling = ():void => {
299
+ let sheet = document.createElement('style');
300
+ sheet.innerHTML = clientstyling;
301
+ customStylingContainer.appendChild(sheet);
302
+ }
303
+
304
+ const setClientStylingURL = ():void => {
305
+ displayNone = true;
306
+
307
+ let url:URL = new URL(clientstylingurl);
308
+ let cssFile:HTMLElement = document.createElement('style');
309
+
310
+ fetch(url.href)
311
+ .then((res:any) => res.text())
312
+ .then((data:any) => {
313
+ cssFile.innerHTML = data
314
+
315
+ if (customStylingContainer) {
316
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
317
+ setTimeout(() => { displayNone = false; }, 500);
318
+ }
319
+ });
320
+ }
321
+
292
322
  onMount(() => {
293
323
  isMounted = true
294
324
  window.addEventListener('message', messageHandler, false);
@@ -301,6 +331,8 @@
301
331
  }
302
332
  });
303
333
 
334
+ $: customStylingContainer && clientstyling && setClientStyling();
335
+ $: customStylingContainer && clientstylingurl && setClientStylingURL();
304
336
  $: session && setSession();
305
337
  $: userid && setPlayerID();
306
338
  $: lang && setLocale(lang);
@@ -315,7 +347,7 @@
315
347
  <p>{$_('tournamentsController.500')}</p>
316
348
  <p>{error}</p>
317
349
  {:else}
318
- <div class="TournamentsWrapper" part="TournamentsWrapper">
350
+ <div bind:this={customStylingContainer} class="TournamentsWrapper" part="TournamentsWrapper">
319
351
  <div class="Tournaments" style="max-width: {containermaxwidth}px;" part="Tournaments">
320
352
  <div class="FirstRow" part="FirstRow">
321
353
  {#if filtersLoaded}