JavaScript fixes

This commit is contained in:
Joel Addison 2017-12-10 17:21:30 +10:00
parent cb51a2abd8
commit bd25446f6e
3 changed files with 12 additions and 10 deletions

View file

@ -339,7 +339,7 @@
{% block scripts_extra %} {% block scripts_extra %}
<script type="text/javascript"> <script type="text/javascript">
function _toggleVoidInvoices() { var _toggleVoidInvoices = function() {
var visible = false; var visible = false;
function toggleVoidInvoices() { function toggleVoidInvoices() {
$btn = $("#toggle-void-invoices"); $btn = $("#toggle-void-invoices");
@ -359,6 +359,6 @@
return toggleVoidInvoices; return toggleVoidInvoices;
} }
var toggleVoidInvoices = _toggleVoidInvoices(); var toggleVoidInvoices = _toggleVoidInvoices();
_toggleVoidInvoices() = undefined; _toggleVoidInvoices = undefined;
</script> </script>
{% endblock %} {% endblock %}

View file

@ -102,11 +102,11 @@
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ STATIC_URL }}/js/app.js" type="text/javascript"></script> <script src="{% static 'js/app.js' %}" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="{{ STATIC_URL }}/js/bootstrap.min.js" type="text/javascript"></script> <script src="{% static 'js/bootstrap.min.js' %}" type="text/javascript"></script>
<script src="{{ STATIC_URL }}/js/jquery.formset.js"></script> <script src="{% static 'js/jquery.formset.js' %}"></script>
{% block extra_script %} {% block extra_script %}
{% endblock %} {% endblock %}
{% block scripts_extra %}{% endblock %} {% block scripts_extra %}{% endblock %}

View file

@ -15,11 +15,13 @@ u.documentReady(function () {
} }
var menuOpener = document.querySelector('[data-menu-opener]'); var menuOpener = document.querySelector('[data-menu-opener]');
u.addEventListener(menuOpener, 'click', function (e) { if (menuOpener) {
e.preventDefault(); u.addEventListener(menuOpener, 'click', function (e) {
u.toggleClass(this, 'is-active'); e.preventDefault();
u.toggleClass(document.querySelector('[data-menu]'), 'is-active'); u.toggleClass(this, 'is-active');
}); u.toggleClass(document.querySelector('[data-menu]'), 'is-active');
});
}
}); });
},{"./components/tabbed-panel":2,"./includes/utils":3}],2:[function(require,module,exports){ },{"./components/tabbed-panel":2,"./includes/utils":3}],2:[function(require,module,exports){