]> git.armaanb.net Git - chorizo.git/commitdiff
draft 4
authorArmaan Bhojwani <me@armaanb.net>
Sat, 23 Oct 2021 20:37:49 +0000 (16:37 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 24 Oct 2021 01:56:32 +0000 (21:56 -0400)
.clang-format
Makefile
browser.c
chorizo-usage.1 [new file with mode: 0644]
chorizo-usage.7 [deleted file]
config.h
downloads.c
user-scripts/hints.js

index 0e1993de3b9d7c4acda3623678cf7373dd618a8c..c33ab1db23c924525437b482894c089127eb41d3 100644 (file)
@@ -77,8 +77,8 @@ PenaltyReturnTypeOnItsOwnLine: 60
 
 PointerAlignment: Right
 ReflowComments: false
-SortIncludes: false
-SortUsingDeclarations: false # Unknown to clang-format-4.0
+SortIncludes: true
+SortUsingDeclarations: true # Unknown to clang-format-4.0
 SpaceAfterCStyleCast: false
 SpaceAfterTemplateKeyword: true
 SpaceBeforeAssignmentOperators: true
index f123f024b3b2fb84989af50896638cf28313fc9f..ca95305a2fc73a66eb69b6e7fdcbcb83560c7fe6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,14 +25,12 @@ extensions:
 install: all
        mkdir -p $(bindir) \
                $(mandir)/man1 \
-               $(mandir)/man7 \
                $(libdir)/chorizo/web-extensions \
                $(datadir)/chorizo/user-scripts
 
        cp chorizo $(bindir)/
 
        cp chorizo.1 $(mandir)/man1/
-       cp chorizo-usage.7 $(mandir)/man7/
        makewhatis /usr/local/man
 
        cp -r extensions/*.so $(libdir)/chorizo/web-extensions/
@@ -42,7 +40,6 @@ uninstall:
        rm -rf $(bindir)/chorizo \
                $(libdir)/chorizo \
                $(mandir)/man1/chorizo* \
-               $(mandir)/man7/chorizo* \
                $(datadir)/chorizo
 
 reinstall: uninstall install
index 84a2a4a3a1dad2c0a8a78dadf086c3e2be90ee82..385f1671d2741eeb24f5e4ded80d5662aa85b4fe 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -31,8 +31,10 @@ void show_web_view(WebKitWebView *, gpointer);
 void trust_user_certs(WebKitWebContext *);
 
 struct Client {
-       GtkWidget *jsbutton;
        GtkWidget *location;
+       GtkWidget *search;
+       GtkWidget *search_switch;
+       GtkWidget *isearch;
        GtkWidget *tabicon;
        GtkWidget *tablabel;
        GtkWidget *vbox;
@@ -72,16 +74,6 @@ allocfail(void)
        exit(EXIT_FAILURE);
 }
 
-void
-togglejs(GtkButton *jsbutton, gpointer data)
-{
-       struct Client *c = (struct Client *)data;
-       webkit_settings_set_enable_javascript(
-               c->settings,
-               !webkit_settings_get_enable_javascript(c->settings));
-       webkit_web_view_set_settings(WEBKIT_WEB_VIEW(c->web_view), c->settings);
-}
-
 void
 client_destroy(GtkWidget *widget, gpointer data)
 {
@@ -212,7 +204,6 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
 
        c->settings =
                webkit_web_view_get_settings(WEBKIT_WEB_VIEW(c->web_view));
-       webkit_settings_set_enable_javascript(c->settings, cfg_js_default);
        if (cfg.verbose)
                webkit_settings_set_enable_write_console_messages_to_stdout(
                        c->settings, true);
@@ -235,8 +226,6 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
                         G_CALLBACK(decide_policy), NULL);
        g_signal_connect(G_OBJECT(c->web_view), "key-press-event",
                         G_CALLBACK(key_web_view), c);
-       g_signal_connect(G_OBJECT(c->web_view), "button-release-event",
-                        G_CALLBACK(key_web_view), c);
        g_signal_connect(G_OBJECT(c->web_view), "scroll-event",
                         G_CALLBACK(key_web_view), c);
        g_signal_connect(G_OBJECT(c->web_view), "mouse-target-changed",
@@ -245,16 +234,15 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
                         G_CALLBACK(crashed_web_view), c);
 
        GtkWidget *locbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
-       c->jsbutton = gtk_toggle_button_new_with_label("JS");
-       gtk_widget_set_tooltip_text(c->jsbutton, "Toggle JavaScript execution");
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(c->jsbutton),
-                                    cfg_js_default);
-       g_signal_connect(G_OBJECT(c->jsbutton), "toggled", G_CALLBACK(togglejs),
-                        c);
 
        c->location = gtk_entry_new();
+       gtk_entry_set_placeholder_text(GTK_ENTRY(c->location), "Web address");
        gtk_box_pack_start(GTK_BOX(locbox), c->location, TRUE, TRUE, 0);
 
+       c->search = gtk_entry_new();
+       gtk_entry_set_placeholder_text(GTK_ENTRY(c->search), "Search");
+       gtk_box_pack_start(GTK_BOX(locbox), c->search, FALSE, TRUE, 0);
+
        if (cfg.private) {
                GtkWidget *privindicator = gtk_label_new("Private mode");
                gtk_widget_set_tooltip_text(
@@ -264,7 +252,6 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
                gtk_box_pack_end(GTK_BOX(locbox), privindicator, FALSE, FALSE,
                                 5);
        }
-       gtk_box_pack_start(GTK_BOX(locbox), c->jsbutton, FALSE, FALSE, 0);
 
        g_signal_connect(G_OBJECT(c->location), "key-press-event",
                         G_CALLBACK(key_location), c);
@@ -284,6 +271,15 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
        c->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
        gtk_box_pack_start(GTK_BOX(c->vbox), locbox, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(c->vbox), c->web_view, TRUE, TRUE, 0);
+
+       GtkWidget *overlay = gtk_overlay_new();
+       c->isearch = gtk_entry_new();
+       gtk_container_add(GTK_CONTAINER(c->vbox), overlay);
+       gtk_container_add(GTK_CONTAINER(overlay), c->isearch);
+      gtk_widget_set_halign (overlay, GTK_ALIGN_CENTER);
+           gtk_widget_set_valign (overlay, GTK_ALIGN_CENTER);
+       gtk_widget_show_all(overlay);
+
        gtk_container_set_focus_child(GTK_CONTAINER(c->vbox), c->web_view);
 
        c->tabicon = gtk_image_new_from_icon_name("text-html",
@@ -291,7 +287,7 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
 
        c->tablabel = gtk_label_new("chorizo");
        gtk_label_set_ellipsize(GTK_LABEL(c->tablabel), PANGO_ELLIPSIZE_END);
-       gtk_label_set_width_chars(GTK_LABEL(c->tablabel), 20);
+       gtk_label_set_width_chars(GTK_LABEL(c->tablabel), cfg_tab_width);
        gtk_widget_set_has_tooltip(c->tablabel, TRUE);
 
        /*
@@ -531,8 +527,8 @@ changed_uri(GObject *obj, GParamSpec *pspec, gpointer data)
                //No g_get_user_state_dir unfortunately
                gchar *state_env = getenv("XDG_STATE_DIR");
                gchar *state_dir = (state_env) ?
-                                                state_env :
-                                                g_build_filename(g_get_home_dir(),
+                                          state_env :
+                                          g_build_filename(g_get_home_dir(),
                                                            ".local", "state",
                                                            "chorizo", NULL);
 
@@ -732,7 +728,7 @@ init_default_web_context(void)
        WebKitWebContext *wc;
        WebKitCookieManager *cm;
        wc = (cfg.private) ? webkit_web_context_new_ephemeral() :
-                                  webkit_web_context_get_default();
+                            webkit_web_context_get_default();
 
        p = g_build_filename(g_get_user_config_dir(), "chorizo", "adblock",
                             NULL);
@@ -816,6 +812,7 @@ search_init(struct Client *c, int direction)
                search(c, direction);
        }
 }
+
 gboolean
 key_common(GtkWidget *widget, GdkEvent *event, gpointer data)
 {
@@ -962,17 +959,6 @@ key_common(GtkWidget *widget, GdkEvent *event, gpointer data)
                                gtk_notebook_next_page(
                                        GTK_NOTEBOOK(mw.notebook));
                                return TRUE;
-                       } else if (GDK_KEY_p == key) {
-                               gboolean on =
-                                       webkit_settings_get_enable_javascript(
-                                               c->settings);
-                               webkit_settings_set_enable_javascript(
-                                       c->settings, !on);
-                               webkit_web_view_set_settings(
-                                       WEBKIT_WEB_VIEW(c->web_view),
-                                       c->settings);
-                               gtk_toggle_button_set_active(
-                                       GTK_TOGGLE_BUTTON(c->jsbutton), !on);
                        } else if (GDK_KEY_d == key) {
                                gtk_widget_grab_focus(c->location);
                                gtk_entry_set_text(GTK_ENTRY(c->location),
@@ -1071,6 +1057,7 @@ key_tablabel(GtkWidget *widget, GdkEvent *event, gpointer data)
        }
        return FALSE;
 }
+
 gboolean
 key_web_view(GtkWidget *widget, GdkEvent *event, gpointer data)
 {
@@ -1086,26 +1073,6 @@ key_web_view(GtkWidget *widget, GdkEvent *event, gpointer data)
                        gtk_entry_set_progress_fraction(GTK_ENTRY(c->location),
                                                        0);
                }
-       } else if (event->type == GDK_BUTTON_RELEASE) {
-               GdkModifierType modifiers =
-                       gtk_accelerator_get_default_mod_mask();
-               switch (((GdkEventButton *)event)->button) {
-               case 1:
-                       if ((((GdkEventButton *)event)->state & modifiers) ==
-                                   GDK_CONTROL_MASK &&
-                           c->hover_uri != NULL) {
-                               client_new(c->hover_uri, NULL, TRUE, FALSE);
-                               return TRUE;
-                       }
-                       break;
-               case 8:
-                       webkit_web_view_go_back(WEBKIT_WEB_VIEW(c->web_view));
-                       return TRUE;
-               case 9:
-                       webkit_web_view_go_forward(
-                               WEBKIT_WEB_VIEW(c->web_view));
-                       return TRUE;
-               }
        } else if (event->type == GDK_SCROLL) {
                event->scroll.delta_y *= cfg_scroll_lines;
                if (((GdkEventScroll *)event)->state & GDK_CONTROL_MASK) {
@@ -1138,9 +1105,21 @@ mainwindow_setup(void)
 
        mw.notebook = gtk_notebook_new();
        gtk_notebook_set_scrollable(GTK_NOTEBOOK(mw.notebook), TRUE);
+       gtk_notebook_set_tab_pos(GTK_NOTEBOOK(mw.notebook), GTK_POS_LEFT);
        gtk_container_add(GTK_CONTAINER(mw.win), mw.notebook);
        g_signal_connect(G_OBJECT(mw.notebook), "switch-page",
                         G_CALLBACK(notebook_switch_page), NULL);
+
+       GtkCssProvider *css = gtk_css_provider_new();
+       const char *css_data = "notebook header.left * { \
+                                       margin: 0; \
+                                       padding-top: 0; \
+                                       padding-bottom: 0; \
+                               }";
+       gtk_css_provider_load_from_data(css, css_data, strlen(css_data), NULL);
+       gtk_style_context_add_provider_for_screen(
+               gdk_screen_get_default(), GTK_STYLE_PROVIDER(css),
+               GTK_STYLE_PROVIDER_PRIORITY_USER);
 }
 
 void
@@ -1163,6 +1142,7 @@ notebook_switch_page(GtkNotebook *nb, GtkWidget *p, guint idx, gpointer data)
 {
        mainwindow_title(idx);
 }
+
 gboolean
 quit_if_nothing_active(void)
 {
@@ -1308,7 +1288,6 @@ main(int argc, char **argv)
                gtk_main();
                remove(fifopath);
        }
-       for (int i = 0; i < clients; i++) { free(&(client_arr[i])); }
 
        exit(EXIT_SUCCESS);
 }
diff --git a/chorizo-usage.1 b/chorizo-usage.1
new file mode 100644 (file)
index 0000000..d8a71fb
--- /dev/null
@@ -0,0 +1,93 @@
+.TH "chorizo-usage" "1" "2021-10-11"
+.P
+.SH NAME
+chorizo-usage - extended usage hints
+.P
+.SH DESCRIPTION
+\fBchorizo\fR is a simple web browser using GTK+ 3, GLib and WebKit2GTK+.\& This
+manpage contains additional hints and pointers regarding its usage.\&
+.P
+.SH DOWNLOAD MANAGER
+Open the download manager using the appropriate hotkey.\& A new window listing
+your downloads will appear.\& Clicking on an item will remove it from the list and
+\fB\fRif needed\fB\fR cancel the download.\&
+.P
+There's no file manager integration, nor does \fBchorizo\fR delete, overwrite or
+resume downloads.\& If a file already exists, it won't be touched.\& Instead, the
+new file name will have a suffix such as \fB.\&1\fR, \fB.\&2\fR, \fB.\&3\fR, and so on.\&
+.P
+.SH USER-SUPPLIED JAVASCRIPT FILES
+When a page is being loaded, the directory \fI~/.\&local/share/chorizo/user-scripts\fR
+will be scanned and each file in it ending with \fB.\&js\fR will be run as a
+JavaScript file in the context of said page.\&
+.P
+\fBchorizo\fR comes with the following scripts:
+.P
+\fBhints.\&js\fR
+.RS 4
+Press \fBf\fR (open link in current window) or \fBF\fR (open in new window) to
+activate link hints.\& After typing the characters for one of them, press
+\fBEnter\fR to confirm.\& Press \fBEscape\fR to abort.\&
+.P
+.RE
+\fBprivacy-redirect.\&js\fR
+.RS 4
+Redirects YouTube, Reddit, etc to privacy respecting alternatives.\&
+.P
+.RE
+\fBdarkreader.\&js\fR
+.RS 4
+See https://darkreader.\&org.\&
+.P
+.RE
+Those bundled scripts are automatically installed on \fBmake install\fR.\& To use
+them, though, make sure to link them to the directory mentioned above.\&
+.P
+.SH USER-SUPPLIED CSS FILES
+User supplied CSS files will be scanned for from
+\fI~/.\&local/share/chorizo/user-styles\fR, and be applied every time a page
+loads.\& The rules in these files override any rules provided by the website.\&
+.P
+.SH WEB EXTENSIONS
+On startup, WebKit checks \fI~/.\&local/share/chorizo/web-extensions\fR for any \fB.\&so\fR
+files.\& See
+<http://blogs.\&igalia.\&com/carlosgc/2013/09/10/webkit2gtk-web-process-extensions/>
+this blog post for further information on these extensions.\&
+.P
+\fBchorizo\fR comes with the following extensions:
+.P
+\fBwe_adblock.\&so\fR
+.RS 4
+Generic adblock.\& Reads patterns from the file \fI~/.\&config/chorizo/adblock\fR.\& Each
+line can contain a regular expression.\& These expressions match
+case-insensitive and partially, i.\&e.\&\fB*foo.\&*\fR is the same as \fB.\&*FOO.\&*\fR and
+you can use anchors like \fB^https?\&://.\&.\&.\&\fR.\& Please refer to
+https://developer.\&gnome.\&org/glib/stable/glib-regex-syntax.\&html the GLib
+reference for more details.\& Lines starting with "#" are ignored.\&
+.P
+Those bundled web extensions are automatically compiled when you run \fBmake\fR
+and installed on \fBmake install\fR.\& To use them, though, make sure to link them
+to the directory mentioned above.\&
+.P
+.RE
+.SH TRUSTED CERTIFICATES
+By default, \fBchorizo\fR trusts whatever CAs are trusted by WebKit.\& If you wish to
+trust additional certificates, such as self-signed certificates, the first thing
+you should do is try to add the appropriate CAs to your system-wide store.\&
+.P
+If you wish to add simple exceptions, you can grab the certificate and store it
+in the directory \fI~/.\&local/share/chorizo/certs\fR.\& The filename must be equal to
+the hostname:
+.P
+.RS 4
+$ echo | openssl s_client -connect foo.\&de:443 | openssl x509 >foo.\&de
+.P
+.RE
+This tells \fBchorizo\fR to trust the given certificate when connecting to host
+\fBfoo.\&de\fR.\&
+.P
+Note: This is NOT equal to certificate pinning.\& WebKit ignores user-specified
+certificates if the server's certificate can be validated by any system-wide CA.\&
+.P
+.SH SEE ALSO
+\fBchorizo\fR(1), \fBchorizo-config\fR(5)
diff --git a/chorizo-usage.7 b/chorizo-usage.7
deleted file mode 100644 (file)
index 5857863..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-.TH "chorizo-usage" "7" "2021-10-11"
-.P
-.SH NAME
-chorizo-usage - extended usage hints
-.P
-.SH DESCRIPTION
-\fBchorizo\fR is a simple web browser using GTK+ 3, GLib and WebKit2GTK+.\& This
-manpage contains additional hints and pointers regarding its usage.\&
-.P
-.SH DOWNLOAD MANAGER
-Open the download manager using the appropriate hotkey.\& A new window listing
-your downloads will appear.\& Clicking on an item will remove it from the list and
-\fB\fRif needed\fB\fR cancel the download.\&
-.P
-There's no file manager integration, nor does \fBchorizo\fR delete, overwrite or
-resume downloads.\& If a file already exists, it won't be touched.\& Instead, the
-new file name will have a suffix such as \fB.\&1\fR, \fB.\&2\fR, \fB.\&3\fR, and so on.\&
-.P
-.SH USER-SUPPLIED JAVASCRIPT FILES
-When a page is being loaded, the directory \fI~/.\&local/share/chorizo/user-scripts\fR
-will be scanned and each file in it ending with \fB.\&js\fR will be run as a
-JavaScript file in the context of said page.\&
-.P
-\fBchorizo\fR comes with the following scripts:
-.P
-\fBhints.\&js\fR
-.RS 4
-Press \fBf\fR (open link in current window) or \fBF\fR (open in new window) to
-activate link hints.\& After typing the characters for one of them, press
-\fBEnter\fR to confirm.\& Press \fBEscape\fR to abort.\&
-.P
-.RE
-\fBprivacy-redirect.\&js\fR
-.RS 4
-Redirects YouTube, Reddit, etc to privacy respecting alternatives.\&
-.P
-.RE
-\fBdarkreader.\&js\fR
-.RS 4
-See https://darkreader.\&org.\&
-.P
-.RE
-Those bundled scripts are automatically installed on \fBmake install\fR.\& To use
-them, though, make sure to link them to the directory mentioned above.\&
-.P
-.SH USER-SUPPLIED CSS FILES
-User supplied CSS files will be scanned for from
-\fI~/.\&local/share/chorizo/user-styles\fR, and be applied every time a page
-loads.\& The rules in these files override any rules provided by the website.\&
-.P
-.SH WEB EXTENSIONS
-On startup, WebKit checks \fI~/.\&local/share/chorizo/web-extensions\fR for any \fB.\&so\fR
-files.\& See
-<http://blogs.\&igalia.\&com/carlosgc/2013/09/10/webkit2gtk-web-process-extensions/>
-this blog post for further information on these extensions.\&
-.P
-\fBchorizo\fR comes with the following extensions:
-.P
-\fBwe_adblock.\&so\fR
-.RS 4
-Generic adblock.\& Reads patterns from the file \fI~/.\&config/chorizo/adblock\fR.\& Each
-line can contain a regular expression.\& These expressions match
-case-insensitive and partially, i.\&e.\&\fB*foo.\&*\fR is the same as \fB.\&*FOO.\&*\fR and
-you can use anchors like \fB^https?\&://.\&.\&.\&\fR.\& Please refer to
-https://developer.\&gnome.\&org/glib/stable/glib-regex-syntax.\&html the GLib
-reference for more details.\& Lines starting with "#" are ignored.\&
-.P
-Those bundled web extensions are automatically compiled when you run \fBmake\fR
-and installed on \fBmake install\fR.\& To use them, though, make sure to link them
-to the directory mentioned above.\&
-.P
-.RE
-.SH TRUSTED CERTIFICATES
-By default, \fBchorizo\fR trusts whatever CAs are trusted by WebKit.\& If you wish to
-trust additional certificates, such as self-signed certificates, the first thing
-you should do is try to add the appropriate CAs to your system-wide store.\&
-.P
-If you wish to add simple exceptions, you can grab the certificate and store it
-in the directory \fI~/.\&local/share/chorizo/certs\fR.\& The filename must be equal to
-the hostname:
-.P
-.RS 4
-$ echo | openssl s_client -connect foo.\&de:443 | openssl x509 >foo.\&de
-.P
-.RE
-This tells \fBchorizo\fR to trust the given certificate when connecting to host
-\fBfoo.\&de\fR.\&
-.P
-Note: This is NOT equal to certificate pinning.\& WebKit ignores user-specified
-certificates if the server's certificate can be validated by any system-wide CA.\&
-.P
-.SH SEE ALSO
-\fBchorizo\fR(1), \fBchorizo-config\fR(5)
index d782887ca2b0f86bfbf6ab3f0a5d81f9f3bce428..840b0bc829077d46456b13dac11017e7806275f2 100644 (file)
--- a/config.h
+++ b/config.h
@@ -13,5 +13,6 @@ int cfg_scroll_lines = 3;
 gchar *cfg_search_engine = "https://searx.be/search?q=";
 //Search engine
 int cfg_max_tabs_closed = 16;
-
+//Tab width in chars
+int cfg_tab_width = 15;
 #endif
index 439f2a017442f1e397a12312967408d051f9c937..1cf3bef9a5b80c79d652bb0b813ec3b5c72222ba 100644 (file)
@@ -110,7 +110,7 @@ download_handle(WebKitDownload *download, gchar *suggested_filename,
 
        gtk_widget_destroy(chooser);
 
-       remove(uri + 7);
+       remove(uri + 7); // Remove before overwrite
        tb = gtk_tool_button_new(NULL, NULL);
        gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(tb), "network-receive");
        gtk_tool_button_set_label(GTK_TOOL_BUTTON(tb), uri);
@@ -153,7 +153,6 @@ const char *
 download_get_path(struct DownloadItem *payload)
 {
        const char *path = webkit_download_get_destination(payload->download);
-       // Offset by 7 to remove "file://"
        return path += 7;
 }
 
@@ -186,8 +185,8 @@ void
 download_copy_path(GtkMenuItem *tb, gpointer data)
 {
        const char *path = download_get_path((struct DownloadItem *)data);
-       gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD),
-                              path + 7, strlen(path) - 7);
+       gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), path,
+                              strlen(path));
 }
 
 void
index c1854c366e260e924692056b1ab1c3164fcfe9d5..aa5daa2ddf7889f5c0cecdbe349796e07e0bac9e 100644 (file)
@@ -1,6 +1,6 @@
 // This is NOT a core component of chorizo, but an optional user script.
-// Please refer to chorizo.usage(1) for more information on user scripts.
-
+// Please refer to chorizo-usage(1) for more information on user scripts.
+//
 // Press "f" (open link in current window) or "F" (open in new window)
 // to activate link hints. After typing the characters for one of them,
 // press Enter to confirm. Press Escape to abort.
@@ -8,7 +8,7 @@
 // This is an "80% solution". It works for many web sites, but has
 // flaws. For more background on this topic, see this blog post:
 // https://www.uninformativ.de/blog/postings/2020-02-24/0/POSTING-en.html
-
+//
 // Based on the following, but modified for chorizo and personal taste:
 //
 // easy links for surf
@@ -28,20 +28,13 @@ var key_follow_new_win = "F";
 
 function update_highlights_or_abort() {
     var submatch;
-    var col_sel, col_unsel;
     var longest_id = 0;
 
-    if (document.chorizo_hints.state === "follow_new") {
-        col_unsel = "#DAFFAD";
-        col_sel = "#FF5D00";
-    } else {
-        col_unsel = "#A7FFF5";
-        col_sel = "#33FF00";
-    }
+    const color = (document.chorizo_hints.state === "follow_new") ? "#ffccff"
+        : "#99ffcc";
 
     for (var id in document.chorizo_hints.labels) {
         var label = document.chorizo_hints.labels[id];
-        var bgcol = col_unsel;
 
         longest_id = Math.max(longest_id, id.length);
 
@@ -49,12 +42,9 @@ function update_highlights_or_abort() {
             submatch = id.match("^" + document.chorizo_hints.box.value);
             if (submatch !== null) {
                 var href_suffix = "";
-                var box_shadow_inner = "#B00000";
                 if (id === document.chorizo_hints.box.value) {
-                    bgcol = col_sel;
-                    box_shadow_inner = "red";
                     if (label.elem.tagName.toLowerCase() === "a")
-                        href_suffix = ": <span style='font-size: 75%'>" +
+                        href_suffix = ": <span>" +
                                       label.elem.href + "</span>";
                 }
 
@@ -65,8 +55,7 @@ function update_highlights_or_abort() {
                 label.span.style.visibility = "visible";
 
                 save_parent_style(label);
-                label.elem.style.boxShadow = "0 0 5pt 2pt black, 0 0 0 2pt " +
-                                             box_shadow_inner + " inset";
+                label.elem.style.boxShadow = "0 0 5px 5px red";
             } else {
                 label.span.style.visibility = "hidden";
                 reset_parent_style(label);
@@ -76,7 +65,7 @@ function update_highlights_or_abort() {
             label.span.innerHTML = id;
             reset_parent_style(label);
         }
-        label.span.style.backgroundColor = bgcol;
+        label.span.style.backgroundColor = color;
     }
 
     if (document.chorizo_hints.box.value.length > longest_id)
@@ -195,12 +184,13 @@ function create_labels() {
         } while (n !== 0);
 
         var span = document.createElement("span");
-        span.style.border = "black 1pt solid";
+        span.style.border = "black 1px solid";
         span.style.color = "black";
         span.style.fontFamily = "monospace";
-        span.style.fontSize = "10pt";
+        span.style.fontSize = "10px";
         span.style.fontWeight = "normal";
-        span.style.margin = "0px 2pt";
+        span.style.margin = "0px 2px";
+        span.style.padding = "1px 5px";
         span.style.position = "absolute";
         span.style.textTransform = "lowercase";
         span.style.visibility = "hidden";
@@ -216,13 +206,10 @@ function create_labels() {
         // placement results, but we can *only* do this for <a> ...
         var tag_name = elem.tagName.toLowerCase();
         if (tag_name === "a") {
-            span.style.borderTopLeftRadius = "10pt";
-            span.style.borderBottomLeftRadius = "10pt";
-            span.style.padding = "0px 2pt 0px 5pt";
+            span.style.borderRadius = "2px";
             elem.appendChild(span);
         } else {
-            span.style.borderRadius = "10pt";
-            span.style.padding = "0px 5pt";
+            span.style.borderRadius = "10px";
             elem.parentNode.insertBefore(span, elem);
         }