From 58bc18a5efb61d7302e41aaf0d0eef3b80fa793c Mon Sep 17 00:00:00 2001 From: "John R. D'Orazio" Date: Wed, 17 Feb 2021 22:12:34 +0100 Subject: [PATCH 1/3] add preferorigin toggle --- Sidebar.html | 259 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 181 insertions(+), 78 deletions(-) diff --git a/Sidebar.html b/Sidebar.html index 18f1a05..fc86668 100644 --- a/Sidebar.html +++ b/Sidebar.html @@ -49,45 +49,123 @@ }); ?> + - - - - + + + + + -
- - -
-
- +
+ class="empty">none> +
+ +
+ +
+ " /> + +
+
+
+
+ + + +
+
+
+ +
+ " /> + +
+
+
+
+ + +
+
+ - +
+ +
+ +
+ + BibleGet I/O for Google Docs v. +
+ - - + + - + \ No newline at end of file From 7fccb86401ab957e6fc80040c0cb9f72c1096398 Mon Sep 17 00:00:00 2001 From: "John R. D'Orazio" Date: Wed, 17 Feb 2021 22:53:11 +0100 Subject: [PATCH 2/3] plug in preferorigin to server payload --- Code.gs | 8 ++++---- Settings.html | 2 +- Sidebar.html | 21 +++++++++++++++------ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Code.gs b/Code.gs index 125d4c7..d2280f2 100644 --- a/Code.gs +++ b/Code.gs @@ -68,8 +68,8 @@ const BGET = { VERSETEXT: 4 }, PREFERORIGIN: { //PREFER ORIGIN : most catholic editions of the Bible have texts based both on the Greek and on the Hebrew versions of the Bible - GREEK: 1, // resulting in duplicate verses, which can be both be quoted with the same reference (e.g. Esther 1,1-10) - HEBREW: 2 // Even though some Catholic editions place the Greek version in separate "books", for simplicity the BibleGet project places them as quotable verses following the CEI2008 layout. This preference allows the user to define which origin to prefer (if available) when making the quote + HEBREW: 1, // resulting in duplicate verses, which can be both be quoted with the same reference (e.g. Esther 1,1-10) + GREEK: 2 // Even though some Catholic editions place the Greek version in separate "books", for simplicity the BibleGet project places them as quotable verses following the CEI2008 layout. This preference allows the user to define which origin to prefer (if available) when making the quote }, TYPECASTING: { //just for quality assurance and good measure, let's explicitly define typecasting of our UserProperties, don't just rely on JSON.parse //this way we know that floats will be floats and ints will be ints and we don't have to worry about it every time in our code when we use the values @@ -583,9 +583,9 @@ function sendMail(txt) { //Function fetchData @ used in SidebarJS and in other scripts here in Code.gs (which are called from SidebarJS), to communicate with the BibleGet endpoints function fetchData(request){ - let {query,version} = request; + let {query,version,preferorigin} = request; let {rettype,appid} = REQUESTPARAMS; - let payload = {'query':query,'version':version,'return':rettype,'appid':appid,'pluginversion':VERSION}; + let payload = {'query':query,'version':version,'return':rettype,'appid':appid,'pluginversion':VERSION,'preferorigin':preferorigin}; try{ var response = UrlFetchApp.fetch(ENDPOINTURL,{'method':'post','payload':payload}); var responsecode = response.getResponseCode(); diff --git a/Settings.html b/Settings.html index cd970b5..82c06b9 100644 --- a/Settings.html +++ b/Settings.html @@ -860,8 +860,8 @@

//We can't save the userProps obj unless we have all the user Properties in this object, this is why we need the object, //and need it fully populated, not only available to populate one at a time var passUserPropertiesServer2Client = function(propsobj){ - userProps.populated = true; userProps = propsobj; + userProps.populated = true; for (let [key, value] of Object.entries(propsobj).sort() ) { if(typeof value === 'object'){ diff --git a/Sidebar.html b/Sidebar.html index fc86668..ead17ab 100644 --- a/Sidebar.html +++ b/Sidebar.html @@ -1,6 +1,8 @@