msc-any-pip
Advanced tools
Comparing version
@@ -12,5 +12,7 @@ import { _wcl } from './common-lib.js'; | ||
winwidth: 0, | ||
winheight: 0 | ||
winheight: 0, | ||
preferinitialwindowplacement: false, | ||
disallowreturntoopener: false | ||
}; | ||
const booleanAttrs = []; // booleanAttrs default should be false | ||
const booleanAttrs = ['disallowreturntoopener', 'preferinitialwindowplacement']; // booleanAttrs default should be false | ||
const objectAttrs = []; | ||
@@ -206,2 +208,7 @@ const custumEvents = { | ||
break; | ||
case 'disallowreturntoopener': | ||
case 'preferinitialwindowplacement': | ||
this.#config[attrName] = true; | ||
break; | ||
} | ||
@@ -283,2 +290,18 @@ } | ||
set preferinitialwindowplacement(value) { | ||
this.toggleAttribute('preferinitialwindowplacement', Boolean(value)); | ||
} | ||
get preferinitialwindowplacement() { | ||
return this.#config.preferinitialwindowplacement; | ||
} | ||
set disallowreturntoopener(value) { | ||
this.toggleAttribute('disallowreturntoopener', Boolean(value)); | ||
} | ||
get disallowreturntoopener() { | ||
return this.#config.disallowreturntoopener; | ||
} | ||
#fireEvent(evtName, detail) { | ||
@@ -311,6 +334,7 @@ this.dispatchEvent(new CustomEvent(evtName, | ||
// pip | ||
const delta = 30; | ||
const pipWindow = await window?.documentPictureInPicture.requestWindow({ | ||
width: this.winwidth, | ||
height: this.winheight + delta | ||
height: this.winheight, | ||
disallowReturnToOpener: this.disallowreturntoopener, | ||
preferInitialWindowPlacement: this.preferinitialwindowplacement | ||
}); | ||
@@ -317,0 +341,0 @@ _wcl.cloneStyleSheetsToDocument(pipWindow.document); |
{ | ||
"name": "msc-any-pip", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Imaging what if we can let anything Picture-in-Picture (not only <video />) ?! Here comes <msc-any-pip /> to let it dream comes true. <msc-any-pip /> apply Document Picture-in-Picture API to given elements have Picture-in-Picture feature.", | ||
@@ -5,0 +5,0 @@ "main": "index.html", |
@@ -31,3 +31,5 @@ # msc-any-pip | ||
"winwidth": 450, | ||
"winheight": 300 | ||
"winheight": 300, | ||
"disallowreturntoopener": false, | ||
"preferinitialwindowplacement": false | ||
} | ||
@@ -79,3 +81,5 @@ </script> | ||
winwidth: 450, | ||
winheight: 300 | ||
winheight: 300, | ||
disallowreturntoopener: false, | ||
preferinitialwindowplacement: true | ||
}; | ||
@@ -135,2 +139,22 @@ const nodeC = new MscAnyPip(config); | ||
- **disallowreturntoopener** | ||
Hides the "back to tab" button in the Picture-in-Picture window if true. It is false by default (not set). | ||
```html | ||
<msc-any-pip disallowreturntoopener> | ||
... | ||
</msc-any-pip> | ||
``` | ||
- **preferinitialwindowplacement** | ||
Open the Picture-in-Picture window in its default position and size if true. It is false by default (not set). | ||
```html | ||
<msc-any-pip preferinitialwindowplacement> | ||
... | ||
</msc-any-pip> | ||
``` | ||
## Properties | ||
@@ -142,2 +166,4 @@ | ||
| winheight | Number | Getter / Setter for Picture-in-Picture window height. Default is <msc-any-pip />'s clientHeight. | | ||
| disallowreturntoopener | Boolean | Getter / Setter for disallowreturntoopener. Hides the "back to tab" button in the Picture-in-Picture window if true. It is false by default. | | ||
| preferinitialwindowplacement | Boolean | Getter / Setter for preferinitialwindowplacement. Open the Picture-in-Picture window in its default position and size if true. It is false by default. | | ||
@@ -144,0 +170,0 @@ ## Mathod |
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
68336
15.84%8
14.29%1311
5.81%185
16.35%2
100%