summaryrefslogtreecommitdiffstats
path: root/htdocs/scripts/w3c-validator.js
diff options
context:
space:
mode:
authorville <ville@localhost>2010-01-06 21:43:51 +0000
committerville <ville@localhost>2010-01-06 21:43:51 +0000
commitfec6acd64318d818abf84b5c0ed747f4afe74b84 (patch)
tree38710c2758ecf913b95c08889eaf3c83936a85a0 /htdocs/scripts/w3c-validator.js
parent20c12a6112f42d790b7f4b130860f96d4332a699 (diff)
downloadmarkup-validator-fec6acd64318d818abf84b5c0ed747f4afe74b84.zip
markup-validator-fec6acd64318d818abf84b5c0ed747f4afe74b84.tar.gz
markup-validator-fec6acd64318d818abf84b5c0ed747f4afe74b84.tar.bz2
Indentation/whitespace tweaks, NFC.
Diffstat (limited to 'htdocs/scripts/w3c-validator.js')
-rw-r--r--htdocs/scripts/w3c-validator.js110
1 files changed, 54 insertions, 56 deletions
diff --git a/htdocs/scripts/w3c-validator.js b/htdocs/scripts/w3c-validator.js
index 73f8aae..1b6f989 100644
--- a/htdocs/scripts/w3c-validator.js
+++ b/htdocs/scripts/w3c-validator.js
@@ -1,22 +1,22 @@
var W3C = {
-
+
start: function(){
-
+
//select elements
-
+
W3C.Legends = $$('legend.toggletext');
W3C.LegendImage = $$('.toggleicon');
W3C.Options = $$('div.options');
-
+
W3C.TabSet = $('tabset_tabs');
-
+
W3C.Tabs = W3C.TabSet.getElements('li');
W3C.TabLinks = W3C.TabSet.getElements('a');
-
+
W3C.Sections = $$('fieldset.tabset_content');
W3C.Submits = $$('input[type=submit]');
W3C.Forms = $$('form');
-
+
W3C.Submits.each(function(submit, i){
var value = submit.value;
submit.setStyle('display', 'none');
@@ -27,15 +27,15 @@ var W3C = {
W3C.Forms[i].submit();
});
});
-
-
+
+
//initialize effects arrays
-
+
W3C.SectionFx = [];
W3C.OptionsFx = [];
-
+
//creating the Effects for the Options
-
+
W3C.Options.each(function(option, i){
W3C.OptionsFx[i] = new Fx.Slide(option, {'wait': false, 'duration': 180});
W3C.OptionsFx[i].addEvent('onComplete', function(){
@@ -47,9 +47,9 @@ var W3C = {
}
});
});
-
+
//creating links on legends, with event listeners
-
+
W3C.Legends.each(function(legend, i){
var pid = W3C.Sections[i].id.replace(/-/g, '_');
var opt = '+with_options';
@@ -63,9 +63,9 @@ var W3C = {
W3C.refreshOptionLinks(!block, i);
});
});
-
+
//creating event listeners on tabs
-
+
W3C.Tabs.each(function(li, i){
var link = li.getFirst();
link.href = link.original = '#' + link.href.split('#')[1].replace(/-/g, '_');
@@ -74,17 +74,17 @@ var W3C = {
W3C.displaySection(i);
});
});
-
+
//updating the location
-
+
W3C.updateLocation();
-
+
//setting the initial display of the options, based on the location
-
+
W3C.refreshOptionLinks(W3C.WithOptions);
-
+
//attaching the Sections effects, and display section based on the uri
-
+
W3C.Sections.each(function(section, i){
var fakeId = section.id.replace(/-/g, '_');
W3C.SectionFx[i] = new Fx.Style(section, 'opacity', {'wait': false, 'duration': 220});
@@ -94,56 +94,54 @@ var W3C = {
W3C.Located = true;
}
});
-
+
//displaying the first section if no one is located
-
+
if (!W3C.Located) W3C.displaySection(0, true);
-
+
if (window.ie) $$('legend').setStyle('margin-left', '-0.4em');
},
-
+
updateLocation: function(){
W3C.Location = window.location.hash.replace('#', '').split('+');
W3C.WithOptions = (W3C.Location[1] && W3C.Location[1].contains('with_options'));
},
-
+
refreshOptionLinks: function(options, idx){
-
+
if (!options){
- W3C.LegendImage.each(function(legendimage, i){
- legendimage.setProperties({
- src: './images/arrow-closed.png',
- alt: 'Show '
- });
- legendimage.removeClass('toggled');
- });
+ W3C.LegendImage.each(function(legendimage, i){
+ legendimage.setProperties({
+ src: './images/arrow-closed.png',
+ alt: 'Show '
+ });
+ legendimage.removeClass('toggled');
+ });
if ($chk(idx)) W3C.OptionsFx[idx].slideOut();
W3C.Legends.removeClass('toggled');
-
+
} else {
- W3C.LegendImage.each(function(legendimage, i){
- legendimage.setProperties({
- src: './images/arrow-open.png',
- alt: 'Hide '
- });
- legendimage.addClass('toggled');
- if ($chk(idx)) W3C.OptionsFx[idx].slideIn();
- W3C.Legends.addClass('toggled');
- W3C.Legends.each(function(legend, i){
- var link = legend.getFirst();
- var linkhref = link.getProperty("href").replace("+with_options", '');
- link.setProperty("href", linkhref);
+ W3C.LegendImage.each(function(legendimage, i){
+ legendimage.setProperties({
+ src: './images/arrow-open.png',
+ alt: 'Hide '
+ });
+ legendimage.addClass('toggled');
+ if ($chk(idx)) W3C.OptionsFx[idx].slideIn();
+ W3C.Legends.addClass('toggled');
+ W3C.Legends.each(function(legend, i){
+ var link = legend.getFirst();
+ var linkhref = link.getProperty("href").replace("+with_options", '');
+ link.setProperty("href", linkhref);
+ });
});
-
- });
-
}
-
+
W3C.TabLinks.each(function(link){
link.href = (options) ? link.original + '+with_options' : link.original;
});
},
-
+
displaySection: function(i, sudden){
W3C.Sections.each(function(section, j){
var block = section.getStyle('display') == 'block';
@@ -158,13 +156,13 @@ var W3C = {
W3C.Sections[j].setStyles({'display': 'none', 'opacity': 0});
}
});
-
+
W3C.Tabs.each(function(link, j){
if (j == i) link.addClass('selected');
else link.removeClass('selected');
});
},
-
+
setHash: function(hash){
if (window.webkit419){
W3C.FakeForm = W3C.FakeForm || new Element('form', {'method': 'get'}).injectInside(document.body);
@@ -173,7 +171,7 @@ var W3C = {
window.location.hash = hash;
}
}
-
+
};
window.addEvent('domready', W3C.start);