|
| 1 | +let navToggle = document.getElementById('navToggle') |
1 | 2 | var el = document.querySelector('.chrome-tabs')
|
2 | 3 | var chromeTabs = new ChromeTabs()
|
3 | 4 | let id = 0;
|
@@ -288,6 +289,72 @@ var el = document.querySelector('.chrome-tabs')
|
288 | 289 | function Backward() {
|
289 | 290 | document.getElementById(currentTab).contentWindow.history.back()
|
290 | 291 | }
|
| 292 | + navToggle.addEventListener('mouseover', function () { |
| 293 | + let fullscreenBehavior = localStorage.getItem('fullscreenBehavior'); |
| 294 | + if (fullscreenBehavior === 'true') { |
| 295 | + fullScreenIframe(false); |
| 296 | + } else if (fullscreenBehavior === 'false') { |
| 297 | + fullScreenIframe(false, 'content'); |
| 298 | + } |
| 299 | + }); |
| 300 | + function fullScreenIframe(value, fullscreenBehavior) { |
| 301 | + if (fullscreenBehavior === 'content') { |
| 302 | + if (value === true) { |
| 303 | + let iframe = document.getElementById('uv-iframe'); |
| 304 | + iframe.requestFullscreen(); |
| 305 | + navToggle.classList.remove('dnone'); |
| 306 | + } else if (value === false) { |
| 307 | + document.exitFullscreen(); |
| 308 | + navToggle.classList.add('dnone'); |
| 309 | + } |
| 310 | + } else { |
| 311 | + if (value === true) { |
| 312 | + let iframe = document.getElementById(currentTab); |
| 313 | + document.getElementById('hamburger').classList.add('dnone') |
| 314 | + navToggle.classList.remove('dnone'); |
| 315 | + //set to position absolute |
| 316 | + iframe.style.position = 'absolute'; |
| 317 | + //set to top left corner |
| 318 | + iframe.style.top = '0'; |
| 319 | + iframe.style.left = '0'; |
| 320 | + //set to full width and height |
| 321 | + iframe.style.width = '100%'; |
| 322 | + iframe.style.height = '100%'; |
| 323 | + //set z-index to 9999 |
| 324 | + iframe.style.zIndex = '9998'; |
| 325 | + //add a transition |
| 326 | + iframe.style.transition = 'all 0.5s ease-in-out'; |
| 327 | + } else if (value === false) { |
| 328 | + let iframe = document.getElementById(currentTab); |
| 329 | + document.getElementById('hamburger').classList.remove('dnone') |
| 330 | + navToggle.classList.add('dnone'); |
| 331 | + //set styles to height: calc(100% - 4rem);width: 100%;border: none;position: fixed;top: 4rem;right: 0;left: 0;bottom: 0;border: none; background: var(--bg-color); |
| 332 | + iframe.style.height = 'calc(100% - 86px)'; |
| 333 | + iframe.style.width = '100%'; |
| 334 | + iframe.style.border = 'none'; |
| 335 | + iframe.style.position = 'fixed'; |
| 336 | + iframe.style.top = '86px'; |
| 337 | + iframe.style.right = '0'; |
| 338 | + iframe.style.left = '0'; |
| 339 | + iframe.style.bottom = '0'; |
| 340 | + iframe.style.border = 'none'; |
| 341 | + iframe.style.background = 'var(--bg-color)'; |
| 342 | + iframe.style.transition = 'all 0.5s ease-in-out'; |
| 343 | + iframe.style.zIndex = '9999'; |
| 344 | + } |
| 345 | + } |
| 346 | + } |
| 347 | + function fullscreenIframe() { |
| 348 | + let fullscreenBehavior = localStorage.getItem('fullscreenBehavior'); |
| 349 | + if (fullscreenBehavior === 'true') { |
| 350 | + fullScreenIframe(true); |
| 351 | + } else if (fullscreenBehavior === 'false') { |
| 352 | + fullScreenIframe(true, 'content'); |
| 353 | + } else { |
| 354 | + localStorage.setItem('fullscreenBehavior', 'true'); |
| 355 | + fullScreenIframe(true); |
| 356 | + } |
| 357 | + } |
291 | 358 |
|
292 | 359 | init();
|
293 | 360 | initApps();
|
0 commit comments