mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-28 01:10:58 +01:00
Added support for automatic expansion of details when printing
This commit is contained in:
parent
9f4e4c8884
commit
71fc5d1d37
File diff suppressed because one or more lines are too long
@ -190,7 +190,7 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/application.a8c1b0c3.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/application.efe184c7.js' | url }}"></script>
|
||||
{% if lang.t("search.language") != "en" %}
|
||||
{% set languages = lang.t("search.language").split(",") %}
|
||||
{% if languages | length and languages[0] != "" %}
|
||||
|
@ -498,6 +498,20 @@ function initialize(config) { // eslint-disable-line func-style
|
||||
.initialize(facts)
|
||||
})
|
||||
})
|
||||
|
||||
/* Before-print hook */
|
||||
const print = () => {
|
||||
const details = document.querySelectorAll("details")
|
||||
Array.prototype.forEach.call(details, detail => {
|
||||
detail.setAttribute("open", "")
|
||||
})
|
||||
}
|
||||
|
||||
/* Open details before printing */
|
||||
new Material.Event.MatchMedia("print", {
|
||||
listen: print, unlisten: () => {}
|
||||
}) // Webkit
|
||||
window.onbeforeprint = print // IE, FF
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user