bpm's Operations Room

understanding & extending Opera

log: learnings & developments,2009

Open post for details.(green links are button-installer tags)

  • Dec 28-30: View / Copy Selection Source buttons.
  • Dec 27: Mailsnip button: send webpage snips to your friends.
  • Dec 25: macro: delete-from-system for personal bar bookmarks (remedying long-felt lack).
  • Dec 25: Linkgrabber 2: simplified by Judedon's workaround for Copy bug.
  • Dec 25: one can paste webpage snippets (links, pictures and all) into emails with Design Mode.
  • Dec 22: generated pages to pass data to clipboard: so cool it must be useful? See buttons post.
  • Dec 21: reload-menu.ini button (see buttons post).
  • Dec 12: how to achieve equivalent of Firefox "Faviconize" extension (Aliaser post).
  • Dec 1-3: two-page split-screen function, and several surprises associated with it.
  • Nov 28: javascript Pagelaunch from text URL; fixes macro flaws, settings-indpendent.
  • Nov 23: finicky local-file panel icons explained: URL in bookmark and IDX file must agree in case.
  • Nov 23: PrintNote button for Notes panel toolbar (buttons post)
  • Nov 20: Link grabber: macros to capture links as links (in BBCode, HTML or text).
  • Nov 16: style-marked button-installer tags implemented (discussion here).
  • Nov 15: New-Window option added to Back/Forward buttons; button help demo
  • Nov 14: Contacts panel is part of mail system (noob-unobvious critical fact).
  • Nov 10: quirk: mail subfilters don't work unless senseless "mark as filtered" is checked.
  • Nov 7: to have phrase/wordset address-field searches now, must set up second Google search.
  • Nov 7: bad news for dialog.ini hackers: the file is not the whole story.
  • Nov 7: a (reliable, non-GUI) way to launch specific sessions.
  • Nov 7: quick-start utility for "resume from last time" users (rename&swap method).
  • Nov 6: set WIN filetype to open with Opera. Then a link to autosave.win always resumes - even if startup setting is "open with home page."
  • Nov 3: alias dictionary sorted out.
  • Oct 24: view mail files within the browser

2009-12-1: 2-page split screen and... weirdness
You probably have to be an Opera hacker to feel that this is weird. Anyhow: when Opera variables (including %u - URL of current page, %t - defined text, and %c - clipboard contents) are present in a javascript command or a data URL, and it is launched by a GoToPage command with 0 as second parameter, Opera will swap in the value of the variable; while if the parameter is 1, the variable name will be used. Here's a demo: clicking this link launches a data URL with this content:
data:text/html,The URL is %u, and clipboard contents are %C.
The default interpretation is parameter=1, so the the variables won't be replaced by their values. And here are buttons that launch the same URL: one with a null parameter:Demo,0 and one with parameter=1: Demo,1.
This provides a way to make a split-tab button combining two pages: Opera commands can store URL to clipboard & close page; then javascript can access the clipboard (as well as current URL) to assemble a frameset-page command. Note: buttons launching data URLs are extremely finicky in 10.5 pre-Alpha. test... sometimes they don't work until a letter is capitalized, or until an icon is added to a command - flaky stuff like that.

