changeset 29:18110c461824

js: loading another content if OS is Win
author Alexander Solovyov <piranha@piranha.org.ua>
date Mon, 16 Feb 2009 00:04:58 +0200
parents cbfc4d01da6b
children d13070c29a6c
files src/en/index.html src/en/javascript/main.js src/en/win.html
diffstat 3 files changed, 62 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/en/index.html	Sun Feb 15 19:59:01 2009 +0100
+++ b/src/en/index.html	Mon Feb 16 00:04:58 2009 +0200
@@ -5,13 +5,14 @@
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 		<link href="styles/styles.css" type="text/css" rel="stylesheet">
 		<script type="text/javascript" src="javascript/typeface.js"></script>
-		<script type="text/javascript" src="javascript/optimer_regular.typeface.js"></script>					
+		<script type="text/javascript" src="javascript/optimer_regular.typeface.js"></script>
+		<script type="text/javascript" src="javascript/main.js"></script>
 		<title>Mercurial SCM</title>
 	</head>
 	<body id="home">
-				
+
 		<h1 id="logo"><a href="index.html">mercurial</a></h1>
-			
+
 		<ul id="nav" class="typeface-js">
 			<li><a href="about.html">about</a></li>
 			<li><a href="javascript:void(0);">download</a></li>
@@ -19,7 +20,7 @@
 			<li><a href="javascript:void(0);">docs</a></li>
 			<li><a href="javascript:void(0);">community</a></li>
 		</ul>
-		
+
 		<form id="search" method="post" action="index.html">
 			<fieldset>
 				<legend>Search form</legend>
@@ -28,14 +29,14 @@
 				<input class="submit" type="submit" value="search">
 			</fieldset>
 		</form>
-		
+
 		<div id="content">
 			<div class="row">
 				<div class="col big">
 					<h1>Work easier <br> Work faster</h1>
 					<h2>Mercurial is a free, distributed source control management tool. It offers you the power to efficiently handle projects of any size while using an easy and intuitive interface.</h2>
 				</div>
-				<div class="col">					
+				<div class="col">
 					<a class="download typeface-js" href="javascript:void(0);">
 						<strong>Download now</strong>
 						Mercurial <em>2.42</em>
@@ -44,14 +45,18 @@
 					<dl>
 						<dt class="typeface-js">Requirements</dt>
 						<dd>Python 2.5 (<a href="http://www.python.org">get python</a>)</dd>
-						
+
 						<dt>Another OS?<br><em>Get mercurial for:</em></dt>
 						<dd><a href="javascript:void(0);">Mac OS X</a></dd>
-						<dd><a href="javascript:void(0);">Linux</a></dd>						
-					</dl>				
+						<dd><a href="javascript:void(0);">Linux</a></dd>
+					</dl>
 				</div>
 			</div>
-			
+
+			<div id="replace">
+			    That's a default content here
+		    </div>
+
 			<div class="row">
 				<div class="col big">
 					<h3>How you can benefit from Mercurial</h3>
@@ -77,7 +82,7 @@
 				</div>
 			</div>
 		</div>
-		
+
 		<div id="footer">
 			<a href="http://www.designpunct.ro">punct</a> /
 			<a href="http://www.avantlumiere.com/">bitbucket</a> /
@@ -86,8 +91,8 @@
 				<img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/us/80x15.png" />
 			</a>
 			<br />
-			This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License</a>.		
+			This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License</a>.
 		</div>
-		
+
 	</body>
 </html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/en/javascript/main.js	Mon Feb 16 00:04:58 2009 +0200
@@ -0,0 +1,43 @@
+// http://simonwillison.net/2004/May/26/addLoadEvent/
+function addLoadEvent(func) {
+  var oldonload = window.onload;
+  if (typeof window.onload != 'function') {
+    window.onload = func;
+  } else {
+    window.onload = function() {
+      if (oldonload) {
+        oldonload();
+      }
+      func();
+    }
+  }
+}
+
+var xmlhttp = null;
+
+function loadXMLDoc(url) {
+    if (window.XMLHttpRequest) {// code for Firefox, Opera, IE7, etc.
+        xmlhttp = new XMLHttpRequest();
+    } else if (window.ActiveXObject) {// code for IE6, IE5
+        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+    }
+    if (xmlhttp != null) {
+        xmlhttp.onreadystatechange = stateChange;
+        xmlhttp.open("GET",url,true);
+        xmlhttp.send(null);
+    } else {
+        alert("Your browser does not support XMLHTTP.");
+    }
+}
+
+function stateChange() {
+    if (xmlhttp.readyState==4) {// 4 = "loaded"
+        document.getElementById('replace').innerHTML = xmlhttp.responseText;
+    }
+}
+
+addLoadEvent(function () {
+    if (navigator.appVersion.indexOf("Win")!=-1) {
+        loadXMLDoc("win.html");
+    }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/en/win.html	Mon Feb 16 00:04:58 2009 +0200
@@ -0,0 +1,1 @@
+That's a part for Windows!
\ No newline at end of file