|
Prev: IE Scrollbars
Next: Ugh
From: VK on 6 May 2008 13:55 On May 6, 7:55 pm, Jorge <jo...(a)jorgechamorro.com> wrote: > VK wrote: > > In the continuation of the discussion at "Making Site Opaque -- This > > Strategy Feasible?" and my comment at > >http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 > > > I am proposing the current v. 0.0.3 beta for criticism and for bug fix > > in cope that it may be interesting for anyone to donate their time to > > participate. > > Hey, why did you left out those nice faders() ? I did not! Look at TransModal.coverEffect - it is waiting for its moment. It is just necessary to make working properly the most basic functionality before starting with extra features. It like a car: before bringing it to West Cost Custom it must be able to at least leave the garage by its own :-)
From: VK on 6 May 2008 14:20 On May 6, 6:01 pm, Matthias Watermann <li...(a)mwat.de> wrote: > On Tue, 06 May 2008 02:25:41 -0700, VK wrote: > > [...] > > Just some hints after reading (w/o testing) it: > > > if ('userLanguage' in navigator) { > > var lang = navigator.userLanguage.substring(0,2); > > } > > else if ('language' in navigator) { > > var lang = navigator.language.substring(0,2); > > } > > else { > > var lang = 'en'; > > } > > Should be: > > var lang = 'en'; > if ('userLanguage' in navigator) { > lang = navigator.userLanguage.substring(0,2); > } > else if ('language' in navigator) { > lang = navigator.language.substring(0,2); > } with pending else{} left this way. Not a crime of any kind and often met, but we have here a standard logical construct if X then do this else if Y then do that (if neither of both then) else do default which is if (X) {} else if (Y) {} else {} what would be benefits to break the logic flow? I am not claiming that there are not any, but what are they? > > TransModal.lang = (lang in TransModal.buttonLabelSet) ? > > lang : 'en'; > > I'd assume that "lang" is unknown here since there are only three > vars with that name each of which inside a different "if"-scope. Variable scope in Javascript was already explained by other posters as I see. > > [...] > > var wndDialog = document.createElement('DIV'); > > > wndDialog.id = 'TransModalDialog'; > > > /* Some complex styling of a completely empty element > > * may make IE to act strange. To avoid that we are > > * setting the default content to NO-BREAK SPACE > > */ > > wndDialog.innerHTML = '<span>\u00A0</span>'; > > Why use "innerHTML" (instead of "createElement()") here? because then we have to add TextNode into it which is a royal pain in IE6 - not talking about adding form controls this way which is a headache beyond tolerance IMO with IE. Also innerHTML is 10-15 times quicker then per-node manipulations. This being said, I am ready to replace both innerHTML usages by a reliable DOM alternative if anyone has it. > > with (wndDialog.style) { > > position = 'absolute'; > > zIndex = '1002'; > > left = '0px'; > > top = '0px'; > > cursor = 'default'; > > visibility = 'hidden'; > > } > > Just a matter of style & opinion: > > var s; > if ((s = wndDialog.style)) { > s.position = 'absolute'; > s.zIndex = '1002'; > s.left = '0px'; > s.top = '0px'; > s.cursor = 'default'; > s.visibility = 'hidden'; > } Yeah... "To WITH, or not to WITH" :-) Javascript WITH implementation is indeed a ticking bomb to handle with extreme care. I myself once was a complete fool with it: http://groups.google.com/group/mozilla.dev.tech.svg/msg/e3ef5a71b7d95318 So I do agree with Matt Kruse at http://www.javascripttoolbox.com/bestpractices/#with as overall - but I do not agree to make WITH as some self-contained evilness that acts by its own no matter what :-) In case as above is .style is available then all these properties should be here as well. Or still better do not take the risk? > > [...]
From: Jorge on 6 May 2008 14:31 On May 6, 8:20 pm, VK <schools_r...(a)yahoo.com> wrote: > Yeah... "To WITH, or not to WITH" :-) > Javascript WITH implementation is indeed a ticking bomb to handle with > extreme care. I myself once was a complete fool with it:http://groups.google.com/group/mozilla.dev.tech.svg/msg/e3ef5a71b7d95318 > > So I do agree with Matt Kruse athttp://www.javascripttoolbox.com/bestpractices/#with > as overall - but I do not agree to make WITH as some self-contained > evilness that acts by its own no matter what :-) In case as above > is .style is available then all these properties should be here as > well. Or still better do not take the risk? > Yeah... "With statement considered harmful" :-) http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/
From: VK on 6 May 2008 14:53 On May 6, 10:31 pm, Jorge <jo...(a)jorgechamorro.com> wrote: > On May 6, 8:20 pm, VK <schools_r...(a)yahoo.com> wrote: > > > Yeah... "To WITH, or not to WITH" :-) > > Javascript WITH implementation is indeed a ticking bomb to handle with > > extreme care. I myself once was a complete fool with it:http://groups.google.com/group/mozilla.dev.tech.svg/msg/e3ef5a71b7d95318 > > > So I do agree with Matt Kruse athttp://www.javascripttoolbox.com/bestpractices/#with > > as overall - but I do not agree to make WITH as some self-contained > > evilness that acts by its own no matter what :-) In case as above > > is .style is available then all these properties should be here as > > well. Or still better do not take the risk? > > Yeah... "With statement considered harmful" :-)http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/ OK, voted out. Bye-bye, WITH :-( :-)
From: VK on 6 May 2008 15:01
On May 6, 1:25 pm, VK <schools_r...(a)yahoo.com> wrote: > /* It would be nice to have button labels on > * user's preferred language and not English > * only. > * navigator.userLanguage (IE) and > * navigator.language (some other UAs) values > * may have different meanings: OS language, > * or browser interface language, or the preferred > * language in the browser settings. Either way > * IMHO it still allows to make a good guess what > * language the current user would like to see. > * If the detected language is not implemented yet > * then English is used by default. > * For such basic lexicon as "Yes", "No", "Cancel" etc. > * we may disregard country-specific variations, so we > * are taking only two first letters from the language > * code - so say "en", "en_US", "en_GB" will be "en". > * > *? Objections? > */ > > if ('userLanguage' in navigator) { > var lang = navigator.userLanguage.substring(0,2); > } > else if ('language' in navigator) { > var lang = navigator.language.substring(0,2); > } > else { > var lang = 'en'; > } > > TransModal.lang = (lang in TransModal.buttonLabelSet) ? > lang : 'en'; I tried to find a resource with standard button labels in localized Windows versions but no success. Anyone has one? It also could be easily checked with IE installed via VBScript. Anyone has time to match English labels to localized ones using provided VBScript? I am interested in any language of course, especially in French, German and Spanish. -------------------------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"> <title>Label test</title> <script type="text/vbscript"> </script> </head> <body> <p>VBScript MsgBox labels' test</p> <p> <button type="button" onclick='MsgBox "OK only", 0' >OK only</button> <button type="button" onclick='MsgBox "OK | Cancel", 1' >OK | Cancel</button> <button type="button" onclick='MsgBox "Abort | Retry | Ignore", 2' >Abort | Retry | Ignore</button> <button type="button" onclick='MsgBox "Yes | No | Cancel", 3' >Yes | No | Cancel</button> </p> </body> </html> |