April 23, 2019, 03:51:31 am *
Welcome, Guest. Please login or register.
   Forum Home   Search Login Register OBiTALK  
Pages: [1]
Author Topic: firmware 1.2.1 (Build: 2384) and Opera 11.50 don't play nicely together  (Read 1294 times)
Jr. Member
Posts: 21

« on: August 11, 2011, 07:42:47 pm »

The problem lies in one of the DOM references, that Opera cannot "see" things as an object (or at least the expected object).  I managed to write some "corrective" user JavaScript, basing it on the JS returned to Opera by the OBi firmware.

Basically, whenever a user toggles the default checkbox for a setting, the corresponding field's "write-ability" is not altered.  Most notably, if the status of "default" is checked and one unchecks it, the corresponding field is not activated/not made read-write/etc.
Uncaught exception: TypeError: Cannot convert 'element' to object
Error thrown at line 134, column 4 in useDefault(element) in /VS_1_VP_1_.xml:
    if (element.name == null)
called from line 1, column 0 in <anonymous function>(event):
...problem is that element is not set as expected on entry into this fn, so it has no member "name."  So the fixes in my userscript start with:
    if ( typeof origObj == "undefined" ) {
element = event.currentTarget;
// alert("useDefault(): set element to "+event.currentTarget);
    } else {
element = origObj;
    if (element.name == null || element.name == "" )
        element = event.currentTarget;
Basically, I'm using opera.defineMagicFunction("useDefault",...), and "origObj" gets set to the original object sent to the function being overridden ("useDefault" in this case).  See http://www.opera.com/docs/userjs/specs/#magicfunc for more details.  typeof is pretty much guaranteed not to throw an error, so checking it against "undefined" is safe-ish. Therefore, by the time the original test for the name member happens, element has been properly "found," and is therefore the expected object.

Anyhooo...I wasn't sure if here, or feature requests, or some other forum was the best place to post this.  A little poking around with Opera 11.50, an OBi, and Opera's "integrated" debugger, Dragonfly, will show the interpretation errors.  I have workarounds in place, but it might be something to consider for firmware developers.

I would also respectfully ask that the firmware check for working JavaScript, and notify the user quite prominently that it has been disabled.  The usual method is a DIV with a unique ID, the text contents of which are "This requires JavaScript to be enabled, but is apparently disabled."  JavaScript somewhere does
var jswarn = document.getElementById("jswarningDivID");
if ( jswarn ) { jswarn.style.display = "none"; }
Two things...I use NoScript when I'm using Firefox, and in both FF and Opera I occasionally disable JS for varying reasons, and it's a tad disappointing/frustrating when things don't work for non-apparent reasons.  That's all.  I realize it's kinda my fault, but I'd like the extra convenience of knowing when it's been disabled and required.
Pages: [1]
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC