You are not logged in.
@bernarcher : I tried your new patch .. there is no problem for patching source file and compile.
but JumNav v0.3 doesn't work either ... it doesn't show me anything on the web page...
EDIT : to brisbin33 the follow link script I use can be found here
Last edited by akira86 (2010-08-18 21:22:24)
Offline
it may be stupid but ... how to use searchengine I can't get it work ...
I put "searchengine aaa http://www.google.com/search?q=%s" in my jumanjirc but then ???
I tried aaa command ... didn't work, nor ":aaa" ...
EDIT : too quick again ... I looked in the jumanji.c and it appeare the right command is ":open aaa test" or ":tabopen aaa blabla"
Last edited by akira86 (2010-08-18 22:20:01)
Offline
Sometimes when I (accidently) drag images, the mouse cursor gets stuck in the dragging mode, which makes all mouse clicks go in vain. I guess webkit doesn't recognize that I released the mouse button.
Is there some way to fix the mouse without restarting X?
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
As promised, here is portix's script that I use for hints.
// HINTSTYLE: letter || number or whatever you want
var HINTSTYLE = "letter";
var elements = [];
var active_arr = [];
var hints;
var overlays;
var active;
var lastpos = 0;
focus_color = "#00ff00";
normal_color = "#ffff99";
opacity = 0.3;
border = "1px dotted #000000";
hint_foreground = "#ffffff";
hint_background = "#0000aa";
hint_border = "2px dashed #000000";
hint_opacity = 0.6;
hint_font_size = "12px";
hint_font_weight = "bold";
hint_font_family = "monospace";
vertical_offset = 0;
horizontal_offset = -10;
var letters_seq = "fdsartgbvecwxqyiopmnhzulkj"
// Hint
function Hint(element) {
this.element = element;
this.rect = element.getBoundingClientRect();
function create_span(element, h, v) {
var span = document.createElement("span");
var leftpos = Math.max((element.rect.left + document.defaultView.scrollX), document.defaultView.scrollX) + h;
var toppos = Math.max((element.rect.top + document.defaultView.scrollY), document.defaultView.scrollY) + v;
span.style.position = "absolute";
span.style.left = leftpos + "px";
span.style.top = toppos + "px";
return span;
}
function create_hint(element) {
var hint = create_span(element, horizontal_offset, vertical_offset - element.rect.height/2);
hint.style.fontSize = hint_font_size;
hint.style.fontWeight = hint_font_weight;
hint.style.fontFamily = hint_font_family;
hint.style.color = hint_foreground;
hint.style.background = hint_background;
hint.style.opacity = hint_opacity;
hint.style.border = hint_border;
hint.style.zIndex = 10001;
hint.style.visibility = 'visible';
return hint;
}
function create_overlay(element) {
var overlay = create_span(element, 0, 0);
overlay.style.width = element.rect.width + "px";
overlay.style.height = element.rect.height + "px";
overlay.style.opacity = opacity;
overlay.style.backgroundColor = normal_color;
overlay.style.border = border;
overlay.style.zIndex = 10000;
overlay.style.visibility = 'visible';
overlay.addEventListener( 'click', function() { click_element(element); }, false );
return overlay;
}
this.hint = create_hint(this);
this.overlay = create_overlay(this);
}
//NumberHint
NumberHint.prototype.getTextHint = function (i, length) {
start = length <=10 ? 1 : length <= 100 ? 10 : 100;
var content = document.createTextNode(start + i);
this.hint.appendChild(content);
}
NumberHint.prototype.betterMatch = function(input) {
var bestposition = 37;
var ret = 0;
for (var i=0; i<active_arr.length; i++) {
var e = active_arr[i];
if (input && bestposition != 0) {
var content = e.element.textContent.toLowerCase().split(" ");
for (var cl=0; cl<content.length; cl++) {
if (content[cl].toLowerCase().indexOf(input) == 0) {
if (cl < bestposition) {
ret = i;
bestposition = cl;
break;
}
}
}
}
}
return ret;
}
NumberHint.prototype.matchText = function(input) {
var ret = false;
if (parseInt(input) == input) {
text_content = this.hint.textContent;
}
else {
text_content = this.element.textContent.toLowerCase();
}
if (text_content.match(input)) {
return true;
}
}
// LetterHint
LetterHint.prototype.getTextHint = function(i, length) {
var text;
if (length < 26) {
text = letters_seq[i];
}
else {
text = letters_seq[parseInt(i/26)] + letters_seq[25-(i%26)];
}
var content = document.createTextNode(text);
this.hint.appendChild(content);
}
LetterHint.prototype.betterMatch = function(input) {
for (var i=0; i<active_arr.length; i++) {
var e = active_arr[i];
if (e.hint.textContent.indexOf(input.toLowerCase()) == 0) {
return i;
}
}
}
LetterHint.prototype.matchText = function(input) {
return this.hint.textContent.match(input.toLowerCase());
}
function LetterHint(element) {
this.constructor = Hint;
this.constructor(element);
}
LetterHint.prototype = new Hint();
function NumberHint(element) {
this.constructor = Hint;
this.constructor(element);
}
NumberHint.prototype = new Hint();
function show_hints() {
document.activeElement.blur();
var res = document.body.querySelectorAll('a, area, textarea, select, link, input:not([type=hidden]), button, frame, iframe');
hints = document.createElement("div");
overlays = document.createElement("div");
for (var i=0; i<res.length; i++) {
var e = HINTSTYLE.toLowerCase() == "letter" ? new LetterHint(res[i]) : new NumberHint(res[i]);
hints.appendChild(e.hint);
var rects = e.element.getClientRects()[0];
var r = e.rect;
if (!r || r.top > window.innerHeight || r.bottom < 0 || r.left > window.innerWidth || r < 0 || !rects ) {
continue;
}
var style = document.defaultView.getComputedStyle(e.element, null);
if (style.getPropertyValue("visibility") != "visible" || style.getPropertyValue("display") == "none") {
continue;
}
elements.push(e);
};
elements.sort( function(a,b) { return a.rect.top - b.rect.top; });
for (var i=0; i<elements.length; i++) {
var e = elements[i];
e.getTextHint(i, elements.length);
overlays.appendChild(e.overlay);
}
elements[0].overlay.style.backgroundColor = focus_color;
active_arr = elements;
document.body.appendChild(hints);
document.body.appendChild(overlays);
}
function is_input(element) {
var e = element.element;
var type = e.type.toLowerCase();
if (e.tagName == "INPUT" || e.tagName == "TEXTAREA" ) {
if (type == "radio" || type == "checkbox") {
e.checked = !e.checked;
}
else if (type == "submit" || type == "reset" || type == "button") {
click_element(element);
}
else {
e.focus();
}
return true;
}
return false;
}
function update_hints(input) {
var array = [];
if (input) {
input = input.toLowerCase();
}
for (var i=0; i<active_arr.length; i++) {
var e = active_arr[i];
if (e.matchText(input)) {
array.push(e);
}
else {
e.hint.style.visibility = 'hidden';
e.overlay.style.visibility = 'hidden';
}
}
active_arr = array;
if (array.length == 0) {
clear();
return;
}
else if (array.length == 1) {
return evaluate(array[0]);
}
else {
array[lastpos].overlay.style.backgroundColor = normal_color;
lastpos = array[0].betterMatch(input);
array[lastpos].overlay.style.backgroundColor = focus_color;
}
}
function clear() {
if (overlays.parentNode) {
overlays.parentNode.removeChild(overlays);
}
if (hints.parentNode) {
hints.parentNode.removeChild(hints);
}
elements = [];
active_arr = [];
active = undefined;
}
function evaluate(element) {
var ret;
var e = element.element;
if (!is_input (element) && e.href) {
if (e.href.match(/javascript:/) || (e.type.toLowerCase() == "button")) {
click_element(element);
}
else {
ret = e.href;
}
}
clear();
return ret;
}
function click_element(e) {
var mouseEvent = document.createEvent("MouseEvent");
mouseEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
e.element.dispatchEvent(mouseEvent);
clear();
}
function get_active() {
return evaluate(active);
}
function focus(newpos) {
active_arr[lastpos].overlay.style.backgroundColor = normal_color;
active_arr[newpos].overlay.style.backgroundColor = focus_color;
active = active_arr[newpos];
lastpos = newpos;
}
function focus_next() {
var newpos = lastpos == active_arr.length-1 ? 0 : lastpos + 1;
focus(newpos);
}
function focus_prev() {
var newpos = lastpos == 0 ? active_arr.length-1 : lastpos - 1;
focus(newpos);
}
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
@bernarcher : I tried your new patch .. there is no problem for patching source file and compile.
but JumNav v0.3 doesn't work either ... it doesn't show me anything on the web page...
Now, that is really bad.
To check if your copy isn't corrupted could you please insert this "alert" statement after line 1187 so that it reads:
function show_hints() {
alert("Starting JumNav");
initCollSequence();
After calling the script from jumanji there should this message display at least.
To know or not to know ...
... the questions remain forever.
Offline
no alert appear so redownload the script from http://pastebin.com/n2fuNn4B .
Then is works, I see number, some on the correct link some others in the midle of nowhere ...
Offline
As promised, here is portix's script that I use for hints.
// HINTSTYLE: letter || number or whatever you want var HINTSTYLE = "letter"; var elements = []; var active_arr = []; var hints; var overlays; var active; var lastpos = 0; focus_color = "#00ff00"; normal_color = "#ffff99"; opacity = 0.3; border = "1px dotted #000000"; hint_foreground = "#ffffff"; hint_background = "#0000aa"; hint_border = "2px dashed #000000"; hint_opacity = 0.6; hint_font_size = "12px"; hint_font_weight = "bold"; hint_font_family = "monospace"; vertical_offset = 0; horizontal_offset = -10; var letters_seq = "fdsartgbvecwxqyiopmnhzulkj" // Hint function Hint(element) { this.element = element; this.rect = element.getBoundingClientRect(); function create_span(element, h, v) { var span = document.createElement("span"); var leftpos = Math.max((element.rect.left + document.defaultView.scrollX), document.defaultView.scrollX) + h; var toppos = Math.max((element.rect.top + document.defaultView.scrollY), document.defaultView.scrollY) + v; span.style.position = "absolute"; span.style.left = leftpos + "px"; span.style.top = toppos + "px"; return span; } function create_hint(element) { var hint = create_span(element, horizontal_offset, vertical_offset - element.rect.height/2); hint.style.fontSize = hint_font_size; hint.style.fontWeight = hint_font_weight; hint.style.fontFamily = hint_font_family; hint.style.color = hint_foreground; hint.style.background = hint_background; hint.style.opacity = hint_opacity; hint.style.border = hint_border; hint.style.zIndex = 10001; hint.style.visibility = 'visible'; return hint; } function create_overlay(element) { var overlay = create_span(element, 0, 0); overlay.style.width = element.rect.width + "px"; overlay.style.height = element.rect.height + "px"; overlay.style.opacity = opacity; overlay.style.backgroundColor = normal_color; overlay.style.border = border; overlay.style.zIndex = 10000; overlay.style.visibility = 'visible'; overlay.addEventListener( 'click', function() { click_element(element); }, false ); return overlay; } this.hint = create_hint(this); this.overlay = create_overlay(this); } //NumberHint NumberHint.prototype.getTextHint = function (i, length) { start = length <=10 ? 1 : length <= 100 ? 10 : 100; var content = document.createTextNode(start + i); this.hint.appendChild(content); } NumberHint.prototype.betterMatch = function(input) { var bestposition = 37; var ret = 0; for (var i=0; i<active_arr.length; i++) { var e = active_arr[i]; if (input && bestposition != 0) { var content = e.element.textContent.toLowerCase().split(" "); for (var cl=0; cl<content.length; cl++) { if (content[cl].toLowerCase().indexOf(input) == 0) { if (cl < bestposition) { ret = i; bestposition = cl; break; } } } } } return ret; } NumberHint.prototype.matchText = function(input) { var ret = false; if (parseInt(input) == input) { text_content = this.hint.textContent; } else { text_content = this.element.textContent.toLowerCase(); } if (text_content.match(input)) { return true; } } // LetterHint LetterHint.prototype.getTextHint = function(i, length) { var text; if (length < 26) { text = letters_seq[i]; } else { text = letters_seq[parseInt(i/26)] + letters_seq[25-(i%26)]; } var content = document.createTextNode(text); this.hint.appendChild(content); } LetterHint.prototype.betterMatch = function(input) { for (var i=0; i<active_arr.length; i++) { var e = active_arr[i]; if (e.hint.textContent.indexOf(input.toLowerCase()) == 0) { return i; } } } LetterHint.prototype.matchText = function(input) { return this.hint.textContent.match(input.toLowerCase()); } function LetterHint(element) { this.constructor = Hint; this.constructor(element); } LetterHint.prototype = new Hint(); function NumberHint(element) { this.constructor = Hint; this.constructor(element); } NumberHint.prototype = new Hint(); function show_hints() { document.activeElement.blur(); var res = document.body.querySelectorAll('a, area, textarea, select, link, input:not([type=hidden]), button, frame, iframe'); hints = document.createElement("div"); overlays = document.createElement("div"); for (var i=0; i<res.length; i++) { var e = HINTSTYLE.toLowerCase() == "letter" ? new LetterHint(res[i]) : new NumberHint(res[i]); hints.appendChild(e.hint); var rects = e.element.getClientRects()[0]; var r = e.rect; if (!r || r.top > window.innerHeight || r.bottom < 0 || r.left > window.innerWidth || r < 0 || !rects ) { continue; } var style = document.defaultView.getComputedStyle(e.element, null); if (style.getPropertyValue("visibility") != "visible" || style.getPropertyValue("display") == "none") { continue; } elements.push(e); }; elements.sort( function(a,b) { return a.rect.top - b.rect.top; }); for (var i=0; i<elements.length; i++) { var e = elements[i]; e.getTextHint(i, elements.length); overlays.appendChild(e.overlay); } elements[0].overlay.style.backgroundColor = focus_color; active_arr = elements; document.body.appendChild(hints); document.body.appendChild(overlays); } function is_input(element) { var e = element.element; var type = e.type.toLowerCase(); if (e.tagName == "INPUT" || e.tagName == "TEXTAREA" ) { if (type == "radio" || type == "checkbox") { e.checked = !e.checked; } else if (type == "submit" || type == "reset" || type == "button") { click_element(element); } else { e.focus(); } return true; } return false; } function update_hints(input) { var array = []; if (input) { input = input.toLowerCase(); } for (var i=0; i<active_arr.length; i++) { var e = active_arr[i]; if (e.matchText(input)) { array.push(e); } else { e.hint.style.visibility = 'hidden'; e.overlay.style.visibility = 'hidden'; } } active_arr = array; if (array.length == 0) { clear(); return; } else if (array.length == 1) { return evaluate(array[0]); } else { array[lastpos].overlay.style.backgroundColor = normal_color; lastpos = array[0].betterMatch(input); array[lastpos].overlay.style.backgroundColor = focus_color; } } function clear() { if (overlays.parentNode) { overlays.parentNode.removeChild(overlays); } if (hints.parentNode) { hints.parentNode.removeChild(hints); } elements = []; active_arr = []; active = undefined; } function evaluate(element) { var ret; var e = element.element; if (!is_input (element) && e.href) { if (e.href.match(/javascript:/) || (e.type.toLowerCase() == "button")) { click_element(element); } else { ret = e.href; } } clear(); return ret; } function click_element(e) { var mouseEvent = document.createEvent("MouseEvent"); mouseEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); e.element.dispatchEvent(mouseEvent); clear(); } function get_active() { return evaluate(active); } function focus(newpos) { active_arr[lastpos].overlay.style.backgroundColor = normal_color; active_arr[newpos].overlay.style.backgroundColor = focus_color; active = active_arr[newpos]; lastpos = newpos; } function focus_next() { var newpos = lastpos == active_arr.length-1 ? 0 : lastpos + 1; focus(newpos); } function focus_prev() { var newpos = lastpos == 0 ? active_arr.length-1 : lastpos - 1; focus(newpos); }
Thank you for this, but sadly, it does not work. Copy/pasted exactly, repulled git, updated config, opened browser.
Hit f, hints appear, type hint, hit enter... nothing.
Maybe something else is wrong with my system...
//github/
Offline
Then is works, I see number, some on the correct link some others in the midle of nowhere ...
It works at all - what a relief! Thanks for your efforts.
About those misplaced links, try to toggle the display modes (raw/not raw) when in navigation mode (where you see the element links only). In many cases raw mode will better locate them. Meanwhile I did change the positioning functions slightly so that most links will be better placed from start. A new JumNav version I will post the next days. (There are a few annoying quirks to solve before.)
About switching modes please see the comments on top of the script (see also here). And have a look at the user configuration section. I'd like to know whether this toggle concept actually works elsewhere.
Last edited by bernarcher (2010-08-19 07:50:02)
To know or not to know ...
... the questions remain forever.
Offline
brisbin, this script uses alphabets as hints. I don't even have to hit enter ...just the two alphabets on the link that I am trying to go to. By the way, are you using a different branch maybe? I am just using the aur package.
if it helps here's my jumanjirc
# jumanji configuration
# search engines
searchengine ggl http://www.google.com/search?q=%s
searchengine wiki http://en.wikipedia.org/w/index.php?search=%s
searchengine awiki http://wiki.archlinux.org/index.php?search=%s
# browser settings
set homepage http://www.google.com/ig
set auto_save 60
# look
set font monospace normal 9
set stylesheet file:///home/inxsible/.config/jumanji/style.css
# follow hints
script ~/.config/jumanji/scripts/hints.js
# downloads
set download_dir ~/downloads/
set download_command urxvt -e sh -c "wget --load-cookies ~/.config/jumanji/cookies '%s' -O %s";
# keybindings
#map <C-,> nav_history previous
#map <C-.> nav_history next
# key maps
map J nav_tabs next
map K nav_tabs previous
map H nav_history previous
map L nav_history next
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
brisbin, this script uses alphabets as hints. I don't even have to hit enter ...just the two alphabets on the link that I am trying to go to. By the way, are you using a different branch maybe? I am just using the aur package.
if it helps here's my jumanjirc
# jumanji configuration # search engines searchengine ggl http://www.google.com/search?q=%s searchengine wiki http://en.wikipedia.org/w/index.php?search=%s searchengine awiki http://wiki.archlinux.org/index.php?search=%s # browser settings set homepage http://www.google.com/ig set auto_save 60 # look set font monospace normal 9 set stylesheet file:///home/inxsible/.config/jumanji/style.css # follow hints script ~/.config/jumanji/scripts/hints.js # downloads set download_dir ~/downloads/ set download_command urxvt -e sh -c "wget --load-cookies ~/.config/jumanji/cookies '%s' -O %s"; # keybindings #map <C-,> nav_history previous #map <C-.> nav_history next # key maps map J nav_tabs next map K nav_tabs previous map H nav_history previous map L nav_history next
//blue/0/~/ aurget -Ss jumanji-git
aur/jumanji-git 20100717-1
a web browser
//blue/0/~/ pacman -Qs jumanji
local/jumanji-git 20100717-1
a web browser
//blue/0/~/ head ~/.config/jumanji/scripts/dwb2_hints.js
// HINTSTYLE: letter || number or whatever you want
var HINTSTYLE = "letter";
var elements = [];
var active_arr = [];
var hints;
var overlays;
var active;
var lastpos = 0;
focus_color = "#00ff00";
//blue/0/~/ grep ^script .config/jumanji/jumanjirc
script ~/.config/jumanji/scripts/dwb2_hints.js
i have to be overlooking something dumb . the letters appear on 'f', hitting the first character does not narrow down the visible links, but when i type the second character, the link i chose is the only one visible on screen... but nothing further happens.
oh well, maybe when webkit gets fixed we'll get built-in hinting.
Last edited by brisbin33 (2010-08-19 13:28:34)
//github/
Offline
I don't see anything that pops out to be different either
what branch are you using?
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
that's the one I am using. I last updated on Aug 8. Maybe something changed after that?
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
@brisbin33 did you try the dwb2_hints.js I linked you at post #476 ?
Offline
@brisbin33 did you try the dwb2_hints.js I linked you at post #476 ?
Didn't notice that link there, thanks... will try that one too, diff showed some stuff against Inxsible's
Won't be back (physically) to my computer for a while, but I'll report back eventually. Thanks.
Last edited by brisbin33 (2010-08-19 18:49:55)
//github/
Offline
Wow, this is really nice.
Offline
would there be a way to use vimprobable2's/vimperator's hints instead?
Offline
Am I the only one where download feature crash because "~" isn't recognize ??
EDIT : another thing :
{GDK_CONTROL_MASK, GDK_Tab, isc_completion, { NEXT_GROUP } },
doesn't work but
{GDK_CONTROL_MASK, GDK_l, isc_completion, { NEXT_GROUP } },
work ...
EDIT : I corrected the bug and send the patch to the jumanji dev ... it's in the main branch since this morning.
Last edited by akira86 (2010-08-22 15:08:25)
Offline
what do people use for the download_command? I tried using wget, but it doesn't have my account information when I need to download a file that requires an account on a site.
Offline
default download command is :
"xterm -e sh -c \"wget --load-cookies ~/.config/jumanji/cookies '%s' -O '%s'\""
but I had to change it since "~" isn't recognize for me, in jumanjirc :
set download_dir /home/max/downloads/
set download_command xterm -e wget --load-cookies /home/max/.config/jumanji/cookies '%s' -O '%s'
Last edited by akira86 (2010-08-23 17:52:14)
Offline
Thanks that works for me. Also, ~ works for me...
Offline
its sad, but i've noticed a very slow work of jumanji on my PC (its atom330 based).
For example mouseclicks, pagescroll, interacting with inputs, opening new page an so on - are MUCH faster in vimprobable+tabbed than in jumanji.
i wonder if i (or developer) can fix it?
Offline
I don't see a way to disable/toggle javascript. Does anyone know how to do that?
@cf8: same problem here. ;(
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
i hope you can continue coding, because i like this browser you are coding. i like surf in terminal and this browser. looks so cool, even though i have not used that uzbl, after i saw some post at here, i am trying . i hope you can create a simple but useful can comfortable vimprobable. when i back to school, i will feel your result. so exiting....
(my english is poor , hope you can understand my mean.
)
Hack
Like computer , code , linux , hack .
Offline
yeah. jumanji is a great all-in-one but simple and light browser. also it uses some of vimprobable code.
but i wonder why it has this speed regression...
Offline