dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 639b19f9a4d9ae1ffbc8cbc5af1e8cc8115cfa06
parent c47f77646df190e3dd86c16983907e9ca24e77a9
Author: hhvn <dev@hhvn.uk>
Date:   Sat, 19 Jun 2021 17:38:52 +0100

.c/s/script.js: remove vim key handling

Diffstat:
M.config/surf/script.js | 98+------------------------------------------------------------------------------
1 file changed, 1 insertion(+), 97 deletions(-)

diff --git a/.config/surf/script.js b/.config/surf/script.js @@ -1,102 +1,6 @@ -//======> vim.js <====== -// @namespace renevier.fdn.fr -// @author arno <arenevier@fdn.fr> -// @licence GPL/LGPL/MPL -// @description use vim keybingings (i, j, k, l, …) to navigate a web page. -function up() { - if (window.scrollByLines) - window.scrollByLines(-2.5); // gecko - else - window.scrollBy(0, -29); // webkit -} -function down() { - if (window.scrollByLines) - window.scrollByLines(5); // gecko - else - window.scrollBy(0, 29); // webkit -} -function pageup() { - if (window.scrollByPages) - window.scrollByPages(-1); // gecko - else - window.scrollBy(0, 0 - _pageScroll()); // webkit -} -function pagedown() { - if (window.scrollByPages) - window.scrollByPages(0.5); // gecko - else - window.scrollBy(0, 150); // webkit -} -function right() { - window.scrollBy(15, 0); -} -function left() { - window.scrollBy(-15, 0); -} -function home() { - window.scroll(0, 0); -} -function bottom() { - window.scroll(document.width, document.height); -} -// If you don't like default key bindings, customize here. -// if you want to use the combination 'Ctrl + b' (for example), use '^b' -var bindings = { - 'h' : left, - 'l' : right, - 'k' : up, - 'j' : down, - 'g' : home, - 'G' : bottom, - '^u': pageup, - '^d': pagedown, - '^b': pageup, - '^f': pagedown, -} -function isEditable(element) { - - if (element.nodeName.toLowerCase() == "textarea") - return true; - // we don't get keypress events for text input, but I don't known - // if it's a bug, so let's test that - if (element.nodeName.toLowerCase() == "input" && element.type == "text") - return true; - // element is editable - if (document.designMode == "on" || element.contentEditable == "true") { - return true; - } - - return false; -} -function keypress(evt) { - var target = evt.target; - - // if we're on a editable element, we probably don't want to catch - // keypress, we just want to write the typed character. - if (isEditable(target)) - return; - var key = String.fromCharCode(evt.charCode); - if (evt.ctrlKey) { - key = '^' + key; - } - var fun = bindings[key]; - if (fun) - fun(); -} -function _pageScroll() { - // Gecko algorithm - // ---------------- - // The page increment is the size of the page, minus the smaller of - // 10% of the size or 2 lines. - return window.innerHeight - Math.min(window.innerHeight / 10, 24); -} -window.addEventListener("keypress", keypress, false); - - - //======> linkhinting.js <====== /* based on chromium plugin code, adapted by Nibble<.gs@gmail.com> */ -/* colours modified by haydenh<hayden@haydenvh.com> */ +/* modified by hhvn<hayden@haydenvh.com> */ var hint_num_str = ''; var hint_elems = []; var hint_open_in_new_tab = false;