summaryrefslogtreecommitdiff
path: root/doc/root.html
blob: 3c6de2e46c7245fc13ed1c34f488cb697fc659b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!--{
	"Path": "/"
}-->

<div class="left">

<div id="learn">
<a class="popout share">Pop-out</a>
<div class="rootHeading">Try Go</div>
<div class="input">
<textarea spellcheck="false" class="code">// You can edit this code!
// Click here and start typing.
package main

import "fmt"

func main() {
	fmt.Println("Hello, 世界")
}</textarea>
</div>
<div class="output">
<pre>
Hello, 世界
</pre>
</div>
<div class="buttons">
<a class="run" href="#" title="Run this code [shift-enter]">Run</a>
<a class="share" href="#" title="Share this code">Share</a>
<a class="tour" href="//tour.golang.org/" title="Learn Go from your browser">Tour</a>
</div>
<div class="toys">
<select>
	<option value="hello.go">Hello, World!</option>
	<option value="life.go">Conway's Game of Life</option>
	<option value="fib.go">Fibonacci Closure</option>
	<option value="peano.go">Peano Integers</option>
	<option value="pi.go">Concurrent pi</option>
	<option value="sieve.go">Concurrent Prime Sieve</option>
	<option value="solitaire.go">Peg Solitaire Solver</option>
	<option value="tree.go">Tree Comparison</option>
</select>
</div>
</div>

</div>

<div class="right">

<div id="about">
Go is an open source programming language that makes it easy to build
simple, reliable, and efficient software.
</div>

<div id="gopher"></div>

<a href="/doc/install" id="start">
<span class="big">Download Go</span>
<span class="desc">
Binary distributions available for<br>
Linux, Mac OS X, Windows, and more.
</span>
</a>

</div>

<div style="clear: both"></div>

<div class="left">

<div id="video">
<div class="rootHeading">Featured video</div>
<iframe width="415" height="241" src="//www.youtube.com/embed/ytEkHepK08c" frameborder="0" allowfullscreen></iframe>
</div>

</div>

<div class="right">

<div id="blog">
<div class="rootHeading">Featured articles</div>
<div class="read"><a href="//blog.golang.org/">Read more</a></div>
</div>

</div>

<div style="clear: both;"></div>

<script type="text/javascript">

function readableTime(t) {
	var m = ["January", "February", "March", "April", "May", "June", "July",
		"August", "September", "October", "November", "December"];
	var p = t.substring(0, t.indexOf("T")).split("-");
	var d = new Date(p[0], p[1]-1, p[2]);
	return d.getDate() + " " + m[d.getMonth()] + " " + d.getFullYear();
}

function feedLoaded(result) {
	var blog = document.getElementById("blog");
	var read = blog.getElementsByClassName("read")[0];
	for (var i = 0; i < result.length && i < 2; i++) {
		var entry = result[i];
		var title = document.createElement("a");
		title.className = "title";
		title.href = entry.Link;
		title.innerHTML = entry.Title;
		blog.insertBefore(title, read);
		var extract = document.createElement("div");
		extract.className = "extract";
		extract.innerHTML = entry.Summary;
		blog.insertBefore(extract, read);
		var when = document.createElement("div");
		when.className = "when";
		when.innerHTML = "Published " + readableTime(entry.Time);
		blog.insertBefore(when, read);
	}
}

window.initFuncs.push(function() {
	// Set up playground if enabled.
	if (window.playground) {
		window.playground({
			"codeEl":        "#learn .code",
			"outputEl":      "#learn .output",
			"runEl":         "#learn .run",
			"shareEl":       "#learn .share",
			"shareRedirect": "//play.golang.org/p/",
			"toysEl":        "#learn .toys select"
		});
	} else {
		$('#learn').hide()
	}

	// Load blog feed.
	$('<script/>').attr('text', 'text/javascript')
		.attr('src', '//blog.golang.org/.json?jsonp=feedLoaded')
		.appendTo('body');

	// Set the video at random.
	var videos = [
		{h: 241, s: "//www.youtube.com/embed/ytEkHepK08c"}, // Tour of Go
		{h: 241, s: "//www.youtube.com/embed/f6kdp27TYZs"}, // Concurrency Patterns
		{h: 233, s: "//player.vimeo.com/video/69237265"}    // Simple environment
	];
	var v = videos[Math.floor(Math.random()*videos.length)];
	$('#video iframe').attr('height', v.h).attr('src', v.s);
});

</script>