Fixed #4: Click on Logo/Title without Github-Repository: None

This commit is contained in:
squidfunk 2016-02-21 17:32:36 +01:00
parent e7a41822a0
commit ba72ddb949
9 changed files with 32 additions and 27 deletions

View File

@ -1,6 +1,7 @@
mkdocs-material-0.x.x (2016-xx-xx)
* Fixed #3: Ordered lists within an unordered list have ::before content
* Fixed #4: Click on Logo/Title without Github-Repository: "None"
* Moved Modernizr to top to ensure basic usability in IE8
mkdocs-material-0.1.2 (2016-02-16)

File diff suppressed because one or more lines are too long

View File

@ -81,7 +81,7 @@
{% block extrahead %}{% endblock %}
</head>
<body>
{% if repo_name == 'GitHub' %}
{% if repo_name == 'GitHub' and repo_url %}
{% set repo_id = repo_url | replace('https://github.com/', '') %}
{% if repo_id[-1:] == '/' %}
{% set repo_id = repo_id[:-1] %}
@ -142,7 +142,7 @@
var base_url = '{{ base_url }}';
var repo_id = '{{ repo_id }}';
</script>
<script src="{{ base_url }}/assets/javascripts/application-c6d2e828bd.js"></script>
<script src="{{ base_url }}/assets/javascripts/application-a10a824a49.js"></script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>
{% endfor %}

View File

@ -1,5 +1,6 @@
<nav aria-label="Navigation">
<a href="{{ repo_url }}" class="project">
{% set home = repo_url | default('/', true) %}
<a href="{{ home }}" class="project">
<div class="banner">
{% if config.extra.logo %}
<div class="logo">
@ -17,7 +18,7 @@
</a>
<div class="scrollable">
<div class="wrapper">
{% if repo_name == 'GitHub' %}
{% if repo_name == 'GitHub' and repo_url %}
<ul class="repo">
<li class="repo-download">
{% set version = config.extra.version | default('master') %}

View File

@ -1,6 +1,6 @@
{
"assets/images/favicon.ico": "assets/images/favicon-e565ddfa3b.ico",
"assets/javascripts/application.js": "assets/javascripts/application-c6d2e828bd.js",
"assets/javascripts/application.js": "assets/javascripts/application-a10a824a49.js",
"assets/javascripts/modernizr.js": "assets/javascripts/modernizr-4ab42b99fd.js",
"assets/stylesheets/application.css": "assets/stylesheets/application-eaf860cca2.css"
}

View File

@ -502,24 +502,26 @@ document.addEventListener('DOMContentLoaded', function() {
* ------------------------------------------------------------------------- */
/* Get Stars for current repository */
pegasus('https://api.github.com/repos/' + repo_id).then(
if (repo_id) {
pegasus('https://api.github.com/repos/' + repo_id).then(
/* Request successful, we got the stars */
function(data, xhr) {
var count = data.stargazers_count;
if (count > 10000)
count = (count / 1000).toFixed(0) + 'k';
else if (count > 1000)
count = (count / 1000).toFixed(1) + 'k';
/* Request successful, we got the stars */
function(data, xhr) {
var count = data.stargazers_count;
if (count > 10000)
count = (count / 1000).toFixed(0) + 'k';
else if (count > 1000)
count = (count / 1000).toFixed(1) + 'k';
/* Set number of stars */
var stars = document.querySelector('.repo-stars .count');
stars.innerHTML = count;
},
/* Set number of stars */
var stars = document.querySelector('.repo-stars .count');
stars.innerHTML = count;
},
/* Handle error */
function(data, xhr) {
console.error(data, xhr.status);
}
);
/* Handle error */
function(data, xhr) {
console.error(data, xhr.status);
}
);
}
});

View File

@ -127,7 +127,7 @@
regular expressions out-of-the-box. Since there might be a slash at the
end of the repository name, we just do a string comparison and kill it.
-->
{% if repo_name == 'GitHub' %}
{% if repo_name == 'GitHub' and repo_url %}
{% set repo_id = repo_url | replace('https://github.com/', '') %}
{% if repo_id[-1:] == '/' %}
{% set repo_id = repo_id[:-1] %}

View File

@ -1,8 +1,9 @@
<!-- Navigation -->
<nav aria-label="Navigation">
{% set home = repo_url | default('/', true) %}
<!-- Project information -->
<a href="{{ repo_url }}" class="project">
<a href="{{ home }}" class="project">
<!-- Name and logo -->
<div class="banner">
@ -32,7 +33,7 @@
<div class="wrapper">
<!-- Repository -->
{% if repo_name == 'GitHub' %}
{% if repo_name == 'GitHub' and repo_url %}
<ul class="repo">
<li class="repo-download">
{% set version = config.extra.version | default('master') %}