web:config

tips and tricks for the interwebs

Subscribe to RSS feed

Posts tagged with "opera"

for heavy duty posters

, , , ...

I present you with a new script to enhance user experience on my.opera, dubbed Scribit.

The script provides the user the hability to edit all his/her forum posts, blog posts and comments, dev.opera comments and widget discussion's page comments without the need of opening a new webpage with the edit form. The script will create a inline editor, that will replace the original post, or comment, so the user can edit it inplace, therefore making editions much more pleasant and quick. The script also displays a inline toolbar with all the available formatting commands used to produce bbcode. The toolbar is not only displayed in the inline editor, but also in the already existing reply boxes in the forums, blogs and at dev.opera.

This script initially only worked for forum posts and was very simple. I coded version 2.0, to submit to the User Javascript contest but by influence of the others the script never got to the juri's inbox. Oh well...

Screenshot with default setup (standard skin)

Screenshot of Quick Edit link

Screenshot of post quick editing (Oxygen skin)

Instructions
The following keyboard shortcuts are supported in the inline editor, producing bbcode formating. Press Ctrl plus any of the following keys:
  • b - bold
  • i - italic
  • u - underline
  • s - strikethrough
  • p - preformatted code
  • t - insert unordered list
  • l - align text to the left
  • g - center text
  • r - align text to the right
  • j - justify text
  • m - insert image
  • h - create hyperlink
  • e - insert email link
  • f - attach file
  • q - format text as quote
  • w - whisper text
  • ENTER - submit post
Later on, I'll make these easier customizable.

The script's configuration has sensible defaults. The entire UI is drawn using the current Opera skin, therefore providing an extra integration with the browser. Note however, that some skin bugs might be releaved. This script was succcessfully tested with Opera's default skin, and some other popular skins.
You can tweak the editor's behavior, although you need to edit the script itself.

This script does a daily new version check, warning the user of the new script version. You can disable this feature though. Check the configuration kCheckForNewVersion.

This entire script was done by me from scratch. The version check code was imported from the myopera-enhancements script, also made by me, and Robin Zalek. I recomend you to check it out. cool
http://my.opera.com/xErath/blog/2009/02/10/my-opera-community-enhancements

Credit also for AyushJ's quick-reply script for some inspiration. wizard
http://my.opera.com/community/forums/topic.dml?id=185091

Many thanks to Lars Kleinschmidt as well for testing and feedback. wink

However, the script has much to catch up. The roadmap is:
  • finishing html editing support yikes
  • supporting html to bbcode convertion and back on the fly
  • adding a 'remove formatting button', trivial for html, hard for bbcode knight
  • removing all prompt boxes and replacing them with proper floating
  • menus providing the user input suggestions, like listing his/her files when the attach button is pressed.
  • replacing the default new blog post, new form thread, and new dev opera article
  • making a lovely UI to edit configurations

Etimology: Scribit derives from scribe spock

Download the script from:
xerath-myopera-scribit.js
Future versions will be announced here, and the script will notify the user of the new version.

For the geeks
Script documentation is available at, generated using JSDoc:
scribit-documentation.zip

All text strings stored by this script are properly grouped to ease the script's localization. Currently, the suported languages are english and portuguese. Other users are encouraged to contribute. The language is autodetected and will match your UI language, but this can be overriden by setting the kPreferedLanguage configuration variable. If the UI language is not supported, english will be used.

