web: Minor improvements to the extension player page
This commit is contained in:
parent
8cd5414c5d
commit
b9abc463d6
|
@ -1952,13 +1952,22 @@ export class RufflePlayer extends HTMLElement {
|
||||||
this.isExtension &&
|
this.isExtension &&
|
||||||
window.location.origin !== this.swfUrl!.origin
|
window.location.origin !== this.swfUrl!.origin
|
||||||
) {
|
) {
|
||||||
|
const url = new URL(this.swfUrl!);
|
||||||
|
if (this.loadedConfig?.parameters) {
|
||||||
|
const parameters = sanitizeParameters(
|
||||||
|
this.loadedConfig.parameters
|
||||||
|
);
|
||||||
|
Object.entries(parameters).forEach(([key, value]) => {
|
||||||
|
url.searchParams.set(key, value);
|
||||||
|
});
|
||||||
|
}
|
||||||
this.hideSplashScreen();
|
this.hideSplashScreen();
|
||||||
const div = document.createElement("div");
|
const div = document.createElement("div");
|
||||||
div.id = "message_overlay";
|
div.id = "message_overlay";
|
||||||
div.innerHTML = `<div class="message">
|
div.innerHTML = `<div class="message">
|
||||||
${textAsParagraphs("message-cant-embed")}
|
${textAsParagraphs("message-cant-embed")}
|
||||||
<div>
|
<div>
|
||||||
<a target="_blank" href="${this.swfUrl}">${text(
|
<a target="_blank" href="${url}">${text(
|
||||||
"open-in-new-tab"
|
"open-in-new-tab"
|
||||||
)}</a>
|
)}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,9 +29,10 @@ window.addEventListener("DOMContentLoaded", async () => {
|
||||||
|
|
||||||
player.load({
|
player.load({
|
||||||
...options,
|
...options,
|
||||||
// Override default value for 'letterbox' when playing in the extension player page.
|
|
||||||
letterbox: "on" as Letterbox,
|
|
||||||
url: swfUrl,
|
url: swfUrl,
|
||||||
base: swfUrl.substring(0, swfUrl.lastIndexOf("/") + 1),
|
base: swfUrl.substring(0, swfUrl.lastIndexOf("/") + 1),
|
||||||
|
// Override some default values when playing in the extension player page.
|
||||||
|
letterbox: "on" as Letterbox,
|
||||||
|
forceScale: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue