-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad73f11
commit d8d2c52
Showing
4 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const frame = document.getElementById('nitro'); | ||
|
||
window.FlashExternalInterface = {}; | ||
|
||
window.FlashExternalInterface.disconnect = () => { | ||
const el = document.getElementById('disconnected'); | ||
|
||
if (el) { | ||
el.classList.remove('pointer-events-none'); | ||
el.classList.remove('opacity-0'); | ||
el.classList.add('opacity-100'); | ||
} | ||
}; | ||
|
||
window.FlashExternalInterface.onMessage = (event) => { | ||
if (!frame || event.source !== frame.contentWindow) return; | ||
if (typeof event.data !== 'string') return; | ||
if (!event.data.startsWith('Nitro_LegacyExternalInterface')) return; | ||
if (!('FlashExternalInterface' in window)) return; | ||
|
||
const { method, params } = JSON.parse(event.data.substr(29)); | ||
|
||
const fn = window.FlashExternalInterface[method]; | ||
|
||
if (!fn) return; | ||
|
||
fn(...params); | ||
} | ||
|
||
if (frame && frame.contentWindow) { | ||
window.addEventListener('message', (event) => window.FlashExternalInterface.onMessage(event)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
resources/themes/atom/views/components/client/disconnect.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<div id="disconnected" class="absolute inset-0 z-50 w-full h-screen transition-all duration-500 opacity-0 pointer-events-none"> | ||
<div class="absolute w-full h-full bg-black bg-opacity-50"></div> | ||
|
||
<div class="relative flex flex-col items-center justify-center w-full h-full gap-4"> | ||
<h2 class="text-2xl text-white"> | ||
{{ __('Whoops! It seems like you have been disconnected...') }} | ||
</h2> | ||
|
||
<div class="flex gap-x-4"> | ||
<a href="{{ route('game.nitro') }}"> | ||
<x-button>{{ __('Reload client') }}</x-button> | ||
</a> | ||
|
||
<a href="{{ route('users.me') }}"> | ||
<x-button variant="secondary">{{ __('Back to website') }}</x-button> | ||
</a> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters