1
0
mirror of https://github.com/Decicus/DecAPI-Docs.git synced 2024-11-22 21:02:30 +01:00

Add IDs to each endpoint

Add transition on load to the specific endpoint (if linked to)
Update icons for some routes
This commit is contained in:
Alex Thomassen 2017-01-12 11:28:08 +01:00
parent 7ea7705e73
commit 295fbcd08c
5 changed files with 49 additions and 12 deletions

View File

@ -10,11 +10,13 @@
},
{
"name": "bttv",
"title": "BetterTTV"
"title": "BetterTTV",
"icon": "gamepad"
},
{
"name": "dayz",
"title": "DayZ"
"title": "DayZ",
"icon": "gamepad"
},
{
"name": "lever",

View File

@ -1 +1 @@
[{"name":"askfm","title":"ASKfm","icon":"question"},{"name":"br","title":"Battle Royale (Arma 3 Mod)"},{"name":"bttv","title":"BetterTTV"},{"name":"dayz","title":"DayZ"},{"name":"lever","title":"Lever"},{"name":"misc","title":"Miscellaneous"},{"name":"r6","title":"Rainbow 6","icon":"gamepad"},{"name":"random","title":"Random","icon":"random"},{"name":"steam","title":"Steam","icon":"steam"},{"name":"twitch","title":"Twitch","icon":"twitch"},{"name":"twitter","title":"Twitter","icon":"twitter"},{"name":"youtube","title":"YouTube","icon":"youtube"}]
[{"name":"askfm","title":"ASKfm","icon":"question"},{"name":"br","title":"Battle Royale (Arma 3 Mod)"},{"name":"bttv","title":"BetterTTV","icon":"gamepad"},{"name":"dayz","title":"DayZ","icon":"gamepad"},{"name":"lever","title":"Lever"},{"name":"misc","title":"Miscellaneous"},{"name":"r6","title":"Rainbow 6","icon":"gamepad"},{"name":"random","title":"Random","icon":"random"},{"name":"steam","title":"Steam","icon":"steam"},{"name":"twitch","title":"Twitch","icon":"twitch"},{"name":"twitter","title":"Twitter","icon":"twitter"},{"name":"youtube","title":"YouTube","icon":"youtube"}]

View File

@ -15,6 +15,11 @@
.fa-heart {
color: #be1931;
}
#back-to-top:hover {
cursor: pointer;
text-decoration: underline;
}
</style>
</head>
<body>
@ -24,8 +29,9 @@
<a class="navbar-brand" href="#">DecAPI Docs</a>
</div>
<ul class="nav navbar-nav">
<li><a href="https://github.com/Decicus/DecAPI"><i class="fa fa-1x fa-github"></i> GitHub Repo</a></li>
<ul class="nav navbar-nav navbar-right">
<li><a href="https://github.com/Decicus/DecAPI-Docs"><i class="fa fa-1x fa-book"></i> DecAPI Docs on GitHub</a></li>
<li><a href="https://github.com/Decicus/DecAPI"><i class="fa fa-1x fa-github"></i> DecAPI on GitHub</a></li>
</ul>
</div>
</nav>
@ -43,7 +49,7 @@
<div class="panel panel-default hidden" id="endpoint-template">
<div class="panel-heading">
<h3 class="panel-title" id="title">
<span class="text-muted" id="base"><a href="#"></a></span><span id="route"></span>
<a href="#"><span class="text-muted" id="base"></span><span id="route"></span></a>
</h3>
</div>
<div class="panel-body" id="main-body">
@ -122,7 +128,11 @@
<h3 class="panel-title">Table of contents:</h3>
</div>
<div class="panel-body">
<p>The table of contents will only link you to the specific "categories", and not to any specific endpoints.</p>
<p>
The table of contents will only link you to the specific "categories", and not to any specific endpoints.
<br>
However, you can click the path/header for the endpoint and it will allow you to directly link to that section.
</p>
<div class="list-group"></div>
</div>
</div>
@ -136,7 +146,7 @@
<div class="container-fluid">
<p class="navbar-text">Design &amp; layout heavily inspired by <a href="https://xpaw.me/" class="navbar-link">xPaw</a> from their <a href="https://lab.xpaw.me/steam_api_documentation.html" class="navbar-link">Steam Web API Documentation</a>. Special thanks <i class="fa fa-1x fa-heart"></i></p>
<a href="#" class="pull-right navbar-text" title="Back to top"><i class="fa fa-1x fa-arrow-circle-up"></i> Back to top</a>
<span class="pull-right navbar-text" id="back-to-top" title="Back to top"><i class="fa fa-1x fa-arrow-circle-up"></i> Back to top</span>
</div>
</nav>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>

View File

@ -4,8 +4,16 @@ $(document).ready(function() {
endTemp = $('#endpoint-template', content),
faTemp = $('#fa-template', content),
toc = $('#toc', content),
btt = $('#back-to-top'),
baseUrl = 'https://beta.decapi.me';
btt.on('click', function() {
$('html, body').animate({
scrollTop: $('body').offset().top
}, 1000);
window.location.hash = '';
});
$.get({
url: './data/base.min.json',
type: 'GET',
@ -63,10 +71,13 @@ $(document).ready(function() {
routes = $('#route-body', panel),
qs = $('#qs-body', panel);
$('#base a', title)
.attr('href', '#' + id)
.html(info.base_path + '/');
$('#route', title).html(end.route);
var panelId = id + '_' + end.route
.replace(new RegExp('/', 'g'), '_')
.replace(new RegExp('({)|(})', 'g'), '');
$('a', title).attr('href', '#' + panelId);
$('a #base', title).html(info.base_path + '/');
$('a #route', title).html(end.route);
$.each(end.notes, function(k, note) {
$('<li/>')
@ -149,8 +160,20 @@ $(document).ready(function() {
panel.removeClass('hidden');
panel.appendTo(div);
$('<div/>').attr('id', panelId).prependTo(panel);
});
});
var hash = window.location.hash.replace('#', '');
if (hash.trim() !== '') {
var section = $('#' + hash);
if (section.length > 0) {
$('html, body').animate({
scrollTop: section.offset().top
}, 1000);
}
}
}
});
}

View File

@ -5,8 +5,10 @@
title: "Battle Royale (Arma 3 Mod)"
- name: bttv
title: "BetterTTV"
icon: "gamepad"
- name: dayz
title: "DayZ"
icon: "gamepad"
- name: lever
title: "Lever"
- name: misc