Commits

Alexander Solovyov committed 18110c4

js: loading another content if OS is Win

  • Participants
  • Parent commits cbfc4d0

Comments (0)

Files changed (3)

File src/en/index.html

 		<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>
 			<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>
 				<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>
 					<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>
 				</div>
 			</div>
 		</div>
-		
+
 		<div id="footer">
 			<a href="http://www.designpunct.ro">punct</a> /
 			<a href="http://www.avantlumiere.com/">bitbucket</a> /
 				<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>

File src/en/javascript/main.js

+// 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");
+    }
+});

File src/en/win.html

+That's a part for Windows!