extension: Add autostart to toggle splashScreen/autoplay/unmuteOverlay

This commit is contained in:
Daniel Jacobs 2023-01-05 10:22:05 -05:00 committed by Adrian Wielgosik
parent debb45706a
commit ddb45f2cc2
6 changed files with 16 additions and 0 deletions

View File

@ -11,6 +11,9 @@
"settings_show_swf_download": {
"message": "Show SWF download in context menu"
},
"settings_autostart": {
"message": "Play automatically without splash screen (then click to unmute)"
},
"settings_warn_on_unsupported_content": {
"message": "Warn on unsupported content"
},

View File

@ -43,6 +43,10 @@
<input type="checkbox" id="show_swf_download" />
<label for="show_swf_download">Show SWF download in context menu</label>
</div>
<div class="option checkbox">
<input type="checkbox" id="autostart" />
<label for="autostart">Play automatically without splash screen (then click to unmute)</label>
</div>
</div>
<script src="dist/options.js"></script>
</body>

View File

@ -35,6 +35,10 @@
<input type="checkbox" id="show_swf_download" />
<label for="show_swf_download">Show SWF download in context menu</label>
</div>
<div class="option checkbox">
<input type="checkbox" id="autostart" />
<label for="autostart">Disable splash screen and autoplay (click to unmute)</label>
</div>
</div>
<div id="version-text">Ruffle extension</div>
<button id="options-button">Settings</button>

View File

@ -7,6 +7,7 @@ export interface Options {
warnOnUnsupportedContent: boolean;
logLevel: LogLevel;
showSwfDownload: boolean;
autostart: boolean;
}
interface OptionElement<T> {

View File

@ -173,6 +173,9 @@ function isXMLDocument(): boolean {
warnOnUnsupportedContent: options.warnOnUnsupportedContent,
logLevel: options.logLevel,
showSwfDownload: options.showSwfDownload,
autoplay: options.autostart ? "on" : "auto",
unmuteOverlay: options.autostart ? "hidden" : "visible",
splashScreen: !options.autostart,
},
});
})();

View File

@ -7,6 +7,7 @@ const DEFAULT_OPTIONS: Options = {
warnOnUnsupportedContent: true,
logLevel: "error" as LogLevel,
showSwfDownload: false,
autostart: false,
};
export let i18n: {