Attempt to improve initial page load by adding defer attribute to scripts, will attempt to add defer to inline scripts as well soon
This commit is contained in:
@@ -6,27 +6,32 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Workout Tracker</title>
|
||||
<script src="/static/js/plotly-basic-2.20.0.min.js"></script>
|
||||
<script src="/static/js/plotly-basic-2.20.0.min.js" defer></script>
|
||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900&display=swap" rel="stylesheet" />
|
||||
<link href="/static/css/tw-elements.min.css" rel="stylesheet">
|
||||
<script src="/static/js/tailwindcss@3.2.4.js"></script>
|
||||
<script src="/static/js/tailwindcss@3.2.4.js" defer></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: "class",
|
||||
theme: {
|
||||
fontFamily: {
|
||||
sans: ["Roboto", "sans-serif"],
|
||||
body: ["Roboto", "sans-serif"],
|
||||
mono: ["ui-monospace", "monospace"],
|
||||
window.addEventListener('DOMContentLoaded', _ => {
|
||||
tailwind.config = {
|
||||
darkMode: "class",
|
||||
theme: {
|
||||
fontFamily: {
|
||||
sans: ["Roboto", "sans-serif"],
|
||||
body: ["Roboto", "sans-serif"],
|
||||
mono: ["ui-monospace", "monospace"],
|
||||
},
|
||||
},
|
||||
},
|
||||
corePlugins: {
|
||||
preflight: false,
|
||||
},
|
||||
};
|
||||
corePlugins: {
|
||||
preflight: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
</script>
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
<script src="/static/js/tw-elements.min.js"></script>
|
||||
<script src="/static/js/tw-elements.min.js" defer></script>
|
||||
<script src="/static/js/htmx.min.js" defer></script>
|
||||
<script src="/static/js/hyperscript.min.js" defer></script>
|
||||
<script src="/static/js/sweetalert2@11.js" defer></script>
|
||||
|
||||
<script>
|
||||
function debounce(func, timeout = 300) {
|
||||
@@ -185,9 +190,6 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="/static/js/htmx.min.js"></script>
|
||||
<script src="/static/js/hyperscript.min.js"></script>
|
||||
<script src="/static/js/sweetalert2@11.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -49,7 +49,7 @@
|
||||
<option value="all">All</option>
|
||||
</select>
|
||||
<script>
|
||||
te.Select.getOrCreateInstance(document.querySelector("#workout-view-picker")).setValue("{{ selected_view | safe }}");
|
||||
window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#workout-view-picker")).setValue("{{ selected_view | safe }}"));
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<script>te.Select.getOrCreateInstance(document.querySelector("#dashboard-people-multi-select")).setValue({{ selected_person_ids | list_to_string | safe}})</script>
|
||||
<script>window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#dashboard-people-multi-select")).setValue({{ selected_person_ids | list_to_string | safe}}))</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full lg:w-1/4 sm:w-full px-3 mb-6 md:mb-0">
|
||||
@@ -43,7 +43,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<script>te.Select.getOrCreateInstance(document.querySelector("#dashboard-exercise-multi-select")).setValue({{ selected_exercise_ids | list_to_string | safe}})</script>
|
||||
<script> window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#dashboard-exercise-multi-select")).setValue({{ selected_exercise_ids | list_to_string | safe}}))</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full lg:w-1/4 sm:w-full px-3 mb-6 md:mb-0"><label
|
||||
@@ -129,13 +129,13 @@
|
||||
<div id="person-{{ p['PersonId'] }}-exercise-{{ e['ExerciseId'] }}"
|
||||
class="w-full mt-2 aspect-video"></div>
|
||||
<script>
|
||||
Plotly.newPlot(document.getElementById("person-{{ p['PersonId'] }}-exercise-{{ e['ExerciseId'] }}"), [{
|
||||
window.addEventListener('DOMContentLoaded', _ => Plotly.newPlot(document.getElementById("person-{{ p['PersonId'] }}-exercise-{{ e['ExerciseId'] }}"), [{
|
||||
x: {{ e['EstimatedOneRepMaxProgressions']['StartDates'] | replace('"', "'") | safe }},
|
||||
y: {{ e['EstimatedOneRepMaxProgressions']['Estimated1RMs'] | replace('"', "'") | safe }},
|
||||
text: {{ e['EstimatedOneRepMaxProgressions']['TopSets'] | replace('"', "'") | safe }},
|
||||
name: "{{ p['PersonName'] }} - {{ e['ExerciseName'] }}",
|
||||
hovertemplate
|
||||
}], layout, config);
|
||||
}], layout, config));
|
||||
</script>
|
||||
{% endif %}
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<script>
|
||||
te.Select.getOrCreateInstance(document.querySelector("#topset-exercise-select-{{ topset_id }}")).setValue("{{ exercise_id }}");
|
||||
window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#topset-exercise-select-{{ topset_id }}")).setValue("{{ exercise_id }}"));
|
||||
</script>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<script>
|
||||
te.Select.getOrCreateInstance(document.querySelector("#workout-exercise-select-{{ workout['WorkoutId'] }}"));
|
||||
window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#workout-exercise-select-{{ workout['WorkoutId'] }}")));
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<script>
|
||||
te.Select.getOrCreateInstance(document.querySelector("#workout-tag-select-{{ workout_id }}")).setValue({{ selected_workout_tag_ids| list_to_string | safe }});
|
||||
window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#workout-tag-select-{{ workout_id }}")).setValue({{ selected_workout_tag_ids| list_to_string | safe }}));
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<option value="all" selected>All</option>
|
||||
</select>
|
||||
<script>
|
||||
te.Select.getOrCreateInstance(document.querySelector("#workout-view-picker")).setValue("all");
|
||||
window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#workout-view-picker")).setValue("all"));
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,7 +56,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<script>
|
||||
te.Select.getOrCreateInstance(document.querySelector("#multiSelection")).setValue({{ selected_exercise_ids| list_to_string | safe }});
|
||||
window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#multiSelection")).setValue({{ selected_exercise_ids| list_to_string | safe }}));
|
||||
</script>
|
||||
</div>
|
||||
<div class="w-full md:w-1/4 px-3 mb-6 md:mb-0">
|
||||
@@ -117,7 +117,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<script>
|
||||
te.Select.getOrCreateInstance(document.querySelector("#graph-axis-multiselect")).setValue({{ graph_axis | safe }});
|
||||
window.addEventListener('DOMContentLoaded', _ => te.Select.getOrCreateInstance(document.querySelector("#graph-axis-multiselect")).setValue({{ graph_axis | safe }}));
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user