summaryrefslogtreecommitdiff
path: root/inc/assets/js/block-editor-script.js
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2021-07-21 14:54:07 -0500
committerZach van Rijn <me@zv.io>2021-07-21 14:54:07 -0500
commit9d4123cee1867ee7199b06bdc92d40611f547ecc (patch)
tree6d864e2725242863afed1f8ba12d9c7a9bc63a69 /inc/assets/js/block-editor-script.js
downloadblog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.gz
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.bz2
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.xz
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.zip
Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/.
Diffstat (limited to 'inc/assets/js/block-editor-script.js')
-rw-r--r--inc/assets/js/block-editor-script.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/inc/assets/js/block-editor-script.js b/inc/assets/js/block-editor-script.js
new file mode 100644
index 0000000..73c2378
--- /dev/null
+++ b/inc/assets/js/block-editor-script.js
@@ -0,0 +1,50 @@
+
+window.addEventListener( 'load', function(e) {
+ astra_onload_function();
+});
+
+function astra_onload_function() {
+
+ /* Do things after DOM has fully loaded */
+
+ var astraMetaBox = document.querySelector( '#astra_settings_meta_box' );
+ if( astraMetaBox != null ){
+
+ document.querySelector('#site-content-layout').addEventListener('change',function( event ) {
+
+ var bodyClass = document.querySelector('body'),
+ contentLayout = document.getElementById('site-content-layout').value;
+ switch( contentLayout ) {
+ case 'content-boxed-container':
+ bodyClass.classList.add('ast-separate-container');
+ bodyClass.classList.remove('ast-two-container' , 'ast-page-builder-template' , 'ast-plain-container');
+ break;
+ case 'boxed-container':
+ bodyClass.classList.add('ast-separate-container' , 'ast-two-container');
+ bodyClass.classList.remove('ast-page-builder-template' , 'ast-plain-container');
+ break;
+ case 'page-builder':
+ bodyClass.classList.add('ast-page-builder-template');
+ bodyClass.classList.remove('ast-two-container' , 'ast-plain-container' , 'ast-separate-container');
+ break;
+ case 'plain-container':
+ bodyClass.classList.add('ast-plain-container');
+ bodyClass.classList.remove('ast-two-container' , 'ast-page-builder-template' , 'ast-separate-container');
+ break;
+ }
+ });
+
+ var titleCheckbox = document.getElementById('site-post-title'),
+ titleBlock = document.querySelector('.editor-post-title__block');
+
+ titleCheckbox.addEventListener('change',function() {
+
+ if( titleCheckbox.checked ){
+ titleBlock.style.opacity = '0.2';
+ } else {
+ titleBlock.style.opacity = '1.0';
+ }
+ });
+ }
+
+ }