The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features

See the new Forums

Custom Search Button (not engine specific)

Forums » General Opera topics » Customizing Opera

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

6. November 2011, 04:00:07

jabcreations

Posts: 112

Custom Search Button (not engine specific)

Is there a way to create a "Search" button just like the go button though obviously for the search field please?

6. November 2011, 05:23:59

spadija

Posts: 1643

Probably. Check here and search the page for "Search". There are a number of commands that look like they could be useful in creating a search button. I'm not sure what they all do though.

You may need to use a sequence of commands. For example like "Show web search & Delay, 100 & Insert, "stuff" & Go" would use the default search engine to search for "stuff". operawiki has a number of useful articles about creating buttons.

6. November 2011, 09:41:47

Moderator

sgunhouse

Volunteer

Posts: 66788

Why not just use the Go button? As I recall, it applies to whichever field is to the immediate left of it - not just the address field. Mind you, changing the title in that case would be a good idea ...

6. November 2011, 09:44:30

jabcreations

Posts: 112

Originally posted by sgunhouse:

Why not just use the Go button? As I recall, it applies to whichever field is to the immediate left of it - not just the address field. Mind you, changing the title in that case would be a good idea ...



Just tried that and it doesn't work, thanks though.

6. November 2011, 13:15:56

spadija

Posts: 1643

Whoops, I think I misread your original post a bit.

What about "Focus search field & Delay, 100 & Go"?

6. November 2011, 13:19:17

jabcreations

Posts: 112

That sounds like what I want...why the delay though? A search button and a separate search and go button would be the most ideal.

6. November 2011, 19:08:59

spadija

Posts: 1643

When you string together commands (especially ones that affect the UI) Opera doesn't necessarily wait for the previous command to finish before it starts the next one. Adding the delay makes sure the search field is focused before the next command happens. The delay might not be necessary though if focusing the search field happens instantly. You can try it without and see if it works.

7. November 2011, 08:33:50

jabcreations

Posts: 112

Alright I understand, I've encountered that scenario with JavaScript on occasion.

So is it possible to at least get a normal search button equivalent to the Go button?

7. November 2011, 22:55:25

jabcreations

Posts: 112

Originally posted by spadija:

Does one" target="_blank">http://homepage.hispeed.ch/ttt-o/button/h-bu-browser-adv.html#browsergoclear]one of these work?



Thanks for the suggestion though no and I went through every one I thought might be relevant.

7. November 2011, 23:12:20

spadija

Posts: 1643

So, you just want a "Go" button for the existing search field, right? I just built this one using this useful tool and the action I posted above and it works for me.

8. November 2011, 19:02:08 (edited)

jabcreations

Posts: 112

That works though I'm having trouble with the commands and text posted on the forums with what seems to work in the actual standard_toolbar.ini file.

Here are the two search buttons I was able to get working. Button7 is vertically taller but has the Go button icon. Button8 has the correct search icon but is not as vertically tall as button7. Also every time I try to try to make linkable buttons Opera gives me "external action" text. I did get the paste feature working somehow but I have a lot of notes at the moment that I need to sort out. Can you please help me out with that?

Button7, "Search"=Focus search field, , , "Search", "Forward" & Delay, 10 & Go
Button8, "Search"=Focus search field, , , , "Search" & Delay, 10 & Go



Paste and Go

Button9, "Paste and Search"=Focus search field, , , , "Search" & Delay, 10 & Paste & Go

8. November 2011, 19:17:55

spadija

Posts: 1643

I'm not sure what you mean about "external action" text.

Try using "Panel Search" for the icon instead of "Search" (link). The regular search icon is 16x16 instead of 22x22. This extension is very useful when you're searching for a specific icon.

Also, I've never been good at writing buttons in INI files and getting them to work. What problems are you having with it?

8. November 2011, 20:33:04

jabcreations

Posts: 112

That extension is pretty nifty (took me a second to spot it on the toolbar), thanks!

What I want to do is share the buttons I've created by creating links to the commands that add the buttons to Opera's custom toolbar button menu. The problem is that while I have the buttons in the toolbars and I know what the code is inside of the standard_toolbar.ini file every time I try to create a link like yours it goofs up and gives me some weird text-label name for the button. I want very specific button names however Opera, you, the websites and everything seems to disagree on which parameter (separated by the commas) are what. In other words there is no set rule established for item 1, item 2, item 3, item 4, item 5 (separated by the commas) but I do see that is how the commands are generated. I know that opera:/button/ is put before the command.

So here is my code for the buttons directly from the standard_toolbar.ini file. Without making an actual link using url = could you please quote the text that I would put in to the BBcode url = command? That would help me greatly clarify what is what I think.

"Search" (just a search button)

Button6, "Search"=Focus search field, , , "Search", "Panel Search" & Delay, 10 & Go



"Paste & Search" give focus to the field, paste, executes search

Button7, "Paste & Search"=Focus search field, , , , "Panel Search" & Delay, 10 & Paste & Go

8. November 2011, 20:52:44

spadija

Posts: 1643

Ah. I've just been using the tool I linked to earlier to generate the links, but the basic format is listed lower on that page.

The format for one action is:
Action, Param1, Param2, Title, Icon
Where you can omit any unused parameters from the end and concatenate multiple actions together with & (perform in sequence), | (perform the second if the first cannot be performed), > (cycle through the actions with each click), or + (perform the second action if the button is clicked and held).