Frameset pages have a draggable divider, which makes them handy for things like watching livestreams of sports while chatting on a fan forum - less fussy than restoring and resizing two tabs independently. Here they are: (NOTE: these needed escaping of # inside RegExp, March 2010; don't know how they could have worked before. They don't work in 10.5, due I think to use of Opera variables).
Split 2 T/B Split 2 L/R
To bail out of a frame, Rightclick - switching back to full-tab mode is on the context menu.
Initially-unobvious-to-me points these buttons required or revealed:
  • Opera variables become javascript variables if parameter is 0.
  • quotes have to be escaped through two levels: %22 is the first level, but if that were in the installer it would get interpreted by Opera during install, resulting in live quotes in the button code, causing misreading on execution; so one must escape the % - which becomes %25, making %2522 the needed double-escaped quote. Opera then puts %22 in the button, and the live quote finally appears at the right level. (What you see on the installer alert box has already burnt off one level of escaping.)
  • a quirk of Opera's command interpreter causes failure if one generates a frameset page where one of the frame URLs contains a "#". This is common - used to target a location within a page, and as a hashmark in database URLs. Solution is to use javascript Replace command to escape all #s.
  • the split-page buttons which have been on the Wiki's Power Buttons page all these years don't escape # - and are thus (in the context of Opera's flaw) seriously defective. They even fail when tested on the page where they're posted, for example, if one navigates to their section via links - and no-one has remarked on it or sorted it out. Weird to see this unremarked. (Pesala did introduce a viable split-screen button to the forums in 2008. Avoids URL-parsing flaw by avoiding URLs - generates frame contents using document.write.)

2009-11-23: finicky IDX: case in URL has to agree for panel icon.
One of my local panel files was only showing its icon sporadically - eventually realized it was the only one where there was a mismatch in case between the URL in the localhost IDX and the one in the bookmark (folder called "HTML" in one, "html" in the other). Fixed that - fixed the flaw.

2009-11-15: Back/Forward In New Window
added to dropdown menus for the Back/Forward buttons. See Buttons post.

2009-11-15: button help demo
For toolbars where button titles are not shown, you can put as much text as you like in a button's title - which then pops up as a tooltip when the button is hovered.\n Here's a demo: drag this paragraph to a toolbar where only icons are displayed to have a useless button with a lengthy title.\n Button titles are defined by the third parameter or - if there is none - the anchor of the installer tag.\n So type whatever you want to have pop up in a tooltip as the installer-tag anchor; when you hover the button, you'll see it.\n This particular button has no real action - it's just a way of providing the tooltip.\n But one could use the method to include instructions or explanations with any button.\n
Backslash n, as in javascript, works as a linebreak.


For an info-only button (which works even where titles are shown on the bar), one could also use a javascript alertbox: info (drag to toolbar)
So here's an idea: Opera could install with these things all over the place - popup help to explain contexts (such as the mail system, the links panel etc.) and get you started; with the invitation to delete the buttons once no longer needed. Like info stickers on a product.

2009-11-14: Contacts panel part of mail system (noob-unobvious critical fact)
It's easy to start using Mail (like I did) without realizing that it's designed to work with two of Opera's panels - Mail and Contacts. That means you're using only parts of a system. Clicking a Contact opens a tab with a view/filter of all messages to & from the contact. That's very user-friendly - it duplicates the folder functionality most are used to - but you need to be quite a keen reader of documentation to be notified of it. The Contacts panel is not mentioned in the introduction to mail - which is a page long enough that a person who gets through it will imagine they are good to go. It is explained in the multi-page mail tutorial - but that's second-level help most (I think) will never read through. The noob would have nothing to discover if Contacts were included as a folder (or just a button that invoked the Contacts panel, which could be treated as a temporary teaching device) in the Mail panel - and the Mail panel opened by default when Read Mail was invoked. The current system is fine once you know about it - just unobvious if you don't; but in a busy world noob transparency is important - and it's not hard to achieve if you recognize its importance.

2009-11-10 mail subfilters quirk
if parent filter has "mark as filtered" checked, no messages are listed in subfilters (despite count being correct) - until "mark as filtered" is checked in the subfilter as well. A senseless requirement - what should be required is just "show filtered" - ergo, a UI bug.

2009-11-7: need two Google searches
used to be phrase search without g prefix, wordset with - but Opera 10 does whatever g search does when no g. So - I've put quotes around the %s in the address field (Prefs / Search / (select Google) / Edit / Details), making the default a phrase search, and added a second Google search without the quotes, different prefix, for wordset searches.

2009-11-7: dialog.ini is not the whole story
Took a look at combining Save Session and Manage Sessions dialogs, so one could see the list while naming a session - and was surprised to find that dialogs are not fully specified in dialog.ini. The same code produces two different dialogs, depending on the name. To see this, copy this into a custom dialog.ini and restart to see the effect:
[Save Session Dialog]
Group0, 0, , 10, 10, 300, 200, Size, End
Treeview4, 0, Sessions_treeview, 0, 120, 150, 150, Size

[Session Manager Dialog]
Group0, 0, , 10, 10, 300, 200, Size, End
Treeview4, 0, Sessions_treeview, 0, 120, 150, 150, Size

Then look at the Save Session and Manage Sessions dialogs generated by the File menu commands: former doesn't show the list; latter does, and is bigger - from the same code. So - there is some file we don't have access to that is involved, and has info about what the names mean. At which point the hacker is basically defeated.

2009-11-7: launch sessions by name
session launch is GUI-gesture only, usually - interacting with a dialog. Macros which try to achieve an expected outcome with navigation commands are brittle, defeated if the list changes. So here's a fixed command which reliably launches a named session, regardless of list changes: "exit & execute (named session)." Closes Opera, executes the session file in Windows context - which, presuming you've registered Opera to open *.win files, relaunches Opera with the session. Not suited for every need, but worthwhile for some. And no, "execute (session-name)" without exiting first doesn't work.

2009-11-7: quick-start utility
quick start for "resume" users: rename autosave.win; swap in empty session; launch. There's a theme here: knowing what system files do and being fluent at swapping them, you can manipulate the system in ways not otherwise possible. Utility presented (copiable) in Better Sessions post.

2009-11-6: register Opera to open sessions files
in Windows Explorer, associate the WIN extension with Opera (Tools/Folder options/Filetypes/New). Then you can put shortcuts and links to sessions files around your system, and clicking them will open Opera and load the session. This is particularly useful if you use the "open with home page" setting, which obliterates the autosave.win file on startup and makes it impossible to recover what you had open after a crash: keep a link to autosave.win available, and clicking that after a crash will open Opera with the autosaved session from before the crash.

2009-10-24: view mail files within the browser
I had to export and then re-import my mail to clean out something that was disabling filters, and a few mails got lost with each operation (which, incidentally, does not seem good!). So to get them back I needed to inspect the .mbs files (each one an email) in my backup of the mail store. Turns out they're standard Unix mail format, which is plain text - can view them by associating the .mbs extension with a text program such as Notepad. However, there's a better way: view them in Opera, and they're formatted. To do this, you need to add mbs to the set of extensions which Opera is to treat as text and open. That's: Prefs/Advanced/Downloads; uncheck "hide file types opened by Opera"; type txt in the quickfind box (should bring up the line for mime-type text/plain); add mbs to the extension list, and make sure "open with Opera" is checked. (My list is: txt,ini,dat,lng,mbs,adr - which covers most of the guts of Opera.) Then bookmark your mail store folder and you're all set to look under the hood if the system starts acting up.
Incidentally, the mail store proves to be very sensible: folders for day, month and year, all properly numbered; and the mails themselves just text files. Having been through misery trying to get into old Outlook Express archives, this is nice to see.

the lore of sessionsLink grabbers

Comments

AlexanderSaransksw Thursday, February 25, 2010 9:19:39 AM

Bpm, do you know that link "clicking this link launches a data URL with this content" (in the "2009-12-1: 2-page split screen and... weirdness" article) doesn't work in Opera 10.50 Beta 2 anymore?
It opens the page with the line: "The URL of the current page is %u, and the current clipboard contents are %C."

Does anyone knows the reason? Thank you!

bpm Thursday, February 25, 2010 10:04:27 PM

Sorry to confuse - that discrepancy is just because I didn't quote exactly. The data URL works the same as in 10.1. What's different is the outcome with the Demo,0 button - it doesn't include anything now - neither the variable name, nor its value.

So... it seems that the splicing of Opera variables into data URLs has been eliminated.
Here's a button to check if this goes for js too: it will generate alert with clipboard contents, if splicing is happening: Alert(%C). And that works in 10.5.

There will be a lot of such changes to figure out once 10.5 has settled down; I'm waiting until buttons install reliably before looking into it.

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.