bpm's Operations Room

understanding & extending Opera

Buttons

(last updated 2010-3-16) (green links are button-installer tags)

Some button lore and links, and about 20 buttons: mostly from me with a few favorites from others; mostly useful, with a few whose value is chiefly as demos or explorations.

Button lore
  • the things you click or drag in order to install a toolbar button are for the most part loosely referred to as "buttons", but really they're pseudolinks: HTML address tags which Opera.ASA has repurposed, using them as a way to package function code. There's an installer in Opera that reads them and adds their content as lines in the toolbar.ini file.
  • because they're address tags, you can bookmark them: rightclick the installer tag, select "bookmark link." This is a good way to store them; drag from bookmark to toolbar to install. You can put comments, and even the URL of the source page, in the bookmark's Description field.
  • bookmarking also provides the quickest way to edit a button (e.g. change the icon). It puts the code in the bookmark's URL field - use Edit Properties to access that, edit, then drag the bookmark to a toolbar to install.
  • bookmarking puts escaped code in the URL field - the spaces are replaced with %20, and punctuation with similar 3-byte sequences. I sometimes do an extra maneuver to get rid of the escaping: click the installer, copy the action off the alertbox (where it is not escaped) and paste that form into the bookmark URL field. It still works and it's easier to read.
  • the functions assigned to buttons can for the most part be assigned to keystrokes, mouse gestures and menu lines just as well. They are usually macros (strings of Opera commands), and sometimes javascript.
  • one class of button functions doesn't work anywhere else: those with a + branch - which is "hold for second function" or "pull down for menu".
  • clicking installers is a good and safe way to see button action. It's shown on an alert box (in legible form, not escaped like the URL tooltip) - and you get the chance to cancel the install, no harm done. Copying off the alert box is also a good way to get the code if you'd rather put it on a kb/mouse/menu gesture.
  • due to a long-standing flaw in my.opera software, one must escape the colon after "javascript" (to %3A) when posting installers for javascript buttons on the forums.
  • resources:
    Tomu's guide to button-making and list of Opera actions on the Wiki - the best place to start if you don't know the ropes. (Many thanks are due to Tomu for several basic resources Opera.ASA doesn't provide).
    Pesala's button page an assortment of carefully considered buttons, and a well-written introduction to button making.
    button page on nonTroppo's Opera wiki - a large collection, from basic to advanced.
    Custom Buttons forum - an attempt, Jan 2009, to get a Buttons Central started that has pretty much fizzled out - but there are some good buttons (main contributors: Pesala & Dude09).
    Tomu's 2400-button collection an exhaustive collection of simple buttons.

My buttons (useful)

Back/Forward with New Window option on the dropdowns. (One can achieve this with two taps, but I just never found that intuitive.) Requires menu.ini paste
Back
Forward

paste into menu.ini:
[Back button menu]
Item, "back in new"=duplicate page & back
----------------
include, Internal Back History

[Forward button menu]
Item, "forward in new"=duplicate page & forward
----------------
include, Internal Forward History


Sort-order toggle: toggles between "My order" and alphabetical; patches the bug that Notes panel always opens in alphabetical order. Preferable to View menu dropdown because it's one click (instead of click, highlight, click) - and also provides a visual indicator (through switching icons) of what sort order is in effect. (Needs to go on lower toolbar in panel.) Works in Bookmarks panel too. SortToggle

float / dock panel float/dock,SP . . float/dock,noSP
Let the panel float if you want to use it without disrupting page layout - it pops up above the page instead of narrowing it (which triggers a reflow) and shoving it to one side. I mostly use it for notes. Two versions - which works better depends on your Close Page setting: No-SP for default, close-and-go-back setting; with-SP for close-and-move-right setting. (Wrong one will switch page when panel docks.) The natural place for this one is on the panel header (the upper panel toolbar, which is shared by all panels so putting the button in one place looks after them all.)

Toggle tab bar between top & left. Put it on tab bar head (extreme left of bar.) Vertical bar is great for keeping many tabs legible. ToggleBar. (Which is good - but you can add something useful for the price of a menu.ini paste: the same button with a drop-down menu of divider pages. See PageGroups Now: creating a pagegroup system with current Opera resources.)

Toolbar showcode: /|/ A very simple action, but a somewhat startling effect: click this button, and up pops the code which defines the toolbar it's on. Useful for figuring out what a button is, inspecting and editing code if there's an issue, or copying a button to give to others. The line of code works by searching for itself: Go to page,"tb" & Find & insert,"/|/". This one is a demo that works on any toolbar; the full set use names as targets, and have the benefit of showing you the toolbar's name when hovered. To try it out, you need to nickname your toolbar INI file "tb" and make sure your Opera is set up to open INI files: given that, it's just a matter of dropping it on a toolbar, and restarting Opera to refresh the file. For the full set (toolbars and menus) and details on how to get INIs to open if they don't now, see Showcode: click to see inside toolbars and menus

SlxSource shows the HTML source for an onscreen selection in a javascript prompt dialog (with option to copy). Developed from this 2006 on-page script by Burnout426, via a bookmarklet posted by Gary Sugar.

2009-12-21: Menu reloader. Of value to Opera hackers; takes the repetitive dialog clicking out of menu.ini debugging. For Sourceview toolbar: ApplyChanges&ReloadMenus.

Buttons from others (***: included in HTML-editing toolbar)

***Kill button, from Scipio (Wiki). Click to activate, then click page elements (such as ads or annoyingly animated avatars) to remove them (until next reload). Get it (and read more detailed instructions) here.

Alias from AyushJ. Gives you the ability to rename pages temporarily - turns your tab bar into a notepad. See this blog page for more discussion. (I actually use it on tab rightclick menu now, but had it as a button for a while.)

Reload without reloading images from AyushJ.TextFresh

***Design mode toggle (this one from Lex1): makes rendered pages editable. You can insert and delete text, use Ctrl+B for bold and Ctrl+I for italic, cut and paste chunks of HTML... even merge pages. It will take a while to get your head around what Design Mode is.

***Lex1's SaveSnapshot (page in Russian - third section, fourth button - caption is English) : Select part of a webpage, click button, save to disk: you have created a clipping from a webpage - complete with page style, which is no mean trick (since the style may be in external files). If no selection, saves the whole page - a fast and excellent archiving tool. What's more, it captures the generated page rather than source - so it's a way to save pages marked up or modified using Design mode and ContentEditable (which the normal save function can't do). (Updated, March 2010, for Opera 10.5.)

