| Current Path : /home/chauffn/vuzelia/2023/media/plg_convertformstools_calculations/js/ |
| Current File : /home/chauffn/vuzelia/2023/media/plg_convertformstools_calculations/js/calculation_builder.js |
!function(l,c){"use strict";function i(e,t){var n=e.scrollTop,a=0,o=e.selectionStart||"0"==e.selectionStart?"ff":!!l.selection&&"ie",c=("ie"==o?(e.focus(),(c=l.selection.createRange()).moveStart("character",-e.value.length),a=c.text.length):"ff"==o&&(a=e.selectionStart),e.value.substring(0,a)),i=e.value.substring(a,e.value.length);e.value=c+t+i,a+=t.length,"ie"==o?(e.focus(),(c=l.selection.createRange()).moveStart("character",-e.value.length),c.moveStart("character",a),c.moveEnd("character",0),c.select()):"ff"==o&&(e.selectionStart=a,e.selectionEnd=a,e.focus()),e.scrollTop=n,e.focus()}l.addEventListener("DOMContentLoaded",function(){l.querySelector(".nrEditor").addEventListener("fields.displayOptions",function(e){var t,n,a,e=e.detail.el.querySelector(".calculation-builder");function o(){t.FieldsHelper.getFieldsArray().filter(function(e){return void 0!==e.name}).forEach(function(e){var t=l.createElement("option");t.value=e.shortcode,t.innerHTML=e.label,a.appendChild(t)}),a.options[0].selected=!0}e&&((e=e).classList.contains("init")||((t=c.ConvertFormsBuilder).loadStylesheet("media/plg_convertformstools_calculations/css/calculation_builder.css"),n=e.querySelector("textarea"),(a=e.querySelector("select")).addEventListener("focus",function(){for(var e=a.options.length-1;0<=e;e--)a.options[e].disabled||a.remove(e);o()}),a.addEventListener("change",function(e){i(n,e.target.value)}),e.addEventListener("click",function(e){if("submit"==e.target.type)return e.preventDefault(),e.target.classList.contains("backspace")?(n.value=n.value.slice(0,n.value.length-1),void n.focus()):e.target.classList.contains("clear")?(n.value="",void n.focus()):void i(n,e.target.innerText)}),o(),e.classList.add("init")))})})}(document,window);