Jason wrote:
Looks like I got it working:
http://dheera.net/jason/photos/index.html
Unfortunately, that only seems to be so.
Click on 日本語 at the bottom.
Do you guys think the code is efficient?
First of all, since I do not have a Mac, I have taken the time to watch all
three screencasts about RapidWeaver closely last night. I must say the
things you can do with it are impressive indeed, however the way it is done
is not. As I expected, it is basically a point-and-click application:
unless you select the "HTML Code" template for your new Website (which will
get you at least a HTML editor with syntax highlighting and some code
templates), you will never see a single piece of its code before you
publish it. I consider that to be a _Bad_ Thing, since I am convinced
(from personal experience) that understanding Web authoring comes from
understanding of the underlying concepts, including the used markup,
formatting, and programming languages. What I observed on your new Website
merely justifies this opinion.
The script you use is completely unnecessary, since nothing is generated
dynamically here -- it is but RapidWeaver which creates the illusion of
that. In the end, your documents are all static. And you are not even
referring to the "subpage" of the other language but always to the
homepage. However, AIUI, it is possible to detach each document ("page")
from the global Website layout, hence it should be possible to have a
link to the "subpage" of the other language on each "subpage", without
introducing a dependency on client-side scripting at all and thereby
making navigation impossible without (enabled) support for it. The same
goes for the `Launch in Google Maps' "links" in your Art/Google Maps
section, for example.
As was said before, `javascript
:' is evil[tm]. Search the archives for
"pseudo-protocol".
As for the rest of "your" code:
- You serve XHTML as text/html, which is error-prone:
<URL:http://hixie.ch/advocacy/xhtml>
- Internet Explorer does not support XHTML, and you do not need XHTML here.
HTML 4.01 Strict/Transitional suffices and is _not less_ standards
compliant than XHTML (I am emphasizing that here because RapidWeaver
marketing emphasizes that the code generated by their tool would be
standards compliant).
- XHTML 1.0 _Transitional_ is (usually) a contradiction in itself.
(Either you want well-formed Valid markup, dividing markup and formatting,
or you want a tag soup with presentational elements and attributes.)
- You have made a hyperlink out of your first-level heading, but users
do not know about that (before they hover over/tab to it) because it
looks like the rest of your text. Users expect textual hyperlinks to
be underlined or at least in a different color by default, probably
except of hyperlinks in navigation sections of a document.
- Black on dark gray is hardly a good color combination, especially for
a (first-level) heading. More contrast, and a little bit more color,
please.
- You use `br' elements where there is no line-break intended.
- Your script resource (javascript.js) contains `<!--' and `//-->' outside
of literals which is utter nonsense, especially in an XHTML context.
(Search the archives.) Remove that.
- if (!document.getElementsByTagName) return;
does not qualify as feature test for the method to be _called_.
Search the archives for "isMethodType".
- for (var i=0; i<anchors.length; i++) {
is inefficient compared to
for (var i = anchors.length; i--;) {
- The whole `anchors-and-if (anchor.getAttribute("href") ...' thing
is unnecessary, W3C DOM Level 2 HTML defines the `links' collection
as property of the `document' (HTMLDocument) object, which is
supported since NN 2.0, IE 3.02/4.0(CE; according to MSDN Library),
Opera 6 (at least), and by KHTML-based UAs (Konqueror, Safari etc.).
- Element::getAttribute() should be avoided if possible; its implementations
are known to be buggy, and the value it returns is not "live". There are
attribute properties in the HTML DOM for this, also specified in W3C DOM
Level 2 HTML:
for (var links = document.links, i = links.length; i--;)
{
var anchor = links[i];
if (anchor.rel.toLowerCase() == "external")
{
anchor.target = "_blank";
}
}
- The above was just for the sake of completeness. _Do not_ try to impose
new windows/tabs on users with target="_blank", even though the link is
"external". Remove externalLinks(), or modify it so that "external"
links are marked instead.
- `document.location' is deprecated long since. W3C DOM Level 2 HTML
calls for `document.URL' -- which is in fact supported as a string
property since NN 2.0, IE 4.0 (all platforms, according to MSDN
Library), Opera 6.0 (at least), and by KHTML-based UAs, fortunately :)
- All your variables (whereas some of them are unnecessary) are in fact
properties of the global object, or of the object before it in the scope
chain, because you do not declare them with `var'. This is considered
error-prone, search the archives.
- Your script code lacks proper indentation.
Please quote the minimum of what you are replying to:
<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
<URL:http://www.safalra.com/special/googlegroupsreply/>
HTH
PointedEars