From 47562e0a71f80cd43ce684355609362fbedd6f7a Mon Sep 17 00:00:00 2001 From: Brian Huisman Date: Thu, 22 Jun 2023 09:57:33 -0400 Subject: [PATCH] Add 'online' value for Mustache template Provide an 'online' value to the Search Result Mustache template. This will, for example, allow you to put things in your Search Result template that will show up when your site is displayed live (PHP), but will not be output when your site is displayed using the offline Javascript, and vice versa. eg. {{#online}} This will only display in your template if it's online. {{/online}} {{^online}} This will only display in your template it it's offline. {{/online}} --- orcinus/js/template.offline.js | 4 ++++ orcinus/search.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/orcinus/js/template.offline.js b/orcinus/js/template.offline.js index 0ad4930..ffb4e75 100644 --- a/orcinus/js/template.offline.js +++ b/orcinus/js/template.offline.js @@ -80,8 +80,12 @@ function os_return_all() { // Create the Mustache template let os_TEMPLATE = { + errors: false, + + online: false, version: '{{version}}', searchable: false, + addError: function(text) { if (!this.errors) { this.errors = {}; diff --git a/orcinus/search.php b/orcinus/search.php index 5d71f0d..f87d992 100644 --- a/orcinus/search.php +++ b/orcinus/search.php @@ -59,6 +59,8 @@ foreach ($_RDATA['s_latin'] as $char => $latin) { // {{{{{ Initialize the Mustache templating engine class OS_Mustache { public $errors; + + public $online = true; public $version; public $searchable;