Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove unused JS code and packages

Roland Geider23c28b23240a
diff --git a/package.json b/package.json
index 80228a98c..c76c69427 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,6 @@
"metrics-graphics": "^2.15.6",
"popper.js": "^1.16.1",
"shariff": "^3.3.0",
- "tinymce": "^5.10.9",
"yarn": "^1.22.19"
},
"scripts": {
diff --git a/wger/core/static/js/wger-core.js b/wger/core/static/js/wger-core.js
index aa96d2c09..0ff66da86 100644
--- a/wger/core/static/js/wger-core.js
+++ b/wger/core/static/js/wger-core.js
@@ -133,22 +133,6 @@ function getProfileField(field) {
}
-function wgerToggleComments() {
- $('#exercise-comments-toggle').click(function (e) {
- var showComment;
- e.preventDefault();
-
- showComment = getProfileField('show_comments');
- if (!showComment) {
- $('.exercise-comments').show();
- } else {
- $('.exercise-comments').hide();
- }
-
- // Update user profile
- setProfileField('show_comments', !showComment);
- });
-}
function wgerToggleReadOnlyAccess() {
$('#toggle-ro-access').click(function (e) {
@@ -173,28 +157,6 @@ function wgerToggleReadOnlyAccess() {
});
}
-/*
- Init calls for tinyMCE editor
- */
-function wgerInitTinymce() {
- // Only try to init it on pages that loaded its JS file (so they probably need it)
- //
- // See the following links on detail about configuring the menus
- // http://www.tinymce.com/wiki.php/Configuration:toolbar
- // http://www.tinymce.com/wiki.php/Configuration:menu
- if (typeof tinyMCE !== 'undefined') {
- tinyMCE.init({
- // General options
- mode: 'textareas',
- width: '100%',
-
- entity_encoding: 'raw',
- plugins: "lists",
- menubar: false,
- toolbar: 'undo redo | bold italic | bullist numlist '
- });
- }
-}
/*
Open a modal dialog for form editing
diff --git a/wger/nutrition/static/js/nutrition.js b/wger/nutrition/static/js/nutrition.js
index 284aa50be..888417729 100644
--- a/wger/nutrition/static/js/nutrition.js
+++ b/wger/nutrition/static/js/nutrition.js
@@ -59,77 +59,7 @@ function wgerInitIngredientDetail(url) {
});
}
-/*
- * Update the user's preferences
- */
-function wgerInitIngredientAutocompleter() {
- // Init the autocompleter
- $('#id_ingredient_searchfield').autocomplete({
- serviceUrl: function () {
- return '/api/v2/ingredient/search/?language=' + getSearchLanguages()
- },
- paramName: 'term',
- minChars: 3,
- onSelect: function (suggestion) {
- const ingredientId = suggestion.data.id;
-
- // After clicking on a result set the value of the hidden field
-
- $('#id_ingredient').val(ingredientId);
- $('#ingredient_name').html(suggestion.value);
-
- // See if the ingredient has any units and set the values for the forms
- $.get('/api/v2/ingredientweightunit/?ingredient=' + ingredientId, function (unitData) {
- // Remove any old units, if any
- var options = $('#id_weight_unit').find('option');
- $.each(options, function (index, optionObj) {
- if (optionObj.value !== '') {
- $(optionObj).remove();
- }
- });
-
- // Add new units, if any
- $.each(unitData.results, function (index, value) {
- $.get('/api/v2/weightunit/' + value.unit + '/', function (unit) {
- var unitName = unit.name + ' (' + value.gram + 'g)';
- $('#id_unit').append(new Option(unitName, value.id));
- $('#id_weight_unit').append(new Option(unitName, value.id));
- });
- });
- });
- },
- formatResult: function (suggestion) {
- if (suggestion.data.image_thumbnail) {
- return '<div><img src="' + suggestion.data.image_thumbnail + '" /> ' + suggestion.value + '</div>';
- }
- return '<div>' + suggestion.value + '</div>';
- }
- });
-}
-function wgerDrawNutritionDiaryChart(planPk) {
- d3.json('/api/v2/nutritionplan/' + planPk + '/get_log_overview/').then(function (data) {
- if (data.length > 0) {
- $.getJSON('/api/v2/nutritionplan/' + planPk + '/nutritional_values/',
- function (nutritionalValues) {
- MG.data_graphic({
- data: data,
- chart_type: 'bar',
- y_accessor: 'energy',
- x_accessor: 'date',
- decimals: 0,
- full_width: true,
- baselines: [{
- value: nutritionalValues.total.energy,
- label: 'Planned (' + nutritionalValues.total.energy + 'kcal)'
- }],
- target: '#nutrition_diary_chart',
- colors: '#307916'
- });
- });
- }
- });
-}
/*
* Draw the BMI chart