Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

added missing css/js files

  • Loading branch information...
commit a47d914de2b247a868d3e9a8155b2160ebb93538 1 parent 89af8af
Josip Lisec authored

Showing 3 changed files with 725 additions and 4 deletions. Show diff stats Hide diff stats

  1. +195 0 godocs.js
  2. +4 4 index.html
  3. +526 0 style.css
195 godocs.js
... ... @@ -0,0 +1,195 @@
  1 +// Copyright 2012 The Go Authors. All rights reserved.
  2 +// Use of this source code is governed by a BSD-style
  3 +// license that can be found in the LICENSE file.
  4 +
  5 +/* A little code to ease navigation of these documents.
  6 + *
  7 + * On window load we:
  8 + * + Bind search box hint placeholder show/hide events (bindSearchEvents)
  9 + * + Generate a table of contents (generateTOC)
  10 + * + Bind foldable sections (bindToggles)
  11 + * + Bind links to foldable sections (bindToggleLinks)
  12 + */
  13 +
  14 +(function() {
  15 +'use strict';
  16 +
  17 +function bindSearchEvents() {
  18 +
  19 + var search = $('#search');
  20 + if (search.length === 0) {
  21 + return; // no search box
  22 + }
  23 +
  24 + function clearInactive() {
  25 + if (search.is('.inactive')) {
  26 + search.val('');
  27 + search.removeClass('inactive');
  28 + }
  29 + }
  30 +
  31 + function restoreInactive() {
  32 + if (search.val() !== '') {
  33 + return;
  34 + }
  35 + search.val(search.attr('placeholder'));
  36 + search.addClass('inactive');
  37 + }
  38 +
  39 + search.on('focus', clearInactive);
  40 + search.on('blur', restoreInactive);
  41 +
  42 + restoreInactive();
  43 +}
  44 +
  45 +/* Generates a table of contents: looks for h2 and h3 elements and generates
  46 + * links. "Decorates" the element with id=="nav" with this table of contents.
  47 + */
  48 +function generateTOC() {
  49 + if ($('#manual-nav').length > 0) {
  50 + return;
  51 + }
  52 +
  53 + var nav = $('#nav');
  54 + if (nav.length === 0) {
  55 + return;
  56 + }
  57 +
  58 + var toc_items = [];
  59 + $(nav).nextAll('h2, h3').each(function() {
  60 + var node = this;
  61 + if (node.id == '')
  62 + node.id = 'tmp_' + toc_items.length;
  63 + var link = $('<a/>').attr('href', '#' + node.id).text($(node).text());
  64 + var item;
  65 + if ($(node).is('h2')) {
  66 + item = $('<dt/>');
  67 + } else { // h3
  68 + item = $('<dd/>');
  69 + }
  70 + item.append(link);
  71 + toc_items.push(item);
  72 + });
  73 + if (toc_items.length <= 1) {
  74 + return;
  75 + }
  76 +
  77 + var dl1 = $('<dl/>');
  78 + var dl2 = $('<dl/>');
  79 +
  80 + var split_index = (toc_items.length / 2) + 1;
  81 + if (split_index < 8) {
  82 + split_index = toc_items.length;
  83 + }
  84 + for (var i = 0; i < split_index; i++) {
  85 + dl1.append(toc_items[i]);
  86 + }
  87 + for (/* keep using i */; i < toc_items.length; i++) {
  88 + dl2.append(toc_items[i]);
  89 + }
  90 +
  91 + var tocTable = $('<table class="unruled"/>').appendTo(nav);
  92 + var tocBody = $('<tbody/>').appendTo(tocTable);
  93 + var tocRow = $('<tr/>').appendTo(tocBody);
  94 +
  95 + // 1st column
  96 + $('<td class="first"/>').appendTo(tocRow).append(dl1);
  97 + // 2nd column
  98 + $('<td/>').appendTo(tocRow).append(dl2);
  99 +}
  100 +
  101 +function bindToggle(el) {
  102 + $('.toggleButton', el).click(function() {
  103 + if ($(el).is('.toggle')) {
  104 + $(el).addClass('toggleVisible').removeClass('toggle');
  105 + } else {
  106 + $(el).addClass('toggle').removeClass('toggleVisible');
  107 + }
  108 + });
  109 +}
  110 +function bindToggles(selector) {
  111 + $(selector).each(function(i, el) {
  112 + bindToggle(el);
  113 + });
  114 +}
  115 +
  116 +function bindToggleLink(el, prefix) {
  117 + $(el).click(function() {
  118 + var href = $(el).attr('href');
  119 + var i = href.indexOf('#'+prefix);
  120 + if (i < 0) {
  121 + return;
  122 + }
  123 + var id = '#' + prefix + href.slice(i+1+prefix.length);
  124 + if ($(id).is('.toggle')) {
  125 + $(id).find('.toggleButton').first().click();
  126 + }
  127 + });
  128 +}
  129 +function bindToggleLinks(selector, prefix) {
  130 + $(selector).each(function(i, el) {
  131 + bindToggleLink(el, prefix);
  132 + });
  133 +}
  134 +
  135 +function setupDropdownPlayground() {
  136 + if (!$('#page').is('.wide')) {
  137 + return; // don't show on front page
  138 + }
  139 + var button = $('#playgroundButton');
  140 + var div = $('#playground');
  141 + var setup = false;
  142 + button.toggle(function() {
  143 + button.addClass('active');
  144 + div.show();
  145 + if (setup) {
  146 + return;
  147 + }
  148 + setup = true;
  149 + playground({
  150 + 'codeEl': $('.code', div),
  151 + 'outputEl': $('.output', div),
  152 + 'runEl': $('.run', div),
  153 + 'fmtEl': $('.fmt', div),
  154 + 'shareEl': $('.share', div),
  155 + 'shareRedirect': 'http://play.golang.org/p/'
  156 + });
  157 + },
  158 + function() {
  159 + button.removeClass('active');
  160 + div.hide();
  161 + });
  162 + button.show();
  163 + $('#menu').css('min-width', '+=60');
  164 +}
  165 +
  166 +// fixFocus tries to put focus to div#page so that keyboard navigation works.
  167 +function fixFocus() {
  168 + var page = $('div#page');
  169 + var topbar = $('div#topbar');
  170 + page.css('outline', 0); // disable outline when focused
  171 + page.attr('tabindex', -1); // and set tabindex so that it is focusable
  172 + $(window).resize(function (evt) {
  173 + // only focus page when the topbar is at fixed position (that is, it's in
  174 + // front of page, and keyboard event will go to the former by default.)
  175 + // by focusing page, keyboard event will go to page so that up/down arrow,
  176 + // space, etc. will work as expected.
  177 + if (topbar.css('position') == "fixed")
  178 + page.focus();
  179 + }).resize();
  180 +}
  181 +
  182 +$(document).ready(function() {
  183 + bindSearchEvents();
  184 + generateTOC();
  185 + bindToggles(".toggle");
  186 + bindToggles(".toggleVisible");
  187 + bindToggleLinks(".exampleLink", "example_");
  188 + bindToggleLinks(".overviewLink", "");
  189 + bindToggleLinks(".examplesLink", "");
  190 + bindToggleLinks(".indexLink", "");
  191 + setupDropdownPlayground();
  192 + fixFocus();
  193 +});
  194 +
  195 +})();
