2016-01-08 13:08:40 +00:00
{% extends "base.html" %}
{% block mainbody %}
< div class = "navbar navbar-inverse navbar-fixed-top" >
< div class = "container" >
< div class = "navbar-header" >
< button type = "button" class = "navbar-toggle" data-toggle = "collapse" data-target = ".navbar-collapse" >
< span class = "icon-bar" > < / span >
< span class = "icon-bar" > < / span >
< span class = "icon-bar" > < / span >
< / button >
< div class = "navbar-brand" >
< a href = "https://twitter.com/share" class = "twitter-share-button" data-url = "http://pokeapi.co" data-text = "Pokéapi - the Pokémon RESTful API " data-via = "phalt_" data-related = "phalt_" > Tweet< / a >
< script > ! function ( d , s , id ) { var js , fjs = d . getElementsByTagName ( s ) [ 0 ] , p = /^http:/ . test ( d . location ) ? 'http' : 'https' ; if ( ! d . getElementById ( id ) ) { js = d . createElement ( s ) ; js . id = id ; js . src = p + '://platform.twitter.com/widgets.js' ; fjs . parentNode . insertBefore ( js , fjs ) ; } } ( document , 'script' , 'twitter-wjs' ) ; < / script >
< / div >
< / div >
< div class = "collapse navbar-collapse navbar-right" >
< ul class = "nav navbar-nav" >
< li > < a href = "/" > Home< / a > < / li >
< li > < a href = "/about/" > About< / a > < / li >
< li class = "active" > < a href = "#" > Documentation< / a > < / li >
< / ul >
< / div > <!-- /.nav - collapse -->
< / div >
< / div >
< section id = "docs" >
< div class = "header" >
{% block docstitle %}
{% endblock docstitle %}
< / div >
< div class = "container" >
< div class = "row pad_top" >
< div class = "col-sm-3 side-nav" >
< div class = "nav-group" >
< ul class = "version-select" >
{% block docsversionstate %}
{% endblock docsversionstate %}
< / ul >
2016-01-09 15:55:39 +00:00
< div class = "doc-select hidden-xs" >
2016-01-08 13:08:40 +00:00
{% block docsnav %}
{% endblock docsnav %}
< / div >
< / div >
< / div >
2016-01-09 15:55:39 +00:00
< div class = "col-sm-9 docs-body" >
2016-01-08 13:08:40 +00:00
< h2 id = "info" > Information< / h2 >
< p class = "lead" > Please take note when using this API:< / p >
< ul >
< li > This is a < b > consumption-only< / b > API - only the HTTP GET method is available on resources.< / li >
< li > < b > No authentication< / b > is required to access this API. All resources are fully open and available.< / li >
< ul >
< li > There is, however, a daily rate limit of 300 requests < b > per resource< / b > per IP address. So a single IP address can call the < i > bulbasaur< / i > resource 300 times a day. Not 300 requests across the entire dataset! This is to stop our database from falling over under heavy load.< / li >
< / ul >
< li > If you are going to be regularly using the API, I recommend caching data on your service.< / li >
< ul >
< li > Luckily, we provide < b > modified/created datetime stamps< / b > on every single resource so you can check for updates (and thus make your caching efficient).< / li >
< / ul >
< / ul >
{% block docsbody %}
{% endblock docsbody %}
< / div >
< / div >
< / div >
< / section >
< script >
var sticky = $('.nav-group');
2016-01-09 15:55:39 +00:00
var docSelect = $('.doc-select');
2016-01-08 13:08:40 +00:00
var offset = sticky.offset();
var sideNav = $('.side-nav');
2016-01-09 15:55:39 +00:00
var navParents = $('.doc-select').children('ul').children('li');
2016-01-08 13:08:40 +00:00
var doc = $(document);
2016-01-09 15:55:39 +00:00
var win = $(window);
2016-01-08 13:08:40 +00:00
2016-01-09 15:55:39 +00:00
function navOps () {
2016-01-08 13:08:40 +00:00
2016-01-09 15:55:39 +00:00
//check sticky
2016-01-08 13:08:40 +00:00
if (doc.scrollTop() >= (offset.top - 65)) {
2016-01-09 15:55:39 +00:00
console.log(window.innerHeight - offset.top);
2016-01-08 13:08:40 +00:00
sticky.addClass('stick');
2016-01-09 15:55:39 +00:00
sticky.css({
width: sideNav.width() + 'px',
});
2016-01-08 13:08:40 +00:00
} else {
sticky.removeClass('stick');
sticky.css({ width: '' });
}
2016-01-09 15:55:39 +00:00
navParents.removeClass('active');
var parent;
var target;
var activeParent = $(navParents[0]);
var scrollTop = win.scrollTop();
for (var i = 0; i < navParents.length ; i + + ) {
parent = $(navParents[i]);
target = $(parent.find('a').attr('href'));
if (scrollTop >= target.offset().top) {
activeParent = parent;
} else {
break;
}
}
activeParent.addClass('active');
var children = activeParent.find('li');
var child;
var activeChild;
children.removeClass('active');
for (i = 0; i < children.length ; i + + ) {
child = $(children[i]);
target = $(child.find('a').attr('href'));
if (scrollTop >= target.offset().top) {
activeChild = child;
} else {
break;
}
}
if (activeChild) {
activeChild.addClass('active');
}
2016-01-08 13:08:40 +00:00
}
doc.scroll(function () {
2016-01-09 15:55:39 +00:00
navOps();
2016-01-08 13:08:40 +00:00
});
2016-01-09 15:55:39 +00:00
win.resize(function () {
2016-01-08 13:08:40 +00:00
2016-01-09 15:55:39 +00:00
navOps();
2016-01-08 13:08:40 +00:00
});
2016-01-09 15:55:39 +00:00
navOps();
2016-01-08 13:08:40 +00:00
< / script >
{% endblock %}