aboutsummaryrefslogtreecommitdiff
path: root/html
diff options
context:
space:
mode:
Diffstat (limited to 'html')
-rw-r--r--html/DOM_helpers.js4
-rw-r--r--html/MOZILLA_scrollbar_fix.css6
-rw-r--r--html/back_button.css5
-rw-r--r--html/base.css4
-rw-r--r--html/default_blocking_policy.js5
-rw-r--r--html/display-panel.html8
-rw-r--r--html/display-panel.js36
-rw-r--r--html/import_frame.js4
-rw-r--r--html/options.html30
-rw-r--r--html/options_main.js7
10 files changed, 69 insertions, 40 deletions
diff --git a/html/DOM_helpers.js b/html/DOM_helpers.js
index 01e2be9..4fe118d 100644
--- a/html/DOM_helpers.js
+++ b/html/DOM_helpers.js
@@ -1,5 +1,7 @@
/**
- * Hachette operations on DOM elements
+ * This file is part of Haketilo.
+ *
+ * Function: Operations on DOM elements.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
diff --git a/html/MOZILLA_scrollbar_fix.css b/html/MOZILLA_scrollbar_fix.css
index 5feb7c3..cdbd5c6 100644
--- a/html/MOZILLA_scrollbar_fix.css
+++ b/html/MOZILLA_scrollbar_fix.css
@@ -1,6 +1,8 @@
/**
- * Hachette
- * Hacky fix for vertical scrollbar width being included in child's width.
+ * This file is part of Haketilo.
+ *
+ * Function: Hacky fix for vertical scrollbar width being included in child's
+ * width.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
diff --git a/html/back_button.css b/html/back_button.css
index 1ddc5da..b83e834 100644
--- a/html/back_button.css
+++ b/html/back_button.css
@@ -1,6 +1,7 @@
/**
- * part of Hachette
- * Style for a "back" button with a CSS arrow image.
+ * This file is part of Haketilo.
+ *
+ * Function: Style for a "back" button with a CSS arrow image.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
diff --git a/html/base.css b/html/base.css
index df52f7c..517a5c1 100644
--- a/html/base.css
+++ b/html/base.css
@@ -1,5 +1,7 @@
/**
- * Hachette base styles
+ * This file is part of Haketilo.
+ *
+ * Function: Base styles.
*
* Copyright (C) 2021 Wojtek Kosior
* Copyright (C) 2021 Nicholas Johnson
diff --git a/html/default_blocking_policy.js b/html/default_blocking_policy.js
index 2f49bac..b6458f3 100644
--- a/html/default_blocking_policy.js
+++ b/html/default_blocking_policy.js
@@ -1,6 +1,7 @@
/**
- * part of Hachette
- * Default policy dialog logic.
+ * This file is part of Haketilo.
+ *
+ * Function: Logic for the dialog of default policy selection.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
diff --git a/html/display-panel.html b/html/display-panel.html
index 3ed1b7a..ee9e767 100644
--- a/html/display-panel.html
+++ b/html/display-panel.html
@@ -1,12 +1,16 @@
<!doctype html>
<!--
+ This file is part of Haketilo.
+
+ Function: Extension's popup page.
+
Copyright (C) 2021 Wojtek Kosior
Redistribution terms are gathered in the `copyright' file.
-->
<html>
<head>
<meta charset="utf-8"/>
- <title>Hachette - page settings</title>
+ <title>Haketilo - page settings</title>
<link type="text/css" rel="stylesheet" href="reset.css" />
<link type="text/css" rel="stylesheet" href="base.css" />
<link type="text/css" rel="stylesheet" href="back_button.css" />
@@ -331,7 +335,7 @@
<div class="footer padding_inline has_upper_thin_line">
<button id="settings_but" type="button">
- Open Hachette settings
+ Open Haketilo settings
</button>
</div>
</div>
diff --git a/html/display-panel.js b/html/display-panel.js
index 7d801c9..c078850 100644
--- a/html/display-panel.js
+++ b/html/display-panel.js
@@ -1,5 +1,7 @@
/**
- * Hachette display panel logic
+ * This file is part of Haketilo.
+ *
+ * Function: Popup logic.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
@@ -21,7 +23,6 @@
* IMPORT TYPE_PREFIX
* IMPORT nice_name
* IMPORT open_in_settings
- * IMPORT url_matches
* IMPORT each_url_pattern
* IMPORT by_id
* IMPORT clone_template
@@ -114,36 +115,21 @@ function add_pattern_to_list(pattern)
return template;
}
-function ensure_pattern_exists(pattern)
-{
- let entry_object = known_patterns.get(pattern);
- /*
- * As long as pattern computation works well, we should never get into this
- * conditional block. This is just a safety measure. To be removed as part
- * of a bigger rework when we start taking iframes into account.
- */
- if (entry_object === undefined) {
- console.log(`unknown pattern: ${pattern}`);
- entry_object = add_pattern_to_list(pattern);
- }
-
- return entry_object;
-}
-
function style_possible_pattern_entry(pattern, exists_in_settings)
{
const [text, class_action] = exists_in_settings ?
["Edit", "add"] : ["Add", "remove"];
- const entry_object = ensure_pattern_exists(pattern);
+ const entry_object = known_patterns.get(pattern);
- entry_object.button.textContent = `${text} setting`;
- entry_object.entry.classList[class_action]("matched_pattern");
+ if (entry_object) {
+ entry_object.button.textContent = `${text} setting`;
+ entry_object.entry.classList[class_action]("matched_pattern");
+ }
}
function handle_page_change(change)
{
- if (url_matches(tab_url, change.item))
- style_possible_pattern_entry(change.item, change.new_val !== undefined);
+ style_possible_pattern_entry(change.item, change.new_val !== undefined);
}
function populate_possible_patterns_list(url)
@@ -276,8 +262,8 @@ function handle_activity_report(message)
template.script_contents.textContent = data;
container_for_injected.appendChild(template.div);
}
- if (type === "content_type") {
- if (!/html/.test(data))
+ if (type === "is_html") {
+ if (!data)
content_type_cell.classList.remove("hide");
}
if (type === "repo_query_action") {
diff --git a/html/import_frame.js b/html/import_frame.js
index c0eb2f0..ae6fab4 100644
--- a/html/import_frame.js
+++ b/html/import_frame.js
@@ -1,5 +1,7 @@
/**
- * Hachette HTML import frame script
+ * This file is part of Haketilo.
+ *
+ * Function: Logic for the settings import frame.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
diff --git a/html/options.html b/html/options.html
index f2a75e1..2e8317c 100644
--- a/html/options.html
+++ b/html/options.html
@@ -1,12 +1,16 @@
<!doctype html>
<!--
+ This file is part of Haketilo.
+
+ Function: Extension's settings page.
+
Copyright (C) 2021 Wojtek Kosior
Redistribution terms are gathered in the `copyright' file.
-->
<html>
<head>
<meta charset="utf-8"/>
- <title>Hachette options</title>
+ <title>Haketilo options</title>
<link type="text/css" rel="stylesheet" href="reset.css" />
<link type="text/css" rel="stylesheet" href="base.css" />
<link type="text/css" rel="stylesheet" href="table.css" />
@@ -152,6 +156,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;
+ }
</style>
</head>
<body>
@@ -226,15 +246,18 @@
<label for="page_url_field">URL: </label>
<input id="page_url_field"></input>
<label>Payload: </label>
- <span>
+ <span class="nowrap">
<span id="page_payload"></span>
<button id="select_page_components_but">
Choose payload
</button>
</span>
- <div>
+ <div id="allow_native_scripts_container" class="nowrap">
<input id="page_allow_chbx" type="checkbox" style="display: inline;"></input>
<label for="page_allow_chbx">Allow native scripts</label>
+ <span class="form_disabled_msg">
+ (only possible when no payload is used)
+ </span>
</div>
<div>
<button id="save_page_but" type="button"> Save </button>
@@ -248,6 +271,7 @@
</div>
</div>
<button id="add_page_but" type="button"> Add page </button>
+ <br/>
<IMPORT html/default_blocking_policy.html />
</div>
<div id="bags" class="tab">
diff --git a/html/options_main.js b/html/options_main.js
index 2f4f154..f8faf9b 100644
--- a/html/options_main.js
+++ b/html/options_main.js
@@ -1,5 +1,7 @@
/**
- * Hachette HTML options page main script
+ * This file is part of Haketilo.
+ *
+ * Function: Settings page logic.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
@@ -157,6 +159,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 +167,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");
}
}