My buttons (exploratory)
Not saying they aren't useful, but of interest to me mainly as explorations.

2009-12-28 Selection Source view variants
This one SlxPage sets up a dual-pane view with Opera's source view (which provides some color coding), and is good for tweaking and exploration; it opens a blank page, goes to source view, pastes in the selection, reloads (which puts the rendered selection in the blank page) and floats the sourceview page as an inset window. A different method for copying selection source is to generate a page showing it (using CDATA tag, which suspends rendering like CODE tag does on forum) and copy from that. This is slower and loses all linebreaks, but permits a split screen, with selection rendered in top pane & source displayed below, with a draggable splitter: SlxSplitView.

All three, as a button with a pulldown menu: SlxSource(Copy?) and paste this into menu.ini:
[selection source menu]
Item, "SlxSource to sourceview"=External action,,,,"copy mail to" | Go to page,"javascript:var html=document.createElement('div');html.appendChild(window.getSelection().getRangeAt(0).cloneContents());prompt('',html.innerHTML)"& delay,200 & copy & cancel & Go to page,"Opera:blank" & delay,200 & View document source & delay,200 & select all & paste & delay,200 & reload & restore page
Item, "Slx Splitview" =Go to page,"javascript:var html=document.createElement('div');html.appendChild(window.getSelection().getRangeAt(0).cloneContents());document.write(%22<frameset rows='*,*'><frame id='f1'><frame id='f2'></frameset>%22);window.f1.document.write(html.innerHTML);window.f2.document.write('<![CDATA['+html.innerHTML+']]>')"

Dummy branch included in some of these functions to disable a buggy Opera parser which malfunctions when functions include a Copy and are invoked with no selection.

2009-12-22/27: Mail multiline insert solves a problem created when, in Opera 10, the Convert-hex-to-Unicode function stopped working to insert linebreaks in mail (in macros generating boilerplate such as return addresses). The technique is: generate a page with the boilerplate block, using a data URL; copy it, paste into email. It's a demo or template; must edit in real text.
Related: MailSnip (for HTML mail). Select a passage on a webpage, click; an email is opened, with snipped selection (format, links and all; even some pictures) and URL pasted into body. An HTML webnote for your friends. Discussion here.

2009-11-23: PrintNote, for Notes panel toolbar (lower of the two - top one is common to all panels). Copies whatever is selected (which can be all or part of a note, in editing pane - or a set of notes, selected in tree pane with Ctrl+click or Shift+click), generates a page (using a data URL) with a big text area, pastes selection into it & calls up Print dialog. (Response to a forum wishlist post.)

Data-loss defect in the Notes system, and a quick backup to keep your notes safethe restless quest: imperfections noted.

Comments

Mağruf ÇolakoğluZAHEK Thursday, July 2, 2009 9:01:46 PM

Very nice post.thanks.

A.RuzanovLex1 Thursday, March 4, 2010 2:36:00 PM

Lex1's Save via js


Updated for 10.5 (Save snapshot).

dapxin Monday, April 19, 2010 3:35:43 AM

I keep coming back to some of your buttons, thx.

Write a comment

New comments have been disabled for this post.