8 index.html
@@ -5,13 +5,13 @@
5 5
6 6 <title>timewarp - The Go Programming Language</title>
7 7
8   -<link type="text/css" rel="stylesheet" href="http://localhost:8080/doc/style.css">
9   -<script type="text/javascript" src="http://localhost:8080/doc/godocs.js"></script>
  8 +<link type="text/css" rel="stylesheet" href="style.css">
  9 +<script type="text/javascript" src="godocs.js"></script>
10 10
11 11 </head>
12 12 <body>
13 13
14   -<div id="topbar"><div class="container wide">
  14 +<div id="topbar" style="display:none"><div class="container wide">
15 15
16 16 <form method="GET" action="http://localhost:8080/search">
17 17 <div id="menu">
@@ -54,7 +54,7 @@
54 54
55 55 <div id="short-nav">
56 56 <dl>
57   - <dd><code>import "."</code></dd>
  57 + <dd><code>import "github.com/josip/timewarp"</code></dd>
58 58 </dl>
59 59 <dl>
60 60 <dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
526 style.css
... ... @@ -0,0 +1,526 @@
  1 +body {
  2 + margin: 0;
  3 + font-family: Helvetica, Arial, sans-serif;
  4 + font-size: 16px;
  5 +}
  6 +pre,
  7 +code {
  8 + font-family: Menlo, monospace;
  9 + font-size: 14px;
  10 +}
  11 +pre {
  12 + line-height: 18px;
  13 +}
  14 +pre .comment {
  15 + color: #375EAB;
  16 +}
  17 +pre .highlight,
  18 +pre .highlight-comment,
  19 +pre .selection-highlight,
  20 +pre .selection-highlight-comment {
  21 + background: #FFFF00;
  22 +}
  23 +pre .selection,
  24 +pre .selection-comment {
  25 + background: #FF9632;
  26 +}
  27 +pre .ln {
  28 + color: #999;
  29 +}
  30 +body {
  31 + color: #222;
  32 +}
  33 +a,
  34 +.exampleHeading .text {
  35 + color: #375EAB;
  36 + text-decoration: none;
  37 +}
  38 +a:hover,
  39 +.exampleHeading .text:hover {
  40 + text-decoration: underline;
  41 +}
  42 +p,
  43 +pre,
  44 +ul,
  45 +ol {
  46 + margin: 20px;
  47 +}
  48 +pre {
  49 + background: #e9e9e9;
  50 + padding: 10px;
  51 +
  52 + -webkit-border-radius: 5px;
  53 + -moz-border-radius: 5px;
  54 + border-radius: 5px;
  55 +}
  56 +
  57 +h1,
  58 +h2,
  59 +h3,
  60 +h4,
  61 +.rootHeading {
  62 + margin: 20px 0;
  63 + padding: 0;
  64 + color: #375EAB;
  65 + font-weight: bold;
  66 +}
  67 +h1 {
  68 + font-size: 24px;
  69 +}
  70 +h2 {
  71 + font-size: 20px;
  72 + background: #E0EBF5;
  73 + padding: 2px 5px;
  74 +}
  75 +h3 {
  76 + font-size: 20px;
  77 +}
  78 +h3,
  79 +h4 {
  80 + margin: 20px 5px;
  81 +}
  82 +h4 {
  83 + font-size: 16px;
  84 +}
  85 +.rootHeading {
  86 + font-size: 20px;
  87 + margin: 0;
  88 +}
  89 +
  90 +dl {
  91 + margin: 20px;
  92 +}
  93 +dd {
  94 + margin: 2px 20px;
  95 +}
  96 +dl,
  97 +dd {
  98 + font-size: 14px;
  99 +}
  100 +div#nav table td {
  101 + vertical-align: top;
  102 +}
  103 +
  104 +table.dir th {
  105 + text-align: left;
  106 +}
  107 +table.dir td {
  108 + word-wrap: break-word;
  109 + vertical-align: top;
  110 +}
  111 +div#page.wide table.dir td.name {
  112 + white-space: nowrap;
  113 +}
  114 +.alert {
  115 + color: #AA0000;
  116 +}
  117 +
  118 +div#heading {
  119 + float: left;
  120 + margin: 0 0 10px 0;
  121 + padding: 21px 0;
  122 + font-size: 20px;
  123 + font-weight: normal;
  124 +}
  125 +div#heading a {
  126 + color: #222;
  127 + text-decoration: none;
  128 +}
  129 +
  130 +div#topbar {
  131 + background: #E0EBF5;
  132 + height: 64px;
  133 + overflow: hidden;
  134 +}
  135 +
  136 +body {
  137 +}
  138 +div#page {
  139 + width: 100%;
  140 +}
  141 +div#page > .container,
  142 +div#topbar > .container {
  143 + text-align: left;
  144 + margin-left: auto;
  145 + margin-right: auto;
  146 + padding: 0 20px;
  147 + width: 900px;
  148 +}
  149 +div#page.wide > .container,
  150 +div#topbar.wide > .container {
  151 + width: auto;
  152 +}
  153 +div#plusone {
  154 + float: right;
  155 +}
  156 +
  157 +div#footer {
  158 + text-align: center;
  159 + color: #666;
  160 + font-size: 14px;
  161 + margin: 40px 0;
  162 +}
  163 +
  164 +div#menu > a,
  165 +div#menu > input,
  166 +div#learn .buttons a,
  167 +div.play .buttons a,
  168 +div#blog .read a {
  169 + padding: 10px;
  170 +
  171 + text-decoration: none;
  172 + font-size: 16px;
  173 +
  174 + -webkit-border-radius: 5px;
  175 + -moz-border-radius: 5px;
  176 + border-radius: 5px;
  177 +}
  178 +div#playground .buttons a,
  179 +div#menu > a,
  180 +div#menu > input {
  181 + border: 1px solid #375EAB;
  182 +}
  183 +div#playground .buttons a,
  184 +div#menu > a {
  185 + color: white;
  186 + background: #375EAB;
  187 +}
  188 +#playgroundButton.active {
  189 + background: white;
  190 + color: #375EAB;
  191 +}
  192 +a#start,
  193 +div#learn .buttons a,
  194 +div.play .buttons a,
  195 +div#blog .read a {
  196 + color: #222;
  197 + border: 1px solid #375EAB;
  198 + background: #E0EBF5;
  199 +}
  200 +
  201 +div#menu {
  202 + float: right;
  203 + min-width: 590px;
  204 + padding: 10px 0;
  205 + text-align: right;
  206 +}
  207 +div#menu > a {
  208 + margin-right: 5px;
  209 + margin-bottom: 10px;
  210 +
  211 + padding: 10px;
  212 +}
  213 +div#menu > input {
  214 + position: relative;
  215 + top: 1px;
  216 + width: 60px;
  217 + background: white;
  218 + color: #222;
  219 +}
  220 +div#menu > input.inactive {
  221 + color: #999;
  222 +}
  223 +
  224 +div.left {
  225 + float: left;
  226 + clear: left;
  227 +}
  228 +div.right {
  229 + float: right;
  230 + clear: right;
  231 +}
  232 +div.left,
  233 +div.right {
  234 + width: 415px;
  235 +}
  236 +
  237 +div#learn,
  238 +div#about {
  239 + padding-top: 20px;
  240 +}
  241 +div#learn h2,
  242 +div#about {
  243 + margin: 0;
  244 +}
  245 +div#about {
  246 + font-size: 20px;
  247 +}
  248 +
  249 +div#about {
  250 + height: 96px;
  251 +}
  252 +div#gopher {
  253 + background: url(/doc/gopher/frontpage.png) no-repeat;
  254 + background-position: center top;
  255 + height: 155px;
  256 +}
  257 +a#start {
  258 + display: block;
  259 + padding: 10px;
  260 +
  261 + text-align: center;
  262 + text-decoration: none;
  263 +
  264 + -webkit-border-radius: 5px;
  265 + -moz-border-radius: 5px;
  266 + border-radius: 5px;
  267 +}
  268 +a#start .big {
  269 + font-weight: bold;
  270 + font-size: 20px;
  271 +}
  272 +a#start .desc {
  273 + font-size: 14px;
  274 + font-weight: normal;
  275 + margin-top: 5px;
  276 +}
  277 +
  278 +div#learn .icon {
  279 + float: right;
  280 + cursor: pointer;
  281 +}
  282 +div#learn pre,
  283 +div#learn textarea {
  284 + padding: 0;
  285 + margin: 0;
  286 + font-family: Menlo, monospace;
  287 + font-size: 14px;
  288 +}
  289 +div#learn .input {
  290 + padding: 10px;
  291 + margin-top: 10px;
  292 + height: 150px;
  293 +
  294 + -webkit-border-top-left-radius: 5px;
  295 + -webkit-border-top-right-radius: 5px;
  296 + -moz-border-radius-topleft: 5px;
  297 + -moz-border-radius-topright: 5px;
  298 + border-top-left-radius: 5px;
  299 + border-top-right-radius: 5px;
  300 +}
  301 +div#learn .input textarea {
  302 + width: 100%;
  303 + height: 100%;
  304 + border: none;
  305 + outline: none;
  306 + resize: none;
  307 +}
  308 +div#learn .output {
  309 + border-top: none !important;
  310 +
  311 + padding: 10px;
  312 + height: 59px;
  313 + overflow: auto;
  314 +
  315 + -webkit-border-bottom-right-radius: 5px;
  316 + -webkit-border-bottom-left-radius: 5px;
  317 + -moz-border-radius-bottomright: 5px;
  318 + -moz-border-radius-bottomleft: 5px;
  319 + border-bottom-right-radius: 5px;
  320 + border-bottom-left-radius: 5px;
  321 +}
  322 +div#learn .output pre {
  323 + padding: 0;
  324 +
  325 + -webkit-border-radius: 0;
  326 + -moz-border-radius: 0;
  327 + border-radius: 0;
  328 +}
  329 +div#learn .input,
  330 +div#learn .input textarea,
  331 +div#learn .output,
  332 +div#learn .output pre {
  333 + background: #FFFFD8;
  334 +}
  335 +div#learn .input,
  336 +div#learn .output {
  337 + border: 1px solid #375EAB;
  338 +}
  339 +div#learn .buttons {
  340 + float: right;
  341 + padding: 20px 0 10px 0;
  342 + text-align: right;
  343 +}
  344 +div#learn .buttons a {
  345 + height: 16px;
  346 + margin-left: 5px;
  347 + padding: 10px;
  348 +}
  349 +div#learn .toys {
  350 + margin-top: 8px;
  351 +}
  352 +div#learn .toys select {
  353 + border: 1px solid #375EAB;
  354 + margin: 0;
  355 +}
  356 +div#learn .output .exit {
  357 + display: none;
  358 +}
  359 +
  360 +div#blog,
  361 +div#video {
  362 + margin-top: 40px;
  363 +}
  364 +div#blog > a,
  365 +div#blog > div,
  366 +div#blog > h2,
  367 +div#video > a,
  368 +div#video > div,
  369 +div#video > h2 {
  370 + margin-bottom: 10px;
  371 +}
  372 +div#blog .title,
  373 +div#video .title {
  374 + display: block;
  375 + font-size: 20px;
  376 +}
  377 +div#blog .when {
  378 + color: #666;
  379 + font-size: 14px;
  380 +}
  381 +div#blog .read {
  382 + text-align: right;
  383 +}
  384 +
  385 +.toggleButton { cursor: pointer; }
  386 +.toggle .collapsed { display: block; }
  387 +.toggle .expanded { display: none; }
  388 +.toggleVisible .collapsed { display: none; }
  389 +.toggleVisible .expanded { display: block; }
  390 +
  391 +table.codetable { margin-left: auto; margin-right: auto; border-style: none; }
  392 +table.codetable td { padding-right: 10px; }
  393 +hr { border-style: none; border-top: 1px solid black; }
  394 +
  395 +img.gopher {
  396 + float: right;
  397 + margin-left: 10px;
  398 + margin-bottom: 10px;
  399 +}
  400 +.pkgGopher {
  401 + text-align: right;
  402 +}
  403 +.pkgGopher .gopher {
  404 + float: none;
  405 + position: relative;
  406 + top: -40px;
  407 + margin-bottom: -120px;
  408 +}
  409 +h2 { clear: right; }
  410 +
  411 +/* example and drop-down playground */
  412 +div.play {
  413 + padding: 0 20px 40px 20px;
  414 +}
  415 +div.play pre,
  416 +div.play textarea,
  417 +div.play .lines {
  418 + padding: 0;
  419 + margin: 0;
  420 + font-family: Menlo, monospace;
  421 + font-size: 14px;
  422 +}
  423 +div.play .input {
  424 + padding: 10px;
  425 + margin-top: 10px;
  426 +
  427 + -webkit-border-top-left-radius: 5px;
  428 + -webkit-border-top-right-radius: 5px;
  429 + -moz-border-radius-topleft: 5px;
  430 + -moz-border-radius-topright: 5px;
  431 + border-top-left-radius: 5px;
  432 + border-top-right-radius: 5px;
  433 +
  434 + overflow: hidden;
  435 +}
  436 +div.play .input textarea {
  437 + width: 100%;
  438 + height: 100%;
  439 + border: none;
  440 + outline: none;
  441 + resize: none;
  442 +
  443 + overflow: hidden;
  444 +}
  445 +div#playground .input textarea {
  446 + overflow: auto;
  447 + resize: auto;
  448 +}
  449 +div.play .output {
  450 + border-top: none !important;
  451 +
  452 + padding: 10px;
  453 + max-height: 200px;
  454 + overflow: auto;
  455 +
  456 + -webkit-border-bottom-right-radius: 5px;
  457 + -webkit-border-bottom-left-radius: 5px;
  458 + -moz-border-radius-bottomright: 5px;
  459 + -moz-border-radius-bottomleft: 5px;
  460 + border-bottom-right-radius: 5px;
  461 + border-bottom-left-radius: 5px;
  462 +}
  463 +div.play .output pre {
  464 + padding: 0;
  465 +
  466 + -webkit-border-radius: 0;
  467 + -moz-border-radius: 0;
  468 + border-radius: 0;
  469 +}
  470 +div.play .input,
  471 +div.play .input textarea,
  472 +div.play .output,
  473 +div.play .output pre {
  474 + background: #FFFFD8;
  475 +}
  476 +div.play .input,
  477 +div.play .output {
  478 + border: 1px solid #375EAB;
  479 +}
  480 +div.play .buttons {
  481 + float: right;
  482 + padding: 20px 0 10px 0;
  483 + text-align: right;
  484 +}
  485 +div.play .buttons a {
  486 + height: 16px;
  487 + margin-left: 5px;
  488 + padding: 10px;
  489 + cursor: pointer;
  490 +}
  491 +div.play .output .exit {
  492 + color: #999;
  493 +}
  494 +
  495 +/* drop-down playground */
  496 +#playgroundButton,
  497 +div#playground {
  498 + /* start hidden; revealed by javascript */
  499 + display: none;
  500 +}
  501 +div#playground {
  502 + position: absolute;
  503 + top: 63px;
  504 + right: 20px;
  505 + padding: 0 10px 10px 10px;
  506 + z-index: 1;
  507 + text-align: left;
  508 + background: #E0EBF5;
  509 +
  510 + border: 1px solid #B0BBC5;
  511 + border-top: none;
  512 +
  513 + -webkit-border-bottom-left-radius: 5px;
  514 + -webkit-border-bottom-right-radius: 5px;
  515 + -moz-border-radius-bottomleft: 5px;
  516 + -moz-border-radius-bottomright: 5px;
  517 + border-bottom-left-radius: 5px;
  518 + border-bottom-right-radius: 5px;
  519 +}
  520 +div#playground .code {
  521 + width: 520px;
  522 + height: 200px;
  523 +}
  524 +div#playground .output {
  525 + height: 100px;
  526 +}

0 comments on commit a47d914

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