Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
Command IDs question
Posted by: JohnHell
Date: May 07, 2005 12:47AM

I can't found in the docs if i can send any value to a command id to be executed. Is this possible? I guess not.

I was using a modified version of the highlight macro to display text on a web, but I want to go to the position of that text too, not only highlight or maybe, to avoid an stupid step as hightlight, to directly go to that text. As if you use "search as you type". But with this command you neither can send a value to go to that word directly so... any advices?

Thank you.

Options: ReplyQuote
Re: Command IDs question
Posted by: rmn
Date: May 08, 2005 12:25AM

> I can't found in the docs if i can send any value to a command id to be executed. Is this possible? I guess not.

You mean like id(ID_EDIT_FIND, $text);? No, you can't. sad smiley

> I was using a modified version of the highlight macro to display text on a web, but I want to go to the position of that text too, not only highlight or maybe, to avoid an stupid step as hightlight, to directly go to that text. As if you use "search as you type". But with this command you neither can send a value to go to that word directly so... any advices?

Perhaps you can ask in javascript-related forums for a "bookmarklet to immitate Find dialogs" or something.... And by the way, why not use the Find dialog?

Options: ReplyQuote
Re: Command IDs question
Posted by: JohnHell
Date: May 09, 2005 03:15PM

I was trying to make macro to mark page, as when you read a book you use a paper to mark where you left the reading. But as i said the focus doesn't go to the highlighted text, the macro was this:

NOTE THAT THE VARIABLES AND FUNCTIONS NAMES ARE IN SPANISH.
THE FIRST AND SECOND FUNCTION ARE TO USE IN MENUS.CFG OR ACCEL.CFG.
### MARCA PAGINAS

marcapagina{
$salvaclip = getclipboard();
id(ID_EDIT_COPY);
$marcastr = getclipboard();
$marca=setpref(STRING, "marcapaginas.".$url, $marcastr);
setclipboard($salvaclip);
}

recuperapagina{
$marca=getpref(STRING, "marcapaginas.".$url);
$marca != "" ? &mihighlight:alert("Lo siento, no hay marcapágina para esta página, revisa la URL.");
}

mihighlight{
open("javascriptsad smileyfunction(){var count=0, text, dv;text='".$marca."';dv=document.defaultView;function searchWithinNode(node, te, len){var pos, skip, spannode, middlebit, endbit, middleclone;skip=0;if( node.nodeType==3 ){pos=node.data.toUpperCase().indexOf(te);if(pos>=0){spannode=document.createElement(%22SPAN%22);spannode.style.backgroundColor=%22yellow%22;middlebit=node.splitText(pos);endbit=middlebit.splitText(len);middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);++count;skip=1;}}else if( node.nodeType==1&& node.childNodes&& dv.getComputedStyle(node, null).getPropertyValue(%22display%22)!=%22none%22){for (var child=0; child < node.childNodes.length; ++child){child=child+searchWithinNode(node.childNodes[child], te, len);}}return skip;}window.status=%22Searching for '%22+text+%22'...%22;searchWithinNode(document.body, text.toUpperCase(), text.length);window.status=%22Found %22+count+%22 occurrence%22+(count==1?%22%22:%22s%22)+%22 of '%22+text+%22'.%22;})();");
}

Options: ReplyQuote
Re: Command IDs question
Posted by: jsnj
Date: May 09, 2005 10:30PM

I was trying to make macro to mark page, as when you read a book you use a paper to mark where you left the reading.

Just enable typeaheadfind in menus via Tools - Page Search - Find As You Type. Then uncheck Links Only. Now when reading a page, just start typing the word you wish to highlight and it'll go to it and highlight it. Then you can go to another layer or window and the word will remain highlighted in the previous layer/window.

Options: ReplyQuote
Re: Command IDs question
Posted by: JohnHell
Date: May 10, 2005 12:19AM

I don't mean that.

Yes, I know that about "find as you type" because I have enabled and I use it often.

But i don't mean that. Did you understand what is a mark for a book (i don't know its name in english)? You use it to mark when you left reading.

Ok, imagine you are reading a very hugh document on the net, you are tired and left it for that moment. Ok, you use the macro, selecting the text you left and you enter then as permanent variable, using prefs.js, to know where you left.

Then you go back to the document another day and you want to go where you left. You use the macro to recover it and continue. Isn't nothing strange.

The thing I was searching for is to focus or hightlight (the macro already highlights), or whatever you can understand, the text AND THE WINDOW to the zone where the text you left reading is.

Maybe is impossible with the language level, but the macro I already did highlights the text and you can down the document to find where you left it and it's already a good aid, but only just wanted to make more useful grinning smiley I think is utopian(?) :/

Options: ReplyQuote
Re: Command IDs question
Posted by: jsnj
Date: May 10, 2005 06:26PM

There's no way I know of to do that. What you'd probably like is more comprehensive session saving like in Opera and FFw/Session Saver, both of which save the scrolling position on the page and take you to the exact spot you left off.

Options: ReplyQuote
Re: Command IDs question
Posted by: JohnHell
Date: May 10, 2005 06:43PM

That would be possible if there would be any possibility to focus where your left, but... no way.

Indeed the macro is not for me, it was an idea someone left in a newsgroup about a wish for a plugin for firefox and I though that would be easy to do in KM smiling smiley

Options: ReplyQuote


K-Meleon forum is powered by Phorum.