Then, url encode the whole thing (that is, change all the spaces to %20 and all the quotes to %22. You don't seem to need to encode other symbols like commas and ampersands.) and stick opera:/button/ at the beginning of it.

The first one would be opera:/button/Focus%20search%20field,,,%22Search%22,%22Panel%20Search%22%20&%20Delay,10%20&%20Go.

The second is opera:/button/Focus%20search%20field,,,%22Paste%20&%20Search%22,%22Panel%20Search%22%20&%20Delay,10%20&%20Paste%20&%20Go

8. November 2011, 21:03:35

jabcreations

Posts: 112

One of the problems I'm having is that when people give me linked buttons it creates padding inside of the button on the right side, I'd say about 60-100 pixels.

So when I go in to the standard_toolbar.ini file it seems I can generally fix that by manually changing...

Button6, "Focus search field"=Focus search field, , , "Search", "Panel Search" & Delay, 10 & Go



...to...

Button6, "Search"=Focus search field, , , "Search", "Panel Search" & Delay, 10 & Go



I don't want to share broken links with people when I repost it though which is the problem. Try adding those buttons yourself, you should see one of them adding some unnecessary padding.

8. November 2011, 21:07:45

spadija

Posts: 1643

I don't get the same behavior. Neither button gives me extra padding. Where are you putting this button? What display mode is the toolbar using (Images only, Images and text on right, etc.)?

8. November 2011, 21:09:50

jabcreations

Posts: 112

Hm, I think a missing factor is that my site is served as applicationn/xhtml+xml so ampersands have to be encoded however I'm using HTML entities, not the encoding you and Opera are using. I can't think of anything else right now.

8. November 2011, 21:11:42

spadija

Posts: 1643

In that case, you could try url encoding the ampersands as %26 too. I don't know whether that works though.

8. November 2011, 21:19:27

jabcreations

Posts: 112

Here is the XHTML code using the exact text you posted with the only modification being I replaced the ampersands with %26. I click on the links on the localhost version of my site and the custom toolbar window appears, I drag them to the main toolbar (I want them on the address bar toolbar where these buttons are modified manually in the actual configuration file) for testing (instead of the address bar since those ones already work and have no padding).

<div><a href="opera:/button/Focus%20search%20field,,,%22Search%22,%22Panel%20Search%22%20%26%20Delay,10%20%26%20Go">Opera Search Button</a></div>

<div><a href="opera:/button/Focus%20search%20field,,,%22Paste%20%26%20Search%22,%22Panel%20Search%22%20%26%20Delay,10%20%26%20Paste%20%26%20Go">Opera Paste and Search Button</a></div>

9. November 2011, 06:29:03

Moderator

sgunhouse

Volunteer

Posts: 66788

button

Presuming they've fixed it, the forum's "opbut" syntax is a lot easier to use ...

9. November 2011, 07:01:17

spadija

Posts: 1643

Didn't know about that. To use it, use [ opbut=Action goes here ]Link text goes here[/ opbut ] without the spaces in the BBCode tabs.

9. November 2011, 09:44:27

Moderator

sgunhouse

Volunteer

Posts: 66788

I just dropped as many spaces as I could for length, it handles spaces fine (as in, no need to convert). Sometime last month they were having issues with it, but it looks correct now. The "Link text" is the button label, the actual text displayed is always "button" unfortunately.

9. November 2011, 17:11:14

jabcreations

Posts: 112

Originally posted by sgunhouse:

button

Presuming they've fixed it, the forum's "opbut" syntax is a lot easier to use ...



THAT button works but I still can't get any link to work on my site without any problems. That button comes out with the text label "Focus search field" when I want it to be search instead. I have to somehow have ampersands encoded too since my site is served as application/xhtml+xml. I've tried %26 and the HTML entity & without success.

<div><a href="opera:/button/Focus%20search%20field,,,,&#34;Panel%20Search&#34;&#38;Delay,10&#38;Go">Opera Search Button fixed?!</a></div>


Since this code directly in the toolbar ini file works...

Button6, "Search"=Focus search field, , , "Search", "Panel Search" & Delay, 10 & Go


I've tried to trick Opera in to accepting the following and it relabels the button as "external action"...

<div><a href="opera:/button/&#34;Search&#34;=Focus search field, , , &#34;Search&#34;, &#34;Panel Search&#34; &#38; Delay, 10 &#38; Go">Opera Search Button fixed?!</a></div>

9. November 2011, 18:15:55

spadija

Posts: 1643

Quoted from this page's source:
<a href="opera:/button/Focus%20search%20field,,,%22Go%22,Forward%20&amp;%20Delay,10%20&amp;%20Go" target="_blank">this one</a>


This is the code used by the forum. I doubt the target="_blank" is necessary, but spaces are encoded as %20, quotes as %22, and ampersands as &.

EDIT: Also, to set the text of the button, you use the fourth parameter. (The %22Go%22 in the above link) If you don't set anything, Opera decides on its own what the text should be.

10. November 2011, 09:10:39

Moderator

sgunhouse

Volunteer

Posts: 66788

Opera will automatically use the title attribute of the link (if one is set), otherwise it uses the name of the first command. The opbut command takes care of this for you, if you were actually creating a link in the forum (using the URL tag) you'd have to also use an ABBR (abbreviation) tag to set the title. In HTML, just add a title="Search" as part of the tag.

Forums » General Opera topics » Customizing Opera