summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/clientscript.js
diff options
context:
space:
mode:
authorSimon Rettberg2020-11-03 13:45:37 +0100
committerSimon Rettberg2020-11-03 13:45:37 +0100
commit77f9f9d9e975bd14083656f987b426e81908dd9e (patch)
treef98263140b353ea2a3c9c6a2e19d2eec66fd5115 /modules-available/locationinfo/clientscript.js
parent[locationinfo] Clean up styling a bit more (diff)
downloadslx-admin-77f9f9d9e975bd14083656f987b426e81908dd9e.tar.gz
slx-admin-77f9f9d9e975bd14083656f987b426e81908dd9e.tar.xz
slx-admin-77f9f9d9e975bd14083656f987b426e81908dd9e.zip
[locationinfo] Remove unused javascript
Most javascript was needed for editing the opening times of locations. Some javascript was still used to fill the now disabled input forms for display only. This is now done server-side, and the input fields have been replaced by a simple table.
Diffstat (limited to 'modules-available/locationinfo/clientscript.js')
-rw-r--r--modules-available/locationinfo/clientscript.js91
1 files changed, 0 insertions, 91 deletions
diff --git a/modules-available/locationinfo/clientscript.js b/modules-available/locationinfo/clientscript.js
deleted file mode 100644
index f8309a8a..00000000
--- a/modules-available/locationinfo/clientscript.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Generic helpers.
- */
-
-/**
- * Initialize timepicker on given element.
- */
-function setTimepicker($e) {
- $e.timepicker({
- minuteStep: 15,
- appendWidgetTo: 'body',
- showSeconds: false,
- showMeridian: false,
- defaultTime: false
- });
-}
-
-function getTime(str) {
- if (!str) return false;
- str = str.split(':');
- if (str.length !== 2) return false;
- var h = parseInt(str[0].replace(/^0/, ''));
- var m = parseInt(str[1].replace(/^0/, ''));
- if (h < 0 || h > 23) return false;
- if (m < 0 || m > 59) return false;
- return h * 60 + m;
-}
-
-const allDays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
-
-/*
- * Opening times related...
- */
-
-var slxIdCounter = 0;
-
-/**
- * Adds a new opening time to the table in expert mode.
- */
-function newOpeningTime(vals) {
- var $row = $('#expert-template').find('div.row').clone();
- if (vals['days'] && Array.isArray(vals['days'])) {
- for (var i = 0; i < allDays.length; ++i) {
- $row.find('.i-' + allDays[i]).prop('checked', vals['days'].indexOf(allDays[i]) !== -1);
- }
- }
- $row.find('input').each(function() {
- var $inp = $(this);
- if ($inp.length === 0) return;
- slxIdCounter++;
- $inp.prop('id', 'id-inp-' + slxIdCounter);
- $inp.siblings('label').prop('for', 'id-inp-' + slxIdCounter);
- });
- $row.find('.i-openingtime').val(vals['openingtime']);
- $row.find('.i-closingtime').val(vals['closingtime']);
- $('#expert-table').append($row);
- return $row;
-}
-
-/**
- * Convert fields from simple mode view to entries in expert mode.
- * @returns {Array}
- */
-function simpleToExpert() {
- var retval = [];
- if ($('#week-open').val() || $('#week-close').val()) {
- retval.push({
- 'days': ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
- 'openingtime': $('#week-open').val(),
- 'closingtime': $('#week-close').val(),
- 'tag': '#week'
- });
- }
- if ($('#saturday-open').val() || $('#saturday-close').val()) {
- retval.push({
- 'days': ['Saturday'],
- 'openingtime': $('#saturday-open').val(),
- 'closingtime': $('#saturday-close').val(),
- 'tag': '#saturday'
- });
- }
- if ($('#sunday-open').val() || $('#sunday-close').val()) {
- retval.push({
- 'days': ['Sunday'],
- 'openingtime': $('#sunday-open').val(),
- 'closingtime': $('#sunday-close').val(),
- 'tag': '#sunday'
- });
- }
- return retval;
-}