1const OHIO_LIBRARY_SOURCE = 'ohio'; 2 3jQuery( window ).on('elementor/frontend/init', () => { 4 if (!window.elementorFrontend || !elementorFrontend.isEditMode()) { 5 return; 6 } 7 8 elementor.templates.component.addTab('templates/ohio', { title: 'Ohio Blocks', getFilter: () => ({ type: 'block', source: OHIO_LIBRARY_SOURCE}) }); 9 10 elementor.hooks.addFilter( 11 'templates/source/is-remote', 12 function(isRemote, activeSource) { 13 let isChildView = false; 14 try { 15 throw new Error(''); 16 } catch(e) { 17 isChildView = e.stack.includes('getChildView'); 18 } 19 20 if (isChildView && activeSource === OHIO_LIBRARY_SOURCE) { 21 return true; 22 } 23 24 return isRemote; 25 } 26 ); 27 28 elementor.hooks.addFilter( 29 'elementor/editor/template-library/template/classes', 30 function(classes, viewInstance) { 31 const source = viewInstance.model.get('source'); 32 33 if (source === OHIO_LIBRARY_SOURCE) { 34 classes += ' elementor-template-library-template-remote'; 35 } 36 37 return classes; 38 } 39 ) 40 41 elementor.templates.getFilter = new Proxy(elementor.templates.getFilter, { 42 apply(target, thisArg, args) { 43 if (thisArg && thisArg.component && thisArg.component.currentTab === 'templates/ohio') { 44 try { 45 throw new Error(''); 46 } catch (e) { 47 if (e.stack.includes('onRenderCollection')) { 48 return 'remote'; 49 } 50 } 51 } 52 53 return Reflect.apply(target, thisArg, args); 54 } 55 }) 56 57 elementor.hooks.addFilter( 58 'elementor/editor/template-library/template/action-button', 59 function ( viewId, templateData ) { 60 if ( templateData && templateData.source === OHIO_LIBRARY_SOURCE && templateData.licenseType === 'envato' ) { 61 return '#tmpl-ohio-source-promo-button'; 62 } 63 64 return viewId; 65 } 66 ); 67});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.