| 489 | | }; |
| 490 | | |
| 491 | | let doc = content.document.wrappedJSObject; |
| 492 | | let win = content.wrappedJSObject; |
| 493 | | let player = getElementByIdEx('flvplayer'); |
| 494 | | |
| 495 | | win.toggleMaximizePlayer(); |
| 496 | | |
| 497 | | if(value) { |
| 498 | | let f = function () { |
| 499 | | let viewer = {w: 544, h: 384}; |
| 500 | | let screen = { |
| 501 | | w: content.innerWidth, |
| 502 | | h: content.innerHeight |
| 503 | | }; |
| 504 | | let scale = { |
| 505 | | w: Math.max(1, screen.w / viewer.w), |
| 506 | | h: Math.max(1, screen.h / viewer.h) |
| 507 | | }; |
| 508 | | scale.v = Math.min(scale.w, scale.h); |
| 509 | | storeStyle(doc.body, { |
| 510 | | backgroundImage: 'url()', |
| 511 | | backgroundRepeat: '', |
| 512 | | backgroundColor: 'black' |
| 513 | | }); |
| 514 | | player.SetVariable('videowindow.video_mc.video.smoothing' , 1); |
| 515 | | player.SetVariable('videowindow.video_mc.video.deblocking', 5); |
| 516 | | storeStyle( |
| 517 | | player, |
| 518 | | (scale.w >= scale.h) ? { |
| 519 | | width: Math.floor(viewer.w * scale.h) + 'px', |
| 520 | | height: screen.h + 'px', |
| 521 | | marginLeft: ((screen.w - viewer.w * scale.h) / 2) + 'px', |
| 522 | | marginTop: '0px' |
| 523 | | } : { |
| 524 | | width: screen.w + 'px', |
| 525 | | height: Math.floor(viewer.h * scale.w) + 'px', |
| 526 | | marginLeft: '0px', |
| 527 | | marginTop: ((screen.h - viewer.h * scale.w) / 2) + 'px' |
| 528 | | } |
| 529 | | ); |
| 530 | | player.SetVariable('videowindow._xscale', 100 * scale.v); |
| 531 | | player.SetVariable('videowindow._yscale', 100 * scale.v); |
| 532 | | variablesSetter(); |
| | 503 | } |
| | 504 | |
| | 505 | function turnOn () { |
| | 506 | let viewer = {w: 544, h: 384}; |
| | 507 | let screen = { |
| | 508 | w: content.innerWidth, |
| | 509 | h: content.innerHeight |
| 534 | | f(); |
| 535 | | win.onresize = function () |
| 536 | | (InVimperator && liberator.mode === modes.COMMAND_LINE) || setTimeout(f, 1000); |
| 537 | | } else { |
| 538 | | restoreStyle(doc.body); |
| | 511 | let scale = { |
| | 512 | w: Math.max(1, screen.w / viewer.w), |
| | 513 | h: Math.max(1, screen.h / viewer.h) |
| | 514 | }; |
| | 515 | scale.v = Math.min(scale.w, scale.h); |
| | 516 | storeStyle(doc.body, { |
| | 517 | backgroundImage: 'url()', |
| | 518 | backgroundRepeat: '', |
| | 519 | backgroundColor: 'black' |
| | 520 | }); |
| | 521 | storeStyle( |
| | 522 | player, |
| | 523 | (scale.w >= scale.h) ? { |
| | 524 | width: Math.floor(viewer.w * scale.h) + 'px', |
| | 525 | height: screen.h + 'px', |
| | 526 | marginLeft: ((screen.w - viewer.w * scale.h) / 2) + 'px', |
| | 527 | marginTop: '0px' |
| | 528 | } : { |
| | 529 | width: screen.w + 'px', |
| | 530 | height: Math.floor(viewer.h * scale.w) + 'px', |
| | 531 | marginLeft: '0px', |
| | 532 | marginTop: ((screen.h - viewer.h * scale.w) / 2) + 'px' |
| | 533 | } |
| | 534 | ); |
| | 535 | player.SetVariable('videowindow._xscale', 100 * scale.v); |
| | 536 | player.SetVariable('videowindow._yscale', 100 * scale.v); |
| | 537 | setVariables(true); |
| | 538 | } |
| | 539 | |
| | 540 | function turnOff () { |
| | 541 | restoreStyle(content.document.wrappedJSObject.body); |