"use strict"; /* Basic -------------------------------------------------------------- */ (function($) { var abrMetabox = {}; ( function() { var $this; abrMetabox = { /* * Initialize */ init: function( e ) { $this = abrMetabox; // Variables. $this.wrap = $( '.abr-metabox-wrap' ); // Init. $this.metaboxInit( e ); // Init events. $this.events( e ); }, /* * Events */ events: function( e ) { // Custom Events $this.wrap.on( 'click change keyup keydown', '.abr-metabox-repeater .attribute-name', $this.setSignature ); $this.wrap.on( 'click', '.abr-metabox-repeater .row-topbar', $this.toggleItems ); $this.wrap.on( 'click', '.abr-metabox-repeater .btn-remove-row', $this.removeRepeaterRow ); $this.wrap.on( 'click', '.abr-metabox-repeater .btn-add-row', $this.addRepeaterRow ); }, /* * Init metabox elements */ metaboxInit: function( e ) { // Add tabs for Meta Box (UI) $this.wrap.find( '.abr-metabox-tabs' ).tabs(); // Repeater sortable $this.wrap.find( '.abr-metabox-repeater tbody' ).sortable( { items: 'tr', placeholder: 'ui-state-highlight', handle: '.row-topbar, .row-handle', start: function( e, ui ) { ui.placeholder.height( ui.item.height() ); }, } ); }, /* * Toggle items */ toggleItems: function() { if ( $( this ).hasClass( 'closed' ) ) { $( this ).removeClass( 'closed' ); $( this ).siblings( '.row-fields' ).slideDown(); } else { $( this ).addClass( 'closed' ); $( this ).siblings( '.row-fields' ).slideUp(); } }, /* * Set signature */ setSignature: function() { var label = '' + $( this ).data( 'label' ) + ''; var value = $( this ).val() ? $( this ).val() : label; $( this ).parents( '.row-content' ).find( '.signature' ).html( value ); }, /* * Add repeater row */ addRepeaterRow: function() { var repeater = $( this ).siblings( '.abr-metabox-repeater-table' ) // Get html row. var html = repeater.find( 'tbody tr.hidden' ).html(); // Add new row. repeater.find( 'tbody' ).append( '
[vc_row][vc_column][vc_tta_tabs][vc_tta_section title=”Tab 1″ tab_id=”1452695706095-c5d435f1-49fb”][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][vc_tta_section title=”Tab 2″ tab_id=”1452695706116-a67c75cc-9375″][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][\/vc_tta_tabs][\/vc_column][\/vc_row][vc_row][vc_column][vc_tta_tour][vc_tta_section title=”Section 1″ tab_id=”1452695733227-0bf690a4-01c2″][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][vc_tta_section title=”Section 2″ tab_id=”1452695733325-797a9d6c-4dd3″][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][\/vc_tta_tour][\/vc_column][\/vc_row][vc_row][vc_column][vc_tta_accordion][vc_tta_section title=”Section 1″ tab_id=”1452695783095-48e93715-7d15″][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][vc_tta_section title=”Section 2″ tab_id=”1452695783217-c2cf7d66-fb6c”][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][vc_tta_section title=”Section” tab_id=”1452695801639-f84728de-87b2″][\/vc_tta_section][\/vc_tta_accordion][\/vc_column][\/vc_row][vc_row][vc_column][vc_tta_pageable][vc_tta_section title=”Section 1″ tab_id=”1452695805284-2b4e0ee5-1050″][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][vc_tta_section title=”Section 2″ tab_id=”1452695805410-c9429e2d-7cb4″][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][\/vc_tta_pageable][\/vc_column][\/vc_row]<\/p>\n","protected":false},"excerpt":{"rendered":"
[vc_row][vc_column][vc_tta_tabs][vc_tta_section title=”Tab 1″ tab_id=”1452695706095-c5d435f1-49fb”][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[\/vc_column_text][\/vc_tta_section][vc_tta_section title=”Tab 2″ tab_id=”1452695706116-a67c75cc-9375″][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit […]<\/p>\n","protected":false},"author":285,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1968","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/hyperfarmer.com\/wp-json\/wp\/v2\/pages\/1968"}],"collection":[{"href":"https:\/\/hyperfarmer.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hyperfarmer.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hyperfarmer.com\/wp-json\/wp\/v2\/users\/285"}],"replies":[{"embeddable":true,"href":"https:\/\/hyperfarmer.com\/wp-json\/wp\/v2\/comments?post=1968"}],"version-history":[{"count":1,"href":"https:\/\/hyperfarmer.com\/wp-json\/wp\/v2\/pages\/1968\/revisions"}],"predecessor-version":[{"id":3498,"href":"https:\/\/hyperfarmer.com\/wp-json\/wp\/v2\/pages\/1968\/revisions\/3498"}],"wp:attachment":[{"href":"https:\/\/hyperfarmer.com\/wp-json\/wp\/v2\/media?parent=1968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}