44 var text_error_timeoff_less_timeon = "<?php echo lang ('qso_error_timeoff_less_timeon ' ); ?> ";
55 var lang_qso_title_previous_contacts = "<?php echo lang ('qso_title_previous_contacts ' ); ?> ";
66 var lang_qso_title_times_worked_before = "<?php echo lang ('qso_title_times_worked_before ' ); ?> ";
7+
8+ // Function to switch between LIVE and POST mode without the beforeunload warning
9+ function switchMode(url) {
10+ // Temporarily unbind the beforeunload event to prevent the "Leave site?" popup
11+ $(window).unbind('beforeunload');
12+ // Navigate to the new URL
13+ window.location.href = url;
14+ }
715 </script>
816
917 <div class="row qsopane">
1624 <div class="card-header">
1725 <ul style="font-size: 15px;" class="nav nav-tabs card-header-tabs pull-right" id="myTab" role="tablist">
1826 <li class="nav-item">
19- <a class="nav-link active" id="qsp-tab" data-bs-toggle="tab" href="#qso" role="tab" aria-controls="qso" aria-selected="true"><?php echo lang ('gen_hamradio_qso ' ); ?> <?php if ($ _GET ['manual ' ] == 0 ) {
20- echo " <span class= \"badge text-bg-success \" style= \"cursor: pointer; \" onclick= \"window.location.href=' " . site_url ('qso ' ) . "?manual=1' \" title= \"Switch to POST mode \">LIVE</span> " ;
21- };
22- if ($ _GET ['manual ' ] == 1 ) {
23- echo " <span class= \"badge text-bg-danger \" style= \"cursor: pointer; \" onclick= \"window.location.href=' " . site_url ('qso ' ) . "?manual=0' \" title= \"Switch to LIVE mode \">POST</span> " ;
24- } ?> </a>
27+ <a class="nav-link active" id="qsp-tab" data-bs-toggle="tab" href="#qso" role="tab" aria-controls="qso" aria-selected="true"><?php echo lang ('gen_hamradio_qso ' ); ?> </a>
2528 </li>
2629
2730 <li class="nav-item">
5558 </div>
5659 </li>
5760
61+ <li class="nav-item ms-auto d-flex align-items-center">
62+ <?php if ($ _GET ['manual ' ] == 0 ) {
63+ echo " <span class= \"badge text-bg-success \" style= \"cursor: pointer; font-size: 0.9rem; padding: 0.4rem 0.9rem; \" onclick= \"switchMode(' " . site_url ('qso ' ) . "?manual=1') \" title= \"Switch to Manual mode \">LIVE</span> " ;
64+ };
65+ if ($ _GET ['manual ' ] == 1 ) {
66+ echo " <span class= \"badge text-bg-danger \" style= \"cursor: pointer; font-size: 0.9rem; padding: 0.4rem 0.9rem; \" onclick= \"switchMode(' " . site_url ('qso ' ) . "?manual=0') \" title= \"Switch to LIVE mode \">POST</span> " ;
67+ } ?>
68+ </li>
69+
5870 </ul>
5971 </div>
6072
680692 <div class="card-header">
681693 <h4 style="font-size: 16px; font-weight: bold;" class="card-title">Winkey Web Sockets
682694
683- <div id="cw_socket_status" class="badge text-bg-danger">
695+ <div id="cw_socket_status" class="badge text-bg-danger">
684696 Status: Disconnected
685- </div>
697+ </div>
686698
687699 <button id="toggleLogButton" onclick="toggleMessageLog()" class="btn btn-sm btn-outline-secondary" title="Toggle Message Log">
688700 <i class="fas fa-list"></i>
711723 </div>
712724 </div>
713725 </div>
714-
726+
715727 <!-- CW Speed Control Row -->
716728 <div class="row mb-3">
717729 <div class="col-12">
725737 </div>
726738 </div>
727739 </div>
728-
740+
729741 <!-- Send Message Row -->
730742 <div class="row mb-3">
731743 <div class="col-12">
785797 </div>
786798 </div>
787799 </div>
788-
800+
789801 <!-- Send Message Row -->
790802 <div class="row mb-3">
791803 <div class="col-12">
849861
850862</div>
851863
864+ <!-- Custom Leave QSO Entry Modal -->
865+ <div class="modal fade" id="leaveQsoModal" tabindex="-1" aria-labelledby="leaveQsoModalLabel" aria-hidden="true">
866+ <div class="modal-dialog modal-dialog-centered">
867+ <div class="modal-content">
868+ <div class="modal-header bg-warning">
869+ <h5 class="modal-title" id="leaveQsoModalLabel">
870+ <i class="fas fa-exclamation-triangle me-2"></i>Leave QSO Entry?
871+ </h5>
872+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
873+ </div>
874+ <div class="modal-body">
875+ <p class="mb-0">Are you sure you want to leave QSO entry? Any unsaved changes will be lost.</p>
876+ </div>
877+ <div class="modal-footer">
878+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
879+ <i class="fas fa-times me-1"></i>Stay on Page
880+ </button>
881+ <button type="button" class="btn btn-warning" id="confirmLeaveQso">
882+ <i class="fas fa-sign-out-alt me-1"></i>Leave Page
883+ </button>
884+ </div>
885+ </div>
886+ </div>
852887</div>
853888
854- <script>
855- function openBandmap() {
856- // Open bandmap in a new window without URL bar, toolbars, etc.
857- const width = 500;
858- const height = 800;
859- const left = (screen.width - width) / 2;
860- const top = (screen.height - height) / 2;
861-
862- // Note: Modern browsers may still show address bar due to security restrictions
863- // For Chrome, you can use: chrome.exe --app=http://localhost/index.php/dxcluster/bandmap
864- const features = `width=${width},height=${height},left=${left},top=${top},` +
865- `toolbar=no,location=no,directories=no,status=no,menubar=no,` +
866- `scrollbars=yes,resizable=yes,copyhistory=no`;
867-
868- const popup = window.open('<?php echo site_url ('dxcluster/bandmap ' ); ?> ', 'bandmap', features);
869-
870- // Try to make it fullscreen (user will need to allow this)
871- if (popup) {
872- popup.focus();
873- }
874- }
889+ </div>
875890
876- function openBandmapFullscreen() {
877- // Alternative: Open in current window and go fullscreen
878- window.location.href = '<?php echo site_url ('dxcluster/bandmap ' ); ?> ';
891+ <script>
892+ // Handle the confirm leave button for the custom modal (vanilla JS to avoid jQuery dependency)
893+ document.addEventListener('DOMContentLoaded', function() {
894+ var confirmBtn = document.getElementById('confirmLeaveQso');
895+ if (confirmBtn) {
896+ confirmBtn.addEventListener('click', function() {
897+ if (window.pendingNavigation) {
898+ // Unbind beforeunload to allow navigation
899+ window.jQuery && window.jQuery(window).unbind('beforeunload');
900+ // Navigate to the pending URL
901+ window.location.href = window.pendingNavigation;
879902 }
880- </script>
903+ });
904+ }
905+ });
906+
907+ function openBandmap() {
908+ // Open bandmap in a new window without URL bar, toolbars, etc.
909+ const width = 500;
910+ const height = 800;
911+ const left = (screen.width - width) / 2;
912+ const top = (screen.height - height) / 2;
913+
914+ // Note: Modern browsers may still show address bar due to security restrictions
915+ // For Chrome, you can use: chrome.exe --app=http://localhost/index.php/dxcluster/bandmap
916+ const features = `width=${width},height=${height},left=${left},top=${top},` +
917+ `toolbar=no,location=no,directories=no,status=no,menubar=no,` +
918+ `scrollbars=yes,resizable=yes,copyhistory=no`;
919+
920+ const popup = window.open('<?php echo site_url ('dxcluster/bandmap ' ); ?> ', 'bandmap', features);
921+
922+ // Try to make it fullscreen (user will need to allow this)
923+ if (popup) {
924+ popup.focus();
925+ }
926+ }
927+
928+ function openBandmapFullscreen() {
929+ // Alternative: Open in current window and go fullscreen
930+ window.location.href = '<?php echo site_url ('dxcluster/bandmap ' ); ?> ';
931+ }
932+ </script>
0 commit comments