From 8793e4e9c25cff4538221c8403e8108030aee5ce Mon Sep 17 00:00:00 2001 From: otrok7 <50595291+otrok7@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:44:34 +0100 Subject: [PATCH 1/2] fix for jsInFooter --- crouton.php | 12 +++++++----- croutonjs/src/templates/header.hbs | 10 +++++----- readme.txt | 6 +++++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/crouton.php b/crouton.php index 50ef1490..ec62340b 100644 --- a/crouton.php +++ b/crouton.php @@ -5,7 +5,7 @@ Description: A tabbed based display for showing meeting information. Author: bmlt-enabled Author URI: https://bmlt.app -Version: 3.20.4 +Version: 3.20.5 */ /* Disallow direct access to the plugin file */ if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) { @@ -314,9 +314,11 @@ private function inlineScript($s) } private function outputScript($s) { - if (isset($this->options['jsInFooter'])) { + if ($this->options['jsInFooter']) { wp_add_inline_script('croutonjs', $s); $s = ""; + } else { + $s = ""; } return $this->waitMsg.sprintf('%s
%s
', $this->sharedRender(), $s); } @@ -381,9 +383,9 @@ private function getInitializeCroutonBlock($renderCmd, $config, $mapConfig) if (!$this->croutonBlockInitialized) { $this->croutonBlockInitialized = true; $croutonMap = $this->getMapInitialization($mapConfig); - return ""; + return "var crouton;jQuery(document).ready(function() { $croutonMap crouton = new Crouton($config); $renderCmd });"; } else { - return isset($config) ? "" : ""; + return isset($config) ? "jQuery(document).ready(function() { crouton.setConfig($config); $renderCmd });" : ""; } } @@ -715,7 +717,7 @@ public function adminOptionsPage()

Advanced Options

Should the generated Javascript be placed in the footer or in the body.

- options['jsInFooter'] == 1 ? 'checked' : '') ?> />Place Javascript in Footer + options['jsInFooter'] ? 'checked' : '') ?> />Place Javascript in Footer
diff --git a/croutonjs/src/templates/header.hbs b/croutonjs/src/templates/header.hbs index 073b79d3..ed0a4692 100644 --- a/croutonjs/src/templates/header.hbs +++ b/croutonjs/src/templates/header.hbs @@ -1,17 +1,17 @@ {{startup this}} {{#if this.config.header}} {{#if this.config.include_weekday_button}} -
{{getWord 'weekday'}}
+
{{getWord 'weekday'}}
{{/if}} {{#each this.config.button_filters}} -
{{getWord this.title}}
+
{{getWord this.title}}
{{/each}} {{#each this.config.button_format_filters}} -
{{this.title}}
+
{{this.title}}
{{/each}} {{#if this.config.map_page}} -
{{getWord 'map'}}
-
{{getWord 'tabular'}}
+
{{getWord 'map'}}
+
{{getWord 'tabular'}}
{{/if}} {{#each this.dropdownData}} diff --git a/readme.txt b/readme.txt index 68c5b782..3997e578 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: na, meeting list, meeting finder, maps, recovery, addiction, webservant, b Requires at least: 4.0 Required PHP: 8.0 Tested up to: 6.6.2 -Stable tag: 3.20.4 +Stable tag: 3.20.5 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html crouton implements a Tabbed UI for BMLT. @@ -36,6 +36,10 @@ https://demo.bmlt.app/crouton == Changelog == += 3.20.4 = +* Bug fix for checkbox placing JS in footer +* Accessibility improvements + = 3.20.4 = * Bug fix for fixing container height when using OSM From e0392c0482b4df91e93a13b2eb183bc2d048aa3c Mon Sep 17 00:00:00 2001 From: Alan B <918773+alanb2718@users.noreply.github.com> Date: Fri, 8 Nov 2024 12:50:13 -0800 Subject: [PATCH 2/2] fix service_body_names to not list names of parents --- croutonjs/src/js/crouton-core.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/croutonjs/src/js/crouton-core.js b/croutonjs/src/js/crouton-core.js index 27b3afe3..997717ba 100644 --- a/croutonjs/src/js/crouton-core.js +++ b/croutonjs/src/js/crouton-core.js @@ -539,7 +539,7 @@ function Crouton(config) { if (showingNow!==null) filteredMeetings = self.meetingData.filter((m) => showingNow.includes(m.id_bigint)); var ids = getUniqueValuesOfKey(filteredMeetings, 'service_body_bigint'); var me = this; - self.getServiceBodies(ids).then(function (service_bodies) { + self.getServiceBodies(ids, false).then(function (service_bodies) { var n = service_bodies.length; var names = service_bodies.map((m)=>m['name']); names.sort(); @@ -559,9 +559,7 @@ function Crouton(config) { }); }); } - self.getServiceBodies = function(service_bodies_id) { - const requires_parents = true; - + self.getServiceBodies = function(service_bodies_id, requires_parents=true) { var url = this.config['root_server'] + '/client_interface/jsonp/?switcher=GetServiceBodies' + (requires_parents ? '&parents=1' : '') + getServiceBodiesQueryString(service_bodies_id); return fetchJsonp(url)