`;
this.insertIntoDOM(modalHtml);
- this.modalElement = new Foundation.Reveal(document.getElementById(this.getModalId()));
+ this.modalElement = new Foundation.Reveal(document.getElementById(this.id));
}
initializeTrigger() {
- this.getElement().setAttribute('data-open', this.getModalId());
+ this.element.setAttribute('data-open', this.id);
}
}
@@ -884,29 +949,29 @@
}
show() {
- document.getElementById(this.getModalId()).classList.remove('hidden');
+ document.getElementById(this.id).classList.remove('hidden');
}
hide() {
- document.getElementById(this.getModalId()).classList.add('hidden');
+ document.getElementById(this.id).classList.add('hidden');
}
create(content) {
const modalHtml = `
-
+
-
+
${content}
-
Close
+
Close
`;
this.insertIntoDOM(modalHtml);
}
initializeTrigger() {
- this.getElement().addEventListener('click', () => {
- document.getElementById(this.getModalId()).classList.remove('hidden');
+ this.element.addEventListener('click', () => {
+ document.getElementById(this.id).classList.remove('hidden');
});
}
}
@@ -979,7 +1044,7 @@
constructor(action) {
this.#action = action;
// Clear initial content
- this.getElement().innerHTML = '';
+ this.element.innerHTML = '';
}
/**
@@ -988,8 +1053,8 @@
* @param {string} content - The content to load into the trigger element.
*/
load(content) {
- const existingContent = this.getElement().innerHTML;
- this.getElement().innerHTML = existingContent ? `${existingContent}\n ${content}` : content;
+ const existingContent = this.element.innerHTML;
+ this.element.innerHTML = existingContent ? `${existingContent}\n ${content}` : content;
}
/**
@@ -997,8 +1062,8 @@
*
* @returns {HTMLElement} - The DOM element being worked with.
*/
- getElement() {
- return this.#action.getElement();
+ get element() {
+ return this.#action.element;
}
}
@@ -1012,7 +1077,7 @@
*/
constructor(action) {
this.#action = action;
- this.getElement().style.cursor = 'help';
+ this.element.style.cursor = 'help';
}
/**
@@ -1023,9 +1088,9 @@
* @throws {Error} Throws an error if the trigger elements is not valid.
*/
load(content) {
- const existingTitle = this.getElement().getAttribute('title');
+ const existingTitle = this.element.getAttribute('title');
const newTitle = existingTitle ? existingTitle + "\n" + content : content;
- this.getElement().setAttribute('title', newTitle);
+ this.element.setAttribute('title', newTitle);
}
/**
@@ -1033,8 +1098,8 @@
*
* @returns {HTMLElement} - The DOM element being worked with.
*/
- getElement() {
- return this.#action.getElement();
+ get element() {
+ return this.#action.element;
}
}
@@ -1057,14 +1122,14 @@
}
class UikitTooltip extends BaseTooltip {
- constructor(triggerElement) {
- super(triggerElement);
+ constructor(action) {
+ super(action);
}
load(content) {
try {
super.load(content);
- UIkit.tooltip(this.triggerElement);
+ UIkit.tooltip(this.element);
} catch (error) {
console.error('Error loading UikitTooltip:', error);
}
@@ -1078,9 +1143,9 @@
load(content) {
try {
- this.getElement().setAttribute('data-tooltip', '');
+ this.element.setAttribute('data-tooltip', '');
super.load(content);
- this.getElement().classList.add('has-tip');
+ this.element.classList.add('has-tip');
new Foundation.Tooltip(this.getElement(), {
// Default options
@@ -1089,7 +1154,7 @@
fadeInDuration: 150, // Duration of fade in animation in milliseconds
showOn: 'all', // Can be 'all', 'large', 'medium', 'small'
templateClasses: '', // Custom class(es) to be added to the tooltip template
- tipText: () => this.getElement().getAttribute('title'), // Function to define tooltip text
+ tipText: () => this.element.getAttribute('title'), // Function to define tooltip text
triggerClass: 'has-tip', // Class to be added on the trigger elements
touchCloseText: 'tap to close', // Text for close button on touch devices
positionClass: 'top', // Position of tooltip, can be 'top', 'bottom', 'left', 'right', etc.
@@ -1123,25 +1188,25 @@
this.tooltipElement.id = this.tooltipId;
this.tooltipElement.className = 'absolute invisible bg-gray-800 text-white text-xs px-2 py-1 rounded-md';
this.tooltipElement.style.transition = 'visibility 0.3s linear, opacity 0.3s linear';
- this.tooltipElement.textContent = this.getElement().getAttribute('title');
+ this.tooltipElement.textContent = this.element.getAttribute('title');
document.body.appendChild(this.tooltipElement);
}
_initializeEvents() {
- this.getElement().addEventListener('mouseenter', () => {
- const rect = this.getElement().getBoundingClientRect();
- this._title = this.getElement().getAttribute('title');
+ this.element.addEventListener('mouseenter', () => {
+ const rect = this.element.getBoundingClientRect();
+ this._title = this.element.getAttribute('title');
this.tooltipElement.style.left = `${rect.left + window.scrollX}px`;
this.tooltipElement.style.top = `${rect.bottom + 5 + window.scrollY}px`;
this.tooltipElement.classList.remove('invisible');
this.tooltipElement.classList.add('opacity-100');
- this.getElement().setAttribute('title', '');
+ this.element.setAttribute('title', '');
});
- this.getElement().addEventListener('mouseleave', () => {
+ this.element.addEventListener('mouseleave', () => {
this.tooltipElement.classList.add('invisible');
this.tooltipElement.classList.remove('opacity-100');
- this.getElement().setAttribute('title', this._title);
+ this.element.setAttribute('title', this._title);
});
}
}
@@ -1175,7 +1240,6 @@
*
* @param {Action} action - The action element triggering the tooltip.
* @returns {BaseTooltip|BootstrapTooltip|UikitTooltip|FoundationTooltip|TailwindTooltip} The tooltip instance.
- * @param debug
*/
static framework(action) {
const frameworks = {
@@ -1218,7 +1282,7 @@
'tooltip': TooltipElement
};
- const format = action.getFormat();
+ const format = action.format;
const ElementType = elementTypes[format] || InlineElement;
this.element = new ElementType(action);
@@ -1252,7 +1316,7 @@
* Allows for dependency injection of the Api class for easier testing and flexibility.
* @param {Api} api - Instance of Api class for making API calls.
*/
- constructor(api = new Api()) {
+ constructor(api) {
this.#api = api;
}
@@ -1307,7 +1371,7 @@
*/
async #processReferences(validReferences) {
for (const reference of validReferences) {
- for (const translation of this.#action.getTranslations()) {
+ for (const translation of this.#action.translations) {
try {
const scripture = await this.#api.get(reference, translation);
if (scripture) {
diff --git a/dist/js/getBible.min.js b/dist/js/getBible.min.js
index b1ca596..89de9f8 100644
--- a/dist/js/getBible.min.js
+++ b/dist/js/getBible.min.js
@@ -1,2 +1,2 @@
-/*! getBible Loader v3.0.2 | https://getbible.net | (c) 2014 - 2023 Llewellyn van der Merwe | MIT License */
-!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";function t(){t=function(){return n};var e,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(e){u=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),c=new S(r||[]);return i(a,"_invoke",{value:O(t,n,c)}),a}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var d="suspendedStart",v="suspendedYield",p="executing",g="completed",y={};function b(){}function m(){}function w(){}var k={};u(k,c,(function(){return this}));var E=Object.getPrototypeOf,I=E&&E(E(A([])));I&&I!==r&&o.call(I,c)&&(k=I);var x=w.prototype=b.prototype=Object.create(k);function L(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function M(t,e){function n(r,i,a,c){var l=f(t[r],t,i);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==typeof u&&o.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(u).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(l.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function O(t,n,r){var o=d;return function(i,a){if(o===p)throw new Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var l=T(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var s=f(t,n,r);if("normal"===s.type){if(o=r.done?g:v,s.arg===y)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=g,r.method="throw",r.arg=s.arg)}}}function T(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=f(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r
=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(l&&s){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;_(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},n}function e(t,e,n,r,o,i,a){try{var c=t[i](a),l=c.value}catch(t){return void n(t)}c.done?e(l):Promise.resolve(l).then(r,o)}function n(t){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);function c(t){e(a,o,i,c,l,"next",t)}function l(t){e(a,o,i,c,l,"throw",t)}c(void 0)}))}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}function g(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function y(t,e){return function(t,e){if(e.get)return e.get.call(t);return e.value}(t,m(t,e,"get"))}function b(t,e,n){return function(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}(t,m(t,e,"set"),n),n}function m(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function w(t,e,n){return function(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}(t,e),n}function k(t,e,n){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return n}function E(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function I(t,e,n){E(t,e),e.set(t,n)}function x(t,e){E(t,e),e.add(t)}var L,M,O,T,j=function(){function e(){r(this,e)}var o;return i(e,null,[{key:"set",value:function(t,n,r){var o=w(this,e,S).call(this,t,n),i={data:r,timestamp:Date.now()};try{localStorage.setItem(o,JSON.stringify(i))}catch(t){throw console.error("Error storing data in local storage:",t),t}}},{key:"get",value:(o=n(t().mark((function n(r,o){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",w(this,e,_).call(this,r,o));case 1:case"end":return t.stop()}}),n,this)}))),function(t,e){return o.apply(this,arguments)})}]),e}();function _(t,e){var n=w(this,L,S).call(this,t,e);try{var r=localStorage.getItem(n);if(r){var o=JSON.parse(r),i=o.data;if(o.timestamp>Date.now()-L.ONE_MONTH_IN_MILLISECONDS)return i}return null}catch(t){throw console.error("Error parsing or retrieving data from local storage:",t),t}}function S(t,e){return"getBible-".concat(e,"-").concat(t)}L=j,M=j,T=2592e6,(O=g(O="ONE_MONTH_IN_MILLISECONDS"))in M?Object.defineProperty(M,O,{value:T,enumerable:!0,configurable:!0,writable:!0}):M[O]=T;var A=new WeakSet,N=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://query.getbible.net/v2/";r(this,e),x(this,A),this.apiEndpoint=t}return i(e,[{key:"get",value:function(){var e=n(t().mark((function e(n,r){var o,i,a;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,j.get(n,r);case 3:if(null===(o=t.sent)){t.next=6;break}return t.abrupt("return",o);case 6:return t.next=8,fetch(k(this,A,B).call(this,n,r));case 8:if((i=t.sent).ok){t.next=11;break}throw new Error("".concat(i.status," - ").concat(i.statusText||"Failed to fetch scripture"));case 11:return t.next=13,i.json();case 13:return a=t.sent,t.next=16,j.set(n,r,a);case 16:return t.abrupt("return",a);case 19:throw t.prev=19,t.t0=t.catch(0),console.error("Error fetching data:",t.t0),new Error(t.t0.message||"Error fetching scripture");case 23:case"end":return t.stop()}}),e,this,[[0,19]])})));return function(t,n){return e.apply(this,arguments)}}()}]),e}();function B(t,e){return"".concat(this.apiEndpoint).concat(encodeURIComponent(e),"/").concat(encodeURIComponent(t))}var R=new WeakMap,C=function(){function t(e){r(this,t),I(this,R,{writable:!0,value:void 0}),b(this,R,e)}return i(t,[{key:"getTranslation",value:function(){return y(this,R).translation}},{key:"getAbbreviation",value:function(){return y(this,R).abbreviation}},{key:"getLanguage",value:function(){return y(this,R).lang}},{key:"getLanguageName",value:function(){return y(this,R).language}},{key:"getTextDirection",value:function(){return y(this,R).direction}},{key:"getEncoding",value:function(){return y(this,R).encoding}},{key:"getBookNumber",value:function(){return y(this,R).book_nr}},{key:"getBookName",value:function(){return y(this,R).book_name}},{key:"getChapter",value:function(){return y(this,R).chapter}},{key:"getChapterName",value:function(){return y(this,R).name}},{key:"getVerses",value:function(){return y(this,R).verses}},{key:"getVerse",value:function(t){return y(this,R).verses.find((function(e){return e.verse===t}))}},{key:"getVersesInRange",value:function(t,e){return y(this,R).verses.filter((function(n){return n.verse>=t&&n.verse<=e}))}},{key:"getReference",value:function(){var t=y(this,R).verses.map((function(t){return t.verse})).sort((function(t,e){return t-e})),e="".concat(y(this,R).name,":"),n={},r=null,o=null,i=null;return t.forEach((function(t){null===r?r=t:t===i+1?o=t:(n[r]=null!==o?"".concat(r,"-").concat(o):"".concat(r),r=t,o=null),i=t})),null!==r&&(n[r]=null!==o?"".concat(r,"-").concat(o):"".concat(r)),e+Object.values(n).join(",")}}]),t}(),P=new WeakMap,W=function(){function t(e){r(this,t),I(this,P,{writable:!0,value:void 0}),b(this,P,Object.values(e).map((function(t){return new C(t)})))}return i(t,[{key:"getReference",value:function(t){return t>=0&&t')),e.action().showBookName()&&r.push(''.concat(t.getBookName()," ")),e.action().showReference()&&r.push(''.concat(t.getReference()," ")),e.action().showTranslation()&&r.push(''.concat(t.getTranslation()," ")),e.action().showAbbreviation()&&r.push(''.concat(t.getAbbreviation()," ")),e.action().showLanguage()&&r.push(''.concat(t.getLanguage()," ")),r.length>0&&n.push('"));var o=t.getVerses().map((function(t){return''.concat(t.verse,". ").concat(t.text,"
")})).join("\n");n.push(''.concat(o,"
")),n.push(" ")})),'
'.concat(n.join("\n"),"
")}}]),n}(X),K=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"get",value:function(t){var e=this,n=[];return t.forEachReference((function(t){var r=[];n.push('
')),e.action().showBookName()&&r.push(''.concat(t.getBookName()," ")),e.action().showReference()&&r.push(''.concat(t.getReference()," ")),e.action().showTranslation()&&r.push(''.concat(t.getTranslation()," ")),e.action().showAbbreviation()&&r.push(''.concat(t.getAbbreviation()," ")),e.action().showLanguage()&&r.push(''.concat(t.getLanguage()," "));var o=t.getVerses().map((function(t){return''.concat(t.verse,". ").concat(t.text," ")})).join("\n");n.push(''.concat(o," ")),r.length>0&&n.push('")),n.push("
")})),'
'.concat(n.join("\n"),"
")}}]),n}(X),Q=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"get",value:function(t){var e=this,n=[];return t.forEachReference((function(t){var r=[];e.action().showBookName()&&r.push("".concat(t.getBookName())),e.action().showReference()&&r.push("".concat(t.getReference())),e.action().showTranslation()&&r.push("".concat(t.getTranslation())),e.action().showAbbreviation()&&r.push("".concat(t.getAbbreviation())),e.action().showLanguage()&&r.push("".concat(t.getLanguage())),r.length>0&&n.push("[".concat(r.join(" - "),"]")),n.push(t.getVerses().map((function(t){return"".concat(t.verse,". ").concat(t.text)})).join("\n"))})),"".concat(n.join("\n"),"\n")}}]),n}(X),Z=function(){function t(e){r(this,t);var n={modal:$,inline:K,tooltip:Q}[e.getFormat()]||K;this.format=new n(e)}return i(t,[{key:"get",value:function(t){return this.format.get(t)}}]),t}(),tt=new WeakMap,et=new WeakMap,nt=function(){function t(e){r(this,t),I(this,tt,{writable:!0,value:void 0}),I(this,et,{writable:!0,value:void 0}),b(this,tt,"modal-".concat(Math.random().toString(36).slice(2,11))),b(this,et,e),this.getElement().style.cursor="pointer",this.initializeTrigger()}return i(t,[{key:"load",value:function(t){if(document.getElementById(this.getModalId())){var e=document.getElementById("".concat(this.getModalId(),"-content"));e&&(e.innerHTML+=t)}else this.create(t)}},{key:"insertIntoDOM",value:function(t){document.body.insertAdjacentHTML("beforeend",t)}},{key:"create",value:function(t){var e='\n
\n
\n
✖ \n
\n ').concat(t,"\n
\n
\n
");this.insertIntoDOM(e);var n=document.getElementById(this.getModalId());n.addEventListener("click",(function(t){t.target===n&&(n.style.display="none")}))}},{key:"initializeTrigger",value:function(){var t=this;this.getElement().addEventListener("click",(function(){document.getElementById(t.getModalId()).style.display="flex"}))}},{key:"getModalId",value:function(){return y(this,tt)}},{key:"getElement",value:function(){return y(this,et).getElement()}}]),t}(),rt=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"show",value:function(){UIkit.modal("#".concat(this.getModalId())).show()}},{key:"hide",value:function(){UIkit.modal("#".concat(this.getModalId())).hide()}},{key:"create",value:function(t){var e='\n
\n
\n
\n
\n ').concat(t,"\n
\n
\n
");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){this.getElement().setAttribute("uk-toggle","target: #".concat(this.getModalId()))}}]),n}(nt),ot=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"show",value:function(){new bootstrap.Modal(document.getElementById(this.getModalId())).show()}},{key:"hide",value:function(){var t=bootstrap.Modal.getInstance(document.getElementById(this.getModalId()));t&&t.hide()}},{key:"create",value:function(t){var e='\n
\n
\n
\n \n
\n ').concat(t,"\n
\n
\n
\n
");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){this.getElement().setAttribute("data-bs-toggle","modal"),this.getElement().setAttribute("data-bs-target","#".concat(this.getModalId()))}}]),n}(nt),it=function(t){a(n,t);var e=u(n);function n(t){var o;return r(this,n),(o=e.call(this,t)).modalElement=null,o}return i(n,[{key:"show",value:function(){this.modalElement&&this.modalElement.open()}},{key:"hide",value:function(){this.modalElement&&this.modalElement.close()}},{key:"create",value:function(t){var e='\n
\n
\n ').concat(t,'\n
\n
\n × \n \n
');this.insertIntoDOM(e),this.modalElement=new Foundation.Reveal(document.getElementById(this.getModalId()))}},{key:"initializeTrigger",value:function(){this.getElement().setAttribute("data-open",this.getModalId())}}]),n}(nt),at=function(t){a(n,t);var e=u(n);function n(t){return r(this,n),e.call(this,t)}return i(n,[{key:"show",value:function(){document.getElementById(this.getModalId()).classList.remove("hidden")}},{key:"hide",value:function(){document.getElementById(this.getModalId()).classList.add("hidden")}},{key:"create",value:function(t){var e='\n
\n
\n
\n ').concat(t,'\n
\n
Close \n
\n
");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){var t=this;this.getElement().addEventListener("click",(function(){document.getElementById(t.getModalId()).classList.remove("hidden")}))}}]),n}(nt),ct=function(){function t(e){r(this,t),this.modal=t.framework(e)}return i(t,[{key:"load",value:function(t){this.modal.load(t)}}],[{key:"framework",value:function(t){for(var e={UIkit:rt,bootstrap:ot,Foundation:it,tailwind:at},n=0,r=Object.entries(e);n
0&&void 0!==arguments[0]?arguments[0]:new N;r(this,e),x(this,Lt),x(this,xt),x(this,It),x(this,Et),I(this,bt,{writable:!0,value:void 0}),I(this,mt,{writable:!0,value:void 0}),I(this,wt,{writable:!0,value:void 0}),I(this,kt,{writable:!0,value:void 0}),b(this,bt,t)}var o;return i(e,[{key:"load",value:(o=n(t().mark((function e(n){var r,o;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==(r=n.innerHTML.split(";").map((function(t){return t.trim()}))).length){t.next=4;break}return console.error("No references found in the getBible tagged class."),t.abrupt("return");case 4:if(0!==(o=k(this,Et,Ot).call(this,r)).length){t.next=8;break}return console.error("No valid references found in the getBible tagged class."),t.abrupt("return");case 8:return k(this,xt,_t).call(this,n),t.next=11,k(this,It,Tt).call(this,o);case 11:case"end":return t.stop()}}),e,this)}))),function(t){return o.apply(this,arguments)})}]),e}();function Ot(t){return t.filter((function(t){return!!(t.length<=30&&/\d/.test(t))||(console.error("Invalid getBible reference: ".concat(t)),!1)}))}function Tt(t){return jt.apply(this,arguments)}function jt(){return(jt=n(t().mark((function e(n){var r,o,i,a,c,l,s;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=p(n),t.prev=1,r.s();case 3:if((o=r.n()).done){t.next=32;break}i=o.value,a=p(y(this,mt).getTranslations()),t.prev=6,a.s();case 8:if((c=a.n()).done){t.next=22;break}return l=c.value,t.prev=10,t.next=13,y(this,bt).get(i,l);case 13:(s=t.sent)&&k(this,Lt,St).call(this,s),t.next=20;break;case 17:t.prev=17,t.t0=t.catch(10),console.error("Error loading reference ".concat(i,":"),t.t0);case 20:t.next=8;break;case 22:t.next=27;break;case 24:t.prev=24,t.t1=t.catch(6),a.e(t.t1);case 27:return t.prev=27,a.f(),t.finish(27);case 30:t.next=3;break;case 32:t.next=37;break;case 34:t.prev=34,t.t2=t.catch(1),r.e(t.t2);case 37:return t.prev=37,r.f(),t.finish(37);case 40:case"end":return t.stop()}}),e,this,[[1,34,37,40],[6,24,27,30],[10,17]])})))).apply(this,arguments)}function _t(t){b(this,mt,new Y(t)),b(this,wt,new yt(y(this,mt))),b(this,kt,new Z(y(this,mt)))}function St(t){y(this,wt).load(y(this,kt).get(new W(t)))}document.addEventListener("DOMContentLoaded",(function(t){try{!function(t){document.querySelectorAll(".getBible").forEach((function(e){new Mt(t).load(e).catch((function(t){console.error("Loading error for element ".concat(e,":"),t)}))}))}(new N)}catch(t){console.error("Error initializing GetBible loaders:",t)}}))}));
+/*! getBible Loader v3.0.3 | https://getbible.net | (c) 2014 - 2023 Llewellyn van der Merwe | MIT License */
+!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";function t(){t=function(){return n};var e,n={},r=Object.prototype,i=r.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(e){u=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),c=new _(r||[]);return o(a,"_invoke",{value:I(t,n,c)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=f;var d="suspendedStart",p="suspendedYield",v="executing",g="completed",y={};function b(){}function m(){}function w(){}var k={};u(k,c,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(N([])));x&&x!==r&&i.call(x,c)&&(k=x);var L=w.prototype=b.prototype=Object.create(k);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function n(r,o,a,c){var s=h(t[r],t,o);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==typeof u&&i.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(u).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(s.arg)}var r;o(this,"_invoke",{value:function(t,i){function o(){return new e((function(e,r){n(t,i,e,r)}))}return r=r?r.then(o,o):o()}})}function I(t,n,r){var i=d;return function(o,a){if(i===v)throw new Error("Generator is already running");if(i===g){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var c=r.delegate;if(c){var s=T(c,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=v;var l=h(t,n,r);if("normal"===l.type){if(i=r.done?g:p,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=g,r.method="throw",r.arg=l.arg)}}}function T(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=h(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function M(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function N(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(s&&l){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:N(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},n}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,e,n,r,i,o,a){try{var c=t[o](a),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(r,i)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var a=t.apply(e,r);function c(t){n(a,i,o,c,s,"next",t)}function s(t){n(a,i,o,c,s,"throw",t)}c(void 0)}))}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){c=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw o}}}}function y(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function b(t,e){return function(t,e){if(e.get)return e.get.call(t);return e.value}(t,w(t,e,"get"))}function m(t,e,n){return function(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}(t,w(t,e,"set"),n),n}function w(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function k(t,e,n){return function(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}(t,e),n}function E(t,e,n){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return n}function x(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function L(t,e,n){x(t,e),e.set(t,n)}function O(t,e){x(t,e),e.add(t)}var j,I,T,M,S=function(){function e(){i(this,e)}var n;return a(e,null,[{key:"set",value:function(t,n,r){var i=k(this,e,N).call(this,t,n),o={data:r,timestamp:Date.now()};try{localStorage.setItem(i,JSON.stringify(o))}catch(t){throw console.error("Error storing data in local storage:",t),t}}},{key:"get",value:(n=r(t().mark((function n(r,i){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",k(this,e,_).call(this,r,i));case 1:case"end":return t.stop()}}),n,this)}))),function(t,e){return n.apply(this,arguments)})}]),e}();function _(t,e){var n=k(this,j,N).call(this,t,e);try{var r=localStorage.getItem(n);if(r){var i=JSON.parse(r),o=i.data;if(i.timestamp>Date.now()-j.ONE_MONTH_IN_MILLISECONDS)return o}return null}catch(t){throw console.error("Error parsing or retrieving data from local storage:",t),t}}function N(t,e){return"getBible-".concat(e,"-").concat(t)}j=S,I=S,M=2592e6,(T=y(T="ONE_MONTH_IN_MILLISECONDS"))in I?Object.defineProperty(I,T,{value:M,enumerable:!0,configurable:!0,writable:!0}):I[T]=M;var C=new WeakSet,R=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://query.getbible.net/v2/";i(this,e),O(this,C),this.apiEndpoint=t}return a(e,[{key:"get",value:function(){var e=r(t().mark((function e(n,r){var i,o,a;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,S.get(n,r);case 3:if(null===(i=t.sent)){t.next=6;break}return t.abrupt("return",i);case 6:return t.next=8,fetch(E(this,C,A).call(this,n,r));case 8:if((o=t.sent).ok){t.next=11;break}throw new Error("".concat(o.status," - ").concat(o.statusText||"Failed to fetch scripture"));case 11:return t.next=13,o.json();case 13:return a=t.sent,t.next=16,S.set(n,r,a);case 16:return t.abrupt("return",a);case 19:throw t.prev=19,t.t0=t.catch(0),console.error("Error fetching data:",t.t0),new Error(t.t0.message||"Error fetching scripture");case 23:case"end":return t.stop()}}),e,this,[[0,19]])})));return function(t,n){return e.apply(this,arguments)}}()}]),e}();function A(t,e){return"".concat(this.apiEndpoint).concat(encodeURIComponent(e),"/").concat(encodeURIComponent(t))}var W=new WeakMap,B=function(){function t(n){i(this,t),L(this,W,{writable:!0,value:void 0});if(!n||"object"!==e(n))throw new Error("Data must be a valid object.");["translation","abbreviation","language","lang","direction","encoding","book_nr","book_name","chapter","name","verses","ref"].forEach((function(t){if(void 0===n[t]||null===n[t])throw new Error("Missing required property: '".concat(t,"'."))})),m(this,W,n)}return a(t,[{key:"translation",get:function(){return b(this,W).translation}},{key:"abbreviation",get:function(){return b(this,W).abbreviation}},{key:"language",get:function(){return b(this,W).language}},{key:"languageCode",get:function(){return b(this,W).lang}},{key:"textDirection",get:function(){return b(this,W).direction}},{key:"encoding",get:function(){return b(this,W).encoding}},{key:"bookNumber",get:function(){return b(this,W).book_nr}},{key:"bookName",get:function(){return b(this,W).book_name}},{key:"chapter",get:function(){return b(this,W).chapter}},{key:"chapterName",get:function(){return b(this,W).name}},{key:"verses",get:function(){return b(this,W).verses}},{key:"getVerse",value:function(t){return b(this,W).verses.find((function(e){return e.verse===t}))}},{key:"getVersesInRange",value:function(t,e){return b(this,W).verses.filter((function(n){return n.verse>=t&&n.verse<=e}))}},{key:"localReference",get:function(){return Array.isArray(b(this,W).ref)?b(this,W).ref.join("; "):b(this,W).ref}},{key:"reference",get:function(){var t=b(this,W).verses.map((function(t){return t.verse})).sort((function(t,e){return t-e})),e="".concat(b(this,W).name,":"),n={},r=null,i=null,o=null;return t.forEach((function(t){null===r?r=t:t===o+1?i=t:(n[r]=null!==i?"".concat(r,"-").concat(i):"".concat(r),r=t,i=null),o=t})),null!==r&&(n[r]=null!==i?"".concat(r,"-").concat(i):"".concat(r)),e+Object.values(n).join(",")}}]),t}(),P=new WeakMap,D=function(){function t(e){i(this,t),L(this,P,{writable:!0,value:void 0}),m(this,P,Object.values(e).map((function(t){return new B(t)})))}return a(t,[{key:"forEachReference",value:function(t){b(this,P).forEach(t)}}]),t}(),F=new WeakMap,H=new WeakMap,z=new WeakMap,U=new WeakMap,G=new WeakMap,q=new WeakMap,Y=new WeakMap,J=new WeakMap,V=new WeakMap,X=new WeakMap,$=function(){function t(e){if(i(this,t),L(this,F,{writable:!0,value:void 0}),L(this,H,{writable:!0,value:void 0}),L(this,z,{writable:!0,value:void 0}),L(this,U,{writable:!0,value:void 0}),L(this,G,{writable:!0,value:void 0}),L(this,q,{writable:!0,value:void 0}),L(this,Y,{writable:!0,value:void 0}),L(this,J,{writable:!0,value:void 0}),L(this,V,{writable:!0,value:void 0}),L(this,X,{writable:!0,value:void 0}),!(e instanceof HTMLElement))throw new Error("triggerElement must be an instance of HTMLElement.");m(this,F,e),m(this,H,(e.dataset.format||"inline").toLowerCase()),m(this,z,(e.dataset.translation||"kjv").toLowerCase().split(";").map((function(t){return t.trim()}))),m(this,U,e.dataset.showBookName?parseInt(e.dataset.showBookName,10):0),m(this,G,e.dataset.showReference?parseInt(e.dataset.showReference,10):1),m(this,q,e.dataset.showLocalReference?parseInt(e.dataset.showLocalReference,10):0),m(this,Y,e.dataset.showTranslation?parseInt(e.dataset.showTranslation,10):0),m(this,J,e.dataset.showAbbreviation?parseInt(e.dataset.showAbbreviation,10):0),m(this,V,e.dataset.showLanguage?parseInt(e.dataset.showLanguage,10):0),m(this,X,e.dataset.showLanguageCode?parseInt(e.dataset.showLanguageCode,10):0),b(this,q)&&m(this,G,0)}return a(t,[{key:"translations",get:function(){return b(this,z)}},{key:"bookName",get:function(){return b(this,U)}},{key:"reference",get:function(){return b(this,G)}},{key:"localReference",get:function(){return b(this,q)}},{key:"translation",get:function(){return b(this,Y)}},{key:"abbreviation",get:function(){return b(this,J)}},{key:"language",get:function(){return b(this,V)}},{key:"languageCode",get:function(){return b(this,X)}},{key:"format",get:function(){return b(this,H)}},{key:"element",get:function(){return b(this,F)}}]),t}(),K=new WeakMap,Q=function(){function t(e){i(this,t),L(this,K,{writable:!0,value:void 0}),m(this,K,e)}return a(t,[{key:"action",get:function(){return b(this,K)}},{key:"get",value:function(t){throw new Error("The 'get' method must be implemented in BaseFormat subclass.")}}]),t}(),Z=function(t){c(n,t);var e=f(n);function n(t){return i(this,n),e.call(this,t)}return a(n,[{key:"get",value:function(t){var e=this,n=[];return t.forEachReference((function(t){var r=[];n.push('')),e.action.bookName&&r.push('
'.concat(t.bookName," ")),e.action.reference&&r.push('
'.concat(t.reference," ")),e.action.localReference&&r.push('
'.concat(t.localReference," ")),e.action.translation&&r.push('
'.concat(t.translation," ")),e.action.abbreviation&&r.push('
'.concat(t.abbreviation," ")),e.action.language&&r.push('
'.concat(t.language," ")),e.action.languageCode&&r.push('
'.concat(t.languageCode," ")),r.length>0&&n.push('"));var i=t.verses.map((function(t){return'
'.concat(t.verse,". ").concat(t.text,"
")})).join("\n");n.push('
'.concat(i,"
")),n.push("
")})),''.concat(n.join("\n"),"
")}}]),n}(Q),tt=function(t){c(n,t);var e=f(n);function n(t){return i(this,n),e.call(this,t)}return a(n,[{key:"get",value:function(t){var e=this,n=[];return t.forEachReference((function(t){var r=[];n.push('')),e.action.bookName&&r.push(''.concat(t.bookName," ")),e.action.reference&&r.push(''.concat(t.reference," ")),e.action.localReference&&r.push(''.concat(t.localReference," ")),e.action.translation&&r.push(''.concat(t.translation," ")),e.action.abbreviation&&r.push(''.concat(t.abbreviation," ")),e.action.language&&r.push(''.concat(t.language," ")),e.action.languageCode&&r.push(''.concat(t.languageCode," "));var i=t.verses.map((function(t){return''.concat(t.verse,". ").concat(t.text," ")})).join("\n");n.push(''.concat(i," ")),r.length>0&&n.push('")),n.push("
")})),''.concat(n.join("\n"),"
")}}]),n}(Q),et=function(t){c(n,t);var e=f(n);function n(t){return i(this,n),e.call(this,t)}return a(n,[{key:"get",value:function(t){var e=this,n=[];return t.forEachReference((function(t){var r=[];e.action.bookName&&r.push("".concat(t.bookName)),e.action.reference&&r.push("".concat(t.reference)),e.action.localReference&&r.push("".concat(t.localReference)),e.action.translation&&r.push("".concat(t.translation)),e.action.abbreviation&&r.push("".concat(t.abbreviation)),e.action.language&&r.push("".concat(t.language)),e.action.languageCode&&r.push("".concat(t.languageCode)),r.length>0&&n.push("[".concat(r.join(" - "),"]")),n.push(t.verses.map((function(t){return"".concat(t.verse,". ").concat(t.text)})).join("\n"))})),"".concat(n.join("\n"),"\n")}}]),n}(Q),nt=function(){function t(e){i(this,t);var n={modal:Z,inline:tt,tooltip:et}[e.format]||tt;this.format=new n(e)}return a(t,[{key:"get",value:function(t){return this.format.get(t)}}]),t}(),rt=new WeakMap,it=new WeakMap,ot=function(){function t(e){i(this,t),L(this,rt,{writable:!0,value:void 0}),L(this,it,{writable:!0,value:void 0}),m(this,rt,"modal-".concat(Math.random().toString(36).slice(2,11))),m(this,it,e),this.element.style.cursor="pointer",this.initializeTrigger()}return a(t,[{key:"load",value:function(t){if(document.getElementById(this.id)){var e=document.getElementById("".concat(this.id,"-content"));e&&(e.innerHTML+=t)}else this.create(t)}},{key:"insertIntoDOM",value:function(t){document.body.insertAdjacentHTML("beforeend",t)}},{key:"create",value:function(t){var e='\n \n
\n
✖ \n
\n ').concat(t,"\n
\n
\n
");this.insertIntoDOM(e);var n=document.getElementById(this.id);n.addEventListener("click",(function(t){t.target===n&&(n.style.display="none")}))}},{key:"initializeTrigger",value:function(){var t=this;this.element.addEventListener("click",(function(){document.getElementById(t.id).style.display="flex"}))}},{key:"id",get:function(){return b(this,rt)}},{key:"element",get:function(){return b(this,it).element}}]),t}(),at=function(t){c(n,t);var e=f(n);function n(t){return i(this,n),e.call(this,t)}return a(n,[{key:"show",value:function(){UIkit.modal("#".concat(this.id)).show()}},{key:"hide",value:function(){UIkit.modal("#".concat(this.id)).hide()}},{key:"create",value:function(t){var e='\n \n
\n
\n
\n ').concat(t,"\n
\n
\n
");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){this.element.setAttribute("uk-toggle","target: #".concat(this.id))}}]),n}(ot),ct=function(t){c(n,t);var e=f(n);function n(t){return i(this,n),e.call(this,t)}return a(n,[{key:"show",value:function(){new bootstrap.Modal(document.getElementById(this.id)).show()}},{key:"hide",value:function(){var t=bootstrap.Modal.getInstance(document.getElementById(this.id));t&&t.hide()}},{key:"create",value:function(t){var e='\n \n
\n
\n \n
\n ').concat(t,"\n
\n
\n
\n
");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){this.element.setAttribute("data-bs-toggle","modal"),this.element.setAttribute("data-bs-target","#".concat(this.id))}}]),n}(ot),st=function(t){c(n,t);var e=f(n);function n(t){var r;return i(this,n),(r=e.call(this,t)).modalElement=null,r}return a(n,[{key:"show",value:function(){this.modalElement&&this.modalElement.open()}},{key:"hide",value:function(){this.modalElement&&this.modalElement.close()}},{key:"create",value:function(t){var e='\n \n
\n ').concat(t,'\n
\n
\n × \n \n
');this.insertIntoDOM(e),this.modalElement=new Foundation.Reveal(document.getElementById(this.id))}},{key:"initializeTrigger",value:function(){this.element.setAttribute("data-open",this.id)}}]),n}(ot),lt=function(t){c(n,t);var e=f(n);function n(t){return i(this,n),e.call(this,t)}return a(n,[{key:"show",value:function(){document.getElementById(this.id).classList.remove("hidden")}},{key:"hide",value:function(){document.getElementById(this.id).classList.add("hidden")}},{key:"create",value:function(t){var e='\n \n
\n
\n ').concat(t,'\n
\n
Close \n
\n
");this.insertIntoDOM(e)}},{key:"initializeTrigger",value:function(){var t=this;this.element.addEventListener("click",(function(){document.getElementById(t.id).classList.remove("hidden")}))}}]),n}(ot),ut=function(){function t(e){i(this,t),this.modal=t.framework(e)}return a(t,[{key:"load",value:function(t){this.modal.load(t)}}],[{key:"framework",value:function(t){for(var e={UIkit:at,bootstrap:ct,Foundation:st,tailwind:lt},n=0,r=Object.entries(e);n translation.trim());
this.#showBookName = element.dataset.showBookName ? parseInt(element.dataset.showBookName, 10) : 0;
this.#showReference = element.dataset.showReference ? parseInt(element.dataset.showReference, 10) : 1;
+ this.#showLocalReference = element.dataset.showLocalReference ? parseInt(element.dataset.showLocalReference, 10) : 0;
this.#showTranslation = element.dataset.showTranslation ? parseInt(element.dataset.showTranslation, 10) : 0;
this.#showAbbreviation = element.dataset.showAbbreviation ? parseInt(element.dataset.showAbbreviation, 10) : 0;
this.#showLanguage = element.dataset.showLanguage ? parseInt(element.dataset.showLanguage, 10) : 0;
+ this.#showLanguageCode = element.dataset.showLanguageCode ? parseInt(element.dataset.showLanguageCode, 10) : 0;
+
+ if (this.#showLocalReference){
+ this.#showReference = 0;
+ }
}
/**
@@ -37,7 +45,7 @@ export class Action {
*
* @returns {Array} An array of translation strings.
*/
- getTranslations() {
+ get translations() {
return this.#translations;
}
@@ -46,7 +54,7 @@ export class Action {
*
* @returns {number} The show book name flag (0 or 1).
*/
- showBookName() {
+ get bookName() {
return this.#showBookName;
}
@@ -55,16 +63,25 @@ export class Action {
*
* @returns {number} The show reference flag (0 or 1).
*/
- showReference() {
+ get reference() {
return this.#showReference;
}
+ /**
+ * Retrieves the show local reference flag.
+ *
+ * @returns {number} The show reference flag (0 or 1).
+ */
+ get localReference() {
+ return this.#showLocalReference;
+ }
+
/**
* Retrieves the show translation flag.
*
* @returns {number} The show translation flag (0 or 1).
*/
- showTranslation() {
+ get translation() {
return this.#showTranslation;
}
@@ -73,7 +90,7 @@ export class Action {
*
* @returns {number} The show abbreviation flag (0 or 1).
*/
- showAbbreviation() {
+ get abbreviation() {
return this.#showAbbreviation;
}
@@ -82,16 +99,25 @@ export class Action {
*
* @returns {number} The show language flag (0 or 1).
*/
- showLanguage() {
+ get language() {
return this.#showLanguage;
}
+ /**
+ * Retrieves the show language code flog.
+ *
+ * @returns {number} The show language flag (0 or 1).
+ */
+ get languageCode() {
+ return this.#showLanguageCode;
+ }
+
/**
* Retrieves the element format.
*
* @returns {string} The element format.
*/
- getFormat() {
+ get format() {
return this.#format;
}
@@ -100,7 +126,7 @@ export class Action {
*
* @returns {HTMLElement} The DOM element associated with this object.
*/
- getElement() {
+ get element() {
return this.#element;
}
}
diff --git a/src/js/core/Loader.js b/src/js/core/Loader.js
index 7eb374e..ef811c0 100644
--- a/src/js/core/Loader.js
+++ b/src/js/core/Loader.js
@@ -19,7 +19,7 @@ export class Loader {
* Allows for dependency injection of the Api class for easier testing and flexibility.
* @param {Api} api - Instance of Api class for making API calls.
*/
- constructor(api = new Api()) {
+ constructor(api) {
this.#api = api;
}
@@ -74,7 +74,7 @@ export class Loader {
*/
async #processReferences(validReferences) {
for (const reference of validReferences) {
- for (const translation of this.#action.getTranslations()) {
+ for (const translation of this.#action.translations) {
try {
const scripture = await this.#api.get(reference, translation);
if (scripture) {
diff --git a/src/js/core/Reference.js b/src/js/core/Reference.js
index a57e3e9..1233141 100644
--- a/src/js/core/Reference.js
+++ b/src/js/core/Reference.js
@@ -8,8 +8,38 @@ export class Reference {
* Initializes the BibleVerse object with verse data.
*
* @param {Object} data - The JSON data containing verse information.
+ * @param {string} data.translation - The name of the translation.
+ * @param {string} data.abbreviation - The abbreviation of the translation.
+ * @param {string} data.language - The full language name.
+ * @param {string} data.lang - The language code.
+ * @param {string} data.direction - The text direction (LTR or RTL).
+ * @param {string} data.encoding - The encoding format (e.g., UTF-8).
+ * @param {number} data.book_nr - The book number.
+ * @param {string} data.book_name - The name of the book.
+ * @param {number} data.chapter - The chapter number.
+ * @param {string} data.name - The name of the chapter.
+ * @param {Array} data.verses - An array of objects representing each verse.
+ * @param {string|Array} data.ref - The local reference string or array of strings.
*/
constructor(data) {
+ // Simple validation to check if essential properties are present
+ const requiredProperties = [
+ 'translation', 'abbreviation', 'language', 'lang',
+ 'direction', 'encoding', 'book_nr', 'book_name',
+ 'chapter', 'name', 'verses', 'ref'
+ ];
+
+ if (!data || typeof data !== 'object') {
+ throw new Error('Data must be a valid object.');
+ }
+
+ requiredProperties.forEach(prop => {
+ if (data[prop] === undefined || data[prop] === null) {
+ throw new Error(`Missing required property: '${prop}'.`);
+ }
+ });
+
+ // Assign the data after validation
this.#data = data;
}
@@ -18,7 +48,7 @@ export class Reference {
*
* @returns {string} The name of the translation.
*/
- getTranslation() {
+ get translation() {
return this.#data.translation;
}
@@ -27,26 +57,26 @@ export class Reference {
*
* @returns {string} The abbreviation of the translation.
*/
- getAbbreviation() {
+ get abbreviation() {
return this.#data.abbreviation;
}
- /**
- * Retrieves the language code.
- *
- * @returns {string} The language code.
- */
- getLanguage() {
- return this.#data.lang;
- }
-
/**
* Retrieves the full language name.
*
+ * @returns {string} The language code.
+ */
+ get language() {
+ return this.#data.language;
+ }
+
+ /**
+ * Retrieves the language code.
+ *
* @returns {string} The full name of the language.
*/
- getLanguageName() {
- return this.#data.language;
+ get languageCode() {
+ return this.#data.lang;
}
/**
@@ -54,7 +84,7 @@ export class Reference {
*
* @returns {string} The direction of the text (LTR or RTL).
*/
- getTextDirection() {
+ get textDirection() {
return this.#data.direction;
}
@@ -63,7 +93,7 @@ export class Reference {
*
* @returns {string} The encoding format (e.g., UTF-8).
*/
- getEncoding() {
+ get encoding() {
return this.#data.encoding;
}
@@ -72,7 +102,7 @@ export class Reference {
*
* @returns {number} The book number.
*/
- getBookNumber() {
+ get bookNumber() {
return this.#data.book_nr;
}
@@ -81,7 +111,7 @@ export class Reference {
*
* @returns {string} The name of the book.
*/
- getBookName() {
+ get bookName() {
return this.#data.book_name;
}
@@ -90,7 +120,7 @@ export class Reference {
*
* @returns {number} The chapter number.
*/
- getChapter() {
+ get chapter() {
return this.#data.chapter;
}
@@ -99,16 +129,17 @@ export class Reference {
*
* @returns {string} The name of the chapter.
*/
- getChapterName() {
+ get chapterName() {
return this.#data.name;
}
/**
* Retrieves all verses of the chapter.
*
- * @returns {Array} An array of objects representing each verse.
+ * @returns {Array<{chapter: number, verse: number, name: string, text: string}>}
+ * An array of objects representing each verse.
*/
- getVerses() {
+ get verses() {
return this.#data.verses;
}
@@ -133,12 +164,22 @@ export class Reference {
return this.#data.verses.filter(verse => verse.verse >= startVerse && verse.verse <= endVerse);
}
+ /**
+ * Get the local reference string set in the website.
+ *
+ * @returns {string} The reference string.
+ */
+ get localReference() {
+ // Ensure that this.#data.ref is treated as an array.
+ return Array.isArray(this.#data.ref) ? this.#data.ref.join('; ') : this.#data.ref;
+ }
+
/**
* Generates a reference string for the verses.
*
* @returns {string} The reference string.
*/
- getReference() {
+ get reference() {
const verseNumbers = this.#data.verses.map(verse => verse.verse).sort((a, b) => a - b);
let refString = `${this.#data.name}:`;
let ranges = {};
diff --git a/src/js/core/Scripture.js b/src/js/core/Scripture.js
index 00f95a4..4e7eee6 100644
--- a/src/js/core/Scripture.js
+++ b/src/js/core/Scripture.js
@@ -15,26 +15,6 @@ export class Scripture {
this.#references = Object.values(data).map(reference => new Reference(reference));
}
- /**
- * Gets a reference by its numerical index.
- *
- * @param {number} index - The index of the reference.
- * @returns {Reference|null} The Reference instance or null if out of bounds.
- */
- getReference(index) {
- return (index >= 0 && index < this.#references.length) ? this.#references[index] : null;
- }
-
- /**
- * Gets the translation.
- *
- * @param {number} index - The index of the reference.
- * @returns {Reference|null} The Reference instance or null if out of bounds.
- */
- getReference(index) {
- return (index >= 0 && index < this.#references.length) ? this.#references[index] : null;
- }
-
/**
* Iterates over all references and performs a callback function.
*
diff --git a/src/js/elements/Element.js b/src/js/elements/Element.js
index c8e3d20..55ce095 100644
--- a/src/js/elements/Element.js
+++ b/src/js/elements/Element.js
@@ -20,7 +20,7 @@ export class Element {
'tooltip': TooltipElement
};
- const format = action.getFormat();
+ const format = action.format;
const ElementType = elementTypes[format] || InlineElement;
this.element = new ElementType(action);
diff --git a/src/js/elements/InlineElement.js b/src/js/elements/InlineElement.js
index f53112e..95ed245 100644
--- a/src/js/elements/InlineElement.js
+++ b/src/js/elements/InlineElement.js
@@ -14,7 +14,7 @@ export class InlineElement {
constructor(action) {
this.#action = action;
// Clear initial content
- this.getElement().innerHTML = '';
+ this.element.innerHTML = '';
}
/**
@@ -23,8 +23,8 @@ export class InlineElement {
* @param {string} content - The content to load into the trigger element.
*/
load(content) {
- const existingContent = this.getElement().innerHTML;
- this.getElement().innerHTML = existingContent ? `${existingContent}\n ${content}` : content;
+ const existingContent = this.element.innerHTML;
+ this.element.innerHTML = existingContent ? `${existingContent}\n ${content}` : content;
}
/**
@@ -32,7 +32,7 @@ export class InlineElement {
*
* @returns {HTMLElement} - The DOM element being worked with.
*/
- getElement() {
- return this.#action.getElement();
+ get element() {
+ return this.#action.element;
}
}
diff --git a/src/js/elements/TooltipElement.js b/src/js/elements/TooltipElement.js
index 2709474..3aabf51 100644
--- a/src/js/elements/TooltipElement.js
+++ b/src/js/elements/TooltipElement.js
@@ -34,7 +34,6 @@ export class TooltipElement {
*
* @param {Action} action - The action element triggering the tooltip.
* @returns {BaseTooltip|BootstrapTooltip|UikitTooltip|FoundationTooltip|TailwindTooltip} The tooltip instance.
- * @param debug
*/
static framework(action) {
const frameworks = {
diff --git a/src/js/elements/modals/BaseModal.js b/src/js/elements/modals/BaseModal.js
index 678c850..8906b43 100644
--- a/src/js/elements/modals/BaseModal.js
+++ b/src/js/elements/modals/BaseModal.js
@@ -12,7 +12,7 @@ export class BaseModal {
constructor(action) {
this.#modalId = `modal-${Math.random().toString(36).slice(2, 11)}`;
this.#action = action;
- this.getElement().style.cursor = 'pointer';
+ this.element.style.cursor = 'pointer';
this.initializeTrigger();
}
@@ -22,11 +22,11 @@ export class BaseModal {
* @param {string} content - The content to load into the modal.
*/
load(content) {
- const existingModal = document.getElementById(this.getModalId());
+ const existingModal = document.getElementById(this.id);
// Check if modal already exists
if (existingModal) {
// Update the content of the existing modal
- const contentDiv = document.getElementById(`${this.getModalId()}-content`);
+ const contentDiv = document.getElementById(`${this.id}-content`);
if (contentDiv) {
contentDiv.innerHTML += content;
}
@@ -52,17 +52,17 @@ export class BaseModal {
*/
create(content) {
const modalHtml = `
-
+
`;
this.insertIntoDOM(modalHtml);
- const modalElement = document.getElementById(this.getModalId());
+ const modalElement = document.getElementById(this.id);
modalElement.addEventListener('click', (event) => {
if (event.target === modalElement) {
modalElement.style.display = 'none';
@@ -75,8 +75,8 @@ export class BaseModal {
*
*/
initializeTrigger() {
- this.getElement().addEventListener('click', () => {
- document.getElementById(this.getModalId()).style.display = 'flex';
+ this.element.addEventListener('click', () => {
+ document.getElementById(this.id).style.display = 'flex';
});
}
@@ -85,7 +85,7 @@ export class BaseModal {
*
* @returns {string} - The modal ID
*/
- getModalId() {
+ get id() {
return this.#modalId;
}
@@ -94,7 +94,7 @@ export class BaseModal {
*
* @returns {HTMLElement} - The DOM element being worked with.
*/
- getElement() {
- return this.#action.getElement();
+ get element() {
+ return this.#action.element;
}
}
diff --git a/src/js/elements/modals/BootstrapModal.js b/src/js/elements/modals/BootstrapModal.js
index dec90c0..1192ed9 100644
--- a/src/js/elements/modals/BootstrapModal.js
+++ b/src/js/elements/modals/BootstrapModal.js
@@ -6,12 +6,12 @@ export class BootstrapModal extends BaseModal {
}
show() {
- const modal = new bootstrap.Modal(document.getElementById(this.getModalId()));
+ const modal = new bootstrap.Modal(document.getElementById(this.id));
modal.show();
}
hide() {
- const modal = bootstrap.Modal.getInstance(document.getElementById(this.getModalId()));
+ const modal = bootstrap.Modal.getInstance(document.getElementById(this.id));
if (modal) {
modal.hide();
}
@@ -19,13 +19,13 @@ export class BootstrapModal extends BaseModal {
create(content) {
const modalHtml = `
-
+
-
@@ -35,7 +35,7 @@ export class BootstrapModal extends BaseModal {
}
initializeTrigger() {
- this.getElement().setAttribute('data-bs-toggle', 'modal');
- this.getElement().setAttribute('data-bs-target', `#${this.getModalId()}`);
+ this.element.setAttribute('data-bs-toggle', 'modal');
+ this.element.setAttribute('data-bs-target', `#${this.id}`);
}
}
diff --git a/src/js/elements/modals/FoundationModal.js b/src/js/elements/modals/FoundationModal.js
index d5a4f98..f0cc5a7 100644
--- a/src/js/elements/modals/FoundationModal.js
+++ b/src/js/elements/modals/FoundationModal.js
@@ -20,8 +20,8 @@ export class FoundationModal extends BaseModal {
create(content) {
const modalHtml = `
-
-
+
+
${content}
@@ -29,10 +29,10 @@ export class FoundationModal extends BaseModal {
`;
this.insertIntoDOM(modalHtml);
- this.modalElement = new Foundation.Reveal(document.getElementById(this.getModalId()));
+ this.modalElement = new Foundation.Reveal(document.getElementById(this.id));
}
initializeTrigger() {
- this.getElement().setAttribute('data-open', this.getModalId());
+ this.element.setAttribute('data-open', this.id);
}
}
diff --git a/src/js/elements/modals/TailwindModal.js b/src/js/elements/modals/TailwindModal.js
index ea411dd..5739522 100644
--- a/src/js/elements/modals/TailwindModal.js
+++ b/src/js/elements/modals/TailwindModal.js
@@ -6,29 +6,29 @@ export class TailwindModal extends BaseModal {
}
show() {
- document.getElementById(this.getModalId()).classList.remove('hidden');
+ document.getElementById(this.id).classList.remove('hidden');
}
hide() {
- document.getElementById(this.getModalId()).classList.add('hidden');
+ document.getElementById(this.id).classList.add('hidden');
}
create(content) {
const modalHtml = `
-
+
-
+
${content}
-
Close
+
Close
`;
this.insertIntoDOM(modalHtml);
}
initializeTrigger() {
- this.getElement().addEventListener('click', () => {
- document.getElementById(this.getModalId()).classList.remove('hidden');
+ this.element.addEventListener('click', () => {
+ document.getElementById(this.id).classList.remove('hidden');
});
}
}
diff --git a/src/js/elements/modals/UikitModal.js b/src/js/elements/modals/UikitModal.js
index 749fa28..e2a1b77 100644
--- a/src/js/elements/modals/UikitModal.js
+++ b/src/js/elements/modals/UikitModal.js
@@ -6,19 +6,19 @@ export class UikitModal extends BaseModal {
}
show() {
- UIkit.modal(`#${this.getModalId()}`).show();
+ UIkit.modal(`#${this.id}`).show();
}
hide() {
- UIkit.modal(`#${this.getModalId()}`).hide();
+ UIkit.modal(`#${this.id}`).hide();
}
create(content) {
const modalHtml = `
-
+
-
@@ -27,7 +27,7 @@ export class UikitModal extends BaseModal {
}
initializeTrigger() {
- this.getElement().setAttribute('uk-toggle', `target: #${this.getModalId()}`);
+ this.element.setAttribute('uk-toggle', `target: #${this.id}`);
}
}
diff --git a/src/js/elements/tooltip/BaseTooltip.js b/src/js/elements/tooltip/BaseTooltip.js
index a976809..82a9e6e 100644
--- a/src/js/elements/tooltip/BaseTooltip.js
+++ b/src/js/elements/tooltip/BaseTooltip.js
@@ -10,7 +10,7 @@ export class BaseTooltip {
*/
constructor(action) {
this.#action = action;
- this.getElement().style.cursor = 'help';
+ this.element.style.cursor = 'help';
}
/**
@@ -21,9 +21,9 @@ export class BaseTooltip {
* @throws {Error} Throws an error if the trigger elements is not valid.
*/
load(content) {
- const existingTitle = this.getElement().getAttribute('title');
+ const existingTitle = this.element.getAttribute('title');
const newTitle = existingTitle ? existingTitle + "\n" + content : content;
- this.getElement().setAttribute('title', newTitle);
+ this.element.setAttribute('title', newTitle);
}
/**
@@ -31,7 +31,7 @@ export class BaseTooltip {
*
* @returns {HTMLElement} - The DOM element being worked with.
*/
- getElement() {
- return this.#action.getElement();
+ get element() {
+ return this.#action.element;
}
}
diff --git a/src/js/elements/tooltip/FoundationTooltip.js b/src/js/elements/tooltip/FoundationTooltip.js
index ac56b8f..5b0db66 100644
--- a/src/js/elements/tooltip/FoundationTooltip.js
+++ b/src/js/elements/tooltip/FoundationTooltip.js
@@ -7,9 +7,9 @@ export class FoundationTooltip extends BaseTooltip {
load(content) {
try {
- this.getElement().setAttribute('data-tooltip', '');
+ this.element.setAttribute('data-tooltip', '');
super.load(content);
- this.getElement().classList.add('has-tip');
+ this.element.classList.add('has-tip');
new Foundation.Tooltip(this.getElement(), {
// Default options
@@ -18,7 +18,7 @@ export class FoundationTooltip extends BaseTooltip {
fadeInDuration: 150, // Duration of fade in animation in milliseconds
showOn: 'all', // Can be 'all', 'large', 'medium', 'small'
templateClasses: '', // Custom class(es) to be added to the tooltip template
- tipText: () => this.getElement().getAttribute('title'), // Function to define tooltip text
+ tipText: () => this.element.getAttribute('title'), // Function to define tooltip text
triggerClass: 'has-tip', // Class to be added on the trigger elements
touchCloseText: 'tap to close', // Text for close button on touch devices
positionClass: 'top', // Position of tooltip, can be 'top', 'bottom', 'left', 'right', etc.
diff --git a/src/js/elements/tooltip/TailwindTooltip.js b/src/js/elements/tooltip/TailwindTooltip.js
index 01a9846..f27f978 100644
--- a/src/js/elements/tooltip/TailwindTooltip.js
+++ b/src/js/elements/tooltip/TailwindTooltip.js
@@ -20,25 +20,25 @@ export class TailwindTooltip extends BaseTooltip {
this.tooltipElement.id = this.tooltipId;
this.tooltipElement.className = 'absolute invisible bg-gray-800 text-white text-xs px-2 py-1 rounded-md';
this.tooltipElement.style.transition = 'visibility 0.3s linear, opacity 0.3s linear';
- this.tooltipElement.textContent = this.getElement().getAttribute('title');
+ this.tooltipElement.textContent = this.element.getAttribute('title');
document.body.appendChild(this.tooltipElement);
}
_initializeEvents() {
- this.getElement().addEventListener('mouseenter', () => {
- const rect = this.getElement().getBoundingClientRect();
- this._title = this.getElement().getAttribute('title');
+ this.element.addEventListener('mouseenter', () => {
+ const rect = this.element.getBoundingClientRect();
+ this._title = this.element.getAttribute('title');
this.tooltipElement.style.left = `${rect.left + window.scrollX}px`;
this.tooltipElement.style.top = `${rect.bottom + 5 + window.scrollY}px`;
this.tooltipElement.classList.remove('invisible');
this.tooltipElement.classList.add('opacity-100');
- this.getElement().setAttribute('title', '');
+ this.element.setAttribute('title', '');
});
- this.getElement().addEventListener('mouseleave', () => {
+ this.element.addEventListener('mouseleave', () => {
this.tooltipElement.classList.add('invisible');
this.tooltipElement.classList.remove('opacity-100');
- this.getElement().setAttribute('title', this._title);
+ this.element.setAttribute('title', this._title);
});
}
}
diff --git a/src/js/elements/tooltip/UikitTooltip.js b/src/js/elements/tooltip/UikitTooltip.js
index a656ba5..bb038c6 100644
--- a/src/js/elements/tooltip/UikitTooltip.js
+++ b/src/js/elements/tooltip/UikitTooltip.js
@@ -1,14 +1,14 @@
import {BaseTooltip} from './BaseTooltip.js';
export class UikitTooltip extends BaseTooltip {
- constructor(triggerElement) {
- super(triggerElement);
+ constructor(action) {
+ super(action);
}
load(content) {
try {
super.load(content);
- UIkit.tooltip(this.triggerElement);
+ UIkit.tooltip(this.element);
} catch (error) {
console.error('Error loading UikitTooltip:', error);
}
diff --git a/src/js/formats/BaseFormat.js b/src/js/formats/BaseFormat.js
index 8e6b945..17f9899 100644
--- a/src/js/formats/BaseFormat.js
+++ b/src/js/formats/BaseFormat.js
@@ -18,7 +18,7 @@ export class BaseFormat {
*
* @returns {Action} The current actions.
*/
- action() {
+ get action() {
return this.#action;
}
diff --git a/src/js/formats/BlockFormat.js b/src/js/formats/BlockFormat.js
index 7869cf5..9f95458 100644
--- a/src/js/formats/BlockFormat.js
+++ b/src/js/formats/BlockFormat.js
@@ -16,27 +16,33 @@ export class BlockFormat extends BaseFormat {
let display = [];
scripture.forEachReference((reference) => {
let header = [];
- display.push(`
`);
- if (this.action().showBookName()) {
- header.push(`
${reference.getBookName()} `);
+ display.push(`
`);
+ if (this.action.bookName) {
+ header.push(`
${reference.bookName} `);
}
- if (this.action().showReference()) {
- header.push(`
${reference.getReference()} `);
+ if (this.action.reference) {
+ header.push(`
${reference.reference} `);
}
- if (this.action().showTranslation()) {
- header.push(`
${reference.getTranslation()} `);
+ if (this.action.localReference) {
+ header.push(`
${reference.localReference} `);
}
- if (this.action().showAbbreviation()) {
- header.push(`
${reference.getAbbreviation()} `);
+ if (this.action.translation) {
+ header.push(`
${reference.translation} `);
}
- if (this.action().showLanguage()) {
- header.push(`
${reference.getLanguage()} `);
+ if (this.action.abbreviation) {
+ header.push(`
${reference.abbreviation} `);
+ }
+ if (this.action.language) {
+ header.push(`
${reference.language} `);
+ }
+ if (this.action.languageCode) {
+ header.push(`
${reference.languageCode} `);
}
// Construct the header
if (header.length > 0) {
display.push(``);
}
- const verses = reference.getVerses()
+ const verses = reference.verses
.map(verse => `
${verse.verse}. ${verse.text}
`)
.join("\n");
display.push(`
${verses}
`);
diff --git a/src/js/formats/Format.js b/src/js/formats/Format.js
index fe51dea..0839731 100644
--- a/src/js/formats/Format.js
+++ b/src/js/formats/Format.js
@@ -21,7 +21,7 @@ export class Format {
'tooltip': PlainFormat
};
- const format = action.getFormat();
+ const format = action.format;
const FormatType = formatTypes[format] || InlineFormat;
this.format = new FormatType(action);
}
diff --git a/src/js/formats/InlineFormat.js b/src/js/formats/InlineFormat.js
index a4f94e7..3d69c1c 100644
--- a/src/js/formats/InlineFormat.js
+++ b/src/js/formats/InlineFormat.js
@@ -16,23 +16,29 @@ export class InlineFormat extends BaseFormat {
let display = [];
scripture.forEachReference((reference) => {
let footer = [];
- display.push(`
`);
- if (this.action().showBookName()) {
- footer.push(`
${reference.getBookName()} `);
+ display.push(`
`);
+ if (this.action.bookName) {
+ footer.push(`${reference.bookName} `);
}
- if (this.action().showReference()) {
- footer.push(`${reference.getReference()} `);
+ if (this.action.reference) {
+ footer.push(`${reference.reference} `);
}
- if (this.action().showTranslation()) {
- footer.push(`${reference.getTranslation()} `);
+ if (this.action.localReference) {
+ footer.push(`${reference.localReference} `);
}
- if (this.action().showAbbreviation()) {
- footer.push(`${reference.getAbbreviation()} `);
+ if (this.action.translation) {
+ footer.push(`${reference.translation} `);
}
- if (this.action().showLanguage()) {
- footer.push(`${reference.getLanguage()} `);
+ if (this.action.abbreviation) {
+ footer.push(`${reference.abbreviation} `);
}
- const verses = reference.getVerses()
+ if (this.action.language) {
+ footer.push(`${reference.language} `);
+ }
+ if (this.action.languageCode) {
+ footer.push(`${reference.languageCode} `);
+ }
+ const verses = reference.verses
.map(verse => `${verse.verse}. ${verse.text} `)
.join("\n");
display.push(`${verses} `);
diff --git a/src/js/formats/PlainFormat.js b/src/js/formats/PlainFormat.js
index 70c5b2a..575bf60 100644
--- a/src/js/formats/PlainFormat.js
+++ b/src/js/formats/PlainFormat.js
@@ -16,27 +16,33 @@ export class PlainFormat extends BaseFormat {
let display = [];
scripture.forEachReference((reference) => {
let header = [];
- if (this.action().showBookName()) {
- header.push(`${reference.getBookName()}`);
+ if (this.action.bookName) {
+ header.push(`${reference.bookName}`);
}
- if (this.action().showReference()) {
- header.push(`${reference.getReference()}`);
+ if (this.action.reference) {
+ header.push(`${reference.reference}`);
}
- if (this.action().showTranslation()) {
- header.push(`${reference.getTranslation()}`);
+ if (this.action.localReference) {
+ header.push(`${reference.localReference}`);
}
- if (this.action().showAbbreviation()) {
- header.push(`${reference.getAbbreviation()}`);
+ if (this.action.translation) {
+ header.push(`${reference.translation}`);
}
- if (this.action().showLanguage()) {
- header.push(`${reference.getLanguage()}`);
+ if (this.action.abbreviation) {
+ header.push(`${reference.abbreviation}`);
+ }
+ if (this.action.language) {
+ header.push(`${reference.language}`);
+ }
+ if (this.action.languageCode) {
+ header.push(`${reference.languageCode}`);
}
// Construct the header
if (header.length > 0) {
display.push(`[${header.join(' - ')}]`);
}
display.push(
- reference.getVerses()
+ reference.verses
.map(verse => `${verse.verse}. ${verse.text}`)
.join("\n")
);
diff --git a/tests/uikit.html b/tests/uikit.html
index 4a81b6a..c431950 100644
--- a/tests/uikit.html
+++ b/tests/uikit.html
@@ -26,10 +26,10 @@
John 3:16,19
- John 3:16-17; 1 John 3:16-19,22
+ John 3:16-17; 1 John 3:16-19,22
Genesis 1:1
Psalms 23:1-4
- Romans 8:28,31-39
+ Rom 8:28,31-39