Development :  K-Meleon Forum
K-Meleon development related discussions. 
searchbar plugin v0.1
Posted by: rmn
Date: April 22, 2006 08:20PM

searchbar plugin

This plugin adds a search bar to K-Meleon.


Changes in v0.1:

* Uses "kmeleon.general.searchEngine" instead of "keyword.URL".
* Added "kmeleon.plugins.searchbar.openurl" pref.


Credits:

The openurl code is copied from the Bookmarks / Favorites / Hotlist plugins and originally written by Ulf.

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: alain aupeix chez wanadoo fr
Date: April 23, 2006 03:20AM

@rmn,

Searchbar uses now the k-Meleon default (last used or locked) engine. ok

But it doesn't open in a good mode. I choose to open new search in a new layer. It works with menus, but not with searchbar.

A+

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: rmn
Date: April 23, 2006 10:59AM

That's because this plugin uses a different way to set where to display a search; better than the search macros, which cannot open in new layers unless you are using layers-only mode.

From the readme:

The pref "kmeleon.plugins.searchbar.openurl" can be used to change where the
search is displayed. Possible choices:
- ID_OPEN_LINK: current layer/window (default)
- ID_OPEN_LINK_IN_NEW_WINDOW: new foreground window
- ID_OPEN_LINK_IN_BACKGROUND: new background window
- layers(OpenURL): new foreground layer
- layers(OpenURLBg): new background layer

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: alain aupeix chez wanadoo fr
Date: April 24, 2006 02:04AM

I have modified three macros to have the same open mode as with menu:

SN0{
setpref(INT,$so,0); &EngineSync;
setpref(STRING,"kmeleon.plugins.searchbar.openurl","ID_OPEN_LINK");
}
SN1{
setpref(INT,$so,1); &EngineSync;
getpref(BOOL,"kmeleon.plugins.layers.catchOpen")==true ? $mode="layers(OpenURL)":$mode="ID_OPEN_LINK_IN_NEW_WINDOW";
setpref(STRING,"kmeleon.plugins.searchbar.openurl",$mode)
}
SN2{
setpref(INT,$so,2); &EngineSync;
getpref(BOOL,"kmeleon.plugins.layers.catchOpen")==true ? $mode="layers(OpenURLBg)":$mode="ID_OPEN_LINK_IN_BACKGROUND";
setpref(STRING,"kmeleon.plugins.searchbar.openurl",$mode)
}

With this modifs, we have only 3 modes possibles, but it's better than nothing, and as I use "Layers only", it works exactly the same ...

If mode isn't layers only, it opens in 'new window' or 'new window in background'

A+

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: jsnj
Date: April 24, 2006 01:42PM

...the search macros, which cannot open in new layers unless you are using layers-only mode.

Hi guys :-) Haven't been around here as much lately and haven't tried this plugin, but unless the search script was altered in subsequent updates from when I wrote it for KMv0.9, the above is an incorrect statement. As long as layers are enabled, you can open the search results in a new layer. Works in both Layers & Windows mode and Layers Only mode. Windows Only mode disables the layers plugin so obviously you can't open in a new layer in that mode. Perhaps you meant "cannot open in background window when layers are enabled". That would be true.


If mode isn't layers only, it opens in 'new window' or 'new window in background'

The layers catch pref & related javascript mode prefs weren't part of the original search script, nor should they be. Again, unless the script has been altered, as long as the layers plugin is enabled you can open the search results in a new layer. You don't have to be in Layers Only mode. Enabling the layers plugin doesn't automatically mean you're in Layers Only mode. I've recently downloaded the latest beta and this "mode" stuff has been abandoned in favor of more options, so hopefully there'll be less confusion in v1.0 :-)

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: alain aupeix chez wanadoo fr
Date: April 24, 2006 03:45PM

Hi, jsnj,

happy to see you again ...

A+

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: rmn
Date: April 24, 2006 04:03PM

Hey, glad to hear from you again.

> unless the search script was altered in subsequent updates from when I wrote it for KMv0.9, the above is an incorrect statement

Hm... now that you say it.... :-)

But, for the record, I'm not going to change the plugin's behavior for now, even though it is inconsistent with the search macros.

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: alain aupeix chez wanadoo fr
Date: April 25, 2006 02:01AM

Yes, jsnj, the reference to catch pref wasn't in search macros, but it's the simplest way I have quickly found to automaticly choose the search open mode, without having to create a new macro to choose manually the mode.

I think it's possible to complicate SNx macros to have the complete feature (5 modes), with just a macro more, when layers and windows are enable, to make the choice.

I also have idea to modify the search engine macro and in it update the searchbar title.

A+

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: alain aupeix chez wanadoo fr
Date: April 25, 2006 02:32AM

A line to had to a macro to change the searchbar title (unfortunately not dynamic, needs a start/stop)

EngineSync{
...

setpref(STRING,"kmeleon.plugins.searchbar.title",getpref(STRING, $sen));
}

A+

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: jsnj
Date: April 25, 2006 02:56PM

Yes, jsnj, the reference to catch pref wasn't in search macros, but it's the simplest way I have quickly found to automaticly choose the search open mode, without having to create a new macro to choose manually the mode.

You're checking the wrong pref though. The layers "catchOpen" pref is irrelevant in the search script. You only need to check to see if the layers plugin is enabled to keep sync for the searchbar plugin & search macros open options. The following should work. Didn't test it though.

$sbo="kmeleon.plugins.searchbar.openurl";

SN0{
setpref(INT,$so,0); setpref(STRING,$sbo,"ID_OPEN_LINK"); &EngineSync;
}
SN1{
$layer==true ? $hw="layers(OpenURL)":$hw="ID_OPEN_LINK_IN_NEW_WINDOW";
setpref(INT,$so,1); setpref(STRING,$sbo,$hw); &EngineSync;
}
SN2{
$layer==true ? $hw="layers(OpenURLBg)":$hw="ID_OPEN_LINK_IN_BACKGROUND";
setpref(INT,$so,2); setpref(STRING,$sbo,$hw); &EngineSync;
}


I think it's possible to complicate SNx macros to have the complete feature (5 modes), with just a macro more, when layers and windows are enable, to make the choice.

I don't ever remember seeing any requests for that. But again, I've been absent recently. I'd be surprised if there were a single one though. I don't think any browsers with tabs have the option to open search results in a new external window(foreground or background) when tabs are enabled. It's relatively easy to do with a couple more macros though.

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: rmn
Date: April 25, 2006 07:09PM

> I don't think any browsers with tabs have the option to open search results in a new external window(foreground or background) when tabs are enabled.

I'm thinking to remove the feature (bloat?) altogether from future versions of the plugin. Opening a new window/layer before running a search is too easy.

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: rmn
Date: April 25, 2006 07:24PM

> Opening a new window/layer before running a search is too easy.

I meant to say:
Manually opening a new window/layer before running a search is too easy.

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: alain aupeix chez wanadoo fr
Date: April 26, 2006 04:05AM

@rmn,

I don't use new window, but new layers, and as I'm a little the head in the clouds sometimes, I will often forget to open it before searching, and I will often be ennoyed by this.

I dont think it's a problem to keep the feature. The guys use it or no.

After, macros adaptations are just probably a technical problem for me or jsnj or others...

Bloat ? why? it don't must keep much memory are resources...

A+

Options: ReplyQuote
Re: searchbar plugin v0.1
Posted by: ndebord
Date: April 26, 2006 10:55PM

rmn,

I almost always remember to hit Ctrl T and then search from a new window even though my practice is to use KM 0.9 in layers mode

N

Options: ReplyQuote


K-Meleon forum is powered by Phorum.