Skip to content
Snippets Groups Projects
Commit e2ba9c41 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Only load expander-related JS on pages that include the expander

parent eeb09dcf
No related branches found
No related tags found
No related merge requests found
......@@ -61,24 +61,6 @@ ready(function () {
};
// Expander boxes
var expandable = document.querySelectorAll('.expandable > .expander');
expandable.forEach(function (currentValue, index, arr) {
currentValue.onclick = function (e) {
e.preventDefault();
var parent = e.currentTarget.parentNode;
if (parent.className.match(/(?:^|\s)expanded(?!\S)/)) {
parent.className = parent.className.replace(/(?:^|\s)expanded(?!\S)/g , '');
} else {
parent.className += " expanded";
}
e.currentTarget.blur();
}
});
// Syntax highlight
hljs.registerLanguage('xml', xml);
hljs.registerLanguage('php', php);
......
// Expander boxes
var expandable = document.querySelectorAll('.expandable > .expander');
expandable.forEach(function (currentValue, index, arr) {
currentValue.onclick = function (e) {
e.preventDefault();
var parent = e.currentTarget.parentNode;
if (parent.className.match(/(?:^|\s)expanded(?!\S)/)) {
parent.className = parent.className.replace(/(?:^|\s)expanded(?!\S)/g , '');
} else {
parent.className += " expanded";
}
e.currentTarget.blur();
}
});
......@@ -11,3 +11,6 @@
</div>
</div>
{% block postload %}
<script src="{{ asset('js/expander.js') }}"></script>
{% endblock %}
......@@ -18,6 +18,7 @@ module.exports = environment => {
return {
entry: {
bundle: './src/js/bundle',
expander: './src/js/expander',
logout: './src/js/logout/main',
stylesheet: './src/js/style'
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment