Aichatbot12321 commited on
Commit
9aab938
·
verified ·
1 Parent(s): 65372ee

Update youtube.html

Browse files
Files changed (1) hide show
  1. youtube.html +12 -26
youtube.html CHANGED
@@ -101,16 +101,7 @@
101
  transition: transform 0.3s ease;
102
  }
103
 
104
- #player-overlay.rotated-portrait {
105
- transform: rotate(90deg);
106
- transform-origin: center center;
107
- width: 100vh !important;
108
- height: 100vw !important;
109
- top: 50% !important;
110
- left: 50% !important;
111
- margin-top: -50vw !important;
112
- margin-left: -50vh !important;
113
- }
114
 
115
  #player-menu-btn {
116
  position: absolute;
@@ -1041,11 +1032,10 @@
1041
 
1042
  const target = currentOrientationIsLandscape ? 'landscape' : 'portrait';
1043
 
1044
- // Apply CSS rotation class if portrait mode is forced on a landscape player
1045
- if (!currentOrientationIsLandscape) {
1046
- overlay.classList.add('rotated-portrait');
1047
- } else {
1048
- overlay.classList.remove('rotated-portrait');
1049
  }
1050
 
1051
  if (screen.orientation && screen.orientation.lock) {
@@ -1070,11 +1060,8 @@
1070
  currentOrientationIsLandscape = (targetOrientation === 'landscape');
1071
 
1072
  const overlay = document.getElementById('player-overlay');
1073
- if (!currentOrientationIsLandscape) {
1074
- overlay.classList.add('rotated-portrait');
1075
- } else {
1076
- overlay.classList.remove('rotated-portrait');
1077
- }
1078
 
1079
  if (!screen.orientation || !screen.orientation.lock) return;
1080
 
@@ -1090,8 +1077,6 @@
1090
  await new Promise(r => setTimeout(r, 400));
1091
  const nextOrient = (i % 2 === 1) ? oppositeOrientation : targetOrientation;
1092
  currentOrientationIsLandscape = (nextOrient === 'landscape');
1093
- if (!currentOrientationIsLandscape) overlay.classList.add('rotated-portrait');
1094
- else overlay.classList.remove('rotated-portrait');
1095
  await screen.orientation.lock(nextOrient).catch(()=>{});
1096
  }
1097
  }
@@ -1109,7 +1094,9 @@
1109
  }
1110
 
1111
  document.addEventListener('fullscreenchange', () => {
1112
- if (document.fullscreenElement) {
 
 
1113
  syncPlayerOrientation();
1114
  }
1115
  });
@@ -1261,7 +1248,6 @@
1261
  function closePlayer() {
1262
  const overlay = document.getElementById('player-overlay');
1263
  overlay.style.display = 'none';
1264
- overlay.classList.remove('rotated-portrait');
1265
  hidePlayerMenu();
1266
  if(ytPlayer) { try { ytPlayer.stopVideo(); ytPlayer.destroy(); } catch(e){} ytPlayer = null; }
1267
  if (saveInterval) clearTimeout(saveInterval);
@@ -1540,7 +1526,7 @@
1540
  // --- KEYBOARD SHORTCUTS ---
1541
  document.addEventListener('keydown', (e) => {
1542
  if (document.getElementById('player-overlay').style.display !== 'block') return;
1543
- if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') return;
1544
 
1545
  if (e.key === 'Escape') {
1546
  closePlayer();
@@ -1588,7 +1574,7 @@
1588
  // NUKE NATIVE CONTEXT MENU EXCEPT IN INPUTS
1589
  window.addEventListener('contextmenu', function (e) {
1590
  if (e.target.tagName !== 'INPUT') {
1591
- e.preventDefault();
1592
  }
1593
  });
1594
  </script>
 
101
  transition: transform 0.3s ease;
102
  }
103
 
104
+ /* Clean Fullscreen Player Layout */
 
 
 
 
 
 
 
 
 
105
 
106
  #player-menu-btn {
107
  position: absolute;
 
1032
 
1033
  const target = currentOrientationIsLandscape ? 'landscape' : 'portrait';
1034
 
1035
+ // Re-request Fullscreen if not active so status bar / navigation bar stays hidden
1036
+ if (!document.fullscreenElement) {
1037
+ if (overlay.requestFullscreen) { overlay.requestFullscreen().catch(()=>{}); }
1038
+ else if (overlay.webkitRequestFullscreen) { overlay.webkitRequestFullscreen(); }
 
1039
  }
1040
 
1041
  if (screen.orientation && screen.orientation.lock) {
 
1060
  currentOrientationIsLandscape = (targetOrientation === 'landscape');
1061
 
1062
  const overlay = document.getElementById('player-overlay');
1063
+ if (overlay.requestFullscreen) { overlay.requestFullscreen().catch(()=>{}); }
1064
+ else if (overlay.webkitRequestFullscreen) { overlay.webkitRequestFullscreen(); }
 
 
 
1065
 
1066
  if (!screen.orientation || !screen.orientation.lock) return;
1067
 
 
1077
  await new Promise(r => setTimeout(r, 400));
1078
  const nextOrient = (i % 2 === 1) ? oppositeOrientation : targetOrientation;
1079
  currentOrientationIsLandscape = (nextOrient === 'landscape');
 
 
1080
  await screen.orientation.lock(nextOrient).catch(()=>{});
1081
  }
1082
  }
 
1094
  }
1095
 
1096
  document.addEventListener('fullscreenchange', () => {
1097
+ if (!document.fullscreenElement && screen.orientation && screen.orientation.unlock) {
1098
+ screen.orientation.unlock();
1099
+ } else if (document.fullscreenElement) {
1100
  syncPlayerOrientation();
1101
  }
1102
  });
 
1248
  function closePlayer() {
1249
  const overlay = document.getElementById('player-overlay');
1250
  overlay.style.display = 'none';
 
1251
  hidePlayerMenu();
1252
  if(ytPlayer) { try { ytPlayer.stopVideo(); ytPlayer.destroy(); } catch(e){} ytPlayer = null; }
1253
  if (saveInterval) clearTimeout(saveInterval);
 
1526
  // --- KEYBOARD SHORTCUTS ---
1527
  document.addEventListener('keydown', (e) => {
1528
  if (document.getElementById('player-overlay').style.display !== 'block') return;
1529
+ if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') return;
1530
 
1531
  if (e.key === 'Escape') {
1532
  closePlayer();
 
1574
  // NUKE NATIVE CONTEXT MENU EXCEPT IN INPUTS
1575
  window.addEventListener('contextmenu', function (e) {
1576
  if (e.target.tagName !== 'INPUT') {
1577
+ e.preventDefault();
1578
  }
1579
  });
1580
  </script>