j1-template 2024.2.0 → 2024.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/assets/data/gemini-ui.html +2 -2
  3. data/assets/themes/j1/adapter/js/advertising.js +2 -10
  4. data/assets/themes/j1/adapter/js/analytics.js +1 -5
  5. data/assets/themes/j1/adapter/js/bmd.js +195 -195
  6. data/assets/themes/j1/adapter/js/carousel.js +786 -786
  7. data/assets/themes/j1/adapter/js/clipboard.js +1 -0
  8. data/assets/themes/j1/adapter/js/comments.js +1 -0
  9. data/assets/themes/j1/adapter/js/cookieConsent.js +460 -466
  10. data/assets/themes/j1/adapter/js/customModule.js +5 -4
  11. data/assets/themes/j1/adapter/js/docsearch.js +1 -0
  12. data/assets/themes/j1/adapter/js/dropdowns.js +1 -0
  13. data/assets/themes/j1/adapter/js/fab.js +1 -0
  14. data/assets/themes/j1/adapter/js/gallery.js +495 -494
  15. data/assets/themes/j1/adapter/js/gemini.js +154 -128
  16. data/assets/themes/j1/adapter/js/iconPicker.js +257 -255
  17. data/assets/themes/j1/adapter/js/iconPickerPage.js +279 -279
  18. data/assets/themes/j1/adapter/js/iframer.js +3 -2
  19. data/assets/themes/j1/adapter/js/j1.js +3285 -3285
  20. data/assets/themes/j1/adapter/js/lazyLoader.js +241 -241
  21. data/assets/themes/j1/adapter/js/lightbox.js +242 -241
  22. data/assets/themes/j1/adapter/js/logger.js +1 -0
  23. data/assets/themes/j1/adapter/js/lunr.js +6 -10
  24. data/assets/themes/j1/adapter/js/masonry.js +427 -426
  25. data/assets/themes/j1/adapter/js/masterslider.js +526 -526
  26. data/assets/themes/j1/adapter/js/mmenu.js +1 -0
  27. data/assets/themes/j1/adapter/js/navigator.js +2 -2
  28. data/assets/themes/j1/adapter/js/particles.js +1 -0
  29. data/assets/themes/j1/adapter/js/rangeSlider.js +1 -0
  30. data/assets/themes/j1/adapter/js/rouge.js +288 -287
  31. data/assets/themes/j1/adapter/js/rtable.js +309 -309
  32. data/assets/themes/j1/adapter/js/slick.js +487 -487
  33. data/assets/themes/j1/adapter/js/slimSelect.js +3 -5
  34. data/assets/themes/j1/adapter/js/themeToggler.js +281 -280
  35. data/assets/themes/j1/adapter/js/themes.js +0 -1
  36. data/assets/themes/j1/adapter/js/toccer.js +1 -0
  37. data/assets/themes/j1/adapter/js/translator.js +1 -0
  38. data/assets/themes/j1/adapter/js/waves.js +1 -0
  39. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +23 -17
  40. data/assets/themes/j1/modules/js-cookies/js/js.cookie.js +147 -0
  41. data/assets/themes/j1/modules/js-cookies/js/js.cookie.min.js +2 -0
  42. data/lib/j1/version.rb +1 -1
  43. data/lib/starter_web/README.md +5 -5
  44. data/lib/starter_web/_config.yml +1 -1
  45. data/lib/starter_web/_data/modules/defaults/themes.yml +171 -171
  46. data/lib/starter_web/_data/resources.yml +26 -0
  47. data/lib/starter_web/_data/templates/feed.xml +1 -1
  48. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  49. data/lib/starter_web/package.json +1 -1
  50. data/lib/starter_web/pages/public/learn/roundtrip/present_images.adoc +500 -500
  51. metadata +4 -2
