Add "Ignore Opt-Out" option
This commit is contained in:
parent
2cc0ba20b6
commit
f793110c80
|
@ -58,12 +58,13 @@
|
|||
.RufflePopup-checkbox_slider {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 0;
|
||||
|
||||
width: 30px;
|
||||
height: 7px;
|
||||
border-radius: 5px;
|
||||
margin: auto 7px;
|
||||
margin: 4px 7px auto 15px;
|
||||
|
||||
background-color: #966214;
|
||||
}
|
||||
|
@ -102,5 +103,10 @@
|
|||
<span class="RufflePopup-user_setting_text">Play Flash content in Ruffle</span>
|
||||
<div class="RufflePopup-checkbox_slider"></div>
|
||||
</label>
|
||||
<label class="RufflePopup-user_setting" for="ignore_optout">
|
||||
<input class="RufflePopup-checkbox_with_slider" type="checkbox" name="ignore_optout" id="ignore_optout">
|
||||
<span class="RufflePopup-user_setting_text">Do not allow websites to disable Ruffle</span>
|
||||
<div class="RufflePopup-checkbox_slider"></div>
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
|
@ -68,6 +68,7 @@ function tab_sendmessage() {
|
|||
|
||||
document.addEventListener("DOMContentLoaded", async function (e) {
|
||||
bind_boolean_setting(document.getElementById("ruffle_enable"));
|
||||
bind_boolean_setting(document.getElementById("ignore_optout"));
|
||||
|
||||
let ruffle_status = document.getElementById("ruffle_status");
|
||||
if (ruffle_status === null) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* prefix that is only shared within the injected closure. This isn't entirely
|
||||
* foolproof, but is designed to
|
||||
*/
|
||||
chrome.storage.sync.get(['ruffle_enable'], async function (data) {
|
||||
chrome.storage.sync.get(['ruffle_enable', 'ignore_optout'], async function (data) {
|
||||
let page_optout = document.documentElement.hasAttribute("data-ruffle-optout");
|
||||
try {
|
||||
if (
|
||||
|
@ -37,7 +37,7 @@ chrome.storage.sync.get(['ruffle_enable'], async function (data) {
|
|||
console.log("Unable to check top-level optout: " + e.message);
|
||||
}
|
||||
|
||||
let should_load_untrusted_world = data.ruffle_enable === "on" && !(page_optout || window.RufflePlayer);
|
||||
let should_load_untrusted_world = data.ruffle_enable === "on" && !(page_optout || data.ignore_optout === "on" || window.RufflePlayer);
|
||||
let obfuscated_event_prefix = "rufEvent" + Math.floor(Math.random() * 100000000000);
|
||||
let next_response_promise = null;
|
||||
let next_response_promise_resolve = null;
|
||||
|
@ -93,6 +93,7 @@ chrome.storage.sync.get(['ruffle_enable'], async function (data) {
|
|||
response_callback({
|
||||
"loaded": true,
|
||||
"data": data,
|
||||
"optout": page_optout,
|
||||
"untrusted_response": response
|
||||
});
|
||||
}).catch(function(e) {
|
||||
|
@ -100,12 +101,15 @@ chrome.storage.sync.get(['ruffle_enable'], async function (data) {
|
|||
throw e;
|
||||
});
|
||||
|
||||
return response_promise;
|
||||
return true;
|
||||
} else {
|
||||
response_callback({
|
||||
"loaded": false,
|
||||
"data": data
|
||||
"data": data,
|
||||
"optout": page_optout
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -119,7 +123,7 @@ chrome.storage.sync.get(['ruffle_enable'], async function (data) {
|
|||
.getURL("dist/ruffle.js")
|
||||
.replace("dist/ruffle.js", "");
|
||||
}
|
||||
|
||||
|
||||
if (should_load_untrusted_world) {
|
||||
let setup_scriptelem = document.createElement("script");
|
||||
let setup_src =
|
||||
|
|
|
@ -12,7 +12,7 @@ if (obfuscated_event_prefix) {
|
|||
let response = {};
|
||||
|
||||
if (body.action === "get_page_options") {
|
||||
response.page_options = page_options;
|
||||
//response.page_options = page_options;
|
||||
}
|
||||
|
||||
let event = new CustomEvent(obfuscated_event_prefix + "_response", {"detail": JSON.stringify(response)});
|
||||
|
|
Loading…
Reference in New Issue