Fix overlay templates not showing data in web player

- Created overlay-web-adapter.js to bridge postMessage to WebChannel interface
- Updated all web templates to use conditional Qt script loading
- Updated all Qt player templates with same pattern for consistency
- Prevents browser console errors from Qt URL schemes (qrc:///, overlay://)
- Templates now work in both Qt player and web player environments
parent c9a35c3d
......@@ -29,3 +29,6 @@ there are 2 differenc interfaces.
- Web dashboard: this is the application administration interface plus the interface for cashier, it is in mbetterclient/web_dashboard/, and it is server directly by the application, and eventually proxied by nginx. admin, users, and cashier all uses the web dashboard, with some differences for admin, users or cashier.
- Wensite: this is the public website used when running in --headless mode, it serves brokers and players users. it is served directly by nginx and uses the API from our application.
At the end of every task in a tasklist or modifications you do, commit and push to git the changes
......@@ -3,6 +3,14 @@
<head>
<meta charset="utf-8">
<title>MBetther system</title>
<!-- Web adapter for browser compatibility - detects environment and loads appropriate scripts -->
<script src="/js/overlay-web-adapter.js"></script>
<script>
// Conditionally load Qt scripts only in Qt environment
if (window.loadQtScripts) {
window.loadQtScripts();
}
</script>
<style>
* {
margin: 0;
......@@ -459,8 +467,8 @@
<!--
IMPORTANT: When creating or editing custom templates, always maintain these script tags:
1. qrc:///qtwebchannel/qwebchannel.js - Required for Qt WebChannel communication
2. overlay://overlay.js - Required for overlay functionality and data updates
1. /js/overlay-web-adapter.js - Required for web browser compatibility (bridges postMessage to WebChannel interface)
2. Qt scripts are loaded conditionally via window.loadQtScripts() in Qt environment only
These scripts enable communication between the Qt application and the overlay template.
Without them, the template will not receive data updates or function properly.
......@@ -468,7 +476,5 @@
NOTE: When editing this template or creating new ones, never remove these script sources!
The overlay:// custom scheme ensures JavaScript files work for both built-in and uploaded templates.
-->
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script src="overlay://overlay.js"></script>
</body>
</html>
......@@ -3,7 +3,15 @@
<head>
<meta charset="utf-8">
<title>Fixtures Overlay</title>
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<!-- Web adapter for browser compatibility - detects environment and loads appropriate scripts -->
<script src="/js/overlay-web-adapter.js"></script>
<script>
// Conditionally load Qt scripts only in Qt environment
// In web browser, this does nothing (web adapter handles communication)
if (window.loadQtScripts) {
window.loadQtScripts();
}
</script>
<style>
* {
margin: 0;
......
......@@ -3,7 +3,14 @@
<head>
<meta charset="utf-8">
<title>Match Overlay</title>
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<!-- Web adapter for browser compatibility - must be loaded first -->
<script src="/js/overlay-web-adapter.js"></script>
<script>
// Conditionally load Qt scripts only in Qt environment
if (window.loadQtScripts) {
window.loadQtScripts();
}
</script>
<style>
* {
margin: 0;
......@@ -1390,9 +1397,9 @@
</script>
<!--
IMPORTANT: When creating or editing custom templates, always maintain these two script tags:
1. qrc:///qtwebchannel/qwebchannel.js - Required for Qt WebChannel communication
2. overlay://overlay.js - Required for overlay functionality and data updates
IMPORTANT: When creating or editing custom templates, always maintain these script tags:
1. /js/overlay-web-adapter.js - Required for web browser compatibility (bridges postMessage to WebChannel interface)
2. Qt scripts are loaded conditionally via window.loadQtScripts() - only in Qt environment
These scripts enable communication between the Qt application and the overlay template.
Without them, the template will not receive data updates or function properly.
......@@ -1400,7 +1407,5 @@
NOTE: When editing this template or creating new ones, never remove these script sources!
The overlay:// custom scheme ensures JavaScript files work for both built-in and uploaded templates.
-->
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script src="overlay://overlay.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -3,6 +3,14 @@
<head>
<meta charset="utf-8">
<title>Match Video Overlay</title>
<!-- Web adapter for browser compatibility - detects environment and loads appropriate scripts -->
<script src="/js/overlay-web-adapter.js"></script>
<script>
// Conditionally load Qt scripts only in Qt environment
if (window.loadQtScripts) {
window.loadQtScripts();
}
</script>
<style>
* {
margin: 0;
......@@ -666,8 +674,16 @@
});
</script>
<!-- Required scripts for Qt WebChannel communication -->
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script src="overlay://overlay.js"></script>
<!--
IMPORTANT: When creating or editing custom templates, always maintain these script tags:
1. /js/overlay-web-adapter.js - Required for web browser compatibility (bridges postMessage to WebChannel interface)
2. Qt scripts are loaded conditionally via window.loadQtScripts() in Qt environment only
These scripts enable communication between the Qt application and the overlay template.
Without them, the template will not receive data updates or function properly.
NOTE: When editing this template or creating new ones, never remove these script sources!
The overlay:// custom scheme ensures JavaScript files work for both built-in and uploaded templates.
-->
</body>
</html>
\ No newline at end of file
......@@ -3,7 +3,14 @@
<head>
<meta charset="utf-8">
<title>Results Overlay</title>
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<!-- Web adapter for browser compatibility - must be loaded first -->
<script src="/js/overlay-web-adapter.js"></script>
<script>
// Conditionally load Qt scripts only in Qt environment
if (window.loadQtScripts) {
window.loadQtScripts();
}
</script>
<style>
* {
margin: 0;
......@@ -1305,14 +1312,15 @@
</script>
<!--
IMPORTANT: When creating or editing custom templates, always maintain this script tag:
1. qrc:///qtwebchannel/qwebchannel.js - Required for Qt WebChannel communication
IMPORTANT: When creating or editing custom templates, always maintain these script tags:
1. /js/overlay-web-adapter.js - Required for web browser compatibility (bridges postMessage to WebChannel interface)
2. Qt scripts are loaded conditionally via window.loadQtScripts() - only in Qt environment
This script enables communication between the Qt application and the overlay template.
The results.html template uses inline WebChannel setup with client-initiated data fetching,
similar to fixtures.html, and includes custom dataUpdated signal handling.
NOTE: When editing this template, never remove the qrc:///qtwebchannel/qwebchannel.js script source!
NOTE: When editing this template, never remove the web adapter script source!
The template implements its own WebChannel setup and data polling mechanism.
-->
</body>
......
......@@ -459,8 +459,8 @@
<!--
IMPORTANT: When creating or editing custom templates, always maintain these script tags:
1. qrc:///qtwebchannel/qwebchannel.js - Required for Qt WebChannel communication
2. overlay://overlay.js - Required for overlay functionality and data updates
1. /js/overlay-web-adapter.js - Required for web browser compatibility (bridges postMessage to WebChannel interface)
2. Qt scripts are loaded conditionally via window.loadQtScripts() - only in Qt environment
These scripts enable communication between the Qt application and the overlay template.
Without them, the template will not receive data updates or function properly.
......@@ -468,7 +468,12 @@
NOTE: When editing this template or creating new ones, never remove these script sources!
The overlay:// custom scheme ensures JavaScript files work for both built-in and uploaded templates.
-->
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
<script src="overlay://overlay.js"></script>
<script src="/js/overlay-web-adapter.js"></script>
<script>
// Conditionally load Qt scripts only in Qt environment
if (window.loadQtScripts) {
window.loadQtScripts();
}
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment