Merge pull request #648 from bitcoin/develdocedit

Add contextual link to source file on GitHub in devel-doc
This commit is contained in:
saivann 2014-11-18 12:17:47 -05:00
commit 42df5264ff
7 changed files with 86 additions and 5 deletions

View File

@ -743,6 +743,9 @@ table td,table th{
.toc ul.reportissue li{
background:url(/img/mini_ico_report.svg) no-repeat 0 3px;
}
.toc ul.editsource li{
background:url(/img/mini_ico_rev.svg) no-repeat 0 3px;
}
.toc a,
.toc a:link,
.toc a:active,
@ -818,6 +821,11 @@ table td,table th{
margin:0;
overflow-y:visible;
}
.toccontent .sourcefile{
width:0;
height:0;
position:absolute;
}
.anchorAf{
position:relative;
@ -2174,10 +2182,9 @@ h2 .rssicon{
.toc ul li ul li a.active:before{
content:"";
}
.toc ul.goback li{
background:none;
}
.toc ul.reportissue li{
.toc ul.goback li,
.toc ul.reportissue li,
.toc ul.editsource li{
background:none;
}
.toccontent{

View File

@ -16,6 +16,7 @@ title: "Developer Examples - Bitcoin"
<ul class="goback"><li><a href="/en/developer-documentation">Return To Overview</a></li></ul>
<ul class="reportissue"><li><a href="https://github.com/bitcoin/bitcoin.org/issues/new" onmouseover="updateIssue(event);">Report An Issue</a></li></ul>
<ul class="editsource"><li><a href="https://github.com/bitcoin/bitcoin.org/tree/master/_includes" onmouseover="updateSource(event);">Edit On GitHub</a></li></ul>
</div></div>
<div markdown="1" class="toccontent">
@ -24,12 +25,20 @@ title: "Developer Examples - Bitcoin"
{% include example_intro.md %}
<div class="sourcefile" data-sourcefile="example_testing.md"></div>
{% include example_testing.md %}
<div class="sourcefile" data-sourcefile="example_transactions.md"></div>
{% include example_transactions.md %}
<div class="sourcefile" data-sourcefile="example_payment_processing.md"></div>
{% include example_payment_processing.md %}
<div class="sourcefile" data-sourcefile="example_p2p_networking.md"></div>
{% include example_p2p_networking.md %}
{% include references.md %}

View File

@ -16,6 +16,7 @@ title: "Developer Guide - Bitcoin"
<ul class="goback"><li><a href="/en/developer-documentation">Return To Overview</a></li></ul>
<ul class="reportissue"><li><a href="https://github.com/bitcoin/bitcoin.org/issues/new" onmouseover="updateIssue(event);">Report An Issue</a></li></ul>
<ul class="editsource"><li><a href="https://github.com/bitcoin/bitcoin.org/tree/master/_includes" onmouseover="updateSource(event);">Edit On GitHub</a></li></ul>
</div></div>
@ -29,20 +30,36 @@ of the following file. -->
{% include guide_intro.md %}
<div class="sourcefile" data-sourcefile="guide_block_chain.md"></div>
{% include guide_block_chain.md %}
<div class="sourcefile" data-sourcefile="guide_transactions.md"></div>
{% include guide_transactions.md %}
<div class="sourcefile" data-sourcefile="guide_contracts.md"></div>
{% include guide_contracts.md %}
<div class="sourcefile" data-sourcefile="guide_wallets.md"></div>
{% include guide_wallets.md %}
<div class="sourcefile" data-sourcefile="guide_payment_processing.md"></div>
{% include guide_payment_processing.md %}
<div class="sourcefile" data-sourcefile="guide_operating_modes.md"></div>
{% include guide_operating_modes.md %}
<div class="sourcefile" data-sourcefile="guide_p2p_network.md"></div>
{% include guide_p2p_network.md %}
<div class="sourcefile" data-sourcefile="guide_mining.md"></div>
{% include guide_mining.md %}
{% include references.md %}

View File

@ -16,6 +16,7 @@ title: "Developer Reference - Bitcoin"
<ul class="goback"><li><a href="/en/developer-documentation">Return To Overview</a></li></ul>
<ul class="reportissue"><li><a href="https://github.com/bitcoin/bitcoin.org/issues/new" onmouseover="updateIssue(event);">Report An Issue</a></li></ul>
<ul class="editsource"><li><a href="https://github.com/bitcoin/bitcoin.org/tree/master/_includes" onmouseover="updateSource(event);">Edit On GitHub</a></li></ul>
</div></div>
<div markdown="1" class="toccontent">
@ -24,12 +25,20 @@ title: "Developer Reference - Bitcoin"
{% include ref_intro.md %}
<div class="sourcefile" data-sourcefile="ref_block_chain.md"></div>
{% include ref_block_chain.md %}
<div class="sourcefile" data-sourcefile="ref_transactions.md"></div>
{% include ref_transactions.md %}
<div class="sourcefile" data-sourcefile="ref_wallets.md"></div>
{% include ref_wallets.md %}
<div class="sourcefile" data-sourcefile="ref_p2p_networking.md"></div>
{% include ref_p2p_networking.md %}
## Bitcoin Core APIs
@ -39,6 +48,8 @@ title: "Developer Reference - Bitcoin"
-- * https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)
-->
<div class="sourcefile" data-sourcefile="ref_core_rpc_intro.md"></div>
{% include ref_core_rpc_intro.md %}
### Remote Procedure Calls (RPCs)
@ -52,10 +63,22 @@ create a cross-site scripting (XSS) exploit. To avoid problems, please
treat block chain and memory pool data as an arbitrary input from an
untrusted source.
<div class="sourcefile" data-sourcefile="ref_core_rpcs-abcdefg.md"></div>
{% include ref_core_rpcs-abcdefg.md %}
<div class="sourcefile" data-sourcefile="ref_core_rpcs-hijklmn.md"></div>
{% include ref_core_rpcs-hijklmn.md %}
<div class="sourcefile" data-sourcefile="ref_core_rpcs-opqrst.md"></div>
{% include ref_core_rpcs-opqrst.md %}
<div class="sourcefile" data-sourcefile="ref_core_rpcs-uvwxyz.md"></div>
{% include ref_core_rpcs-uvwxyz.md %}
{% include references.md %}
</div>

BIN
img/mini_ico_rev.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

BIN
img/mini_ico_rev.svg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -414,11 +414,36 @@ for (var i = 0, n = nodes.length; i < n; i++) {
}
function updateIssue(e) {
// Update GitHub issue link with pre-filled with current page location.
// Update GitHub issue link pre-filled with current page location.
var t = getEventTarget(e);
t.href = 'https://github.com/bitcoin/bitcoin.org/issues/new?body=' + encodeURIComponent('Location: ' + window.location.href.toString() + "\n\n");
}
function updateSource(e){
// Update GitHub source file link pre-filled with current page location.
if (!document.getElementsByClassName) return;
var t = getEventTarget(e),
nodes = document.getElementsByClassName('sourcefile'),
pageoffset = getPageYOffset(),
windowy = getWindowY(),
fallback = nodes[0],
first = [fallback, getTop(fallback)],
last = [fallback, getTop(fallback)],
closer = [fallback, getTop(fallback)];
// Find first, last and closer node.
for (var i = 0, n = nodes.length; i < n; i++) {
var top = getTop(nodes[i]);
if (top < first[1]) first = [nodes[i], top];
if (top > last[1]) last = [nodes[i], top];
if (top < pageoffset + 10 && top > closer[1]) closer = [nodes[i], top];
}
// Set closer title to first or last title if at the top or bottom of the page.
if (pageoffset < first[1]) closer = [first[0], first[1]];
if (windowy + pageoffset >= getHeight(document.body)) closer = [last[0], last[1]];
// Set updated url to source file.
t.href = 'https://github.com/bitcoin/bitcoin.org/edit/master/_includes/' + closer[0].getAttribute('data-sourcefile');
}
function disclaimerClose(e) {
// Auto close temporary disclaimer in devel-docs.
if (e) cancelEvent(e);