Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
d920d8d8
Commit
d920d8d8
authored
Jul 30, 2013
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc: don't block page load on JavaScript fetch
R=golang-dev, dsymonds CC=golang-dev
https://golang.org/cl/12050045
parent
789e1c35
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
64 deletions
+72
-64
codewalk.js
doc/codewalk/codewalk.js
+1
-1
godocs.js
doc/godocs.js
+63
-0
root.html
doc/root.html
+1
-1
godoc.html
lib/godoc/godoc.html
+7
-12
package.html
lib/godoc/package.html
+0
-50
No files found.
doc/codewalk/codewalk.js
View file @
d920d8d8
...
...
@@ -296,7 +296,7 @@ CodewalkViewer.prototype.updateHeight = function() {
this
.
sizer
.
height
(
codeHeight
);
};
jQuery
(
document
).
ready
(
function
()
{
window
.
initFuncs
.
push
(
function
()
{
var
viewer
=
new
CodewalkViewer
(
jQuery
(
'#codewalk-main'
));
viewer
.
selectFirstComment
();
viewer
.
targetCommentLinksAtBlank
();
...
...
doc/godocs.js
View file @
d920d8d8
...
...
@@ -163,6 +163,52 @@ function setupDropdownPlayground() {
$
(
'#menu'
).
css
(
'min-width'
,
'+=60'
);
}
function
setupInlinePlayground
()
{
'use strict'
;
// Set up playground when each element is toggled.
$
(
'div.play'
).
each
(
function
(
i
,
el
)
{
// Set up playground for this example.
var
setup
=
function
()
{
var
code
=
$
(
'.code'
,
el
);
playground
({
'codeEl'
:
code
,
'outputEl'
:
$
(
'.output'
,
el
),
'runEl'
:
$
(
'.run'
,
el
),
'fmtEl'
:
$
(
'.fmt'
,
el
),
'shareEl'
:
$
(
'.share'
,
el
),
'shareRedirect'
:
'http://play.golang.org/p/'
});
// Make the code textarea resize to fit content.
var
resize
=
function
()
{
code
.
height
(
0
);
var
h
=
code
[
0
].
scrollHeight
;
code
.
height
(
h
+
20
);
// minimize bouncing.
code
.
closest
(
'.input'
).
height
(
h
);
};
code
.
on
(
'keydown'
,
resize
);
code
.
on
(
'keyup'
,
resize
);
code
.
keyup
();
// resize now.
};
// If example already visible, set up playground now.
if
(
$
(
el
).
is
(
':visible'
))
{
setup
();
return
;
}
// Otherwise, set up playground when example is expanded.
var
built
=
false
;
$
(
el
).
closest
(
'.toggle'
).
click
(
function
()
{
// Only set up once.
if
(
!
built
)
{
setup
();
built
=
true
;
}
});
});
}
// fixFocus tries to put focus to div#page so that keyboard navigation works.
function
fixFocus
()
{
var
page
=
$
(
'div#page'
);
...
...
@@ -186,6 +232,15 @@ function toggleHash() {
}
}
function
addPlusButtons
()
{
var
po
=
document
.
createElement
(
'script'
);
po
.
type
=
'text/javascript'
;
po
.
async
=
true
;
po
.
src
=
'https://apis.google.com/js/plusone.js'
;
var
s
=
document
.
getElementsByTagName
(
'script'
)[
0
];
s
.
parentNode
.
insertBefore
(
po
,
s
);
}
$
(
document
).
ready
(
function
()
{
bindSearchEvents
();
generateTOC
();
...
...
@@ -196,8 +251,16 @@ $(document).ready(function() {
bindToggleLinks
(
".examplesLink"
,
""
);
bindToggleLinks
(
".indexLink"
,
""
);
setupDropdownPlayground
();
setupInlinePlayground
();
fixFocus
();
toggleHash
();
addPlusButtons
();
// godoc.html defines window.initFuncs in the <head> tag, and root.html and
// codewalk.js push their on-page-ready functions to the list.
// We execute those functions here, to avoid loading jQuery until the page
// content is loaded.
for
(
var
i
=
0
;
i
<
window
.
initFuncs
.
length
;
i
++
)
window
.
initFuncs
[
i
]();
});
})();
doc/root.html
View file @
d920d8d8
...
...
@@ -116,7 +116,7 @@ function feedLoaded(result) {
}
}
$
(
function
()
{
window
.
initFuncs
.
push
(
function
()
{
// Set up playground.
playground
({
"codeEl"
:
"#learn .code"
,
...
...
lib/godoc/godoc.html
View file @
d920d8d8
...
...
@@ -8,14 +8,10 @@
<title>
The Go Programming Language
</title>
{{end}}
<link
type=
"text/css"
rel=
"stylesheet"
href=
"/doc/style.css"
>
<script
type=
"text/javascript"
src=
"/doc/jquery.js"
></script>
{{if .Playground}}
<script
type=
"text/javascript"
src=
"/doc/play/playground.js"
></script>
{{end}}
<script
type=
"text/javascript"
src=
"/doc/godocs.js"
></script>
{{if .SearchBox}}
<link
rel=
"search"
type=
"application/opensearchdescription+xml"
title=
"godoc"
href=
"/opensearch.xml"
/>
{{end}}
<script
type=
"text/javascript"
>
window
.
initFuncs
=
[];
</script>
</head>
<body>
...
...
@@ -87,13 +83,12 @@ and code is licensed under a <a href="/LICENSE">BSD license</a>.<br>
</div>
<!-- .container -->
</div>
<!-- #page -->
<script
type=
"text/javascript"
src=
"/doc/jquery.js"
></script>
{{if .Playground}}
<script
type=
"text/javascript"
src=
"/doc/play/playground.js"
></script>
{{end}}
<script
type=
"text/javascript"
src=
"/doc/godocs.js"
></script>
</body>
<script
type=
"text/javascript"
>
(
function
()
{
var
po
=
document
.
createElement
(
'script'
);
po
.
type
=
'text/javascript'
;
po
.
async
=
true
;
po
.
src
=
'https://apis.google.com/js/plusone.js'
;
var
s
=
document
.
getElementsByTagName
(
'script'
)[
0
];
s
.
parentNode
.
insertBefore
(
po
,
s
);
})();
</script>
</html>
lib/godoc/package.html
View file @
d920d8d8
...
...
@@ -224,53 +224,3 @@
<p>
Need more packages? Take a look at the
<a
href=
"http://code.google.com/p/go-wiki/wiki/Projects"
>
Go Projects wiki page
</a>
.
</p>
{{end}}
{{end}}
{{if $.Examples}}
<script>
$
(
document
).
ready
(
function
()
{
'use strict'
;
// Set up playground when each element is toggled.
$
(
'div.play'
).
each
(
function
(
i
,
el
)
{
// Set up playground for this example.
var
setup
=
function
()
{
var
code
=
$
(
'.code'
,
el
);
playground
({
'codeEl'
:
code
,
'outputEl'
:
$
(
'.output'
,
el
),
'runEl'
:
$
(
'.run'
,
el
),
'fmtEl'
:
$
(
'.fmt'
,
el
),
'shareEl'
:
$
(
'.share'
,
el
),
'shareRedirect'
:
'http://play.golang.org/p/'
});
// Make the code textarea resize to fit content.
var
resize
=
function
()
{
code
.
height
(
0
);
var
h
=
code
[
0
].
scrollHeight
;
code
.
height
(
h
+
20
);
// minimize bouncing.
code
.
closest
(
'.input'
).
height
(
h
);
};
code
.
on
(
'keydown'
,
resize
);
code
.
on
(
'keyup'
,
resize
);
code
.
keyup
();
// resize now.
};
// If example already visible, set up playground now.
if
(
$
(
el
).
is
(
':visible'
))
{
setup
();
return
;
}
// Otherwise, set up playground when example is expanded.
var
built
=
false
;
$
(
el
).
closest
(
'.toggle'
).
click
(
function
()
{
// Only set up once.
if
(
!
built
)
{
setup
();
built
=
true
;
}
});
});
});
</script>
{{end}}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment