diff --git a/assets/dist/js/content-ajaxing.js b/assets/dist/js/content-ajaxing.js index f27b486..334d93a 100644 --- a/assets/dist/js/content-ajaxing.js +++ b/assets/dist/js/content-ajaxing.js @@ -1 +1 @@ -!function(){const a={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,a)}catch(a){}globalThis.process={env:a}}(),((a,t,e)=>{let s=new IntersectionObserver((a=>{a.forEach((a=>{if(a.isIntersecting){let e=a.target;e.dataset.ajaxScroll&&fetch(e.dataset.ajaxScroll).then((a=>a.text())).then((a=>{if(e.innerHTML=a,e.classList.add("loaded"),t.attachBehaviors(e),e.dataset.ajaxEvent){const a=new Event(e.dataset.ajaxEvent);window.dispatchEvent(a)}})),e.dataset.ajaxCommands&&t.ajax({url:e.dataset.ajaxCommands,httpMethod:"GET"}).execute(),s.unobserve(e)}}))}),{root:null,rootMargin:"0px",threshold:1});t.behaviors.customAjaxContent={attach:function(a,t){a.querySelectorAll("[data-ajax-scroll]:not(.observing)").forEach((a=>{s.observe(a),a.classList.add("observing")}));a.querySelectorAll("[data-ajax-commands]:not(.observing)").forEach((a=>{s.observe(a),a.classList.add("observing")}));document.querySelectorAll("[data-ajax-now]").forEach((a=>{fetch(a.dataset.ajaxNow).then((a=>a.text())).then((t=>{a.innerHTML=t,a.removeAttribute("data-ajax-now"),a.classList.add("ajax-now--loaded")}))}))}}})(jQuery,Drupal,drupalSettings); \ No newline at end of file +!function(){const a={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,a)}catch(a){}globalThis.process={env:a}}(),((a,t,e)=>{let s=new IntersectionObserver((a=>{a.forEach((a=>{if(a.isIntersecting){let e=a.target;e.dataset.ajaxScroll&&fetch(e.dataset.ajaxScroll).then((a=>a.text())).then((a=>{if(e.innerHTML=a,e.classList.add("loaded"),t.attachBehaviors(e),e.dataset.ajaxEvent){const a=new Event(e.dataset.ajaxEvent);window.dispatchEvent(a)}})),e.dataset.ajaxCommands&&t.ajax({url:e.dataset.ajaxCommands,httpMethod:"GET"}).execute(),s.unobserve(e)}}))}),{root:null,rootMargin:"0px",threshold:1});t.behaviors.customAjaxContent={attach:function(a,t){a.querySelectorAll("[data-ajax-scroll]:not(.observing)").forEach((a=>{s.observe(a),a.classList.add("observing")}));a.querySelectorAll("[data-ajax-commands]:not(.observing)").forEach((a=>{s.observe(a),a.classList.add("observing")}));const e=document.querySelectorAll("[data-ajax-now]");let o={};e.forEach((a=>{o[a.dataset.ajaxNow]||(o[a.dataset.ajaxNow]=[]),o[a.dataset.ajaxNow].push(a)}));for(const[a,t]of Object.entries(o))fetch(a).then((a=>a.text())).then((a=>{t.forEach((t=>{t.innerHTML=a,t.removeAttribute("data-ajax-now"),t.classList.add("ajax-now--loaded")}))}))}}})(jQuery,Drupal,drupalSettings); \ No newline at end of file diff --git a/bluecadet_ajax_content_example/assets/dist/css/sample-library.css b/bluecadet_ajax_content_example/assets/dist/css/sample-library.css index 5678919..8567db8 100644 --- a/bluecadet_ajax_content_example/assets/dist/css/sample-library.css +++ b/bluecadet_ajax_content_example/assets/dist/css/sample-library.css @@ -1,5 +1,5 @@ -.sample-example{ +.simple-example{ background-color:red; } diff --git a/bluecadet_ajax_content_example/assets/src/css/sample-library.css b/bluecadet_ajax_content_example/assets/src/css/sample-library.css index dff087f..732930b 100644 --- a/bluecadet_ajax_content_example/assets/src/css/sample-library.css +++ b/bluecadet_ajax_content_example/assets/src/css/sample-library.css @@ -1,5 +1,5 @@ -.sample-example { +.simple-example { background-color: red; } diff --git a/bluecadet_ajax_content_example/bluecadet_ajax_content_example.libraries.yml b/bluecadet_ajax_content_example/bluecadet_ajax_content_example.libraries.yml index f5c9655..d17abfa 100644 --- a/bluecadet_ajax_content_example/bluecadet_ajax_content_example.libraries.yml +++ b/bluecadet_ajax_content_example/bluecadet_ajax_content_example.libraries.yml @@ -1,10 +1,11 @@ -sample: +simple: version: 1.x css: theme: - assets/dist/css/sample-library.css: {} + assets/dist/css/simple-library.css: {} js: - assets/dist/js/sample-library.js: {} + assets/dist/js/simple-library.js: {} dependencies: - core/drupal - core/jquery + diff --git a/bluecadet_ajax_content_example/src/Controller/AjaxCommandsExample.php b/bluecadet_ajax_content_example/src/Controller/AjaxCommandsExample.php index 7fc216d..64c6702 100644 --- a/bluecadet_ajax_content_example/src/Controller/AjaxCommandsExample.php +++ b/bluecadet_ajax_content_example/src/Controller/AjaxCommandsExample.php @@ -29,7 +29,7 @@ public function build(Request $request) { 'center-content' => [ '#markup' => '
Ajaxed Paragraph 1.
Ajaxed Paragraph 2.
Ajaxed Paragraph 3.
', + '#markup' => 'Ajaxed Paragraph 1.
Ajaxed Paragraph 2.
Ajaxed Paragraph 3.
', '#attached' => [ 'library' => [ - 'bluecadet_ajax_content_example/sample', + 'bluecadet_ajax_content_example/simple', ], ], ];