Invisible themes

Discuss application theming and theme development.
User avatar
scratch
Posts: 4942
Joined: November 6th, 2002, 1:27 am
Location: Massachusetts

Post by scratch »

Stefan wrote:Only W3C thing I found about javascript: is in the WCAG 1.0
"(e.g., do not use "javascript:" as the link target)"
http://www.w3.org/TR/WCAG10/#gl-new-technologies

And I would say that message is pretty clear ;)


It only says not to use "javascript:", it doesn't say not to use "javascript:something". Then again though, "javascript:void(0)" is effectively the same as "javascript:"...
User avatar
scratch
Posts: 4942
Joined: November 6th, 2002, 1:27 am
Location: Massachusetts

Post by scratch »

djst wrote:
Stefan wrote:
djst wrote:So what you suggest is this:

Code: Select all

<a href="return false;" onclick="return installThemeNow('http://lynchknot.lazydesert.net/Acuarela.jar');">Click Here</a>


If that is indeed what you suggest, how would that still work when JS is not available?


This is not what I suggest.
Scroll back, I've posted the code several times in this thread already.


Why make it so hard for me all the time? :)

Ok, I'm going to assume that this is your suggestion:

Code: Select all

 <a href="http://googlebar.mozdev.org/googlebar_045RC.xpi" onclick="return doXPIInstall('http://googlebar.mozdev.org/googlebar_045RC.xpi','Googlebar 0.4.5 RC');return false;">Click Here</a> 


This seems to work when left-clicking, but if you right click, the installer will appear anyway and after that, a context-menu will appear.

Are there any onleftclick="" events or something similar?


you have two returns in there, that's why it's doing it twice. It's doing it once with the javascript, then the install completes successfully so it returns 1 and executes the href. you want this code:

Code: Select all

 <a href="http://googlebar.mozdev.org/googlebar_045RC.xpi" onclick="doXPIInstall('http://googlebar.mozdev.org/googlebar_045RC.xpi','Googlebar 0.4.5 RC');return false;">Click Here</a> 


(note that I haven't tried this, but it *should* work. it won't eliminate the right click issue though.)
User avatar
djst
Moderator
Posts: 2826
Joined: November 5th, 2002, 1:34 am
Location: Sweden
Contact:

Post by djst »

scratch wrote:
djst wrote:
Stefan wrote:
djst wrote:So what you suggest is this:

Code: Select all

<a href="return false;" onclick="return installThemeNow('http://lynchknot.lazydesert.net/Acuarela.jar');">Click Here</a>


If that is indeed what you suggest, how would that still work when JS is not available?


This is not what I suggest.
Scroll back, I've posted the code several times in this thread already.


Why make it so hard for me all the time? :)

Ok, I'm going to assume that this is your suggestion:

Code: Select all

 <a href="http://googlebar.mozdev.org/googlebar_045RC.xpi" onclick="return doXPIInstall('http://googlebar.mozdev.org/googlebar_045RC.xpi','Googlebar 0.4.5 RC');return false;">Click Here</a> 


This seems to work when left-clicking, but if you right click, the installer will appear anyway and after that, a context-menu will appear.

Are there any onleftclick="" events or something similar?


you have two returns in there, that's why it's doing it twice. It's doing it once with the javascript, then the install completes successfully so it returns 1 and executes the href. you want this code:

Code: Select all

 <a href="http://googlebar.mozdev.org/googlebar_045RC.xpi" onclick="doXPIInstall('http://googlebar.mozdev.org/googlebar_045RC.xpi','Googlebar 0.4.5 RC');return false;">Click Here</a> 


(note that I haven't tried this, but it *should* work. it won't eliminate the right click issue though.)


Thanks, that seems to work better. And since the right-click issue is in fact a bug in Mozilla/Gecko, that's not my problem.
User avatar
Stefan
Posts: 2051
Joined: November 5th, 2002, 2:46 am

Post by Stefan »

djst wrote:
Stefan wrote:
djst wrote:Why make it so hard for me all the time? :)


I was in a hurry and had posted code 2-3 times already :D


Unfortunately, your suggested code doesn't work any better. It wants to install the extensions twice.


Didn't I tell you to scroll back :P

Stefan Dec 1 wrote: BTW, the "return false;" should of cource go into the doXPInstall function at the very end, not remain inline like I first posted.


Stefan Dec 1 wrote:
djst wrote:So what is your suggestion?

<a href="http://googlebar.mozdev.org/googlebar_045RC.xpi" onclick="return doXPIInstall('http://googlebar.mozdev.org/googlebar_045RC.xpi','Googlebar 0.4.5 RC');">Click here </a>


Yes, but with "return false;" added to your doXPInstall function (of you will try to install the addon twice).


Scratchs suggestion with removing the return from the first function is perfectly fine, but if you put the return false; in the XPInstall function itself you don't need to add "return false;" in every single onclick="".

Use what you feel most comfortable with :)
User avatar
Stefan
Posts: 2051
Joined: November 5th, 2002, 2:46 am

Post by Stefan »

scratch wrote:
Stefan wrote:Only W3C thing I found about javascript: is in the WCAG 1.0
"(e.g., do not use "javascript:" as the link target)"
http://www.w3.org/TR/WCAG10/#gl-new-technologies

And I would say that message is pretty clear ;)


It only says not to use "javascript:", it doesn't say not to use "javascript:something". Then again though, "javascript:void(0)" is effectively the same as "javascript:"...


If you read the entire section I link to you will see that it's about not making links that break when agumenting codelanguages (eg Javascript) is not available. That includes "javascript:something", "vbscript:something" and anything else you can come up with that is not standard HTML.

The reason I posted it was to show that the only time I've found Javascript: mentioned in W3C specs/guides is in an example of how NOT to do.
User avatar
Stefan
Posts: 2051
Joined: November 5th, 2002, 2:46 am

Post by Stefan »

djst wrote:And since the right-click issue is in fact a bug in Mozilla/Gecko, that's not my problem.


I havn't tested this but I just came to think about a possible fix for that problem.

Use "ondblclick" instead of "onclick"

That way a single rightclick shouldn't trigger the script.
User avatar
djst
Moderator
Posts: 2826
Joined: November 5th, 2002, 1:34 am
Location: Sweden
Contact:

Post by djst »

Stefan wrote:
djst wrote:And since the right-click issue is in fact a bug in Mozilla/Gecko, that's not my problem.


I havn't tested this but I just came to think about a possible fix for that problem.

Use "ondblclick" instead of "onclick"

That way a single rightclick shouldn't trigger the script.


That would require the user to double-click to install, wouldn't it? Doesn't sound like an intuitive solution to me. I guess the bug will be fixed soon, and until then, you'll not be able to right-click and save extensions. However, the themes are having a File link too, so they can be saved anyway. I might remove that link once the bug is fixed though.
User avatar
Stefan
Posts: 2051
Joined: November 5th, 2002, 2:46 am

Post by Stefan »

djst wrote:That would require the user to double-click to install, wouldn't it? Doesn't sound like an intuitive solution to me.


Naturally the text woul dhave to be changed from
Install: Click here
to
Install: DoubleClick here

But for sure, a quick fix of the bug would be preferable :)
Post Reply