- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 21 Aug 2009 10:06:38 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/WebContent/scripts In directory hutz:/tmp/cvs-serv14881/WebContent/scripts Modified Files: Tag: dev2 w3c-validator.js Log Message: new code Index: w3c-validator.js =================================================================== RCS file: /sources/public/2006/unicorn/WebContent/scripts/Attic/w3c-validator.js,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -d -r1.1.2.4 -r1.1.2.5 --- w3c-validator.js 21 Aug 2009 07:04:45 -0000 1.1.2.4 +++ w3c-validator.js 21 Aug 2009 10:06:36 -0000 1.1.2.5 @@ -1,35 +1,92 @@ var W3C = { start: function(){ - - //select elements - - W3C.Legends = $$('legend.toggletext'); - W3C.Options = $$('fieldset.slide 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.js[type=submit]'); W3C.Forms = $$('form.ucn'); - - // unicorn specific W3C.TaskButtons = $$('input.change_task'); - W3C.Tasks = $$('select.ucn_task'); W3C.TaskButtons.setStyle('display', 'none'); + W3C.Tasks = $$('select.ucn_task'); + W3C.SectionFx = []; + W3C.OptionsFx = []; + + //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, '_'); + li.addEvent('click', function(){ + W3C.updateLocation(); + W3C.displaySection(i); + }); + }); + + //updating the location + W3C.updateLocation(); + + W3C.initializeOptions(); + + //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.Tween(section, {property: 'opacity', 'duration': 220, 'wait': false}); + section.setStyle('display', 'none'); + if (W3C.Location[0] && fakeId.contains(W3C.Location[0].replace(/-/g, '_'))){ + W3C.displaySection(i, true); + 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'); + + //changing submit buttons + if ($$('input.js + a').length == 0) { + W3C.Submits.each(function(submit, i){ + var value = submit.value; + submit.setStyle('display', 'none'); + var link = new Element('a', {'class': 'submit', 'href': '#'}); + var span = new Element('span').set('html', value).inject(link); + link.injectAfter(submit).addEvent('click', function(event){ + new Event(event).stop(); + event.stop(); + W3C.Forms[i].submit(); + }); + }); + } + + //adding mouseover events to the task options + $$('select.ucn_task option').addEvent('mouseover', function(event) { + var title = this.title; + $$('span.task_description').each(function (span) { + span.set('text', title); + }); + event.stop(); + }); + + //adding change events to task selects (sends ajax request) W3C.Tasks.addEvent('change', function(event){ - var taskId = this.options[this.selectedIndex].value; + var title = this.options[this.selectedIndex].title; + $$('span.task_description').each(function (span) { + span.set('text', title); + }); - var req = new Request.HTML({url: '/unicorn_dev/',//window.location,// + '?ucn_task=' + taskId, + event.stop(); + var taskId = this.options[this.selectedIndex].value; + var req = new Request.HTML({url: '/unicorn_dev/', method: 'get', onRequest: function() { - $$('div.options_container').each(function (div) { - div.set('html', ''); - }); + $$('div.options_container').each(function (div) { + div.set('html', ''); + }); }, onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) { $$('div.options_container').each(function (div) { @@ -45,63 +102,42 @@ option.setProperty('selected', ''); }; }); - - W3C.start(); + W3C.initializeOptions(); }, onFailure: function() { $$('fieldset.options').set('html', ''); } }); - // + '&ucn_task=' + taskId, - //method: 'get', - req.send('ucn_task=' + taskId + '&ucn_lang=' + $$('input.lang')[0].getProperty('value')); - - + var queryString = 'ucn_task=' + taskId + '&ucn_lang=' + $$('input.lang')[0].getProperty('value'); + req.send(queryString); }); - - if ($$('input.js + a').length == 0) { - W3C.Submits.each(function(submit, i){ - var value = submit.value; - submit.setStyle('display', 'none'); - var link = new Element('a', {'class': 'submit', 'href': '#'}); - var span = new Element('span').set('html', value).inject(link); - link.injectAfter(submit).addEvent('click', function(event){ - //new Event(event).stop(); - event.stop(); - W3C.Forms[i].submit(); - }); - }); - } - - - //initialize effects arrays - - W3C.SectionFx = []; + }, + + initializeOptions: function(){ + W3C.Legends = $$('legend.toggletext'); + W3C.Options = $$('fieldset.slide div.options'); W3C.OptionsFx = []; //creating the Effects for the Options - $$('fieldset.slide div.options').each(function(option, i){ - W3C.OptionsFx[i] = new Fx.Slide(option, {'wait': false, 'duration': 180}); W3C.OptionsFx[i].addEvent('onComplete', function(){ - /*if (this.element.getStyle('margin-top').toInt() == 0){ + if (this.element.getStyle('margin-top').toInt() == 0){ this.wrapper.setStyle('height', 'auto'); } - else {*/ - // this.element.setStyle('display','none'); // if a slideOut completed, set display:none - //} + else { + this.element.setStyle('display','none'); // if a slideOut completed, set display:none + } }); }); //creating links on legends, with event listeners - $$('legend.toggletext').each(function(legend, i){ var html = legend.innerHTML; var pid = W3C.Sections[i].id.replace(/-/g, '_'); var opt = '+with_options'; legend.set('html', '<a href="#'+ pid + opt + '">' + html + '</a>'); - var option = $$('fieldset.slide div.options')[i]; + var option = W3C.Options[i]; var link = legend.getFirst(); link.addEvent('click', function(event){ option.setStyle('display', 'block'); // before any slide effect, set display:block @@ -113,45 +149,14 @@ }); }); - //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, '_'); - li.addEvent('click', function(){ - W3C.updateLocation(); - 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.OptionsFx.each(function (fx) { + if (W3C.WithOptions) fx.show().fireEvent('onComplete'); + else fx.hide(); - W3C.Sections.each(function(section, i){ - var fakeId = section.id.replace(/-/g, '_'); - //W3C.SectionFx[i] = new Fx.Tween(section, 'opacity', {'wait': false, 'duration': 220}); - W3C.SectionFx[i] = new Fx.Tween(section, {property: 'opacity', 'duration': 220, 'wait': false}); - section.setStyle('display', 'none'); - if (W3C.Location[0] && fakeId.contains(W3C.Location[0].replace(/-/g, '_'))){ - W3C.displaySection(i, true); - 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(){ @@ -204,39 +209,7 @@ } else { window.location.hash = hash; } - }, - - //unicorn specific - updateOptions: function(value) { - //alert(value); - - var req = new Request.HTML({url:'/unicorn_dev/?ajax&ucn_task=' + value, - onSuccess: function(html) { - //var s = new Element('div'); - //s.set('html', 'Tom'); - //s.set('html', html); - //alert("d" + s); - //html.inject($('fieldset.options'), 'top'); - //s.inject($$('body'), 'top'); - //s.inject($$('fieldset.options')); - var a = new Element().adopt(html); - - $$('div.options_container').set('html',''); - $$('div.options_container').adopt(html); - - /*W3C.sections.each(function (section) { - html.inject(section); - - });*/ - }, - onFailure: function() { - $$('fieldset.options').set('html', ''); - } - }); - req.send(); - } - }; window.addEvent('domready', W3C.start);
Received on Friday, 21 August 2009 10:06:48 UTC