Revision 5c75d744
Added by koszko almost 2 years ago
| background/page_actions_server.js | ||
|---|---|---|
| 25 | 25 |
|
| 26 | 26 |
function send_actions(url, port) |
| 27 | 27 |
{
|
| 28 |
let [pattern, settings] = query_best(storage, url); |
|
| 29 |
if (!settings) |
|
| 30 |
settings = {allow: policy_observable && policy_observable.value};
|
|
| 28 |
const [pattern, queried_settings] = query_best(storage, url); |
|
| 29 |
|
|
| 30 |
const settings = {allow: policy_observable && policy_observable.value};
|
|
| 31 |
Object.assign(settings, queried_settings); |
|
| 32 |
if (settings.components) |
|
| 33 |
settings.allow = false; |
|
| 34 |
|
|
| 31 | 35 |
const repos = storage.get_all(TYPE_PREFIX.REPO); |
| 32 | 36 |
|
| 33 | 37 |
port.postMessage(["settings", [pattern, settings, repos]]); |
| 34 | 38 |
|
| 35 |
let components = settings.components;
|
|
| 36 |
let processed_bags = new Set();
|
|
| 39 |
const components = settings.components;
|
|
| 40 |
const processed_bags = new Set();
|
|
| 37 | 41 |
|
| 38 | 42 |
if (components !== undefined) |
| 39 | 43 |
send_scripts([components], port, processed_bags); |
| html/options.html | ||
|---|---|---|
| 152 | 152 |
min-width: 70vw; |
| 153 | 153 |
resize: none; |
| 154 | 154 |
} |
| 155 |
|
|
| 156 |
.form_disabled>* {
|
|
| 157 |
opacity: 0.5; |
|
| 158 |
pointer-events: none; |
|
| 159 |
} |
|
| 160 |
|
|
| 161 |
.form_disabled_msg {
|
|
| 162 |
display: none; |
|
| 163 |
font-style: italic; |
|
| 164 |
} |
|
| 165 |
|
|
| 166 |
.form_disabled .form_disabled_msg {
|
|
| 167 |
opacity: initial; |
|
| 168 |
pointer-events: initial; |
|
| 169 |
display: initial; |
|
| 170 |
} |
|
| 155 | 171 |
</style> |
| 156 | 172 |
</head> |
| 157 | 173 |
<body> |
| ... | ... | |
| 226 | 242 |
<label for="page_url_field">URL: </label> |
| 227 | 243 |
<input id="page_url_field"></input> |
| 228 | 244 |
<label>Payload: </label> |
| 229 |
<span> |
|
| 245 |
<span class="nowrap">
|
|
| 230 | 246 |
<span id="page_payload"></span> |
| 231 | 247 |
<button id="select_page_components_but"> |
| 232 | 248 |
Choose payload |
| 233 | 249 |
</button> |
| 234 | 250 |
</span> |
| 235 |
<div> |
|
| 251 |
<div id="allow_native_scripts_container" class="nowrap">
|
|
| 236 | 252 |
<input id="page_allow_chbx" type="checkbox" style="display: inline;"></input> |
| 237 | 253 |
<label for="page_allow_chbx">Allow native scripts</label> |
| 254 |
<span class="form_disabled_msg"> |
|
| 255 |
(only possible when no payload is used) |
|
| 256 |
</span> |
|
| 238 | 257 |
</div> |
| 239 | 258 |
<div> |
| 240 | 259 |
<button id="save_page_but" type="button"> Save </button> |
| html/options_main.js | ||
|---|---|---|
| 157 | 157 |
return [ul.work_name_input.value, {}];
|
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 |
const allow_native_scripts_container = by_id("allow_native_scripts_container");
|
|
| 160 | 161 |
const page_payload_span = by_id("page_payload");
|
| 161 | 162 |
|
| 162 | 163 |
function set_page_components(components) |
| ... | ... | |
| 164 | 165 |
if (components === undefined) {
|
| 165 | 166 |
page_payload_span.setAttribute("data-payload", "no");
|
| 166 | 167 |
page_payload_span.textContent = "(None)"; |
| 168 |
allow_native_scripts_container.classList.remove("form_disabled");
|
|
| 167 | 169 |
} else {
|
| 168 | 170 |
page_payload_span.setAttribute("data-payload", "yes");
|
| 169 | 171 |
let [prefix, name] = components; |
| 170 | 172 |
page_payload_span.setAttribute("data-prefix", prefix);
|
| 171 | 173 |
page_payload_span.setAttribute("data-name", name);
|
| 172 | 174 |
page_payload_span.textContent = nice_name(prefix, name); |
| 175 |
allow_native_scripts_container.classList.add("form_disabled");
|
|
| 173 | 176 |
} |
| 174 | 177 |
} |
| 175 | 178 |
|
Also available in: Unified diff
Make it impossible to check "Allow native scripts" for pages with payload.