@everymatrix/casino-footer 1.0.2 → 1.0.4

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-footer",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "dist/casino-footer.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -48,7 +48,6 @@
48
48
  let socialLinksRepeater:Array<Object> = [];
49
49
  let copyright:string = '';
50
50
  let licenseDesc:string = '';
51
- let footerWidget:HTMLElement;
52
51
  let hasErrors:boolean = false;
53
52
  let isLoading:boolean = false;
54
53
  let receivedFooterData:any;
@@ -74,6 +73,9 @@
74
73
 
75
74
  let timeString:string = '';
76
75
 
76
+ let customStylingContainer:HTMLElement;
77
+ let displayNoneCustomStyling:Boolean = false;
78
+
77
79
  Object.keys(CasinoFooterTranslations).forEach((item:any) => {
78
80
  addNewMessages(item, CasinoFooterTranslations[item]);
79
81
  });
@@ -213,12 +215,6 @@
213
215
  element.append(htmlContent);
214
216
  }
215
217
 
216
- const setClientStyling = () => {
217
- let sheet = document.createElement('style');
218
- sheet.innerHTML = clientstyling;
219
- footerWidget.appendChild(sheet);
220
- }
221
-
222
218
  const changeLanguage = () => {
223
219
  window.postMessage({type: 'LanguageChanged', selectedLanguage}, window.location.href);
224
220
  };
@@ -264,6 +260,32 @@
264
260
  }
265
261
  }
266
262
 
263
+ const setClientStyling = ():void => {
264
+ let sheet = document.createElement('style');
265
+ sheet.innerHTML = clientstyling;
266
+ if (customStylingContainer) {
267
+ customStylingContainer.appendChild(sheet);
268
+ }
269
+ }
270
+
271
+ const setClientStylingURL = ():void => {
272
+ displayNoneCustomStyling = true;
273
+
274
+ let url:URL = new URL(clientstylingurl);
275
+ let cssFile:HTMLElement = document.createElement('style');
276
+
277
+ fetch(url.href)
278
+ .then((res:any) => res.text())
279
+ .then((data:any) => {
280
+ cssFile.innerHTML = data
281
+
282
+ if (customStylingContainer) {
283
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
284
+ setTimeout(() => { displayNoneCustomStyling = false; }, 500);
285
+ }
286
+ });
287
+ }
288
+
267
289
  onMount(() => {
268
290
  languagesArray = languageslist.replace(/ /g,'').split(',');
269
291
  languagesArray = languagesArray.map((language:string) => language.toUpperCase());
@@ -272,7 +294,8 @@
272
294
  $: lang && setLocale(lang);
273
295
  $: session && userid && endpoint && setSession();
274
296
  $: isLoggedIn && lang && setSessionTimer();
275
- $: clientstyling && setClientStyling();
297
+ $: clientstyling && customStylingContainer && setClientStyling();
298
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
276
299
  $: endpoint && lang && env && userroles && getCmsData();
277
300
  $: clockenabled !== 'false' && clocksecondsenabled && clockcustomformat && clockDisplay();
278
301
  $: clockenabled !== 'false' && clocksecondsenabled && (refreshRate = clocksecondsenabled == "true" ? 1000 : 60000) && refreshClock();
@@ -286,13 +309,14 @@
286
309
  {/if}
287
310
  </svelte:head>
288
311
 
312
+ <div bind:this={customStylingContainer}>
289
313
  {#if hasErrors}
290
314
  <p class="SearchLoading" part="SearchLoading">500 Error - Internal Server Error</p>
291
315
  {:else}
292
316
  {#if isLoading}
293
317
  <p class="SearchLoading" part="SearchLoading">Loading ...</p>
294
318
  {:else}
295
- <div class="FooterGrid {sponsorsRepeater ? '' : 'NoSponsorSpacing'}" part="FooterGrid {sponsorsRepeater ? '' : 'NoSponsorSpacing'}" bind:this={footerWidget}>
319
+ <div class="FooterGrid {sponsorsRepeater ? '' : 'NoSponsorSpacing'}" part="FooterGrid {sponsorsRepeater ? '' : 'NoSponsorSpacing'}">
296
320
  <!-- start optionals section -->
297
321
  {#if (clockenabled==="true" || languageselectorenabled==="true" || panicbuttonenabled==="true")}
298
322
  <div class="GridRow ProvisionalRow" part="GridRow">
@@ -476,6 +500,7 @@
476
500
  </div>
477
501
  {/if}
478
502
  {/if}
503
+ </div>
479
504
 
480
505
  <style lang="scss">
481
506