Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const blog_id = block.getAttribute( 'data-blog-id' );
try {
activateSubscription( block, blog_id );
} catch ( err ) {
if ( 'production' !== process.env.NODE_ENV ) {
// eslint-disable-next-line no-console
console.error( err );
}
}
block.setAttribute( 'data-jetpack-block-initialized', 'true' );
} );
};
if ( typeof window !== 'undefined' ) {
domReady( initializeMailchimpBlocks );
}
// Accessibility: https://www.w3.org/TR/wai-aria-practices/examples/accordion/accordion.html
const heading = el.querySelector( '.ugb-accordion__heading h4, .ugb-accordion__title' )
const content = el.querySelector( '.ugb-accordion__text, .ugb-accordion__content' )
heading.setAttribute( 'id', `ugb-accordion-${ instanceID }__heading` )
content.setAttribute( 'id', `ugb-accordion-${ instanceID }__content` )
heading.setAttribute( 'aria-controls', `ugb-accordion-${ instanceID }__content` )
content.setAttribute( 'aria-labelledby', `ugb-accordion-${ instanceID }__heading` )
instanceID++
}
export const initAll = () => {
document.querySelectorAll( '.ugb-accordion' ).forEach( el => init( el ) )
}
domReady( initAll )
constructor(props: {}) {
super(props);
this.store = new Store(top.ABT.options.citation_style);
domReady(() => {
// can't remember why this was needed, but keep it.
this.store.style = top.ABT.options.citation_style;
});
}
setTimeout( () => {
const selectedBlock = getSelectedBlock()
if ( selectedBlock && selectedBlock.name === 'ugb/column' ) {
clearSelectedBlock() // Clear first or else our inspector will show all options.
const columnsBlockClientIds = getBlockParents( selectedBlock.clientId )
if ( columnsBlockClientIds.length ) {
selectBlock( columnsBlockClientIds[ 0 ] )
}
}
}, 0 )
}
blocks = newBlocks
} )
}
domReady( initAutoAttemptRecovery )
const toolbar = document.querySelector( '.edit-post-header-toolbar' )
if ( ! toolbar ) {
return
}
const buttonDiv = document.createElement( 'div' )
buttonDiv.classList.add( 'ugb-insert-library-button__wrapper' )
if ( ! toolbar.querySelector( '.ugb-insert-library-button__wrapper' ) ) {
render( , buttonDiv )
toolbar.appendChild( buttonDiv )
}
}
domReady( mountDesignLibrary )
/**
* WordPress dependencies
*/
import domReady from '@wordpress/dom-ready';
/**
* Internal dependencies
*/
import setValidationErrorRowsSeenClass from './set-validation-error-rows-seen-class';
domReady( setValidationErrorRowsSeenClass );
*/
function setupSubscriber() {
let previousBlocks = null;
subscribe( () => {
const blocks = select( "core/editor" ).getBlocks();
if ( blocks !== previousBlocks ) {
recurseBlocks( blocks );
previousBlocks = blocks;
}
} );
}
domReady( setupSubscriber );
export default setupSubscriber;
* This code is incorporated into Image Compare plugin, which is licensed under
* GPLv2+, however you may use Juxtapose code separately under the terms of its
* original MPL 2.0 license if you wish.
*/
/**
* WordPress dependencies
*/
import domReady from '@wordpress/dom-ready';
/**
* Internal dependencies
*/
import './view.scss';
domReady( function () {
const juxtapose = {
sliders: [],
OPTIMIZATION_ACCEPTED: 1,
OPTIMIZATION_WAS_CONSTRAINED: 2,
};
function Graphic( properties, slider ) {
const self = this;
this.image = new Image();
this.loaded = false;
this.image.onload = function () {
self.loaded = true;
slider._onLoaded();
};
}
const observer = new ResizeObserver( handleObservedResize );
galleries.forEach( gallery => {
if ( gallery.getAttribute( 'data-jetpack-block-initialized' ) === 'true' ) {
return;
}
observer.observe( gallery );
gallery.setAttribute( 'data-jetpack-block-initialized', 'true' );
} );
};
if ( typeof window !== 'undefined' ) {
domReady( observeGalleries );
}
* Setup ResizeObserver to follow each gallery on the page
*/
const observeGalleries = () => {
const galleries = getGalleries();
if ( galleries.length === 0 ) {
return;
}
const observer = new ResizeObserver( handleObservedResize );
galleries.forEach( gallery => observer.observe( gallery ) );
};
if ( typeof window !== 'undefined' ) {
domReady( observeGalleries );
}