@everymatrix/casino-page 0.0.280 → 0.0.283

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-page",
3
- "version": "0.0.280",
3
+ "version": "0.0.283",
4
4
  "main": "dist/casino-page.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": "1a620ac617e7ff4b6f5fe26863d6e3cb7cf4d03c"
39
+ "gitHead": "e19481532307b6ad83a24fda9f9b5ef7cc2a3b4c"
40
40
  }
@@ -55,8 +55,10 @@
55
55
  let playerID:string;
56
56
  let sessionID:string;
57
57
 
58
- let panicLoading = false;
59
- let panicButtonTimeout;
58
+ let panicButton:HTMLElement;
59
+ let panicLoading:boolean = false;
60
+ let timer: number = 0;
61
+ let timerInterval:any;
60
62
 
61
63
  // CasinoPage state
62
64
  let favoritesScreen:boolean = false;
@@ -705,15 +707,10 @@
705
707
  }
706
708
  }
707
709
 
708
- const PanicAction = () => {
709
- panicLoading = true;
710
-
711
- panicButtonTimeout = setTimeout(() => {
712
- panicLoading = false;
713
- window.postMessage({ type: 'PanicButtonClicked' }, window.location.href);
714
- }, 3000);
715
- clearTimeout(panicButtonTimeout);
710
+ const panicAction = ():void => {
711
+ window.postMessage({type: 'PanicButtonClicked'}, window.location.href);
716
712
  }
713
+
717
714
  //
718
715
  // --- END of communication with other widgets
719
716
  //
@@ -849,13 +846,48 @@
849
846
  });
850
847
  }
851
848
 
849
+ const startInterval = (e:any):void => {
850
+ timer = 0;
851
+
852
+ timerInterval = setInterval(() => {
853
+ timer += 1;
854
+ panicLoading = true;
855
+
856
+ if (timer >= 3) {
857
+ clearInterval(timerInterval)
858
+ }
859
+ }, 1000);
860
+ }
861
+
862
+ const endInterval = (e:any):void => {
863
+ if (timer < 3) {
864
+ panicLoading = false;
865
+ }
866
+ clearInterval(timerInterval);
867
+ }
868
+
852
869
  onMount(() => {
853
870
  window.addEventListener('scroll', scrollHandler, false);
854
871
  window.addEventListener('message', messageHandler, false);
855
872
 
873
+ panicButton?.addEventListener("mousedown", startInterval, false);
874
+ panicButton?.addEventListener('touchstart', startInterval, false)
875
+
876
+ // on mouseup stop interval count
877
+ panicButton?.addEventListener("mouseup", endInterval, false);
878
+ panicButton?.addEventListener("touchend", endInterval, false);
879
+
856
880
  return () => {
857
881
  window.removeEventListener('scroll', scrollHandler);
858
882
  window.removeEventListener('message', messageHandler);
883
+
884
+ panicButton?.removeEventListener("mousedown", startInterval);
885
+ panicButton?.removeEventListener('touchstart', startInterval)
886
+
887
+ // on mouseup stop interval count
888
+ panicButton?.removeEventListener("mouseup", endInterval);
889
+ panicButton?.removeEventListener("touchend", endInterval);
890
+
859
891
  }
860
892
  });
861
893
 
@@ -1113,7 +1145,7 @@
1113
1145
  <svg class="w-1 h-1" part="w-1 h-1" fill="none" stroke="white" width="34px" height="34px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
1114
1146
  <p>{$_('casinoPage.break')}</p>
1115
1147
  </div>
1116
- <button class="PanicButton" class:PanicButtonAnimation={panicLoading} part="PanicButton" on:click={() => PanicAction()}>{$_('casinoPage.breakButton')}</button>
1148
+ <button class="PanicButton" class:PanicButtonAnimation={panicLoading} part="PanicButton" bind:this={panicButton} on:click={() => panicAction()}>{$_('casinoPage.breakButton')}</button>
1117
1149
  </div>
1118
1150
  {/if}
1119
1151
  </section>
@@ -1170,11 +1202,37 @@
1170
1202
  }
1171
1203
 
1172
1204
  .PanicButtonAnimation {
1173
- transition: all 3000ms ease-in;
1174
- background-color: var(--emfe-w-color-gray-300, #58586B);
1175
- border: 1px solid var(--emfe-w-color-white, #FFFFFF);
1205
+ background: -webkit-linear-gradient(
1206
+ 135deg,
1207
+ #FD2839 5%, #D0046C 100%
1208
+ );
1209
+
1210
+ background: -moz-linear-gradient(
1211
+ 135deg,
1212
+ #FD2839 5%, #D0046C 100%
1213
+ );
1214
+
1215
+ background: -o-linear-gradient(
1216
+ 135deg,
1217
+ #FD2839 5%, #D0046C 100%
1218
+ );
1219
+
1220
+ width: 240px;
1221
+ color: #fff;
1222
+
1223
+ -webkit-animation: bar-animation 2s linear;
1224
+ }
1225
+
1226
+ @-webkit-keyframes bar-animation {
1227
+ 0% {
1228
+ background-position: 0;
1229
+ }
1230
+ 100% {
1231
+ background-position: 240px;
1232
+ }
1176
1233
  }
1177
1234
 
1235
+
1178
1236
  [type="search"] {
1179
1237
  appearance: none;
1180
1238
  }