Translations code chunk:
var translations = {
    en:{//plain english 
        L_SUBMIT: 'Submit',
        L_CANCEL: 'Cancel',
        L_QUICK_EDIT: 'Quick edit',
        L_QUICK_EDIT_LINK_TOOLTIP: 'Quick edit this post using inline editor',
        L_ERROR_ON_LOAD: 'Error loading post from server',
        L_LOADING_DATA_STATUS_MSG: 'Loading data from server...',
        L_POST_NOT_CHANGED_NOTIF: 'Post not changed (to quit press Cancel)',
        L_SUBMITTING: 'Submitting...',
        L_ERROR: a'Error',
        ...

Have fun! cheers

My Opera Community Enhancements

, ,

For those of you who still do not know "My Opera Community Enhancements" user script, I seriously recommend you give it a read. The script improves the user's experience here at my.opera. For a full feature list, just read the following documentation:
http://files.myopera.com/xErath/mopen/myopera-enhancements.html

The script was done mostly by me and BtEO, although BtEO will no longer participate in the script's development and maintenance.
Forum discussion at:
http://my.opera.com/community/forums/topic.dml?id=172834

Script contributions and bug reports are more than welcome.
Have fun, as always smile

Edit:
Whoops doh ! Forgot to post links...
Script: myopera-community-enhancements.js
External prefs file: myopera-community-enhancements-prefs.js

the interwebs accesses your system !

, ,

Update (2010-Feb-08): due to shit from native java handling to the java plugin, live connect is no longer supported since Opera 10.50. sad We'll miss you

Ever wonder how you could have system access, file IO or other capabilities from a html page hosted elsewhere?
Well, in Opera and Mozilla, you can do it with Java, like...
<script type="text/javascript">
java.lang.Runtime.getRuntime().exec("command arg1 arg2");
</script>
and that command should execute just fine. But first you need to give Java permissions to execute that, so go to Opera's installation folder and locate the classes\opera.policy file.
Open it and add the following rule:
grant codeBase "http://mytrustedserver/-" {
    permission java.security.AllPermission;
};
where mytrustedserver is the name of your server. "file://-" is also allowed.
That way java will have permission to do system call, File IO, etc. However, you're enabling permissions with a sledge hammer this way, but it's just for the sake of testing. Still, you should have a good read of java security policies, if you want to make this widely available.
http://java.sun.com/j2se/1.3/docs/guide/security/PolicyFiles.html

You have the entire java API available.
This should work
var file = navigator.platform.indexOf("Win")>=0 ? "c:\\file.html" : "~/file.html";
var output = new java.io.PrintStream(new java.io.FileOutputStream(new java.io.File(file)));
output.print("<h1>hello world</h1>");
output.close();
java.lang.Runtime.getRuntime().exec("opera "+file);

If you're having problems, analyse what is displayed on the Java console (Tools>Advanced>Java console).

Beware, others can eavesdrop scripts on your browser, but if you're coding for yourself, then you're fairly safe.
Note: don't try to fool users into changing their policy file for bad reasons. It's not worth it.

Happy development smile

http phones file

, , , ...

Hi to everyone!

As some of you might have experienced, Opera blocks access from http: pages to file: or http: in the internet to http: in the intranet.
This however, causes an unfortunate situation where you can't use Opera, for instance, at work if you have intranet web apps that point to network shares with content.

However, this is just an annoyance which is workaroundable.
The trick is simple: set the file: protocol to be handled by an external application, and you should be done. That external application can be Opera again, and in this case, it'll open the network path in a new tab, just like if you clicked an http link normally.
You can also use either of the following depending on your OS/desktop environment:
  • "explorer" on windows - beware, html files will be opened in IE yuck
  • "kfmclient" on linux with KDE desktop
  • "gnome-open" on linux with Gnome desktop
  • "open" on Mac OSX

But, unfortunately, we're not over. Opera has two bugs which make this solution not that straightforward (yes both are reported).

First, some UNC paths are misresolved, for instance:
<a href="\\server\share">
<a href="file:\\server\share">
Although these paths are not valid URIs, some tools generate then, as I've seen.
For instance, if you add a url like \\server\share in MediaWiki, it'll convert it to file:\\server\share

Second, despite being set to open with an external application, Opera still blocks http: to file:.

Solution:
  • to overcome the misresolved links,obviously we'll use an user script
  • to overcome the http: to file: block you need to rename file: to something else and tell Opera to open it, so we'll use an user script for this as well.
So, install the following user script, which fixes the links and converts file: to file-opera:.
fix-file-protocol.js
Second, choose one of the following scripts according to your operating system
  • Windows, place the file in the Opera installation directory, rename to something that ends in .vbs
  • Linux, place it where ever you like
  • Mac OSX, place it where ever you like

Third, go to Tools>Preferences>Advanced>Programs and add a new protocol "file-opera" to be handled by the script you just saved. These scripts open the url in Opera. If you want them to open another program then you're free to edit them yourselves.

And that should do it.

Have fun smile

We only know what indexOf is

, , , ...

It seems like yahoo.com somehow is blocking Peregrine


I'll leave you with a quote and let you draw your own conclusions.
http://my.opera.com/Andrew%20Gregory/blog/2008/05/11/opera-10-is-too-old

Originally posted by Andrew Gregory:

If you're one of those people irritated at how poorly Opera appears to handle web site scripting - this is one of the bigger reasons. It's straight-out careless programming without thought.

Meet meenoo and drag

, , ,

I've previously posted at the forum two scripts to resize textareas.
Now I'll release them here.

Meet the two siblings: power-drag and power-meeno. They complement each other, one being more complete, the other being more broadly usable. Both these scripts started out from the simple desire of resizing textareas easily, alla CSS3 UI. If Safari can do it, then why should not Opera, with some bells and whistles?



Power-meenoo adds a small menu which can be toggled by pressing ALT and hovering a textarea. The menu has many options, and the script is localizable, currently translated in english, portuguese (duh p) and polish (credits to Wasacz). The options are self explainatory, so you can bore yourselves trying them.

Power-drag is simply cool. Probably I should call it "awesome script"? Pressing your shift key then hover textareas, select boxes, iframes, objects, images or input fields to simply resize them by dragging its lower right corner. Simple, clean and efficient. Double click to restore the original dimensions. You can enable the dragging corner always, or use another modifier key. The script requires shift by default because makes the script less intrusive, and does not cover small elements in the page, while having a smaller performance impact.

One script DOES NOT require the other to function properly. They're independent.

Now, you might recall these scripts from the forum. Power-meenoo now requires alt because ctrl is usualy associated with clipboard shortcuts, shift with selections, so that leaves us with alt which is usually associated with menus, so it fits well.
The old scripts you had resize-textarea-util.js and textarea-drag-resizer.js are therefore deprecated. Please delete them if you want to download one of these scripts.

Get them here.
power-drag
power-meenoo

As always, updates will be annouced in the blog post, and the links always point to the most recently updated files..

Spammers using M2?

, , ,


Using Opera's revolutionary e-mail client


norris

Plugsome Toolbar

, , , ...

I present you, right from xErath labs, beign these a two year old laptop (which works just fine), the "Plugsome Toolbar" user javascript. It's fairly simple to use, and very useful.
In the screenshot that follows you can have an idea of what it does:cool



This script is an utility that add a small toolbar to plugins in webpages.pirate
The toolbar by default has 3 buttons:
  • the 1st button is a Reload button which reload the plugin content
  • the 2nd button is a link to the external file that the plugin loaded. Somefiles might get special treatment, like in youtube. Instead of linking to youtube's media player swf, the script links to the video file. Click this link to save the file.
  • the 3rd button is a X which if clicked closes the toolbar, and if double-clicked removes the toolbar and plugin from the page. The space that the plugin occupied is preserved though.
The toolbar is dimmed by default, and it'll highlight when you hover it.
If the toolbar is attached to a Flash file, then you get two extra buttons: a play and a pause button. Note however, that play and pause might not pause/resume plyback in all flash files. This is due to the file's internal structure, and the way content is layed out in the Flash's timeline.

Download link:
xerath-plugsome-toolbar.js
Further updates will be annouced, the link above will point always to the latest version.

Technical details
The script applies different treatment to differents objects in different websites, when returning the link of the file feed to the plugin.
The script already support youtube.
To add your custom behavior for a specific website, the user script exports a small interface.

All functions and variables are grouped in the opera.PlugsomeToolbar object.
The object has the following properties:
  • version - script version
  • URLHandlers - an object with host names and custom functions to apply to a html OBJECT or EMBED to have the link that is available in the toolbar.
  • URLHandlerFallback - a fallback function that should be called when custom functions in URLHandlers require to work asynchronously, but fail to retrieve the file url
  • AllToolbars - an array with all the instantiated toolbars in the current page.
The object looks like this:
a.PlugsomeToolbar = {
    version: '1.0',
    URLHandlers: {'a':...}
    URLHandlerFallback: function(){...},
    AllToolbars: [...]
};

To code your own website rule, do something like this:
opera.PlugsomeToolbar.URLHandlers['.youtube.']=function(object, link){
    var fv = object.getAttribute('flashvars');
    if( fv ){
        /* ... */
        link.href = 'http://www.youtube.com/.....';
        return true;
    };
};
You can, and should place it in another file, because that way you can easily upgrade Plugsome Toolbar without loosing functionality.
The functions in URLHandlers receive 2 arguments, the plugin and the toolbar link to fill in the href. Each function returns true or false, respectively, in case of success or fail. The script, for each plugin, loops through all rules and aborts when one returns true, meaning that the link is known.



cow You might find the name "Plugsome Toolbar" familiar. The original one was invented to feed hype for a specific piece of software, when others did the same thing that the former advertised.
But we're not here to talk about Firefox,... whoops, I said it... whistle

EDIT (2008-June-11)
New update, version 1.0.2.

Changelog:
  • Option to show toolbar when plugins are disabled
  • Added Quicktime and windows media player controls toolbar
Note: the quicktime controls may not work in. It seems quicktime scripting is broken in Opera. But the work is done, until Opera get fixed.

Url filters - The Discipline of Annoyance & Demise

, , , ...

Note: title kindly adapted from Emperor's 2001 album

Lets do a little experience. idea
1. Go to the website http://www.asdf.com/
2. Select block content from the right-click menu
3. Add http://www.asdf.com/* to the blocked urls.
4. Now open this url. Here's what you see

5. Go to a unexistent website like http://foo.bar/. Here's what you see

Can you make the difference ? No ? Look a little closer, approach the screen a bit, observe from different angles. Still can't see the different ? Well, the second website has some red in it. bigeyes doh

What does this mean ?
Whops ! You stumbled upon a invalid domain and Opera cannot connect. But what about the 1st case ? Opera deliberatly blocked the url. devil

Now imagine that you just downloaded one of those ad lists online. You start to wonder..hum ! Opera can't render this webpage. It's a Google conspiracy for sure.sherlock

Most filter files encoutered online are too generic, and hit too many false positives.
Consider the case described in this thread.
The user complained because Opera blocked an image which add "/ad4" in it's base64 content. Well too bad. You downloaded a too generic filter file, now you hit some false positives. But he was lucky to solve the problem with such a simple case. If you check the OP's filter file, whenever there should be either a dot and an wildcard, or wildcard and dot, there is no dot, becaise the person that did that filter file didn't consider that ad4 could ever be part of a valid url, which that rule would happily block.ninja

Now, why did I initially approach this subject with the asdf.com example ?
Simple. Opera currently does not provide any way to tell the user that some content is blocked. Iframes get blank, not loaded scripts go to the error console and that's it. Opera definetly needs a friendly error page telling the user that a url was blocked. If so, the user would then inspect either the info panel, or whatever, to realize that there is blocked content.faint

As an extra case, I once saw a user complaining he couldn't open any website that started with http://count*
Where do I recognize that ? Most statistic website's domains start with count. So the poor used downloaded a bad filter file, and actively contributed for Opera not being part of statistics online. The author of that filter file must be proud.furious

Conclusion: don't accept generic filter files out of ignorance. First inspect them. Tamil has a almost good list, but I consider it too generic. My personal filter file has a very little amount of generic rules. The rest is all full domains, and I rarely see an ad.yes

Happy browsing (without annoying ads). wink

Developer tools unleashed

, ,

Allas ! The wish of many developers and Opera fans was partially fulfilled ! Real developer tools officially supported in Opera yes
See some screenies
I personally have my own tools, but Opera's ones seem much more polished, and since they're in javascript, they're fully editable. yes

But, being me the techie person I am, aka geek, and knowning that the tools announced at dev.opera are scripts, I opened my menu.ini, and saw the following
[Advanced Tools Menu]
Item, 69887            = Manage cookies
Item, 69888        = Manage wand
Item, 920136405    = Content block details, 1
--------------------1
Item, 50838            = Go to page, "opera:plugins",,,"Blank"
Item, 50835            = Go to page, "opera:cache",,,"Blank"
--------------------3
Item, 54122            = Show Java console
Item, 67476            = Show Message console
Item, "Developer Console"="Go to page, "javascript:(function(){var ele=document.documentElement.appendChild(document.createElement('script'));ele.src='http://devfiles.myopera.com/tools/developer/8679/devConsole.js';ele.parentNode.removeChild(ele);opera.tools.console.open();})();", , , " ""
--------------------4
Item, 51212            = Refresh display


Neat, uh ? right hum, maybe not.
What happens if you are offline, or have javascript off ?
Besides, the script is 170kb, which takes time to download, or check if it's not modified, therefore the menu entry does not respond instantelly, which is a usability problem.

The solution is simple. Download the file http://devfiles.myopera.com/tools/developer/8679/devConsole.js to your user js folder, and add this as a bookmarklet, or replace the Developer Console command with
javascript:(function(o){if(o&&o.tools&&o.tools.console&&o.tools.console.open)o.tools.console.open();})(window.opera);
and you're done.

Don't forget to periodically check for the script version.

Happy development ! yes party