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

2006/unicorn/WebContent/scripts w3c_unicorn_results.js,1.16,1.17 w3c_unicorn_index.js,1.13,1.14

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 06 Oct 2009 15:22:10 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MvBre-0008JW-QT@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/WebContent/scripts
In directory hutz:/tmp/cvs-serv31944/WebContent/scripts

Modified Files:
	w3c_unicorn_results.js w3c_unicorn_index.js 
Log Message:
new setHash method which uses window.location.replace so that the root page is not recorded in the browser history. Works fine with ff3.5, should be tested further with other browsers

Index: w3c_unicorn_results.js
===================================================================
RCS file: /sources/public/2006/unicorn/WebContent/scripts/w3c_unicorn_results.js,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- w3c_unicorn_results.js	2 Oct 2009 12:23:59 -0000	1.16
+++ w3c_unicorn_results.js	6 Oct 2009 15:22:08 -0000	1.17
@@ -3,6 +3,8 @@
 	
 	start: function() {
 		
+		document.addEvent('onHistoryChange')
+	
 		W3C.Observers = $$('.observer');
 		
 		var slideDuration = 500;
@@ -30,7 +32,6 @@
 			title.addEvent('click', function(event) {
 				W3C.toggle(section);
 			});
-			
 		});
 		
 		$$('.observer .section').each(function(section) {
@@ -236,10 +237,15 @@
 			W3C.FakeForm = W3C.FakeForm || new Element('form', {'method': 'get'}).injectInside(document.body);
 			W3C.FakeForm.setProperty('action', '#' + hash).submit();
 		} else {
-			window.location.hash = '#' + hash;
+			window.location.replace('#' + hash);
 		}
 	}
 };
 
 window.addEvent('domready', W3C.start);
 
+window.addEvent('onbeforeunload', function () {
+	console.log(history.toString());
+	history.go(-2);
+});
+

Index: w3c_unicorn_index.js
===================================================================
RCS file: /sources/public/2006/unicorn/WebContent/scripts/w3c_unicorn_index.js,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- w3c_unicorn_index.js	1 Oct 2009 17:19:18 -0000	1.13
+++ w3c_unicorn_index.js	6 Oct 2009 15:22:08 -0000	1.14
@@ -340,7 +340,8 @@
 			W3C.FakeForm = W3C.FakeForm || new Element('form', {'method': 'get'}).injectInside(document.body);
 			W3C.FakeForm.setProperty('action', '#' + hash).submit();
 		} else {
-			window.location.hash = '#' + hash;
+			window.location.replace('#' + hash);
+			//window.location.hash = '#' + hash;
 		}
 	}
 	
Received on Tuesday, 6 October 2009 15:22:15 UTC

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