1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-24 07:30:12 +01:00

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) mkdocs-material-0.x.x (2016-xx-xx)
* Fixed #3: Ordered lists within an unordered list have ::before content * 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 * Moved Modernizr to top to ensure basic usability in IE8
mkdocs-material-0.1.2 (2016-02-16) 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 %} {% block extrahead %}{% endblock %}
</head> </head>
<body> <body>
{% if repo_name == 'GitHub' %} {% if repo_name == 'GitHub' and repo_url %}
{% set repo_id = repo_url | replace('https://github.com/', '') %} {% set repo_id = repo_url | replace('https://github.com/', '') %}
{% if repo_id[-1:] == '/' %} {% if repo_id[-1:] == '/' %}
{% set repo_id = repo_id[:-1] %} {% set repo_id = repo_id[:-1] %}
@ -142,7 +142,7 @@
var base_url = '{{ base_url }}'; var base_url = '{{ base_url }}';
var repo_id = '{{ repo_id }}'; var repo_id = '{{ repo_id }}';
</script> </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 %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>
{% endfor %} {% endfor %}

View File

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

View File

@ -1,6 +1,6 @@
{ {
"assets/images/favicon.ico": "assets/images/favicon-e565ddfa3b.ico", "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/javascripts/modernizr.js": "assets/javascripts/modernizr-4ab42b99fd.js",
"assets/stylesheets/application.css": "assets/stylesheets/application-eaf860cca2.css" "assets/stylesheets/application.css": "assets/stylesheets/application-eaf860cca2.css"
} }

View File

@ -502,24 +502,26 @@ document.addEventListener('DOMContentLoaded', function() {
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
/* Get Stars for current repository */ /* 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 */ /* Request successful, we got the stars */
function(data, xhr) { function(data, xhr) {
var count = data.stargazers_count; var count = data.stargazers_count;
if (count > 10000) if (count > 10000)
count = (count / 1000).toFixed(0) + 'k'; count = (count / 1000).toFixed(0) + 'k';
else if (count > 1000) else if (count > 1000)
count = (count / 1000).toFixed(1) + 'k'; count = (count / 1000).toFixed(1) + 'k';
/* Set number of stars */ /* Set number of stars */
var stars = document.querySelector('.repo-stars .count'); var stars = document.querySelector('.repo-stars .count');
stars.innerHTML = count; stars.innerHTML = count;
}, },
/* Handle error */ /* Handle error */
function(data, xhr) { function(data, xhr) {
console.error(data, xhr.status); 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 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. 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/', '') %} {% set repo_id = repo_url | replace('https://github.com/', '') %}
{% if repo_id[-1:] == '/' %} {% if repo_id[-1:] == '/' %}
{% set repo_id = repo_id[:-1] %} {% set repo_id = repo_id[:-1] %}

View File

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