blob: 27dbc74ab67d360aaa9d1661a7bbdc39235a16bc [file] [log] [blame]
Andrew Gerrand8bbe5cc2012-01-20 07:37:36 +11001<!--{
Andrew Gerrand5f2cda52015-09-02 10:46:05 +10002 "Path": "/",
3 "Template": true
Andrew Gerrand8bbe5cc2012-01-20 07:37:36 +11004}-->
5
Andrew Gerrandd1e726c2012-03-05 10:34:22 +11006<div class="left">
Andrew Gerrandd84de092012-02-13 21:22:36 +11007
8<div id="learn">
Andrew Gerrand5dd74172013-09-16 15:47:13 +10009<a class="popout share">Pop-out</a>
Andrew Gerrandd84de092012-02-13 21:22:36 +110010<div class="rootHeading">Try Go</div>
11<div class="input">
Andrew Gerrande8636a62012-03-13 11:00:11 +110012<textarea spellcheck="false" class="code">// You can edit this code!
Andrew Gerrandd84de092012-02-13 21:22:36 +110013// Click here and start typing.
14package main
15
16import "fmt"
17
18func main() {
19 fmt.Println("Hello, 世界")
20}</textarea>
21</div>
Andrew Gerrande8636a62012-03-13 11:00:11 +110022<div class="output">
Andrew Gerrandd84de092012-02-13 21:22:36 +110023<pre>
24Hello, 世界
25</pre>
26</div>
27<div class="buttons">
Andrew Gerrandd528f522012-03-15 17:44:47 +110028<a class="run" href="#" title="Run this code [shift-enter]">Run</a>
Andrew Gerrand5f2cda52015-09-02 10:46:05 +100029{{if $.Share}}
Andrew Gerrandd528f522012-03-15 17:44:47 +110030<a class="share" href="#" title="Share this code">Share</a>
Andrew Gerrand5f2cda52015-09-02 10:46:05 +100031{{end}}
Andrew Gerrand43ad89d2014-07-25 10:28:39 +100032<a class="tour" href="//tour.golang.org/" title="Learn Go from your browser">Tour</a>
Andrew Gerrandd528f522012-03-15 17:44:47 +110033</div>
34<div class="toys">
35<select>
36 <option value="hello.go">Hello, World!</option>
Andrew Gerrand850d1022013-06-04 12:59:28 +100037 <option value="life.go">Conway's Game of Life</option>
Andrew Gerrandd528f522012-03-15 17:44:47 +110038 <option value="fib.go">Fibonacci Closure</option>
39 <option value="peano.go">Peano Integers</option>
40 <option value="pi.go">Concurrent pi</option>
41 <option value="sieve.go">Concurrent Prime Sieve</option>
42 <option value="solitaire.go">Peg Solitaire Solver</option>
43 <option value="tree.go">Tree Comparison</option>
44</select>
Andrew Gerrandd84de092012-02-13 21:22:36 +110045</div>
46</div>
47
48</div>
49
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110050<div class="right">
51
52<div id="about">
Andrew Gerrand8b0fad12013-10-29 15:56:38 +090053Go is an open source programming language that makes it easy to build
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110054simple, reliable, and efficient software.
55</div>
56
57<div id="gopher"></div>
58
Andrew Gerrand31b0b732015-08-05 11:58:44 +100059<a href="https://golang.org/dl/" id="start">
Andrew Gerrand17d12d62013-03-01 11:22:13 +110060<span class="big">Download Go</span>
61<span class="desc">
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110062Binary distributions available for<br>
63Linux, Mac OS X, Windows, and more.
Andrew Gerrand17d12d62013-03-01 11:22:13 +110064</span>
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110065</a>
66
67</div>
68
Andrew Gerrandd84de092012-02-13 21:22:36 +110069<div style="clear: both"></div>
70
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110071<div class="left">
Andrew Gerrandd84de092012-02-13 21:22:36 +110072
73<div id="video">
74<div class="rootHeading">Featured video</div>
Andrew Gerrand5dd74172013-09-16 15:47:13 +100075<iframe width="415" height="241" src="//www.youtube.com/embed/ytEkHepK08c" frameborder="0" allowfullscreen></iframe>
Andrew Gerrandd84de092012-02-13 21:22:36 +110076</div>
77
78</div>
79
Andrew Gerrandd1e726c2012-03-05 10:34:22 +110080<div class="right">
Andrew Gerrandd84de092012-02-13 21:22:36 +110081
82<div id="blog">
83<div class="rootHeading">Featured articles</div>
Andrew Gerrand43ad89d2014-07-25 10:28:39 +100084<div class="read"><a href="//blog.golang.org/">Read more</a></div>
Andrew Gerrandd84de092012-02-13 21:22:36 +110085</div>
86
87</div>
88
89<div style="clear: both;"></div>
90
Andrew Gerrand35096872012-02-15 12:59:50 +110091<script type="text/javascript">
Andrew Gerrandf0c3d262013-05-08 09:23:50 -070092
93function readableTime(t) {
94 var m = ["January", "February", "March", "April", "May", "June", "July",
95 "August", "September", "October", "November", "December"];
96 var p = t.substring(0, t.indexOf("T")).split("-");
97 var d = new Date(p[0], p[1]-1, p[2]);
98 return d.getDate() + " " + m[d.getMonth()] + " " + d.getFullYear();
99}
Andrew Gerrand7190fdd2010-03-20 11:42:57 +1100100
Andrew Gerrandd84de092012-02-13 21:22:36 +1100101function feedLoaded(result) {
Andrew Gerrand35096872012-02-15 12:59:50 +1100102 var blog = document.getElementById("blog");
103 var read = blog.getElementsByClassName("read")[0];
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700104 for (var i = 0; i < result.length && i < 2; i++) {
105 var entry = result[i];
Andrew Gerrand35096872012-02-15 12:59:50 +1100106 var title = document.createElement("a");
107 title.className = "title";
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700108 title.href = entry.Link;
109 title.innerHTML = entry.Title;
Andrew Gerrand35096872012-02-15 12:59:50 +1100110 blog.insertBefore(title, read);
111 var extract = document.createElement("div");
112 extract.className = "extract";
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700113 extract.innerHTML = entry.Summary;
Andrew Gerrand35096872012-02-15 12:59:50 +1100114 blog.insertBefore(extract, read);
115 var when = document.createElement("div");
116 when.className = "when";
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700117 when.innerHTML = "Published " + readableTime(entry.Time);
Andrew Gerrand35096872012-02-15 12:59:50 +1100118 blog.insertBefore(when, read);
119 }
Andrew Gerrandd84de092012-02-13 21:22:36 +1100120}
121
Andrew Gerrandd920d8d2013-07-30 14:22:14 +1000122window.initFuncs.push(function() {
Andrew Gerranda48702e2013-08-22 11:12:44 +1000123 // Set up playground if enabled.
124 if (window.playground) {
125 window.playground({
126 "codeEl": "#learn .code",
127 "outputEl": "#learn .output",
128 "runEl": "#learn .run",
129 "shareEl": "#learn .share",
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000130 "shareRedirect": "//play.golang.org/p/",
Andrew Gerranda48702e2013-08-22 11:12:44 +1000131 "toysEl": "#learn .toys select"
132 });
133 } else {
134 $('#learn').hide()
135 }
Andrew Gerrandd84de092012-02-13 21:22:36 +1100136
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700137 // Load blog feed.
138 $('<script/>').attr('text', 'text/javascript')
Andrew Gerrand43ad89d2014-07-25 10:28:39 +1000139 .attr('src', '//blog.golang.org/.json?jsonp=feedLoaded')
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700140 .appendTo('body');
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000141
142 // Set the video at random.
143 var videos = [
144 {h: 241, s: "//www.youtube.com/embed/ytEkHepK08c"}, // Tour of Go
145 {h: 241, s: "//www.youtube.com/embed/f6kdp27TYZs"}, // Concurrency Patterns
Andrew Gerrand5dd74172013-09-16 15:47:13 +1000146 {h: 233, s: "//player.vimeo.com/video/69237265"} // Simple environment
147 ];
148 var v = videos[Math.floor(Math.random()*videos.length)];
149 $('#video iframe').attr('height', v.h).attr('src', v.s);
Andrew Gerrandf0c3d262013-05-08 09:23:50 -0700150});
151
Andrew Gerrandd84de092012-02-13 21:22:36 +1100152</script>