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

2006/unicorn/WebContent/scripts w3c_unicorn_languages.js,1.3,1.4

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 12 Oct 2009 12:27:40 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MxK04-0002QR-9x@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/WebContent/scripts
In directory hutz:/tmp/cvs-serv9293/WebContent/scripts

Modified Files:
	w3c_unicorn_languages.js 
Log Message:
updated for language form

Index: w3c_unicorn_languages.js
===================================================================
RCS file: /sources/public/2006/unicorn/WebContent/scripts/w3c_unicorn_languages.js,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- w3c_unicorn_languages.js	9 Oct 2009 15:24:58 -0000	1.3
+++ w3c_unicorn_languages.js	12 Oct 2009 12:27:38 -0000	1.4
@@ -3,17 +3,85 @@
 	
 	start: function(){
 		
-		var tdOk = $$('#translations td.ok');
-		tdOk.each(function(element) {
-			var span = element.getElement('span'); 
-			element.store('tip:text', span.title);
-			span.removeProperty('title');
-		});
+		W3C.TableRows = $$('fieldset.translation table tbody tr');
+	
+		if ($('a_miss')) {
+			
+			$('a_miss').addEvent('click', function (event) {
+				event.preventDefault();
+				W3C.TableRows.each(function (tr) {
+					if (tr.getElement('td.missing')) {
+						tr.setStyle('display', '');
+					} else {
+						tr.setStyle('display', 'none');
+					}
+				});
+			});
+			
+			$('a_mod').addEvent('click', function (event) {
+				event.preventDefault();
+				W3C.TableRows.each(function (tr) {
+					if (tr.getElement('td.modified')) {
+						tr.setStyle('display', '');
+					} else {
+						tr.setStyle('display', 'none');
+					}
+				});
+			});
+			
+			$('a_all').addEvent('click', function (event) {
+				event.preventDefault();
+				W3C.TableRows.each(function (tr) {
+					tr.setStyle('display', '');
+				});
+			});
+			
+			$$('fieldset.translation td').each(function (td) {
+				var input = td.getElement('input');
+				input.store('ucn:trad', input.value);
+				
+				input.addEvent('keyup', function (event) {
+					if (input.value != input.retrieve('ucn:trad') && input.value != "") {
+						td.addClass('modified');
+						td.removeClass('missing');
+					} else {
+						td.removeClass('modified');
+						if (input.value == "")
+							td.addClass('missing');
+					}
+					
+					W3C.updateLinks();
+				});
+			});
+			
+			W3C.updateLinks();
 		
-		new Tips(tdOk);
+		} else {
 		
+			var tdOk = $$('#translations td.ok');
+			tdOk.each(function(element) {
+				var span = element.getElement('span'); 
+				element.store('tip:text', span.title);
+				span.removeProperty('title');
+			});
+			new Tips(tdOk);
+		}
+		
+	},
+
+	updateLinks: function() {
 		
+		if ($('translations').getElements('td.missing').length == 0)
+			$('a_miss').setStyle('display', 'none');
+		else
+			$('a_miss').setStyle('display', '');
+		
+		if ($('translations').getElements('td.modified').length == 0)
+			$('a_mod').setStyle('display', 'none');
+		else
+			$('a_mod').setStyle('display', '');
 		
+		$('a_all').setStyle('display', '');
 	}
 	
 };
Received on Monday, 12 October 2009 12:27:41 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:39 UTC