deviant mousedown

Understanding other people's workarounds can be simply impossible. Take this example from the popular creative forum deviantART: if a member tries submitting a new entry from Opera, it will appear impossible to upload files because the "Choose" button does nothing when clicked. (Tabbing to it and pressing enter will work, but who'd think of that..)

The reason is buried deep inside this JS file:

if (window.browser && (browser.isGecko || browser.isOpera)) {
     uploadForm.onmousedown = function () { return false; }; // firefox only - screws up other browsers
}

So this "Firefox only" workaround against an unspecified problem I can't begin to understand is also applied to Opera – with the fatal result that we ignore any mouse clicks inside the upload form because the script cancels mousedown. I'm not sure who's deviating from what here..

(As an aside, code like this makes me pretty curious – what will show up in the site if I throw in a small user JS to set deviantART.pageData.i_am_super_privileged to true?

// most awesome hack ever
if (!path[1] && whoosh[0] == 'Fan Art' && deviantART.pageData && deviantART.pageData.i_am_super_privileged)

source)

Advertisements

7 thoughts on “deviant mousedown

  1. Originally posted by hallvors:

    I'm not sure who's deviating from what here..

    Lol, does that "awesome hack" really work? I'll have to read this later when I'm completely capable, lol. Looks good though. Those Deviants…

  2. if i wrote that code, setting it to true would ban your account or at least flag you as an evil hacker :>I have to remember that one 😉

  3. LOL. Yes, i_am_super_privileged could be used as a sort of honey pot to detect dishonest users :-p Well, I sure hope they *do* check things on the server side, otherwise it would be too easy 🙂

  4. // firefox only - screws up other browsers

    Am I reading that incorrectly or is that function supposed to screw up other browsers? :confused:

  5. @scipio: :lol:@hallvors: I suspect FF might propagade the event despite mousedown returning false. What the workaround was for… er… no idea 😉 I think in that case the form code might be useful…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s