Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got rid of bootstrap.min.js #500

Open
wants to merge 17 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* Top, right navigation button */
input[type="checkbox"]#btn-navbar-checkbox {
display: none;
}

input[type="checkbox"]#btn-navbar-checkbox:not(:checked) ~ .collapse {
height: auto;
}

/* fix label settings for accordion */
.accordion-toggle label {
font-size: unset;
font-weight: unset;
line-height: unset;
margin-bottom: unset;
}

.accordion .accordion-group .accordion-heading label {
margin-bottom: initial;
}

/* radio type accordion */
.accordion .accordion-group input[type="radio"] {
display: none;
}

.accordion .accordion-group input[type="radio"] ~ .collapse {
height: 0;
}

.accordion .accordion-group input[type="radio"]:checked ~ .collapse {
height: auto;
}

/* checkbox type accordion */
.accordion .accordion-group input[type="checkbox"] {
display: none;
}

.accordion .accordion-group input[type="checkbox"]:not(:checked) ~ .collapse {
height: auto;
}

/* Disqus comment text */
input[type="checkbox"]#comment-accordion-toggle-checkbox:not(:checked)
~ .accordion-heading
#comment-accordion-toggle::before {
content: "Click here to hide comments";
}

input[type="checkbox"]#comment-accordion-toggle-checkbox:checked
~ .accordion-heading
#comment-accordion-toggle::before {
content: "Comments";
}
34 changes: 8 additions & 26 deletions templates/_includes/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ <h6 style="display:none;">Comments</h6>

<div class="accordion" id="accordion2">
<div class="accordion-group">
<input type="checkbox" checked id="comment-accordion-toggle-checkbox">
<div class="accordion-heading">
<a class="accordion-toggle disqus-comment-count comment-count"
data-toggle="collapse"
data-parent="#accordion2"
<label class="accordion-toggle"
{%if use_disqus %}
data-disqus-identifier="{{ identifier }}"
{% endif %}
href="{{ url }}#comment_thread"
for="comment-accordion-toggle-checkbox"
id="comment-accordion-toggle">
Comments
</a>
</label>
</div>
<div id="comment_thread" class="accordion-body collapse">
<div class="accordion-inner">
Expand All @@ -64,26 +62,10 @@ <h6 style="display:none;">Comments</h6>

{% macro comments_script() %}
<script>
(function () {
if (window.location.hash.match(/^#comment-\d+$/)) {
$('#comment_thread').collapse('show');
}
})();
window.onhashchange=function(){
if (window.location.hash.match(/^#comment-\d+$/))
window.location.reload(true);
window.addEventListener('load', (event) => {
if (window.location.hash.match(/^#comment-\d+$/)) {
document.getElementById('comment-accordion-toggle-checkbox').checked = false;
}
$('#comment_thread').on('shown', function () {
var link = document.getElementById('comment-accordion-toggle');
var old_innerHTML = link.innerHTML;
$(link).fadeOut(200, function() {
$(this).text('Click here to hide comments').fadeIn(200);
});
$('#comment_thread').on('hidden', function () {
$(link).fadeOut(200, function() {
$(this).text(old_innerHTML).fadeIn(200);
});
})
})
});
</script>
{% endmacro %}
6 changes: 3 additions & 3 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<input type="checkbox" checked id="btn-navbar-checkbox">
<label class="btn btn-navbar" for="btn-navbar-checkbox">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
</label>
<a class="brand" href="{{ SITEURL }}/"><span class=site-name>{{ SITENAME }}</span></a>
<div class="nav-collapse collapse">
<ul class="nav pull-right top-menu">
Expand Down Expand Up @@ -104,7 +105,6 @@
{% include '_includes/bestazon.html' %}
{% endif %}
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script>
function validateForm(query)
{
Expand Down
27 changes: 18 additions & 9 deletions templates/categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ <h1><a href="{{ SITEURL }}/{{ CATEGORIES_URL }}">All Categories</a></h1>
<div class="accordion" id="accordion2">
{% for category, articles in categories %}
<div class="accordion-group">
<input type="radio" name="all-categories-radio" id="{{ category.slug }}" onclick="closeRadio(this);">
<div class="accordion-heading">
<a class="accordion-toggle list-of-categories" data-toggle="collapse" data-parent="#accordion2" href="#{{ category.slug }}-ref">
<label for="{{ category.slug }}">
<a class="accordion-toggle list-of-categories" href="#{{ category.slug }}-ref">
{% set num = articles|count %}
{{ category }}<span>{{ num }}</span>
</a>
</label>
</div>
<div id="{{ category.slug }}-ref" class="accordion-body collapse">
<div class="accordion-inner">
Expand Down Expand Up @@ -79,14 +82,20 @@ <h1><a href="{{ SITEURL }}/{{ CATEGORIES_URL }}">All Categories</a></h1>
{% block script %}
{{ super() }}
<script>
function uncollapse() {
$(window.location.hash).collapse({
toggle: true
})
}
</script>
var closeRadio_notChecked = true;
var closeRadio_prevEl = undefined;
function closeRadio(el) {
if (closeRadio_prevEl !== el) {
closeRadio_prevEl = el;
closeRadio_notChecked = true;
}

<script>
uncollapse();
if (closeRadio_notChecked) {
closeRadio_notChecked = false;
} else {
el.checked = false;
closeRadio_notChecked = true;
}
}
</script>
{% endblock script %}