1
0

root.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <!--{
  2. "Path": "/",
  3. "Template": true
  4. }-->
  5. <div class="left">
  6. <div id="learn">
  7. <a class="popout share">Pop-out</a>
  8. <div class="rootHeading">Try Go</div>
  9. <div class="input">
  10. <textarea spellcheck="false" class="code">// You can edit this code!
  11. // Click here and start typing.
  12. package main
  13. import "fmt"
  14. func main() {
  15. fmt.Println("Hello, 世界")
  16. }</textarea>
  17. </div>
  18. <div class="output">
  19. <pre>
  20. Hello, 世界
  21. </pre>
  22. </div>
  23. <div class="buttons">
  24. <a class="run" href="#" title="Run this code [shift-enter]">Run</a>
  25. {{if $.Share}}
  26. <a class="share" href="#" title="Share this code">Share</a>
  27. {{end}}
  28. <a class="tour" href="//tour.golang.org/" title="Learn Go from your browser">Tour</a>
  29. </div>
  30. <div class="toys">
  31. <select>
  32. <option value="hello.go">Hello, World!</option>
  33. <option value="life.go">Conway's Game of Life</option>
  34. <option value="fib.go">Fibonacci Closure</option>
  35. <option value="peano.go">Peano Integers</option>
  36. <option value="pi.go">Concurrent pi</option>
  37. <option value="sieve.go">Concurrent Prime Sieve</option>
  38. <option value="solitaire.go">Peg Solitaire Solver</option>
  39. <option value="tree.go">Tree Comparison</option>
  40. </select>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="right">
  45. <div id="about">
  46. Go is an open source programming language that makes it easy to build
  47. simple, reliable, and efficient software.
  48. </div>
  49. <div id="gopher"></div>
  50. <a href="https://golang.org/dl/" id="start">
  51. <span class="big">Download Go</span>
  52. <span class="desc">
  53. Binary distributions available for<br>
  54. Linux, Mac OS X, Windows, and more.
  55. </span>
  56. </a>
  57. </div>
  58. <div style="clear: both"></div>
  59. <div class="left">
  60. <div id="video">
  61. <div class="rootHeading">Featured video</div>
  62. <iframe width="415" height="241" src="//www.youtube.com/embed/ytEkHepK08c" frameborder="0" allowfullscreen></iframe>
  63. </div>
  64. </div>
  65. <div class="right">
  66. <div id="blog">
  67. <div class="rootHeading">Featured articles</div>
  68. <div class="read"><a href="//blog.golang.org/">Read more</a></div>
  69. </div>
  70. </div>
  71. <div style="clear: both;"></div>
  72. <script type="text/javascript">
  73. function readableTime(t) {
  74. var m = ["January", "February", "March", "April", "May", "June", "July",
  75. "August", "September", "October", "November", "December"];
  76. var p = t.substring(0, t.indexOf("T")).split("-");
  77. var d = new Date(p[0], p[1]-1, p[2]);
  78. return d.getDate() + " " + m[d.getMonth()] + " " + d.getFullYear();
  79. }
  80. function feedLoaded(result) {
  81. var blog = document.getElementById("blog");
  82. var read = blog.getElementsByClassName("read")[0];
  83. for (var i = 0; i < result.length && i < 2; i++) {
  84. var entry = result[i];
  85. var title = document.createElement("a");
  86. title.className = "title";
  87. title.href = entry.Link;
  88. title.innerHTML = entry.Title;
  89. blog.insertBefore(title, read);
  90. var extract = document.createElement("div");
  91. extract.className = "extract";
  92. extract.innerHTML = entry.Summary;
  93. blog.insertBefore(extract, read);
  94. var when = document.createElement("div");
  95. when.className = "when";
  96. when.innerHTML = "Published " + readableTime(entry.Time);
  97. blog.insertBefore(when, read);
  98. }
  99. }
  100. window.initFuncs.push(function() {
  101. // Set up playground if enabled.
  102. if (window.playground) {
  103. window.playground({
  104. "codeEl": "#learn .code",
  105. "outputEl": "#learn .output",
  106. "runEl": "#learn .run",
  107. "shareEl": "#learn .share",
  108. "shareRedirect": "//play.golang.org/p/",
  109. "toysEl": "#learn .toys select"
  110. });
  111. } else {
  112. $('#learn').hide()
  113. }
  114. // Load blog feed.
  115. $('<script/>').attr('text', 'text/javascript')
  116. .attr('src', '//blog.golang.org/.json?jsonp=feedLoaded')
  117. .appendTo('body');
  118. // Set the video at random.
  119. var videos = [
  120. {h: 241, s: "//www.youtube.com/embed/ytEkHepK08c"}, // Tour of Go
  121. {h: 241, s: "//www.youtube.com/embed/f6kdp27TYZs"}, // Concurrency Patterns
  122. {h: 233, s: "//player.vimeo.com/video/69237265"} // Simple environment
  123. ];
  124. var v = videos[Math.floor(Math.random()*videos.length)];
  125. $('#video iframe').attr('height', v.h).attr('src', v.s);
  126. });
  127. </script>