@@ -113,9 +113,7 @@ j1.adapter.gemini = ((j1, window) => {
113
113
  var cookie_names;
114
114
  var cookie_written;
115
115
  var hostname;
116
- var auto_domain;
117
- var check_cookie_option_domain;
118
- var cookie_domain;
116
+ var domain;
119
117
  var secure;
120
118
 
121
119
  var gemini_model;
@@ -228,7 +226,12 @@ j1.adapter.gemini = ((j1, window) => {
228
226
  // create new reindexed data object
229
227
  newData = Object.values(slimData);
230
228
  // update the select
231
- $slimSelect.setData(newData);
229
+ // failsafe
230
+ if ($slimSelect !== undefined || $slimSelect !== null) {
231
+ $slimSelect.setData(newData);
232
+ } else {
233
+ logger.error('\n' + 'FATAL: slimSelect NOT available');
234
+ } // END create|set slimSelect data elements
232
235
  }
233
236
 
234
237
  // update prompt history data
@@ -258,34 +261,38 @@ j1.adapter.gemini = ((j1, window) => {
258
261
  // update the prompt history
259
262
  if (promptHistoryFromCookie) {
260
263
  logger.debug('\n' + 'save prompt history to cookie');
261
- j1.removeCookie({
262
- name: cookie_names.chat_prompt,
263
- domain: auto_domain,
264
- secure: secure
265
- });
266
264
 
267
265
  if (newHistory.length > 0) {
266
+
267
+ // remove BEFORE write
268
+ j1.removeCookie({ name: cookie_names.chat_prompt });
268
269
  cookie_written = j1.writeCookie({
269
- name: cookie_names.chat_prompt,
270
- data: newHistory,
271
- secure: secure
270
+ name: cookie_names.chat_prompt,
271
+ data: newHistory,
272
+ secure: secure
272
273
  });
274
+
275
+ $("#clear").show()
273
276
  } else {
274
- cookie_written = j1.writeCookie({
275
- name: cookie_names.chat_prompt,
276
- data: {},
277
- secure: secure
278
- });
277
+ j1.removeCookie({ name: cookie_names.chat_prompt });
278
+
279
279
  logger.info('\n' + 'spanElementEventListener, hide prompt history on last element');
280
280
  $("#prompt_history_container").hide();
281
+ $("#clear").hide()
281
282
  } // END if length
282
283
  } // END if promptHistoryFromCookie
283
284
  }
284
285
 
285
286
  logger.info('\n' + 'spanElementEventListener, option deleted:\n' + optionText);
286
287
 
287
- // close currently required to re-add history prompt events on next beforeOpen
288
- $slimSelect.close();
288
+ // failsafe
289
+ if ($slimSelect === undefined || $slimSelect === null) {
290
+ logger.error('\n' + 'FATAL: slimSelect NOT available');
291
+ } else {
292
+ // close currently required to re-add history prompt events on next beforeOpen
293
+ $slimSelect.close();
294
+ }
295
+
289
296
  } // END spanElementEventListener
290
297
 
291
298
  // Log the geolocation position
@@ -534,7 +541,6 @@ j1.adapter.gemini = ((j1, window) => {
534
541
  // module initializer
535
542
  // -------------------------------------------------------------------------
536
543
  init: (options) => {
537
-
538
544
  // -----------------------------------------------------------------------
539
545
  // default module settings
540
546
  // -----------------------------------------------------------------------
@@ -552,7 +558,7 @@ j1.adapter.gemini = ((j1, window) => {
552
558
  url = new liteURL(window.location.href);
553
559
  baseUrl = url.origin;
554
560
  hostname = url.hostname;
555
- auto_domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
561
+ domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
556
562
  secure = (url.protocol.includes('https')) ? true : false;
557
563
  promptHistoryEnabled = geminiOptions.prompt_history_enabled;
558
564
  promptHistoryFromCookie = geminiOptions.prompt_history_from_cookie;
@@ -570,15 +576,13 @@ j1.adapter.gemini = ((j1, window) => {
570
576
  // module initializer
571
577
  // -----------------------------------------------------------------------
572
578
  var dependencies_met_page_ready = setInterval (() => {
573
- var pageState = $('#content').css("display");
574
- var pageVisible = (pageState === 'block') ? true : false;
575
- var j1CoreFinished = (j1.getState() === 'finished') ? true : false;
576
- // var slimSelectFinished = (j1.adapter.slimSelect.getState() === 'finished') ? true : false;
577
- var slimSelectFinished = (Object.keys(j1.adapter.slimSelect.select).length) ? true : false;
578
- var uiLoaded = (j1.xhrDOMState['#gemini_ui'] === 'success') ? true : false;
579
-
580
- // check page ready state
581
- if (j1CoreFinished && pageVisible && slimSelectFinished && uiLoaded && modulesLoaded) {
579
+ var flickerState = $('#no_flicker').css("display");
580
+ var pageState = $('#content').css("display");
581
+ var pageVisible = (flickerState === 'block' && pageState === 'block') ? true : false;
582
+ var selectReady = (document.getElementById(geminiOptions.prompt_history_id)) ? true : false;
583
+ var uiLoaded = (j1.xhrDOMState['#gemini_ui'] === 'success') ? true : false;
584
+
585
+ if (pageVisible && selectReady && uiLoaded && modulesLoaded) {
582
586
  startTimeModule = Date.now();
583
587
 
584
588
  _this.setState('started');
@@ -601,86 +605,91 @@ j1.adapter.gemini = ((j1, window) => {
601
605
 
602
606
  // get|clear textarea element (prompt)
603
607
  textarea = document.getElementById(geminiOptions.prompt_id);
604
- textarea.value = '';
608
+ textarea.value = '';
609
+
610
+ logger.debug('\n' + 'initializing select data');
611
+
612
+ // initialize history array from cookie
613
+ if (promptHistoryEnabled && promptHistoryFromCookie) {
605
614
 
606
- var dependencies_met_select_ready = setInterval(() => {
607
- var selectState = $('#container_prompt_history_select_wrapper').length;
608
- var selectReady = (selectState > 0) ? true : false;
615
+ // get slimSelect object
616
+ selectList = document.getElementById(geminiOptions.prompt_history_id);
617
+ $slimSelect = selectList.slim;
609
618
 
610
- if (selectReady) {
611
- logger.debug('\n' + 'initializing select data');
619
+ // failsafe
620
+ if ($slimSelect === undefined || $slimSelect === null) {
621
+ logger.error('\n' + 'FATAL: slimSelect NOT available');
622
+ }
623
+ // END get slimSelect object
612
624
 
613
- // initialize history array from cookie
614
- if (promptHistoryEnabled && promptHistoryFromCookie) {
615
- // get slimSelect object for the history (placed by slimSelect adapter)
616
- // selectList = document.getElementById('prompt_history');
617
- $slimSelect = j1.adapter.slimSelect.select[geminiOptions.prompt_history_id];
625
+ // limit the prompt history
626
+ promptHistoryMax = geminiOptions.prompt_history_max;
618
627
 
619
- // limit the prompt history
620
- promptHistoryMax = geminiOptions.prompt_history_max;
628
+ // allow|reject history updates if promptHistoryMax reached
629
+ allowPromptHistoryUpdatesOnMax = geminiOptions.allow_prompt_history_updates_on_max;
621
630
 
622
- // allow|reject history updates if promptHistoryMax reached
623
- allowPromptHistoryUpdatesOnMax = geminiOptions.allow_prompt_history_updates_on_max;
631
+ logger.debug('\n' + 'read prompt history from cookie');
632
+ var data = [];
633
+ var option = {};
634
+ chat_prompt = j1.existsCookie(cookie_names.chat_prompt)
635
+ ? j1.readCookie(cookie_names.chat_prompt)
636
+ : {};
624
637
 
625
- logger.debug('\n' + 'read prompt history from cookie');
626
- var data = [];
627
- var option = {};
628
- chat_prompt = j1.existsCookie(cookie_names.chat_prompt)
629
- ? j1.readCookie(cookie_names.chat_prompt)
630
- : {};
638
+ // convert chat prompt object to array
639
+ textHistory = Object.values(chat_prompt);
631
640
 
632
- // convert chat prompt object to array
633
- textHistory = Object.values(chat_prompt);
641
+ // remove duplicates from history
642
+ if (textHistory.length > 1) {
643
+ var textHistoryLenght = textHistory.length;
644
+ var uniqueArray = [...new Set(textHistory)]; // create a 'Set' from the history array to automatically remove duplicates
634
645
 
635
- // remove duplicates from history
636
- if (textHistory.length > 1) {
637
- var textHistoryLenght = textHistory.length;
638
- var uniqueArray = [...new Set(textHistory)]; // create a 'Set' from the history array to automatically remove duplicates
646
+ textHistory = uniqueArray;
647
+ if (textHistoryLenght > textHistory.length) {
648
+ logger.debug('\n' + 'removed duplicates from history array: ' + (textHistoryLenght - textHistory.length) + ' element|s');
649
+ }
650
+ } // END if !allowHistoryDupicates
651
+
652
+ // update|set slimSelect data elements
653
+ var index = 1;
654
+ var data = [];
655
+ var option = {};
656
+ var html;
657
+ textHistory.forEach((historyText) => {
658
+ html = '<span id="opt_' + geminiOptions.prompt_history_id + '_' + index + '" class="ss-option-delete">' + '<i class="mdib mdib-close mdib-16px ml-1 mr-2"></i></span>' + historyText;
659
+ option = {
660
+ text: historyText,
661
+ html: html,
662
+ display: true,
663
+ selected: false,
664
+ disabled: false
665
+ }
666
+ data.push(option);
667
+ index++
668
+ }); // END forEach
639
669
 
640
- textHistory = uniqueArray;
641
- if (textHistoryLenght > textHistory.length) {
642
- logger.debug('\n' + 'removed duplicates from history array: ' + (textHistoryLenght - textHistory.length) + ' element|s');
643
- }
644
- } // END if !allowHistoryDupicates
645
-
646
- // update|set slimSelect data elements
647
- var index = 1;
648
- var data = [];
649
- var option = {};
650
- var html;
651
- textHistory.forEach((historyText) => {
652
- html = '<span id="opt_' + geminiOptions.prompt_history_id + '_' + index + '" class="ss-option-delete">' + '<i class="mdib mdib-close mdib-16px ml-1 mr-2"></i></span>' + historyText;
653
- option = {
654
- text: historyText,
655
- html: html,
656
- display: true,
657
- selected: false,
658
- disabled: false
659
- }
660
- data.push(option);
661
- index++
662
- }); // END forEach
663
- $slimSelect.setData(data);
664
-
665
- // display history container
666
- if (textHistory.length > 0) {
667
- $("#prompt_history_container").show();
668
- }
670
+ // failsafe
671
+ if ($slimSelect !== undefined || $slimSelect !== null) {
672
+ $slimSelect.setData(data);
673
+ } else {
674
+ logger.error('\n' + 'FATAL: slimSelect NOT available');
675
+ } // END create|set slimSelect data elements
669
676
 
670
- // -------------------------------------------------------------
671
- // setup Slim select eventHandlers
672
- // -------------------------------------------------------------
673
- //
674
- _this.setupSlimSelectEventHandlers();
677
+ // display history container
678
+ if (textHistory.length > 0) {
679
+ $("#prompt_history_container").show();
680
+ $("#clear").show();
681
+ }
675
682
 
676
- } else {
677
- // disable|hide clear history button
678
- $("#clear").hide();
679
- } // if promptHistoryEnabled
683
+ // -------------------------------------------------------------
684
+ // setup Slim select eventHandlers
685
+ // -------------------------------------------------------------
686
+ //
687
+ _this.setupSlimSelectEventHandlers();
680
688
 
681
- clearInterval(dependencies_met_select_ready);
682
- } // END if modules loaded
683
- }, 10); // END dependencies_met_select_ready
689
+ } else {
690
+ // disable|hide clear history button
691
+ $("#clear").hide();
692
+ } // if promptHistoryEnabled
684
693
 
685
694
  // -------------------------------------------------------------------
686
695
  // setup UI button eventHandlers
@@ -784,11 +793,13 @@ j1.adapter.gemini = ((j1, window) => {
784
793
  );
785
794
 
786
795
  var dependencies_met_data_loaded = setInterval(() => {
787
- if (j1.xhrDOMState['#gemini_ui'] === 'success') {
796
+ var uiLoaded = (j1.xhrDOMState['#gemini_ui'] === 'success') ? true : false;
797
+
798
+ if (uiLoaded) {
788
799
  logger.debug('\n' + 'Loading UI: successful');
789
800
 
790
801
  clearInterval(dependencies_met_data_loaded);
791
- } // END if xhrDOMState
802
+ } // END if uiLoaded
792
803
  }, 10);
793
804
 
794
805
  }, // END loadUI
@@ -838,7 +849,13 @@ j1.adapter.gemini = ((j1, window) => {
838
849
  data.push(option);
839
850
  index++;
840
851
  }); // END forEach
841
- $slimSelect.setData(data);
852
+
853
+ // failsafe
854
+ if ($slimSelect !== undefined || $slimSelect !== null) {
855
+ $slimSelect.setData(data);
856
+ } else {
857
+ logger.error('\n' + 'FATAL: slimSelect NOT available');
858
+ } // END create|set slimSelect data elements
842
859
 
843
860
  } // END re-read current history from cookie
844
861
 
@@ -851,10 +868,12 @@ j1.adapter.gemini = ((j1, window) => {
851
868
  // wait until prompt history eventListener|s is|are placed
852
869
  var listenerIndex = 1;
853
870
  slimValues.forEach( () => {
854
- var span = 'opt_prompt_history_' + listenerIndex;
855
- var spanElement = document.getElementById(span);
871
+ var span = 'opt_prompt_history_' + listenerIndex;
872
+ var spanElement = document.getElementById(span);
873
+
856
874
  var dependencies_met_listeners_ready = setInterval (() => {
857
- var spanElementReady = (($(spanElement).length) !== 0) ? true : false;
875
+ var spanElementReady = ($(spanElement).length) ? true : false;
876
+
858
877
  if (spanElementReady) {
859
878
  if (listenerIndex === slimValues.length) {
860
879
  eventListenersReady = true;
@@ -892,8 +911,19 @@ j1.adapter.gemini = ((j1, window) => {
892
911
  document.getElementById('prompt').value = '';
893
912
  }
894
913
 
895
- // remove selection from select
896
- $slimSelect.setSelected('', false);
914
+ // failsafe
915
+ if ($slimSelect === undefined || $slimSelect === null) {
916
+ logger.error('\n' + 'FATAL: slimSelect NOT available');
917
+ } else {
918
+ // failsafe
919
+ if ($slimSelect === undefined || $slimSelect === null) {
920
+ logger.error('\n' + 'FATAL: slimSelect NOT available');
921
+ } else {
922
+ // remove selection from select
923
+ $slimSelect.setSelected('', false);
924
+ }
925
+ }
926
+
897
927
  } // END event afterClose
898
928
 
899
929
  }, // END setupSlimSelectEventHandlers()
@@ -1018,26 +1048,31 @@ j1.adapter.gemini = ((j1, window) => {
1018
1048
  data.push(option);
1019
1049
  index++;
1020
1050
  }); // END forEach
1021
- $slimSelect.setData(data);
1022
1051
  // END create|set slimSelect data elements
1023
1052
 
1053
+ // failsafe
1054
+ if ($slimSelect !== undefined || $slimSelect !== null) {
1055
+ $slimSelect.setData(data);
1056
+ } else {
1057
+ logger.error('\n' + 'FATAL: slimSelect NOT available');
1058
+ } // END create|set slimSelect data elements
1059
+
1024
1060
  // display history container
1025
1061
  if (textHistory.length > 0) {
1026
1062
  $("#prompt_history_container").show();
1063
+ $("#clear").show();
1027
1064
  }
1028
1065
 
1029
1066
  // write current history to cookie
1030
1067
  if (promptHistoryFromCookie) {
1031
1068
  logger.debug('\n' + 'sendButton, save prompt history to cookie');
1032
- j1.removeCookie({
1033
- name: cookie_names.chat_prompt,
1034
- domain: auto_domain,
1035
- secure: secure
1036
- });
1069
+
1070
+ // remove BEFORE write
1071
+ j1.removeCookie({ name: cookie_names.chat_prompt });
1037
1072
  cookie_written = j1.writeCookie({
1038
- name: cookie_names.chat_prompt,
1039
- data: textHistory,
1040
- secure: secure
1073
+ name: cookie_names.chat_prompt,
1074
+ data: textHistory,
1075
+ secure: secure
1041
1076
  });
1042
1077
  } // END write current history to cookie
1043
1078
  } // END if promptHistoryEnabled
@@ -1092,21 +1127,12 @@ j1.adapter.gemini = ((j1, window) => {
1092
1127
  logStartOnce = true;
1093
1128
  }
1094
1129
 
1095
- // write empty history to cookie
1130
+ // clear history
1096
1131
  textHistory = [];
1097
- if (promptHistoryFromCookie) {
1098
- j1.removeCookie({
1099
- name: cookie_names.chat_prompt,
1100
- domain: auto_domain,
1101
- secure: secure
1102
- });
1103
- cookie_written = j1.writeCookie({
1104
- name: cookie_names.chat_prompt,
1105
- data: {},
1106
- secure: secure
1107
- });
1108
- }
1132
+ j1.removeCookie({ name: cookie_names.chat_prompt });
1133
+
1109
1134
  $("#prompt_history_container").hide();
1135
+ $("#clear").hide();
1110
1136
  }); // END click accecptClearHistory
1111
1137
 
1112
1138
  // skip clear history