From 5c75d7446187a01409eff1a1e5946f66267f61fb Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 10 Sep 2021 16:50:56 +0200 Subject: Make it impossible to check "Allow native scripts" for pages with payload. --- html/options.html | 23 +++++++++++++++++++++-- html/options_main.js | 3 +++ 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'html') diff --git a/html/options.html b/html/options.html index f2a75e1..01b1061 100644 --- a/html/options.html +++ b/html/options.html @@ -152,6 +152,22 @@ min-width: 70vw; resize: none; } + + .form_disabled>* { + opacity: 0.5; + pointer-events: none; + } + + .form_disabled_msg { + display: none; + font-style: italic; + } + + .form_disabled .form_disabled_msg { + opacity: initial; + pointer-events: initial; + display: initial; + } @@ -226,15 +242,18 @@ - + -
+
+ + (only possible when no payload is used) +
diff --git a/html/options_main.js b/html/options_main.js index 2f4f154..27ab0ec 100644 --- a/html/options_main.js +++ b/html/options_main.js @@ -157,6 +157,7 @@ function work_repo_li_data(ul) return [ul.work_name_input.value, {}]; } +const allow_native_scripts_container = by_id("allow_native_scripts_container"); const page_payload_span = by_id("page_payload"); function set_page_components(components) @@ -164,12 +165,14 @@ function set_page_components(components) if (components === undefined) { page_payload_span.setAttribute("data-payload", "no"); page_payload_span.textContent = "(None)"; + allow_native_scripts_container.classList.remove("form_disabled"); } else { page_payload_span.setAttribute("data-payload", "yes"); let [prefix, name] = components; page_payload_span.setAttribute("data-prefix", prefix); page_payload_span.setAttribute("data-name", name); page_payload_span.textContent = nice_name(prefix, name); + allow_native_scripts_container.classList.add("form_disabled"); } } -- cgit v1.2.3