// 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.
// 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
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);
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>";
}
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);
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)
} 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";
// 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);
}