1 <!--{ 2 "Path": "/", 3 "Template": true 4 }--> 5 6 <div class="left"> 7 8 <div id="learn"> 9 <a class="popout share">Pop-out</a> 10 <div class="rootHeading">Try Go</div> 11 <div class="input"> 12 <textarea spellcheck="false" class="code">// You can edit this code! 13 // Click here and start typing. 14 package main 15 16 import "fmt" 17 18 func main() { 19 fmt.Println("Hello, ") 20 }</textarea> 21 </div> 22 <div class="output"> 23 <pre> 24 Hello, 25 </pre> 26 </div> 27 <div class="buttons"> 28 <a class="run" href="#" title="Run this code [shift-enter]">Run</a> 29 {{if $.Share}} 30 <a class="share" href="#" title="Share this code">Share</a> 31 {{end}} 32 <a class="tour" href="//tour.golang.org/" title="Learn Go from your browser">Tour</a> 33 </div> 34 <div class="toys"> 35 <select> 36 <option value="hello.go">Hello, World!</option> 37 <option value="life.go">Conway's Game of Life</option> 38 <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> 45 </div> 46 </div> 47 48 </div> 49 50 <div class="right"> 51 52 <div id="about"> 53 Go is an open source programming language that makes it easy to build 54 simple, reliable, and efficient software. 55 </div> 56 57 <div id="gopher"></div> 58 59 <a href="https://golang.org/dl/" id="start"> 60 <span class="big">Download Go</span> 61 <span class="desc"> 62 Binary distributions available for<br> 63 Linux, Mac OS X, Windows, and more. 64 </span> 65 </a> 66 67 </div> 68 69 <div style="clear: both"></div> 70 71 <div class="left"> 72 73 <div id="video"> 74 <div class="rootHeading">Featured video</div> 75 <iframe width="415" height="241" src="//www.youtube.com/embed/ytEkHepK08c" frameborder="0" allowfullscreen></iframe> 76 </div> 77 78 </div> 79 80 <div class="right"> 81 82 <div id="blog"> 83 <div class="rootHeading">Featured articles</div> 84 <div class="read"><a href="//blog.golang.org/">Read more</a></div> 85 </div> 86 87 </div> 88 89 <div style="clear: both;"></div> 90 91 <script type="text/javascript"> 92 93 function 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 } 100 101 function feedLoaded(result) { 102 var blog = document.getElementById("blog"); 103 var read = blog.getElementsByClassName("read")[0]; 104 for (var i = 0; i < result.length && i < 2; i++) { 105 var entry = result[i]; 106 var title = document.createElement("a"); 107 title.className = "title"; 108 title.href = entry.Link; 109 title.innerHTML = entry.Title; 110 blog.insertBefore(title, read); 111 var extract = document.createElement("div"); 112 extract.className = "extract"; 113 extract.innerHTML = entry.Summary; 114 blog.insertBefore(extract, read); 115 var when = document.createElement("div"); 116 when.className = "when"; 117 when.innerHTML = "Published " + readableTime(entry.Time); 118 blog.insertBefore(when, read); 119 } 120 } 121 122 window.initFuncs.push(function() { 123 // 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", 130 "shareRedirect": "//play.golang.org/p/", 131 "toysEl": "#learn .toys select" 132 }); 133 } else { 134 $('#learn').hide() 135 } 136 137 // Load blog feed. 138 $('<script/>').attr('text', 'text/javascript') 139 .attr('src', '//blog.golang.org/.json?jsonp=feedLoaded') 140 .appendTo('body'); 141 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 146 {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); 150 }); 151 152 </script> 153