- From: Mercurial notifier <nobody@w3.org>
- Date: Tue, 22 Mar 2011 20:34:01 +0000
- To: link-checker updates <www-validator-cvs@w3.org>
changeset: 392:89d7df5780cc user: Ville Skyttä <ville.skytta@iki.fi> date: Tue Mar 22 22:03:22 2011 +0200 files: MANIFEST bin/checklink bin/checklink.pod docs/linkchecker.js etc/checklink.conf description: Move JavaScript to external file (docs/linkchecker.js). As a side effect, fixes a JavaScript error when submitting forms from the results page (uriOk() was missing), and removes some obsolete documentation related to Style_URI. diff -r e0644feb2f38 -r 89d7df5780cc MANIFEST --- a/MANIFEST Tue Mar 22 21:27:00 2011 +0200 +++ b/MANIFEST Tue Mar 22 22:03:22 2011 +0200 @@ -9,7 +9,8 @@ etc/checklink.conf Optional configuration file etc/perltidyrc perltidy(1) profile docs/checklink.html Additional documentation -docs/linkchecker.css Cascading style sheet for the documentation +docs/linkchecker.css Cascading style sheet used in docs and generated HTML +docs/linkchecker.js JavaScript used in the generated HTML images/double.png images/grad.png images/head-bl.png diff -r e0644feb2f38 -r 89d7df5780cc bin/checklink --- a/bin/checklink Tue Mar 22 21:27:00 2011 +0200 +++ b/bin/checklink Tue Mar 22 22:03:22 2011 +0200 @@ -362,29 +362,13 @@ $DocType = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; my $css_url = URI->new_abs('linkchecker.css', $Cfg{Doc_URI}); - $Head = sprintf(<<'EOF', HTML::Entities::encode($AGENT), $css_url); + my $js_url = URI->new_abs('linkchecker.js', $Cfg{Doc_URI}); + $Head = + sprintf(<<'EOF', HTML::Entities::encode($AGENT), $css_url, $js_url); <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta name="generator" content="%s" /> <link rel="stylesheet" type="text/css" href="%s" /> -<script type="text/javascript"> -function show_progress(progress_id, progress_text, progress_percentage) -{ - var div = document.getElementById("progress" + progress_id); - - var head = div.getElementsByTagName("h3")[0]; - var text = document.createTextNode(progress_text); - var span = document.createElement("span"); - span.appendChild(text); - head.replaceChild(span, head.getElementsByTagName("span")[0]); - - var bar = div.getElementsByTagName("div")[0]; - bar.firstChild.style.width = progress_percentage; - bar.title = progress_percentage; - - var pre = div.getElementsByTagName("pre")[0]; - pre.scrollTop = pre.scrollHeight; -} -</script> +<script type="text/javascript" src="%s"></script> EOF # Trusted environment variables that need laundering in taint mode. @@ -2954,31 +2938,8 @@ $headers .= "Content-Language: en\n\n"; } - my $script = my $onload = ''; + my $onload = ''; if ($doform) { - $script = <<'EOF'; -<script type="text/javascript"> -function uriOk(num) -{ - if (document.getElementById) { - var u = document.getElementById('uri_' + num); - var ok = false; - if (u.value.length > 0) { - if (u.value.search) { - ok = (u.value.search(/\S/) !== -1); - } else { - ok = true; - } - } - if (! ok) { - u.focus(); - } - return ok; - } - return true; -} -</script> -EOF $onload = ' onload="if(document.getElementById){document.getElementById(\'uri_1\').focus()}"'; } @@ -2987,7 +2948,7 @@ <html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\"> <head> <title>W3C Link Checker", &encode($title), "</title> -", $Head, $script, "</head> +", $Head, "</head> <body", $onload, '>'; &banner($title); return; diff -r e0644feb2f38 -r 89d7df5780cc bin/checklink.pod --- a/bin/checklink.pod Tue Mar 22 21:27:00 2011 +0200 +++ b/bin/checklink.pod Tue Mar 22 22:03:22 2011 +0200 @@ -234,12 +234,11 @@ CSS_Validator_URI = http://jigsaw.w3.org/css-validator/validator?uri=%s -C<Doc_URI> and C<Style_URI> are URIs used for linking to the documentation -and style sheet from the dynamically generated content of the link checker. -The defaults are: +C<Doc_URI> is a URI used for linking to the documentation, and CSS and +JavaScript files in the dynamically generated content of the link checker. +The default is: Doc_URI = http://validator.w3.org/docs/checklink.html - Style_URI = http://validator.w3.org/docs/linkchecker.css =back diff -r e0644feb2f38 -r 89d7df5780cc docs/linkchecker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/linkchecker.js Tue Mar 22 22:03:22 2011 +0200 @@ -0,0 +1,39 @@ +function uriOk(num) +{ + if (!document.getElementById) { + return true; + } + + var u = document.getElementById('uri_' + num); + var ok = false; + if (u.value.length > 0) { + if (u.value.search) { + ok = (u.value.search(/\S/) !== -1); + } + else { + ok = true; + } + } + if (!ok) { + u.focus(); + } + return ok; +} + +function show_progress(progress_id, progress_text, progress_percentage) +{ + var div = document.getElementById("progress" + progress_id); + + var head = div.getElementsByTagName("h3")[0]; + var text = document.createTextNode(progress_text); + var span = document.createElement("span"); + span.appendChild(text); + head.replaceChild(span, head.getElementsByTagName("span")[0]); + + var bar = div.getElementsByTagName("div")[0]; + bar.firstChild.style.width = progress_percentage; + bar.title = progress_percentage; + + var pre = div.getElementsByTagName("pre")[0]; + pre.scrollTop = pre.scrollHeight; +} diff -r e0644feb2f38 -r 89d7df5780cc etc/checklink.conf --- a/etc/checklink.conf Tue Mar 22 21:27:00 2011 +0200 +++ b/etc/checklink.conf Tue Mar 22 22:03:22 2011 +0200 @@ -44,8 +44,10 @@ # # Doc_URI is the URI to the Link Checker documentation, shown in the # results report in CGI mode, and the usage message in command line mode. -# If you have installed the documentation locally somewhere, you may wish to -# change this to point to that version. This must be an absolute URI. +# The URIs to the CSS and JavaScript files in the generated HTML are also +# formed using this as their base URI. If you have installed the documentation +# locally somewhere, you may wish to change this to point to that location. +# This must be an absolute URI. # # Default: # Doc_URI = http://validator.w3.org/docs/checklink.html
Received on Tuesday, 22 March 2011 20:34:03 UTC