Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add external JS file for mobile version

Roland Geider915d4c0c8046
diff --git a/wger/manager/static/js/workout-manager-mobile.js b/wger/manager/static/js/workout-manager-mobile.js
new file mode 100644
index 000000000..eaf7ab2d1
--- /dev/null
+++ b/wger/manager/static/js/workout-manager-mobile.js
@@ -0,0 +1,57 @@
+/*
+ *
+ *
+ * Custom JS code for the mobile version
+ *
+ *
+ */
+
+
+
+/*
+ * There are no datepickers in the mobile version
+ */
+function init_weight_datepicker()
+{
+}
+
+/*
+ * Open a modal dialog for form editing
+ */
+function form_modal_dialog()
+{
+ // Unbind all other click events so we don't do this more than once
+ $(".modal-dialog").off();
+
+ // Load the edit dialog when the user clicks on an edit link
+ $(".modal-dialog").click(function(e) {
+ e.preventDefault();
+ window.location.href = $(this).attr("href");
+ });
+}
+
+
+/*
+ * Handle external links with a Web Activity when in Firefox OS
+ */
+$(document).on('pageinit', function () {
+ if(typeof MozActivity != 'undefined') {
+ /*
+ * External links
+ */
+ $('a[href^=http]').click(function(e){
+ e.preventDefault();
+
+ var activity = new MozActivity({
+ name: "view",
+ data: {
+ type: "url",
+ url: $(this).attr("href")
+ }
+ });
+ });
+ }
+ else {
+ console.debug('MozActivity not available, opening links as usual.');
+ }
+});
diff --git a/wger/manager/templates/mobile/template.html b/wger/manager/templates/mobile/template.html
index 29d5f00ef..65602c16a 100644
--- a/wger/manager/templates/mobile/template.html
+++ b/wger/manager/templates/mobile/template.html
@@ -40,39 +40,8 @@
<script src="{% static 'js/jquery-mobile.js' %}" type="text/javascript"></script>
<script src="{% static 'js/d3.js' %}"></script>
<script src="{% static 'js/workout-manager.js' %}" type="text/javascript"></script>
- <script>
- function init_weight_datepicker()
- {
- }
-
- /*
- * Handle external links with a Web Activity when in Firefox OS
- */
- $(document).on('pageinit', function () {
- if(typeof MozActivity != 'undefined') {
- /*
- * External links
- */
- $('a[href^=http]').click(function(e){
- e.preventDefault();
-
- var activity = new MozActivity({
- name: "view",
- data: {
- type: "url",
- url: $(this).attr("href")
- }
- });
- });
- }
- else {
- console.debug('MozActivity not available, opening links as usual.');
- }
- });
-
-
- </script>
-
+ <script src="{% static 'js/workout-manager-mobile.js' %}" type="text/javascript"></script>
+
{% block header %}{% endblock %}
</head>
<body>