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
Branches
Tags
No related merge requests found
...@@ -61,24 +61,6 @@ ready(function () { ...@@ -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 // Syntax highlight
hljs.registerLanguage('xml', xml); hljs.registerLanguage('xml', xml);
hljs.registerLanguage('php', php); 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 @@ ...@@ -11,3 +11,6 @@
</div> </div>
</div> </div>
{% block postload %}
<script src="{{ asset('js/expander.js') }}"></script>
{% endblock %}
...@@ -18,6 +18,7 @@ module.exports = environment => { ...@@ -18,6 +18,7 @@ module.exports = environment => {
return { return {
entry: { entry: {
bundle: './src/js/bundle', bundle: './src/js/bundle',
expander: './src/js/expander',
logout: './src/js/logout/main', logout: './src/js/logout/main',
stylesheet: './src/js/style' stylesheet: './src/js/style'
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment