mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Mark levels done in local storage
This commit is contained in:
@@ -41,5 +41,8 @@ require([
|
||||
editor.setValue(codeSolution);
|
||||
});
|
||||
});
|
||||
|
||||
// Show progress
|
||||
progress.show();
|
||||
});
|
||||
});
|
||||
@@ -12,7 +12,7 @@ define([
|
||||
var getLevels = function() {
|
||||
var levels = $(".book-summary li[data-level]");
|
||||
return _.map(levels, function(level) {
|
||||
return $(level).data("level");
|
||||
return $(level).data("level").toString();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -37,6 +37,8 @@ define([
|
||||
|
||||
var progress = getProgress();
|
||||
progress[level] = state? Date.now() : 0;
|
||||
|
||||
storage.set("progress", progress);
|
||||
};
|
||||
|
||||
// Show progress
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -28,6 +28,12 @@
|
||||
overflow: hidden;
|
||||
background: #35393b;
|
||||
}
|
||||
|
||||
&.done {
|
||||
> a {
|
||||
color: green;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="book-summary">
|
||||
<ul class="summary">
|
||||
<li>
|
||||
<li data-level="0">
|
||||
<a href="{{ basePath }}/README.html">Introduction</a>
|
||||
</li>
|
||||
<li>
|
||||
@@ -8,12 +8,12 @@
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
{% for item in summary.chapters %}
|
||||
<li {% if item._path == _input %}class="active"{% endif %}>
|
||||
<li {% if item._path == _input %}class="active"{% endif %} data-level="{{ item.level }}">
|
||||
<a href="{{ basePath }}/{{ item.path }}">{{ item.title }}</a>
|
||||
{% if item.articles.length > 0 %}
|
||||
<ul class="articles">
|
||||
{% for article in item.articles %}
|
||||
<li {% if article._path == _input %}class="active"{% endif %}>
|
||||
<li {% if article._path == _input %}class="active"{% endif %} data-level="{{ article.level }}">
|
||||
<a href="{{ basePath }}/{{ article.path }}">{{ article.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user