W3C home > Mailing lists > Public > www-validator-cvs@w3.org > February 2009

validator/htdocs/scripts w3c-validator.js,1.5,1.6

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 02 Feb 2009 21:20:21 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LU6DN-0005kA-1V@lionel-hutz.w3.org>

Update of /sources/public/validator/htdocs/scripts
In directory hutz:/tmp/cvs-serv21656/scripts

Modified Files:
	w3c-validator.js 
Log Message:
Addressing http://www.w3.org/Bugs/Public/show_bug.cgi?id=5440 and making the "arrow" image clickable to toggle options.
Cleaning up the javascript used to toggle options a bit in the process, getting rid of one of the ugliest instances of innerHTML there.




Index: w3c-validator.js
===================================================================
RCS file: /sources/public/validator/htdocs/scripts/w3c-validator.js,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- w3c-validator.js	24 Aug 2007 01:14:49 -0000	1.5
+++ w3c-validator.js	2 Feb 2009 21:20:18 -0000	1.6
@@ -5,6 +5,7 @@
 		//select elements
 		
 		W3C.Legends = $$('legend.toggletext');
+		W3C.LegendImage = $$('.toggleicon');
 		W3C.Options = $$('div.options');
 		
 		W3C.TabSet = $('tabset_tabs');
@@ -50,10 +51,8 @@
 		//creating links on legends, with event listeners
 		
 		W3C.Legends.each(function(legend, i){
-			var html = legend.innerHTML;
 			var pid = W3C.Sections[i].id.replace(/-/g, '_');
 			var opt = '+with_options';
-			legend.setHTML('<a href="#'+ pid + opt + '">' + html + '</a>');
 			var option = W3C.Options[i];
 			var link = legend.getFirst();
 			link.addEvent('click', function(event){
@@ -111,11 +110,33 @@
 	refreshOptionLinks: function(options, idx){
 		
 		if (!options){
+    		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.TabLinks.each(function(link){
Received on Monday, 2 February 2009 21:20:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:08 GMT