-// This is NOT a core component of lariza, but an optional user script.
-// Please refer to lariza.usage(1) for more information on user scripts.
+// 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.
// 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,
// 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 lariza and personal taste:
+// Based on the following, but modified for chorizo and personal taste:
//
// easy links for surf
// christian hahn <ch radamanthys de>, sep 2010
var col_sel, col_unsel;
var longest_id = 0;
- if (document.lariza_hints.state === "follow_new")
+ if (document.chorizo_hints.state === "follow_new")
{
col_unsel = "#DAFFAD";
col_sel = "#FF5D00";
col_sel = "#33FF00";
}
- for (var id in document.lariza_hints.labels)
+ for (var id in document.chorizo_hints.labels)
{
- var label = document.lariza_hints.labels[id];
+ var label = document.chorizo_hints.labels[id];
var bgcol = col_unsel;
longest_id = Math.max(longest_id, id.length);
- if (document.lariza_hints.box.value !== "")
+ if (document.chorizo_hints.box.value !== "")
{
- submatch = id.match("^" + document.lariza_hints.box.value);
+ submatch = id.match("^" + document.chorizo_hints.box.value);
if (submatch !== null)
{
var href_suffix = "";
var box_shadow_inner = "#B00000";
- if (id === document.lariza_hints.box.value)
+ if (id === document.chorizo_hints.box.value)
{
bgcol = col_sel;
box_shadow_inner = "red";
label.span.style.backgroundColor = bgcol;
}
- if (document.lariza_hints.box.value.length > longest_id)
+ if (document.chorizo_hints.box.value.length > longest_id)
set_state("inactive");
}
function open_match()
{
- var choice = document.lariza_hints.box.value;
- var was_state = document.lariza_hints.state;
+ var choice = document.chorizo_hints.box.value;
+ var was_state = document.chorizo_hints.state;
- var elem = document.lariza_hints.labels[choice].elem;
+ var elem = document.chorizo_hints.labels[choice].elem;
set_state("inactive"); /* Nukes labels. */
if (elem)
{
console.log("[hints] New state: " + new_state);
- document.lariza_hints.state = new_state;
+ document.chorizo_hints.state = new_state;
- if (document.lariza_hints.state === "inactive")
+ if (document.chorizo_hints.state === "inactive")
{
nuke_labels();
// Removing our box causes unwanted scrolling. Just hide it.
- document.lariza_hints.box.blur();
- document.lariza_hints.box.value = "";
- document.lariza_hints.box.style.visibility = "hidden";
+ document.chorizo_hints.box.blur();
+ document.chorizo_hints.box.value = "";
+ document.chorizo_hints.box.style.visibility = "hidden";
}
else
{
- if (document.lariza_hints.labels === null)
+ if (document.chorizo_hints.labels === null)
create_labels();
// What a terrible hack.
// input element is currently focused. So ... yup, we install an
// invisible text box (opacity 0) and focus it while follow mode
// is active.
- var box = document.lariza_hints.box;
+ var box = document.chorizo_hints.box;
if (box === null)
{
- document.lariza_hints.box = document.createElement("input");
- box = document.lariza_hints.box;
+ document.chorizo_hints.box = document.createElement("input");
+ box = document.chorizo_hints.box;
box.addEventListener("keydown", on_box_key);
box.addEventListener("input", on_box_input);
box.style.top = "0px";
box.type = "text";
- box.setAttribute("lariza_input_box", "yes");
+ box.setAttribute("chorizo_input_box", "yes");
document.body.appendChild(box);
}
function create_labels()
{
- document.lariza_hints.labels = new Object();
+ document.chorizo_hints.labels = new Object();
var selector = "a[href]:not([href=''])";
- if (document.lariza_hints.state !== "follow_new")
+ if (document.chorizo_hints.state !== "follow_new")
{
- selector += ", input:not([type=hidden]):not([lariza_input_box=yes])";
+ selector += ", input:not([type=hidden]):not([chorizo_input_box=yes])";
selector += ", textarea, select, button";
}
span.style.visibility = "hidden";
span.style.zIndex = "2147483647"; // Max for WebKit according to luakit
- document.lariza_hints.labels[label_id] = {
+ document.chorizo_hints.labels[label_id] = {
"elem": elem,
"span": span,
"parent_style": null,
function nuke_labels()
{
- for (var id in document.lariza_hints.labels)
+ for (var id in document.chorizo_hints.labels)
{
- var label = document.lariza_hints.labels[id];
+ var label = document.chorizo_hints.labels[id];
reset_parent_style(label);
label.elem.parentNode.removeChild(label.span);
}
- document.lariza_hints.labels = null;
+ document.chorizo_hints.labels = null;
}
function on_box_input(e)
return;
}
- if (document.lariza_hints.state === "inactive")
+ if (document.chorizo_hints.state === "inactive")
{
if (e.key === key_follow)
set_state("follow");
}
}
-if (document.lariza_hints === undefined)
+if (document.chorizo_hints === undefined)
{
- document.lariza_hints = new Object();
- document.lariza_hints.box = null;
- document.lariza_hints.labels = null;
- document.lariza_hints.state = "inactive";
+ document.chorizo_hints = new Object();
+ document.chorizo_hints.box = null;
+ document.chorizo_hints.labels = null;
+ document.chorizo_hints.state = "inactive";
document.addEventListener("keyup", on_window_key);