On 10/19/2010 09:22 PM, cmpil...@apache.org wrote: > Author: cmpilato > Date: Wed Oct 20 01:22:55 2010 > New Revision: 1024480 > > URL: http://svn.apache.org/viewvc?rev=1024480&view=rev > Log: > * site/publish/site-nav.html > Lose target="_blank" bits from some links -- those aren't valid in XHTML > 1.1.
For a possible alternative approach, see the attached patch. It only affects index.html, but all the other site pages would need to be tweaked likewise for stuff to work. Disclaimer: JavaScript ain't my cup o' tea.
Index: script/site.js =================================================================== --- script/site.js (revision 0) +++ script/site.js (working copy) @@ -0,0 +1,40 @@ +/* site.js --- miscellaneous JavaScript utilities. + * + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + */ + +/* Install an onClick() handler for <a> tags with the "linkaway" + * class which opens the link in a new window. + */ +function addLinkawayEvents() { + // Make sure we have the necessary routines. + if (! document.getElementsByTagName) + return; + + var anchors = document.getElementsByTagName('a'); + for (var i = 0; i < anchors.length; i++) { + var anchor = anchors[i]; + if (anchor.className.search(/\blinkaway\b/) != -1) { + if (! anchor.onclick ) { + anchor.onclick = function(anchor) { window.open(this.href); return false; }; + } + } + } +} Property changes on: script/site.js ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/javascript Index: index.html =================================================================== --- index.html (revision 1024477) +++ index.html (working copy) @@ -4,12 +4,13 @@ <head> <title>Apache Subversion</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +<script src="/script/site.js"></script> <style type="text/css"> @import url("/style/site.css"); </style> </head> -<body> +<body onload="addLinkawayEvents(); return false;"> <!--#include virtual="/site-banner.html" --> <!--#include virtual="/site-nav.html" --> <div id="site-content">
signature.asc
Description: OpenPGP digital signature