Skip to content
Browse files

added missing css/js files

  • Loading branch information...
1 parent 89af8af commit a47d914de2b247a868d3e9a8155b2160ebb93538 @josip committed Dec 22, 2012
Showing with 725 additions and 4 deletions.
  1. +195 −0 godocs.js
  2. +4 −4 index.html
  3. +526 −0 style.css
View
195 godocs.js
@@ -0,0 +1,195 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/* A little code to ease navigation of these documents.
+ *
+ * On window load we:
+ * + Bind search box hint placeholder show/hide events (bindSearchEvents)
+ * + Generate a table of contents (generateTOC)
+ * + Bind foldable sections (bindToggles)
+ * + Bind links to foldable sections (bindToggleLinks)
+ */
+
+(function() {
+'use strict';
+
+function bindSearchEvents() {
+
+ var search = $('#search');
+ if (search.length === 0) {
+ return; // no search box
+ }
+
+ function clearInactive() {
+ if (search.is('.inactive')) {
+ search.val('');
+ search.removeClass('inactive');
+ }
+ }
+
+ function restoreInactive() {
+ if (search.val() !== '') {
+ return;
+ }
+ search.val(search.attr('placeholder'));
+ search.addClass('inactive');
+ }
+
+ search.on('focus', clearInactive);
+ search.on('blur', restoreInactive);
+
+ restoreInactive();
+}
+
+/* Generates a table of contents: looks for h2 and h3 elements and generates
+ * links. "Decorates" the element with id=="nav" with this table of contents.
+ */
+function generateTOC() {
+ if ($('#manual-nav').length > 0) {
+ return;
+ }
+
+ var nav = $('#nav');
+ if (nav.length === 0) {
+ return;
+ }
+
+ var toc_items = [];
+ $(nav).nextAll('h2, h3').each(function() {
+ var node = this;
+ if (node.id == '')
+ node.id = 'tmp_' + toc_items.length;
+ var link = $('<a/>').attr('href', '#' + node.id).text($(node).text());
+ var item;
+ if ($(node).is('h2')) {
+ item = $('<dt/>');
+ } else { // h3
+ item = $('<dd/>');
+ }
+ item.append(link);
+ toc_items.push(item);
+ });
+ if (toc_items.length <= 1) {
+ return;
+ }
+
+ var dl1 = $('<dl/>');
+ var dl2 = $('<dl/>');
+
+ var split_index = (toc_items.length / 2) + 1;
+ if (split_index < 8) {
+ split_index = toc_items.length;
+ }
+ for (var i = 0; i < split_index; i++) {
+ dl1.append(toc_items[i]);
+ }
+ for (/* keep using i */; i < toc_items.length; i++) {
+ dl2.append(toc_items[i]);
+ }
+
+ var tocTable = $('<table class="unruled"/>').appendTo(nav);
+ var tocBody = $('<tbody/>').appendTo(tocTable);
+ var tocRow = $('<tr/>').appendTo(tocBody);
+
+ // 1st column
+ $('<td class="first"/>').appendTo(tocRow).append(dl1);
+ // 2nd column
+ $('<td/>').appendTo(tocRow).append(dl2);
+}
+
+function bindToggle(el) {
+ $('.toggleButton', el).click(function() {
+ if ($(el).is('.toggle')) {
+ $(el).addClass('toggleVisible').removeClass('toggle');
+ } else {
+ $(el).addClass('toggle').removeClass('toggleVisible');
+ }
+ });
+}
+function bindToggles(selector) {
+ $(selector).each(function(i, el) {
+ bindToggle(el);
+ });
+}
+
+function bindToggleLink(el, prefix) {
+ $(el).click(function() {
+ var href = $(el).attr('href');
+ var i = href.indexOf('#'+prefix);
+ if (i < 0) {
+ return;
+ }
+ var id = '#' + prefix + href.slice(i+1+prefix.length);
+ if ($(id).is('.toggle')) {
+ $(id).find('.toggleButton').first().click();
+ }
+ });
+}
+function bindToggleLinks(selector, prefix) {
+ $(selector).each(function(i, el) {
+ bindToggleLink(el, prefix);
+ });
+}
+
+function setupDropdownPlayground() {
+ if (!$('#page').is('.wide')) {
+ return; // don't show on front page
+ }
+ var button = $('#playgroundButton');
+ var div = $('#playground');
+ var setup = false;
+ button.toggle(function() {
+ button.addClass('active');
+ div.show();
+ if (setup) {
+ return;
+ }
+ setup = true;
+ playground({
+ 'codeEl': $('.code', div),
+ 'outputEl': $('.output', div),
+ 'runEl': $('.run', div),
+ 'fmtEl': $('.fmt', div),
+ 'shareEl': $('.share', div),
+ 'shareRedirect': 'http://play.golang.org/p/'
+ });
+ },
+ function() {
+ button.removeClass('active');
+ div.hide();
+ });
+ button.show();
+ $('#menu').css('min-width', '+=60');
+}
+
+// fixFocus tries to put focus to div#page so that keyboard navigation works.
+function fixFocus() {
+ var page = $('div#page');
+ var topbar = $('div#topbar');
+ page.css('outline', 0); // disable outline when focused
+ page.attr('tabindex', -1); // and set tabindex so that it is focusable
+ $(window).resize(function (evt) {
+ // only focus page when the topbar is at fixed position (that is, it's in
+ // front of page, and keyboard event will go to the former by default.)
+ // by focusing page, keyboard event will go to page so that up/down arrow,
+ // space, etc. will work as expected.
+ if (topbar.css('position') == "fixed")
+ page.focus();
+ }).resize();
+}
+
+$(document).ready(function() {
+ bindSearchEvents();
+ generateTOC();
+ bindToggles(".toggle");
+ bindToggles(".toggleVisible");
+ bindToggleLinks(".exampleLink", "example_");
+ bindToggleLinks(".overviewLink", "");
+ bindToggleLinks(".examplesLink", "");
+ bindToggleLinks(".indexLink", "");
+ setupDropdownPlayground();
+ fixFocus();
+});
+
+})();
View
8 index.html
@@ -5,13 +5,13 @@
<title>timewarp - The Go Programming Language</title>
-<link type="text/css" rel="stylesheet" href="http://localhost:8080/doc/style.css">
-<script type="text/javascript" src="http://localhost:8080/doc/godocs.js"></script>
+<link type="text/css" rel="stylesheet" href="style.css">
+<script type="text/javascript" src="godocs.js"></script>
</head>
<body>
-<div id="topbar"><div class="container wide">
+<div id="topbar" style="display:none"><div class="container wide">
<form method="GET" action="http://localhost:8080/search">
<div id="menu">
@@ -54,7 +54,7 @@
<div id="short-nav">
<dl>
- <dd><code>import "."</code></dd>
+ <dd><code>import "github.com/josip/timewarp"</code></dd>
</dl>
<dl>
<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
View
526 style.css
@@ -0,0 +1,526 @@
+body {
+ margin: 0;
+ font-family: Helvetica, Arial, sans-serif;
+ font-size: 16px;
+}
+pre,
+code {
+ font-family: Menlo, monospace;
+ font-size: 14px;
+}
+pre {
+ line-height: 18px;
+}
+pre .comment {
+ color: #375EAB;
+}
+pre .highlight,
+pre .highlight-comment,
+pre .selection-highlight,
+pre .selection-highlight-comment {
+ background: #FFFF00;
+}
+pre .selection,
+pre .selection-comment {
+ background: #FF9632;
+}
+pre .ln {
+ color: #999;
+}
+body {
+ color: #222;
+}
+a,
+.exampleHeading .text {
+ color: #375EAB;
+ text-decoration: none;
+}
+a:hover,
+.exampleHeading .text:hover {
+ text-decoration: underline;
+}
+p,
+pre,
+ul,
+ol {
+ margin: 20px;
+}
+pre {
+ background: #e9e9e9;
+ padding: 10px;
+
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+
+h1,
+h2,
+h3,
+h4,
+.rootHeading {
+ margin: 20px 0;
+ padding: 0;
+ color: #375EAB;
+ font-weight: bold;
+}
+h1 {
+ font-size: 24px;
+}
+h2 {
+ font-size: 20px;
+ background: #E0EBF5;
+ padding: 2px 5px;
+}
+h3 {
+ font-size: 20px;
+}
+h3,
+h4 {
+ margin: 20px 5px;
+}
+h4 {
+ font-size: 16px;
+}
+.rootHeading {
+ font-size: 20px;
+ margin: 0;
+}
+
+dl {
+ margin: 20px;
+}
+dd {
+ margin: 2px 20px;
+}
+dl,
+dd {
+ font-size: 14px;
+}
+div#nav table td {
+ vertical-align: top;
+}
+
+table.dir th {
+ text-align: left;
+}
+table.dir td {
+ word-wrap: break-word;
+ vertical-align: top;
+}
+div#page.wide table.dir td.name {
+ white-space: nowrap;
+}
+.alert {
+ color: #AA0000;
+}
+
+div#heading {
+ float: left;
+ margin: 0 0 10px 0;
+ padding: 21px 0;
+ font-size: 20px;
+ font-weight: normal;
+}
+div#heading a {
+ color: #222;
+ text-decoration: none;
+}
+
+div#topbar {
+ background: #E0EBF5;
+ height: 64px;
+ overflow: hidden;
+}
+
+body {
+}
+div#page {
+ width: 100%;
+}
+div#page > .container,
+div#topbar > .container {
+ text-align: left;
+ margin-left: auto;
+ margin-right: auto;
+ padding: 0 20px;
+ width: 900px;
+}
+div#page.wide > .container,
+div#topbar.wide > .container {
+ width: auto;
+}
+div#plusone {
+ float: right;
+}
+
+div#footer {
+ text-align: center;
+ color: #666;
+ font-size: 14px;
+ margin: 40px 0;
+}
+
+div#menu > a,
+div#menu > input,
+div#learn .buttons a,
+div.play .buttons a,
+div#blog .read a {
+ padding: 10px;
+
+ text-decoration: none;
+ font-size: 16px;
+
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+div#playground .buttons a,
+div#menu > a,
+div#menu > input {
+ border: 1px solid #375EAB;
+}
+div#playground .buttons a,
+div#menu > a {
+ color: white;
+ background: #375EAB;
+}
+#playgroundButton.active {
+ background: white;
+ color: #375EAB;
+}
+a#start,
+div#learn .buttons a,
+div.play .buttons a,
+div#blog .read a {
+ color: #222;
+ border: 1px solid #375EAB;
+ background: #E0EBF5;
+}
+
+div#menu {
+ float: right;
+ min-width: 590px;
+ padding: 10px 0;
+ text-align: right;
+}
+div#menu > a {
+ margin-right: 5px;
+ margin-bottom: 10px;
+
+ padding: 10px;
+}
+div#menu > input {
+ position: relative;
+ top: 1px;
+ width: 60px;
+ background: white;
+ color: #222;
+}
+div#menu > input.inactive {
+ color: #999;
+}
+
+div.left {
+ float: left;
+ clear: left;
+}
+div.right {
+ float: right;
+ clear: right;
+}
+div.left,
+div.right {
+ width: 415px;
+}
+
+div#learn,
+div#about {
+ padding-top: 20px;
+}
+div#learn h2,
+div#about {
+ margin: 0;
+}
+div#about {
+ font-size: 20px;
+}
+
+div#about {
+ height: 96px;
+}
+div#gopher {
+ background: url(/doc/gopher/frontpage.png) no-repeat;
+ background-position: center top;
+ height: 155px;
+}
+a#start {
+ display: block;
+ padding: 10px;
+
+ text-align: center;
+ text-decoration: none;
+
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+a#start .big {
+ font-weight: bold;
+ font-size: 20px;
+}
+a#start .desc {
+ font-size: 14px;
+ font-weight: normal;
+ margin-top: 5px;
+}
+
+div#learn .icon {
+ float: right;
+ cursor: pointer;
+}
+div#learn pre,
+div#learn textarea {
+ padding: 0;
+ margin: 0;
+ font-family: Menlo, monospace;
+ font-size: 14px;
+}
+div#learn .input {
+ padding: 10px;
+ margin-top: 10px;
+ height: 150px;
+
+ -webkit-border-top-left-radius: 5px;
+ -webkit-border-top-right-radius: 5px;
+ -moz-border-radius-topleft: 5px;
+ -moz-border-radius-topright: 5px;
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+}
+div#learn .input textarea {
+ width: 100%;
+ height: 100%;
+ border: none;
+ outline: none;
+ resize: none;
+}
+div#learn .output {
+ border-top: none !important;
+
+ padding: 10px;
+ height: 59px;
+ overflow: auto;
+
+ -webkit-border-bottom-right-radius: 5px;
+ -webkit-border-bottom-left-radius: 5px;
+ -moz-border-radius-bottomright: 5px;
+ -moz-border-radius-bottomleft: 5px;
+ border-bottom-right-radius: 5px;
+ border-bottom-left-radius: 5px;
+}
+div#learn .output pre {
+ padding: 0;
+
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+div#learn .input,
+div#learn .input textarea,
+div#learn .output,
+div#learn .output pre {
+ background: #FFFFD8;
+}
+div#learn .input,
+div#learn .output {
+ border: 1px solid #375EAB;
+}
+div#learn .buttons {
+ float: right;
+ padding: 20px 0 10px 0;
+ text-align: right;
+}
+div#learn .buttons a {
+ height: 16px;
+ margin-left: 5px;
+ padding: 10px;
+}
+div#learn .toys {
+ margin-top: 8px;
+}
+div#learn .toys select {
+ border: 1px solid #375EAB;
+ margin: 0;
+}
+div#learn .output .exit {
+ display: none;
+}
+
+div#blog,
+div#video {
+ margin-top: 40px;
+}
+div#blog > a,
+div#blog > div,
+div#blog > h2,
+div#video > a,
+div#video > div,
+div#video > h2 {
+ margin-bottom: 10px;
+}
+div#blog .title,
+div#video .title {
+ display: block;
+ font-size: 20px;
+}
+div#blog .when {
+ color: #666;
+ font-size: 14px;
+}
+div#blog .read {
+ text-align: right;
+}
+
+.toggleButton { cursor: pointer; }
+.toggle .collapsed { display: block; }
+.toggle .expanded { display: none; }
+.toggleVisible .collapsed { display: none; }
+.toggleVisible .expanded { display: block; }
+
+table.codetable { margin-left: auto; margin-right: auto; border-style: none; }
+table.codetable td { padding-right: 10px; }
+hr { border-style: none; border-top: 1px solid black; }
+
+img.gopher {
+ float: right;
+ margin-left: 10px;
+ margin-bottom: 10px;
+}
+.pkgGopher {
+ text-align: right;
+}
+.pkgGopher .gopher {
+ float: none;
+ position: relative;
+ top: -40px;
+ margin-bottom: -120px;
+}
+h2 { clear: right; }
+
+/* example and drop-down playground */
+div.play {
+ padding: 0 20px 40px 20px;
+}
+div.play pre,
+div.play textarea,
+div.play .lines {
+ padding: 0;
+ margin: 0;
+ font-family: Menlo, monospace;
+ font-size: 14px;
+}
+div.play .input {
+ padding: 10px;
+ margin-top: 10px;
+
+ -webkit-border-top-left-radius: 5px;
+ -webkit-border-top-right-radius: 5px;
+ -moz-border-radius-topleft: 5px;
+ -moz-border-radius-topright: 5px;
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+
+ overflow: hidden;
+}
+div.play .input textarea {
+ width: 100%;
+ height: 100%;
+ border: none;
+ outline: none;
+ resize: none;
+
+ overflow: hidden;
+}
+div#playground .input textarea {
+ overflow: auto;
+ resize: auto;
+}
+div.play .output {
+ border-top: none !important;
+
+ padding: 10px;
+ max-height: 200px;
+ overflow: auto;
+
+ -webkit-border-bottom-right-radius: 5px;
+ -webkit-border-bottom-left-radius: 5px;
+ -moz-border-radius-bottomright: 5px;
+ -moz-border-radius-bottomleft: 5px;
+ border-bottom-right-radius: 5px;
+ border-bottom-left-radius: 5px;
+}
+div.play .output pre {
+ padding: 0;
+
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+div.play .input,
+div.play .input textarea,
+div.play .output,
+div.play .output pre {
+ background: #FFFFD8;
+}
+div.play .input,
+div.play .output {
+ border: 1px solid #375EAB;
+}
+div.play .buttons {
+ float: right;
+ padding: 20px 0 10px 0;
+ text-align: right;
+}
+div.play .buttons a {
+ height: 16px;
+ margin-left: 5px;
+ padding: 10px;
+ cursor: pointer;
+}
+div.play .output .exit {
+ color: #999;
+}
+
+/* drop-down playground */
+#playgroundButton,
+div#playground {
+ /* start hidden; revealed by javascript */
+ display: none;
+}
+div#playground {
+ position: absolute;
+ top: 63px;
+ right: 20px;
+ padding: 0 10px 10px 10px;
+ z-index: 1;
+ text-align: left;
+ background: #E0EBF5;
+
+ border: 1px solid #B0BBC5;
+ border-top: none;
+
+ -webkit-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-right-radius: 5px;
+ -moz-border-radius-bottomleft: 5px;
+ -moz-border-radius-bottomright: 5px;
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+}
+div#playground .code {
+ width: 520px;
+ height: 200px;
+}
+div#playground .output {
+ height: 100px;
+}

0 comments on commit a47d914

Please sign in to comment.
Something went wrong with that request. Please try again.