diff --git a/dist/js/characterCounter.min.js b/dist/js/characterCounter.min.js index 8b9d47c1..dc4f7d85 100644 --- a/dist/js/characterCounter.min.js +++ b/dist/js/characterCounter.min.js @@ -1 +1 @@ -!function(){"use strict";((t,e)=>{const n=(e,n)=>t.t("Characters: @counted/@total",{"@counted":e,"@total":n},{context:"Character counter"}),r=(t,e,n)=>t>=n?2:t>e&&e>0?1:0,a=(e,n,r,a,c)=>2===e?(c.classList.remove("is-hidden"),"input"===a?t.t("The recommended maximum length for the title is @total characters.",{"@total":r},{context:"Character counter"}):t.t("The recommended maximum length for the lead is @total characters.",{"@total":r},{context:"Character counter"})):1===e?(c.classList.remove("is-hidden"),t.t("Consider shortening. A lead under @step characters works best for search engines.",{"@step":n},{context:"Character counter"})):(c.classList.add("is-hidden"),0),c=t=>t.replace(/<[^>]*>/g," ").replace(/\s+/g," ").replace(/&#?[a-z0-9]+;/i," ").trim().length;t.behaviors.characterCounter={attach:function(t){const o=e("character-counter","[data-character-counter]",t);o&&o.forEach((e=>{const o=e.dataset.characterCounter,i=e.dataset.counterInputTag,s=e.dataset.counterTotal,l=e.dataset.counterStep,u=e.querySelector(".character-counter__warning"),d=t.querySelector(`.${o}`);if(!d)return;const h=d.querySelector("[data-counter-id]"),m=d.querySelector("[data-warning-id]"),g=d.querySelector(i);if(!g)return;let p=0;"textarea"===i&&d.parentElement.classList.contains("form-item")&&d.parentElement.querySelector(".form-item__description")&&d.parentElement.querySelector(".form-item__description").insertAdjacentElement("afterend",e),g.value.length>0&&(p=r(g.value.length,l,s),h.textContent=n(g.value.length,s),m.textContent=a(p,l,s,i,u)),"input"===i?g.addEventListener("input",(function(){p=r(g.value.length,l,s),h.textContent=n(g.value.length,s),m.textContent=a(p,l,s,i,u)})):setTimeout((function(){const t=g.parentElement.querySelector(".ck-editor__editable");if(t&&t.ckeditorInstance){const e=t.ckeditorInstance;e.model.document.on("change:data",(()=>{p=r(c(e.getData()),l,s),h.textContent=n(c(e.getData()),s),m.textContent=a(p,l,s,i,u)}))}}))}))}}})(Drupal,once)}(); \ No newline at end of file +!function(){"use strict";((Drupal,t)=>{const e=(t,e)=>Drupal.t("Characters: @counted/@total",{"@counted":t,"@total":e},{context:"Character counter"}),n=(t,e,n)=>t>=n?2:t>e&&e>0?1:0,r=(t,e,n,r,a)=>2===t?(a.classList.remove("is-hidden"),"input"===r?Drupal.t("The recommended maximum length for the title is @total characters.",{"@total":n},{context:"Character counter"}):Drupal.t("The recommended maximum length for the lead is @total characters.",{"@total":n},{context:"Character counter"})):1===t?(a.classList.remove("is-hidden"),Drupal.t("Consider shortening. A lead under @step characters works best for search engines.",{"@step":e},{context:"Character counter"})):(a.classList.add("is-hidden"),0),a=t=>t.replace(/<[^>]*>/g," ").replace(/\s+/g," ").replace(/&#?[a-z0-9]+;/i," ").trim().length;Drupal.behaviors.characterCounter={attach:function(c){const o=t("character-counter","[data-character-counter]",c);o&&o.forEach((t=>{const o=t.dataset.characterCounter,i=t.dataset.counterInputTag,s=t.dataset.counterTotal,l=t.dataset.counterStep,u=t.querySelector(".character-counter__warning"),d=c.querySelector(`.${o}`);if(!d)return;const h=d.querySelector("[data-counter-id]"),m=d.querySelector("[data-warning-id]"),g=d.querySelector(i);if(!g)return;let p=0;"textarea"===i&&d.parentElement.classList.contains("form-item")&&d.parentElement.querySelector(".form-item__description")&&d.parentElement.querySelector(".form-item__description").insertAdjacentElement("afterend",t),g.value.length>0&&(p=n(g.value.length,l,s),h.textContent=e(g.value.length,s),m.textContent=r(p,l,s,i,u)),"input"===i?g.addEventListener("input",(function(){p=n(g.value.length,l,s),h.textContent=e(g.value.length,s),m.textContent=r(p,l,s,i,u)})):setTimeout((function(){const t=g.parentElement.querySelector(".ck-editor__editable");if(t&&t.ckeditorInstance){const c=t.ckeditorInstance;c.model.document.on("change:data",(()=>{p=n(a(c.getData()),l,s),h.textContent=e(a(c.getData()),s),m.textContent=r(p,l,s,i,u)}))}}))}))}}})(Drupal,once)}(); \ No newline at end of file diff --git a/dist/js/debug-item-composer.min.js b/dist/js/debug-item-composer.min.js index c4dacbcd..880e8749 100644 --- a/dist/js/debug-item-composer.min.js +++ b/dist/js/debug-item-composer.min.js @@ -1 +1 @@ -!function(e){"use strict";document.querySelectorAll("[data-since]").forEach((e=>{e.innerText=function(e){const t=new Date(e),a=new Date-t,n=[{name:"milliseconds",val:1e3},{name:"seconds",val:6e4},{name:"minutes",val:36e5},{name:"hours",val:864e5},{name:"days",val:307584e5},{name:"years",val:307584e6}];for(let e=0;e0&&(r=Math.round(a/n[e-1].val)),`${r} ${t.name} ago`}}return"forever ago"}(e.dataset.since)})),document.querySelectorAll("[data-package][data-version]").forEach((function(t){const a=t.dataset.package,n=t.dataset.version;var r={method:"GET",headers:new Headers,redirect:"follow"};if(e&&e.path&&e.path.pathPrefix){const o=`${e.path.baseUrl}${e.path.pathPrefix}api/v1/package?name=${a}&version=${n}`;fetch(o,r).then((e=>e.text())).then((e=>{const a=JSON.parse(e);a.latestVersion?t.innerText=a.latestVersion:t.innerText="Unknown";const n=t.parentElement.querySelector("td:first-of-type");a.isLatest||(n.style="color: red")})).catch((e=>console.log("error",e)))}else console.error("drupalSettings.path.pathPrefix not found")}))}(drupalSettings); \ No newline at end of file +!function(drupalSettings){"use strict";document.querySelectorAll("[data-since]").forEach((e=>{e.innerText=function(e){const t=new Date(e),a=new Date-t,n=[{name:"milliseconds",val:1e3},{name:"seconds",val:6e4},{name:"minutes",val:36e5},{name:"hours",val:864e5},{name:"days",val:307584e5},{name:"years",val:307584e6}];for(let e=0;e0&&(r=Math.round(a/n[e-1].val)),`${r} ${t.name} ago`}}return"forever ago"}(e.dataset.since)})),document.querySelectorAll("[data-package][data-version]").forEach((function(e){const t=e.dataset.package,a=e.dataset.version;var n={method:"GET",headers:new Headers,redirect:"follow"};if(drupalSettings&&drupalSettings.path&&drupalSettings.path.pathPrefix){const r=`${drupalSettings.path.baseUrl}${drupalSettings.path.pathPrefix}api/v1/package?name=${t}&version=${a}`;fetch(r,n).then((e=>e.text())).then((t=>{const a=JSON.parse(t);a.latestVersion?e.innerText=a.latestVersion:e.innerText="Unknown";const n=e.parentElement.querySelector("td:first-of-type");a.isLatest||(n.style="color: red")})).catch((e=>console.log("error",e)))}else console.error("drupalSettings.path.pathPrefix not found")}))}(drupalSettings); \ No newline at end of file diff --git a/dist/js/tprEditForm.min.js b/dist/js/tprEditForm.min.js index b6a011e9..454315fd 100644 --- a/dist/js/tprEditForm.min.js +++ b/dist/js/tprEditForm.min.js @@ -1 +1 @@ -!function(){"use strict";((t,e)=>{e.behaviors.tprEditForm={attach:function(){document.querySelector(".region-sticky__items__inner").querySelectorAll(".gin-sticky").length>0&&document.querySelectorAll('.form-item--status [name="status"]').forEach((t=>{t.addEventListener("click",(t=>{const e=t.target.checked;document.querySelectorAll('.form-item--content-translation-status [name="content_translation[status]"]').forEach((t=>{t.checked=e}))}))}))}}})(jQuery,Drupal)}(); \ No newline at end of file +!function(){"use strict";((t,Drupal)=>{Drupal.behaviors.tprEditForm={attach:function(){document.querySelector(".region-sticky__items__inner").querySelectorAll(".gin-sticky").length>0&&document.querySelectorAll('.form-item--status [name="status"]').forEach((t=>{t.addEventListener("click",(t=>{const e=t.target.checked;document.querySelectorAll('.form-item--content-translation-status [name="content_translation[status]"]').forEach((t=>{t.checked=e}))}))}))}}})(jQuery,Drupal)}(); \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 53022ab8..9bd5d819 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -146,7 +146,13 @@ module.exports = (env, argv) => { minimizer: [ new TerserPlugin({ terserOptions: { - ecma: 2015, + ecma: 2020, + mangle: { + reserved:[ + 'Drupal', + 'drupalSettings' + ] + }, format: { comments: false, },