This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
/*!
* WPBakery Page Builder v6.0.0 (https://wpbakery.com)
* Copyright 2011-2019 Michael M, WPBakery
* License: Commercial. More details: http://go.wpbakery.com/licensing
*/
// jscs:disable
// jshint ignore: start
window.vc||(window.vc={}),function($){var ListenerHelper=vc.events={};_.extend(ListenerHelper,Backbone.Events),ListenerHelper.triggerShortcodeEvents=function(eventType,shortcodeModel){var shortcodeTag;shortcodeTag=shortcodeModel.get("shortcode"),this.trigger("shortcodes",shortcodeModel,eventType),this.trigger("shortcodes:"+shortcodeTag,shortcodeModel,eventType),this.trigger("shortcodes:"+eventType,shortcodeModel),this.trigger("shortcodes:"+shortcodeTag+":"+eventType,shortcodeModel),this.trigger("shortcodes:"+shortcodeTag+":"+eventType+":parent:"+shortcodeModel.get("parent_id"),shortcodeModel),this.triggerParamsEvents(eventType,shortcodeModel)},ListenerHelper.triggerParamsEvents=function(eventType,shortcodeModel){var shortcodeTag,params,settings;shortcodeTag=shortcodeModel.get("shortcode"),params=_.extend({},shortcodeModel.get("params")),settings=vc.map[shortcodeTag],_.isArray(settings.params)&&_.each(settings.params,function(paramSettings){this.trigger("shortcodes:"+eventType+":param",shortcodeModel,params[paramSettings.param_name],paramSettings),this.trigger("shortcodes:"+shortcodeTag+":"+eventType+":param",shortcodeModel,params[paramSettings.param_name],paramSettings),this.trigger("shortcodes:"+eventType+":param:type:"+paramSettings.type,shortcodeModel,params[paramSettings.param_name],paramSettings),this.trigger("shortcodes:"+shortcodeTag+":"+eventType+":param:type:"+paramSettings.type,shortcodeModel,params[paramSettings.param_name],paramSettings),this.trigger("shortcodes:"+eventType+":param:name:"+paramSettings.param_name,shortcodeModel,params[paramSettings.param_name],paramSettings),this.trigger("shortcodes:"+shortcodeTag+":"+eventType+":param:name:"+paramSettings.param_name,shortcodeModel,params[paramSettings.param_name],paramSettings)},this)}}(window.jQuery),function($){"use strict";vc.AccessPolicyConstructor=function(){this.accessPolicy={},vc.events.trigger("vc:access:initialize",this)},vc.AccessPolicyConstructor.prototype={accessPolicy:{},add:function(part,grant){grant=!!_.isUndefined(grant)||!!grant,this.accessPolicy[part]=grant},can:function(part){return!!this.accessPolicy[part]}},$(function(){vc.accessPolicy=new vc.AccessPolicyConstructor})}(window.jQuery),function($){"use strict";vc.events.on("vc:access:initialize",function(access){access.add("be_editor",!vc_user_access().isBlockEditorIsEnabled()&&vc_user_access().editor("backend_editor")),access.add("fe_editor",window.vc_frontend_enabled&&vc_user_access().editor("frontend_editor")),access.add("classic_editor",!vc_user_access().check("backend_editor","disabled_ce_editor",void 0,!0)),window.vc.gridItemEditor||vc.events.trigger("vc:access:backend:ready",access)}),vc.events.on("vc:access:backend:ready",function(access){var $buttonsContainer,front,back,gutenberg,$titleDiv,gutenbergEditor;gutenberg=back=front="",$titleDiv=$("div#titlediv"),gutenbergEditor=document.getElementById("editor"),$titleDiv.length?(access.can("fe_editor")&&(front='<a class="wpb_switch-to-front-composer" href="'+$("#wpb-edit-inline").attr("href")+'">'+window.i18nLocale.main_button_title_frontend_editor+"</a>"),access.can("classic_editor")?access.can("be_editor")&&(back='<a class="wpb_switch-to-composer" href="javascript:;">'+window.i18nLocale.main_button_title_backend_editor+"</a>"):($("#postdivrich").addClass("vc-disable-editor"),access.can("be_editor")&&_.defer(function(){vc.events.trigger("vc:backend_editor:show")})),window.wpbIsGutenberg&&(gutenberg='<a class="wpb_switch-to-gutenberg" href="'+window.wpbGutenbergEditorSWitchUrl+'">'+window.i18nLocale.main_button_title_gutenberg+"</a>"),(front||back||gutenberg)&&($buttonsContainer=$titleDiv.length?$('<div class="composer-switch"><div class="composer-inner-switch"><span class="logo-icon"></span>'+back+front+"</div>"+gutenberg+"</div>").insertAfter($titleDiv):$('<div class="composer-switch"><div class="composer-inner-switch"><span class="logo-icon"></span>'+back+front+"</div>"+gutenberg+"</div>").prependTo("#post-body-content"),access.can("classic_editor")&&$buttonsContainer.find(".wpb_switch-to-composer").on("click",function(e){vc.events.trigger("vc:backend_editor:switch")}))):gutenbergEditor&&setTimeout(function(){back='<a class="wpb_switch-to-composer" href="'+window.wpbGutenbergEditorClassicSWitchUrl+'">'+window.i18nLocale.main_button_title+"</a>";var gutenbergEditorHeader=gutenbergEditor.querySelector(".edit-post-header-toolbar");gutenbergEditorHeader&&($buttonsContainer=$('<div class="composer-switch"><div class="composer-inner-switch"><span class="logo-icon"></span>'+back+"</div></div>").appendTo(gutenbergEditorHeader))},1)})}(window.jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,166 @@
/* =========================================================
* templates-preview.js v1.0.0
* =========================================================
* Copyright 2015 WPBakery
*
* WPBakery Page Builder template preview
* ========================================================= */
/* global vc */
(function ( $ ) {
'use strict';
if ( window.vc && vc.visualComposerView ) {
// unset Draggable
window.vc.visualComposerView.prototype.setDraggable = function () {
};
// unset Sortable
window.vc.visualComposerView.prototype.setSortable = function () {
};
// unset Sortable
window.vc.visualComposerView.prototype.setSorting = function () {
};
// unset save
window.vc.visualComposerView.prototype.save = function () {
};
// unset controls checks for scroll
window.vc.visualComposerView.prototype.navOnScroll = function () {
};
window.vc.visualComposerView.prototype.addElement = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
window.vc.visualComposerView.prototype.addTextBlock = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
window.vc.shortcode_view.prototype.events = {};
window.vc.shortcode_view.prototype.editElement = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
window.vc.shortcode_view.prototype.clone = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
window.vc.shortcode_view.prototype.addElement = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
window.vc.shortcode_view.prototype.deleteShortcode = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
window.vc.shortcode_view.prototype.setEmpty = function () {
};
window.vc.visualComposerView.prototype.events = {};
//vc.shortcode_view.prototype.designHelpersSelector = '[data-js-handler-design-helper]';
// update backend getView
window.vc.visualComposerView.prototype.getView = function ( model ) {
var view;
if ( _.isObject( vc.map[ model.get( 'shortcode' ) ] ) && _.isString( vc.map[ model.get( 'shortcode' ) ].js_view ) && vc.map[ model.get( 'shortcode' ) ].js_view.length && !_.isUndefined(
window[ window.vc.map[ model.get( 'shortcode' ) ].js_view ] ) ) {
try {
var viewConstructor = window[ window.vc.map[ model.get( 'shortcode' ) ].js_view ];
viewConstructor.prototype.events = {};
viewConstructor.prototype.setSortable = function () {
};
viewConstructor.prototype.setSorting = function () {
};
viewConstructor.prototype.setDropable = function () {
};
viewConstructor.prototype.editElement = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
viewConstructor.prototype.clone = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
viewConstructor.prototype.addElement = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
viewConstructor.prototype.deleteShortcode = function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
};
viewConstructor.prototype.setEmpty = function () {
};
viewConstructor.prototype.events = {};
// viewConstructor.prototype.designHelpersSelector = '[data-js-handler-design-helper]';
view = new viewConstructor( { model: model } );
} catch ( err ) {
if ( window.console && window.console.warn ) {
window.console.warn( 'template preview getView error', err );
}
}
} else {
window.vc.shortcode_view.prototype.events = {};
view = new vc.shortcode_view( { model: model } );
}
model.set( { view: view } );
return view;
};
}
if ( window.VcGitemView ) {
window.VcGitemView.prototype.setDropable = function () {
};
window.VcGitemView.prototype.setDraggable = function () {
};
window.VcGitemView.prototype.setDraggableC = function () {
};
}
if ( window.vc && window.vc.events ) {
window.vc.events.on( 'shortcodeView:ready', function ( view ) {
if ( window.VcGitemView ) {
view.$el.find( '.vc_control-btn.vc_element-name.vc_element-move .vc_btn-content' ).attr( 'style', 'cursor:pointer !important;' + 'padding-left: 10px !important;' );
view.$el.find( '.vc_control-btn.vc_element-name.vc_element-move .vc_btn-content .vc-c-icon-dragndrop' ).hide();
if ( 'vc_gitem' === view.model.get( 'shortcode' ) ) {
view.$el.find( '.vc_gitem-add-c-col:not(.vc_zone-added)' ).remove();
}
}
if ( view.$el ) {
// remove TTA section append
view.$el.find( '.vc_tta-section-append' ).remove();
// remove old TTA tour append
view.$el.find( '.add_tab_block' ).remove();
view.$el.find( '.tab_controls' ).remove();
// remove single image "add-image" link
view.$el.find( '.column_edit_trigger' ).remove();
}
} );
}
window.vc.visualComposerView.prototype.initializeAccessPolicy = function () {
this.accessPolicy = {
be_editor: true,
fe_editor: false,
classic_editor: false
};
};
window.vc.events.on( 'app.addAll', function () {
if ( parent && parent.vc ) {
parent.vc.templates_panel_view.setTemplatePreviewSize();
}
} );
$( window ).on( 'resize', function () {
parent.vc.templates_panel_view.setTemplatePreviewSize();
} );
})( window.jQuery );

View File

@@ -0,0 +1,28 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeView_vc_line_chart = window.InlineShortcodeView.extend( {
render: function () {
var model_id = this.model.get( 'id' );
window.InlineShortcodeView_vc_line_chart.__super__.render.call( this );
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_line_charts( model_id );
} );
return this;
},
parentChanged: function () {
var modelId = this.model.get( 'id' );
window.InlineShortcodeView_vc_line_chart.__super__.parentChanged.call( this );
_.defer( function () {
vc.frame_window.vc_line_charts( modelId );
} );
return this;
},
remove: function () {
var id = this.$el.find( '.vc_line-chart' ).data( 'vcChartId' );
window.InlineShortcodeView_vc_line_chart.__super__.remove.call( this );
if ( id && undefined !== vc.frame_window.Chart.instances[ id ] ) {
delete vc.frame_window.Chart.instances[ id ];
}
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,25 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeView_vc_pie = window.InlineShortcodeView.extend( {
render: function () {
_.bindAll( this, 'parentChanged' );
window.InlineShortcodeView_vc_pie.__super__.render.call( this );
this.unbindResize();
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_iframe.vc_pieChart();
} );
return this;
},
unbindResize: function () {
vc.frame_window.jQuery( vc.frame_window ).unbind( 'resize.vcPieChartEditable' );
},
parentChanged: function () {
this.$el.find( '.vc_pie_chart' ).removeClass( 'vc_ready' );
vc.frame_window.vc_pieChart();
},
rowsColumnsConverted: function () {
window.setTimeout( this.parentChanged, 200 );
this.parentChanged();
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,28 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeView_vc_round_chart = window.InlineShortcodeView.extend( {
render: function () {
var model_id = this.model.get( 'id' );
window.InlineShortcodeView_vc_round_chart.__super__.render.call( this );
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_round_charts( model_id );
} );
return this;
},
parentChanged: function () {
var modelId = this.model.get( 'id' );
window.InlineShortcodeView_vc_round_chart.__super__.parentChanged.call( this );
_.defer( function () {
vc.frame_window.vc_round_charts( modelId );
} );
return this;
},
remove: function () {
var id = this.$el.find( '.vc_round-chart' ).data( 'vcChartId' );
window.InlineShortcodeView_vc_round_chart.__super__.remove.call( this );
if ( id && undefined !== vc.frame_window.Chart.instances[ id ] ) {
delete vc.frame_window.Chart.instances[ id ];
}
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,145 @@
(function ( $ ) {
'use strict';
window.vc.events.on( 'shortcodeView:updated', function ( model ) {
var modelId, settings;
settings = vc.map[ model.get( 'shortcode' ) ] || false;
if ( true === settings.is_container ) {
modelId = model.get( 'id' );
window.vc.frame_window.vc_iframe.updateChildGrids( modelId );
}
} );
window.InlineShortcodeViewContainer = window.InlineShortcodeView.extend( {
controls_selector: '#vc_controls-template-container',
events: {
'click > .vc_controls .vc_element .vc_control-btn-delete': 'destroy',
'click > .vc_controls .vc_element .vc_control-btn-edit': 'edit',
'click > .vc_controls .vc_element .vc_control-btn-clone': 'clone',
'click > .vc_controls .vc_element .vc_control-btn-prepend': 'prependElement',
'click > .vc_controls .vc_control-btn-append': 'appendElement',
'click > .vc_empty-element': 'appendElement',
'mouseenter': 'resetActive',
'mouseleave': 'holdActive'
},
hold_active: false,
parent_view: false,
initialize: function ( params ) {
_.bindAll( this, 'holdActive' );
window.InlineShortcodeViewContainer.__super__.initialize.call( this, params );
if ( this.model.get( 'parent_id' ) ) {
this.parent_view = vc.shortcodes.get( this.model.get( 'parent_id' ) ).view;
}
},
resetActive: function ( e ) {
if ( this.hold_active ) {
window.clearTimeout( this.hold_active );
}
},
holdActive: function ( e ) {
this.resetActive();
this.$el.addClass( 'vc_hold-active' );
var view = this;
this.hold_active = window.setTimeout( function () {
if ( view.hold_active ) {
window.clearTimeout( view.hold_active );
}
view.hold_active = false;
view.$el.removeClass( 'vc_hold-active' );
}, 700 );
},
content: function () {
if ( false === this.$content ) {
this.$content = this.$el.find( '.vc_container-anchor:first' ).parent();
this.$el.find( '.vc_container-anchor:first' ).remove();
}
return this.$content;
},
render: function () {
window.InlineShortcodeViewContainer.__super__.render.call( this );
this.content().addClass( 'vc_element-container' );
this.$el.addClass( 'vc_container-block' );
return this;
},
changed: function () {
if ( this.allowAddControlOnEmpty() ) {
if ( 0 === this.$el.find( '.vc_element[data-tag]' ).length ) {
this.$el.addClass( 'vc_empty' ).find( '> :first' ).addClass( 'vc_empty-element' );
} else {
this.$el.removeClass( 'vc_empty' ).find( '> .vc_empty-element' ).removeClass( 'vc_empty-element' );
}
}
},
prependElement: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.prepend = true;
window.vc.add_element_block_view.render( this.model, true );
},
appendElement: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
window.vc.add_element_block_view.render( this.model );
},
addControls: function () {
var shortcodeTag, parentShortcodeTag, allAccess, moveAccess, editAccess, parentAllAccess, parentEditAccess, template, parent, data;
shortcodeTag = this.model.get( 'shortcode' );
template = $( this.controls_selector ).html();
var parentName;
parent = vc.shortcodes.get( this.model.get( 'parent_id' ) );
if ( parent ) {
parentName = vc.getMapped( parent.get( 'shortcode' ) ).name;
parentShortcodeTag = parent.get( 'shortcode' );
}
allAccess = vc_user_access().shortcodeAll( shortcodeTag );
editAccess = vc_user_access().shortcodeEdit( shortcodeTag );
parentAllAccess = vc_user_access().shortcodeAll( parentShortcodeTag );
parentEditAccess = vc_user_access().shortcodeEdit( parentShortcodeTag );
moveAccess = vc_user_access().partAccess( 'dragndrop' );
data = {
name: vc.getMapped( shortcodeTag ).name,
tag: shortcodeTag,
parent_name: parentName,
parent_tag: parentShortcodeTag,
can_edit: editAccess,
can_all: allAccess,
moveAccess: moveAccess,
parent_can_edit: parentEditAccess,
parent_can_all: parentAllAccess,
state: vc_user_access().getState( 'shortcodes' ),
allowAdd: this.allowAddControl(),
switcherPrefix: !parentAllAccess || !allAccess ? '-disable-switcher' : ''
};
var compiledTemplate = vc.template( _.unescape( template ),
_.extend( {}, vc.templateOptions.custom, { evaluate: /\{#([\s\S]+?)#}/g } ) );
this.$controls = $( compiledTemplate( data ).trim() ).addClass( 'vc_controls' );
this.$controls.appendTo( this.$el );
},
allowAddControl: function () {
return 'edit' !== vc_user_access().getState( 'shortcodes' );
},
multi_edit: function ( e ) {
var models = [], parent, children;
if ( e && e.preventDefault ) {
e.preventDefault();
}
if ( this.model.get( 'parent_id' ) ) {
parent = vc.shortcodes.get( this.model.get( 'parent_id' ) );
}
if ( parent ) {
models.push( parent );
children = vc.shortcodes.where( { parent_id: parent.get( 'id' ) } );
window.vc.multi_edit_element_block_view.render( models.concat( children ), this.model.get( 'id' ) );
} else {
window.vc.edit_element_block_view.render( this.model );
}
},
allowAddControlOnEmpty: function () {
return 'edit' !== vc_user_access().getState( 'shortcodes' );
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,72 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeViewContainerWithParent = window.InlineShortcodeViewContainer.extend( {
controls_selector: '#vc_controls-template-container-with-parent',
events: {
'click > .vc_controls .vc_element .vc_control-btn-delete': 'destroy',
'click > .vc_controls .vc_element .vc_control-btn-edit': 'edit',
'click > .vc_controls .vc_element .vc_control-btn-clone': 'clone',
'click > .vc_controls .vc_element .vc_control-btn-prepend': 'prependElement',
'click > .vc_controls .vc_control-btn-append': 'appendElement',
'click > .vc_controls .vc_parent .vc_control-btn-delete': 'destroyParent',
'click > .vc_controls .vc_parent .vc_control-btn-edit': 'editParent',
'click > .vc_controls .vc_parent .vc_control-btn-clone': 'cloneParent',
'click > .vc_controls .vc_parent .vc_control-btn-prepend': 'addSibling',
'click > .vc_controls .vc_parent .vc_control-btn-layout': 'changeLayout',
'click > .vc_empty-element': 'appendElement',
'click > .vc_controls .vc_control-btn-switcher': 'switchControls',
'mouseenter': 'resetActive',
'mouseleave': 'holdActive'
},
destroyParent: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.parent_view.destroy( e );
},
cloneParent: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.parent_view.clone( e );
},
editParent: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.parent_view.edit( e );
},
addSibling: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.parent_view.addElement( e );
},
changeLayout: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.parent_view.changeLayout( e );
},
switchControls: function ( e ) {
var $control, $parent, $current;
if ( e && e.preventDefault ) {
e.preventDefault();
}
vc.unsetHoldActive();
$control = $( e.currentTarget );
$parent = $control.parent();
// $parentAdvanced = $parent.find( '.vc_advanced' );
//$parentAdvanced.width( 30 * $parentAdvanced.find( '.vc_control-btn' ).length );
$parent.addClass( 'vc_active' );
$current = $parent.siblings( '.vc_active' );
//$current.find( '.vc_advanced' ).width( 0 );
$current.removeClass( 'vc_active' );
if ( !$current.hasClass( 'vc_element' ) ) {
window.setTimeout( this.holdActive, 500 );
}
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,125 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeView_vc_column = window.InlineShortcodeViewContainerWithParent.extend( {
controls_selector: '#vc_controls-template-vc_column',
resizeDomainName: 'columnSize',
_x: 0,
css_width: 12,
prepend: false,
initialize: function ( params ) {
window.InlineShortcodeView_vc_column.__super__.initialize.call( this, params );
_.bindAll( this, 'startChangeSize', 'stopChangeSize', 'resize' );
},
render: function () {
var width;
window.InlineShortcodeView_vc_column.__super__.render.call( this );
this.prepend = false;
// Here goes width logic
$( '<div class="vc_resize-bar"></div>' )
.appendTo( this.$el )
.mousedown( this.startChangeSize );
this.setColumnClasses();
this.customCssClassReplace();
return this;
},
destroy: function ( e ) {
var parent_id = this.model.get( 'parent_id' );
window.InlineShortcodeView_vc_column.__super__.destroy.call( this, e );
if ( !vc.shortcodes.where( { parent_id: parent_id } ).length ) {
vc.shortcodes.get( parent_id ).destroy();
}
},
customCssClassReplace: function () {
var css_classes, css_regex, class_match;
css_classes = this.$el.find( '.wpb_column' ).attr( 'class' );
css_regex = /.*(vc_custom_\d+).*/;
class_match = css_classes && css_classes.match ? css_classes.match( css_regex ) : false;
if ( class_match && class_match[ 1 ] ) {
this.$el.addClass( class_match[ 1 ] );
this.$el.find( '.wpb_column' ).attr( 'class', css_classes.replace( class_match[ 1 ], '' ).trim() );
}
},
setColumnClasses: function () {
var offset, width, $content;
offset = this.getParam( 'offset' ) || '';
width = this.getParam( 'width' ) || '1/1';
$content = this.$el.find( '> .wpb_column' );
this.css_class_width = this.convertSize( width );
if ( this.css_class_width !== width ) {
this.css_class_width = this.css_class_width.replace( /[^\d]/g, '' );
}
$content.removeClass( 'vc_col-sm-' + this.css_class_width );
if ( !offset.match( /vc_col\-sm\-\d+/ ) ) {
this.$el.addClass( 'vc_col-sm-' + this.css_class_width );
}
if ( vc.responsive_disabled ) {
offset = offset.replace( /vc_col\-(lg|md|xs)[^\s]*/g, '' );
}
if ( !_.isEmpty( offset ) ) {
$content.removeClass( offset );
this.$el.addClass( offset );
}
},
startChangeSize: function ( e ) {
var width = this.getParam( width ) || 12;
this._grid_step = this.parent_view.$el.width() / width;
vc.frame_window.jQuery( 'body' ).addClass( 'vc_column-dragging' ).disableSelection();
this._x = parseInt( e.pageX, 10 );
vc.$page.bind( 'mousemove.' + this.resizeDomainName, this.resize );
$( vc.frame_window.document ).on( 'mouseup', this.stopChangeSize );
},
stopChangeSize: function () {
this._x = 0;
vc.frame_window.jQuery( 'body' ).removeClass( 'vc_column-dragging' ).enableSelection();
vc.$page.unbind( 'mousemove.' + this.resizeDomainName );
},
resize: function ( e ) {
var width, old_width, diff, params = this.model.get( 'params' );
diff = e.pageX - this._x;
if ( Math.abs( diff ) < this._grid_step ) {
return;
}
this._x = parseInt( e.pageX, 10 );
old_width = '' + this.css_class_width;
if ( 0 < diff ) {
this.css_class_width += 1;
} else if ( 0 > diff ) {
this.css_class_width -= 1;
}
if ( 12 < this.css_class_width ) {
this.css_class_width = 12;
}
if ( 1 > this.css_class_width ) {
this.css_class_width = 1;
}
params.width = vc.getColumnSize( this.css_class_width );
this.model.save( { params: params }, { silent: true } );
this.$el.removeClass( 'vc_col-sm-' + old_width ).addClass( 'vc_col-sm-' + this.css_class_width );
},
convertSize: function ( width ) {
var prefix, numbers, range, num, dev;
prefix = 'vc_col-sm-';
numbers = width ? width.split( '/' ) : [
1,
1
];
range = _.range( 1, 13 );
num = !_.isUndefined( numbers[ 0 ] ) && 0 <= _.indexOf( range,
parseInt( numbers[ 0 ], 10 ) ) ? parseInt( numbers[ 0 ], 10 ) : false;
dev = !_.isUndefined( numbers[ 1 ] ) && 0 <= _.indexOf( range,
parseInt( numbers[ 1 ], 10 ) ) ? parseInt( numbers[ 1 ], 10 ) : false;
// Custom fix for 5 columns grid
if ( '5' === numbers[ 1 ] ) {
return width;
}
if ( false !== num && false !== dev ) {
return prefix + (12 * num / dev);
}
return prefix + '12';
},
allowAddControl: function () {
return vc_user_access().shortcodeAll( 'vc_column' );
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,4 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_column_inner = window.InlineShortcodeView_vc_column.extend( {} );
})();

View File

@@ -0,0 +1,160 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeView_vc_row = window.InlineShortcodeView.extend( {
column_tag: 'vc_column',
events: {
'mouseenter': 'removeHoldActive'
},
layout: 1,
addControls: function () {
this.$controls = $( '<div class="no-controls"></div>' );
this.$controls.appendTo( this.$el );
return this;
},
render: function () {
var $content = this.content();
if ( $content && $content.hasClass( 'vc_row-has-fill' ) ) {
$content.removeClass( 'vc_row-has-fill' );
this.$el.addClass( 'vc_row-has-fill' );
}
window.InlineShortcodeView_vc_row.__super__.render.call( this );
return this;
},
removeHoldActive: function () {
vc.unsetHoldActive();
},
addColumn: function () {
vc.builder.create( {
shortcode: this.column_tag,
parent_id: this.model.get( 'id' )
} ).render();
},
addElement: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.addColumn();
},
changeLayout: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.layoutEditor().render( this.model ).show();
},
layoutEditor: function () {
if ( _.isUndefined( vc.row_layout_editor ) ) {
vc.row_layout_editor = new vc.RowLayoutUIPanelFrontendEditor( { el: $( '#vc_ui-panel-row-layout' ) } );
}
return vc.row_layout_editor;
},
convertToWidthsArray: function ( string ) {
return _.map( string.split( /_/ ), function ( c ) {
var w = c.split( '' );
w.splice( Math.floor( c.length / 2 ), 0, '/' );
return w.join( '' );
} );
},
changed: function () {
window.InlineShortcodeView_vc_row.__super__.changed.call( this );
this.addLayoutClass();
},
content: function () {
if ( false === this.$content ) {
this.$content = this.$el.find( '.vc_container-anchor:first' ).parent();
}
this.$el.find( '.vc_container-anchor:first' ).remove();
return this.$content;
},
addLayoutClass: function () {
this.$el.removeClass( 'vc_layout_' + this.layout );
this.layout = _.reject( vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ), function ( model ) {
return model.get( 'deleted' );
} ).length;
this.$el.addClass( 'vc_layout_' + this.layout );
},
convertRowColumns: function ( layout, builder ) {
if ( !layout ) {
return false;
}
var column_params, new_model, columns_contents, columns;
columns_contents = [];
columns = this.convertToWidthsArray( layout );
vc.layout_change_shortcodes = [];
vc.layout_old_columns = vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } );
_.each( vc.layout_old_columns, function ( column ) {
column.set( 'deleted', true );
columns_contents.push( {
shortcodes: vc.shortcodes.where( { parent_id: column.get( 'id' ) } ),
params: column.get( 'params' )
} );
} );
_.each( columns, function ( column ) {
var prev_settings = columns_contents.shift();
if ( _.isObject( prev_settings ) ) {
new_model = builder.create( {
shortcode: this.column_tag,
parent_id: this.model.get( 'id' ),
order: vc.shortcodes.nextOrder(),
params: _.extend( {}, prev_settings.params, { width: column } )
} ).last();
_.each( prev_settings.shortcodes, function ( shortcode ) {
shortcode.save( {
parent_id: new_model.get( 'id' ),
order: vc.shortcodes.nextOrder()
},
{ silent: true } );
vc.layout_change_shortcodes.push( shortcode );
}, this );
} else {
column_params = { width: column };
new_model = builder.create( {
shortcode: this.column_tag,
parent_id: this.model.get( 'id' ),
order: vc.shortcodes.nextOrder(),
params: column_params
} ).last();
}
}, this );
_.each( columns_contents, function ( column ) {
_.each( column.shortcodes, function ( shortcode ) {
shortcode.save( {
parent_id: new_model.get( 'id' ),
order: vc.shortcodes.nextOrder()
},
{ silent: true } );
vc.layout_change_shortcodes.push( shortcode );
if ( shortcode.view.rowsColumnsConverted ) {
shortcode.view.rowsColumnsConverted();
}
}, this );
}, this );
builder.render( function () {
_.each( vc.layout_change_shortcodes, function ( shortcode ) {
shortcode.trigger( 'change:parent_id' );
if ( shortcode.view.rowsColumnsConverted ) {
shortcode.view.rowsColumnsConverted();
}
} );
_.each( vc.layout_old_columns, function ( column ) {
column.destroy();
} );
vc.layout_old_columns = [];
vc.layout_change_shortcodes = [];
} );
return columns;
},
allowAddControl: function () {
return 'edit' !== vc_user_access().getState( 'shortcodes' );
},
allowAddControlOnEmpty: function () {
return 'edit' !== vc_user_access().getState( 'shortcodes' );
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,6 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_row_inner = window.InlineShortcodeView_vc_row.extend( {
column_tag: 'vc_column_inner'
} );
})();

View File

@@ -0,0 +1,26 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_section = window.InlineShortcodeViewContainer.extend( {
controls_selector: '#vc_controls-template-container',
initialize: function () {
_.bindAll( this, 'checkSectionWidth' );
window.InlineShortcodeView_vc_section.__super__.initialize.call( this );
vc.frame_window.jQuery( vc.frame_window.document ).off( 'vc-full-width-row-single', this.checkSectionWidth );
vc.frame_window.jQuery( vc.frame_window.document ).on( 'vc-full-width-row-single', this.checkSectionWidth );
},
checkSectionWidth: function ( e, data ) {
if ( data.el.hasClass( 'vc_section' ) && data.el.attr( 'data-vc-stretch-content' ) ) {
data.el.siblings( '.vc_controls' ).find( '.vc_controls-out-tl' ).css( { left: data.offset - 17 } );
}
},
render: function () {
var $content = this.content();
if ( $content && $content.hasClass( 'vc_row-has-fill' ) ) {
$content.removeClass( 'vc_row-has-fill' );
this.$el.addClass( 'vc_row-has-fill' );
}
return window.InlineShortcodeView_vc_section.__super__.render.call( this );
}
} );
})();

View File

@@ -0,0 +1,18 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_column_text = window.InlineShortcodeView.extend( {
initialize: function ( options ) {
window.InlineShortcodeView_vc_column_text.__super__.initialize.call( this, options );
_.bindAll( this, 'setupEditor', 'updateContent' );
},
setupEditor: function ( ed ) {
ed.on( 'keyup', this.updateContent );
},
updateContent: function () {
var params = this.model.get( 'params' );
params.content = tinyMCE.activeEditor.getContent();
this.model.save( { params: params }, { silent: true } );
}
} );
})();

View File

@@ -0,0 +1,14 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_flickr = window.InlineShortcodeView.extend( {
render: function () {
window.InlineShortcodeView_vc_flickr.__super__.render.call( this );
var $placeholder = this.$el.find( '.vc_flickr-inline-placeholder' );
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_iframe.vc_Flickr( $placeholder );
} );
return this;
}
} );
})();

View File

@@ -0,0 +1,14 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_posts_slider = window.InlineShortcodeView.extend( {
render: function () {
var model_id = this.model.get( 'id' );
window.InlineShortcodeView_vc_posts_slider.__super__.render.call( this );
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_iframe.vc_postsSlider( model_id );
} );
return this;
}
} );
})();

View File

@@ -0,0 +1,12 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_raw_js = window.InlineShortcodeView.extend( {
render: function () {
window.InlineShortcodeView_vc_raw_js.__super__.render.call( this );
var script = this.$el.find( '.vc_js_inline_holder' ).val();
this.$el.find( '.wpb_wrapper' ).html( script );
return this;
}
} );
})();

View File

@@ -0,0 +1,14 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_toggle = window.InlineShortcodeView.extend( {
render: function () {
var model_id = this.model.get( 'id' );
window.InlineShortcodeView_vc_toggle.__super__.render.call( this );
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_iframe.vc_toggle( model_id );
} );
return this;
}
} );
})();

View File

@@ -0,0 +1,64 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeView_vc_accordion = window.InlineShortcodeView_vc_row.extend( {
events: {
'click > .wpb_accordion > .vc_empty-element': 'addElement'
},
render: function () {
_.bindAll( this, 'stopSorting' );
this.$accordion = this.$el.find( '> .wpb_accordion' );
window.InlineShortcodeView_vc_accordion.__super__.render.call( this );
return this;
},
changed: function () {
if ( this.allowAddControlOnEmpty() && 0 === this.$el.find( '.vc_element[data-tag]' ).length ) {
this.$el.addClass( 'vc_empty' ).find( '> :first' ).addClass( 'vc_empty-element' );
} else {
if ( this.allowAddControlOnEmpty() ) {
this.$el.removeClass( 'vc_empty' ).find( '> .vc_empty-element' ).removeClass( 'vc_empty-element' );
}
this.setSorting();
}
},
buildAccordion: function ( active_model ) {
var active = false;
if ( active_model ) {
active = this.$accordion.find( '[data-model-id=' + active_model.get( 'id' ) + ']' ).index();
}
vc.frame_window.vc_iframe.buildAccordion( this.$accordion, active );
},
setSorting: function () {
vc.frame_window.vc_iframe.setAccordionSorting( this );
},
beforeUpdate: function () {
this.$el.find( '.wpb_accordion_heading' ).remove();
window.InlineShortcodeView_vc_accordion.__super__.beforeUpdate.call( this );
},
stopSorting: function () {
this.$accordion.find( '> .wpb_accordion_wrapper > .vc_element[data-tag]' ).each( function () {
var model = vc.shortcodes.get( $( this ).data( 'modelId' ) );
model.save( { order: $( this ).index() }, { silent: true } );
} );
},
addElement: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
new vc.ShortcodesBuilder()
.create( {
shortcode: 'vc_accordion_tab',
params: { title: window.i18nLocale.section },
parent_id: this.model.get( 'id' )
} )
.render();
},
rowsColumnsConverted: function () {
_.each( vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ), function ( model ) {
if ( model.view.rowsColumnsConverted ) {
model.view.rowsColumnsConverted();
}
} );
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,55 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_accordion_tab = window.InlineShortcodeView_vc_tab.extend( {
events: {
'click > .vc_controls .vc_element .vc_control-btn-delete': 'destroy',
'click > .vc_controls .vc_element .vc_control-btn-edit': 'edit',
'click > .vc_controls .vc_element .vc_control-btn-clone': 'clone',
'click > .vc_controls .vc_element .vc_control-btn-prepend': 'prependElement',
'click > .vc_controls .vc_control-btn-append': 'appendElement',
'click > .vc_controls .vc_parent .vc_control-btn-delete': 'destroyParent',
'click > .vc_controls .vc_parent .vc_control-btn-edit': 'editParent',
'click > .vc_controls .vc_parent .vc_control-btn-clone': 'cloneParent',
'click > .vc_controls .vc_parent .vc_control-btn-prepend': 'addSibling',
'click > .wpb_accordion_section > .vc_empty-element': 'appendElement',
'click > .vc_controls .vc_control-btn-switcher': 'switchControls',
'mouseenter': 'resetActive',
'mouseleave': 'holdActive'
},
changed: function () {
if ( this.allowAddControlOnEmpty() && 0 === this.$el.find( '.vc_element[data-tag]' ).length ) {
this.$el.addClass( 'vc_empty' );
this.content().addClass( 'vc_empty-element' );
} else {
this.$el.removeClass( 'vc_empty' );
this.content().removeClass( 'vc_empty-element' );
}
},
render: function () {
window.InlineShortcodeView_vc_tab.__super__.render.call( this );
if ( !this.content().find( '.vc_element[data-tag]' ).length ) {
this.content().empty();
}
this.parent_view.buildAccordion( !this.model.get( 'from_content' ) && !this.model.get( 'default_content' ) ? this.model : false );
return this;
},
rowsColumnsConverted: function () {
_.each( vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ), function ( model ) {
if ( model.view.rowsColumnsConverted ) {
model.view.rowsColumnsConverted();
}
} );
},
destroy: function ( e ) {
var parent_id = this.model.get( 'parent_id' );
window.InlineShortcodeView_vc_accordion_tab.__super__.destroy.call( this, e );
if ( !vc.shortcodes.where( { parent_id: parent_id } ).length ) {
vc.shortcodes.get( parent_id ).destroy();
}
},
allowAddControl: function () {
return vc_user_access().shortcodeAll( 'vc_accordion_tab' );
}
} );
})();

View File

@@ -0,0 +1,90 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_tab = window.InlineShortcodeViewContainerWithParent.extend( {
controls_selector: '#vc_controls-template-vc_tab',
render: function () {
var tab_id, active, params;
params = this.model.get( 'params' );
window.InlineShortcodeView_vc_tab.__super__.render.call( this );
this.$tab = this.$el.find( '> :first' );
/**
* @deprecated 4.4.3
* @see composer-atts.js vc.atts.tab_id.addShortcode
*/
if ( _.isEmpty( params.tab_id ) ) {
params.tab_id = vc_guid() + '-' + Math.floor( Math.random() * 11 );
this.model.save( 'params', params );
tab_id = 'tab-' + params.tab_id;
this.$tab.attr( 'id', tab_id );
} else {
tab_id = this.$tab.attr( 'id' );
}
this.$el.attr( 'id', tab_id );
this.$tab.attr( 'id', tab_id + '-real' );
if ( !this.$tab.find( '.vc_element[data-tag]' ).length ) {
this.$tab.empty();
}
this.$el.addClass( 'ui-tabs-panel wpb_ui-tabs-hide' );
this.$tab.removeClass( 'ui-tabs-panel wpb_ui-tabs-hide' );
if ( this.parent_view && this.parent_view.addTab ) {
if ( !this.parent_view.addTab( this.model ) ) {
this.$el.removeClass( 'wpb_ui-tabs-hide' );
}
}
active = this.doSetAsActive();
this.parent_view.buildTabs( active );
return this;
},
allowAddControl: function () {
return vc_user_access().shortcodeAll( 'vc_tab' );
},
doSetAsActive: function () {
var active_before_cloned = this.model.get( 'active_before_cloned' );
if ( !this.model.get( 'from_content' ) && !this.model.get( 'default_content' ) && _.isUndefined(
active_before_cloned ) ) {
return this.model;
} else if ( !_.isUndefined( active_before_cloned ) ) {
this.model.unset( 'active_before_cloned' );
if ( true === active_before_cloned ) {
return this.model;
}
}
return false;
},
removeView: function ( model ) {
window.InlineShortcodeView_vc_tab.__super__.removeView.call( this, model );
if ( this.parent_view && this.parent_view.removeTab ) {
this.parent_view.removeTab( model );
}
},
clone: function ( e ) {
var clone, params, builder;
if ( e && e.preventDefault ) {
e.preventDefault();
}
if ( e && e.stopPropagation ) {
e.stopPropagation();
}
vc.clone_index /= 10;
clone = this.model.clone();
params = clone.get( 'params' );
builder = new vc.ShortcodesBuilder();
var new_model = vc.CloneModel( builder, this.model, this.model.get( 'parent_id' ) );
var active_model = this.parent_view.active_model_id;
var that = this;
builder.render( function () {
if ( that.parent_view.cloneTabAfter ) {
that.parent_view.cloneTabAfter( new_model );
}
} );
},
rowsColumnsConverted: function () {
_.each( vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ), function ( model ) {
if ( model.view.rowsColumnsConverted ) {
model.view.rowsColumnsConverted();
}
} );
}
} );
})();

View File

@@ -0,0 +1,187 @@
(function ( $ ) {
'use strict';
window.vc.cloneMethod_vc_tab = function ( data, model ) {
data.params = _.extend( {}, data.params );
data.params.tab_id = vc_guid() + '-cl';
if ( !_.isUndefined( model.get( 'active_before_cloned' ) ) ) {
data.active_before_cloned = model.get( 'active_before_cloned' );
}
return data;
};
window.InlineShortcodeView_vc_tabs = window.InlineShortcodeView_vc_row.extend( {
events: {
'click > :first > .vc_empty-element': 'addElement',
'click > :first > .wpb_wrapper > .ui-tabs-nav > li': 'setActiveTab'
},
already_build: false,
active_model_id: false,
$tabsNav: false,
active: 0,
render: function () {
_.bindAll( this, 'stopSorting' );
this.$tabs = this.$el.find( '> .wpb_tabs' );
window.InlineShortcodeView_vc_tabs.__super__.render.call( this );
this.buildNav();
return this;
},
buildNav: function () {
var $nav = this.tabsControls();
this.$tabs.find( '> .wpb_wrapper > .vc_element[data-tag="vc_tab"]' ).each( function ( key ) {
$( 'li:eq(' + key + ')', $nav ).attr( 'data-m-id', $( this ).data( 'model-id' ) );
} );
},
changed: function () {
if ( this.allowAddControlOnEmpty() && 0 === this.$el.find( '.vc_element[data-tag]' ).length ) {
this.$el.addClass( 'vc_empty' ).find( '> :first > div' ).addClass( 'vc_empty-element' );
} else {
this.$el.removeClass( 'vc_empty' ).find( '> :first > div' ).removeClass( 'vc_empty-element' );
}
this.setSorting();
},
setActiveTab: function ( e ) {
var $tab = $( e.currentTarget );
this.active_model_id = $tab.data( 'm-id' );
},
tabsControls: function () {
return this.$tabsNav ? this.$tabsNav : this.$tabsNav = this.$el.find( '.wpb_tabs_nav' );
},
buildTabs: function ( active_model ) {
if ( active_model ) {
this.active_model_id = active_model.get( 'id' );
this.active = this.tabsControls().find( '[data-m-id=' + this.active_model_id + ']' ).index();
}
if ( false === this.active_model_id ) {
var active_el = this.tabsControls().find( 'li:first' );
this.active = active_el.index();
this.active_model_id = active_el.data( 'm-id' );
}
if ( !this.checkCount() ) {
window.vc.frame_window.vc_iframe.buildTabs( this.$tabs, this.active );
}
},
checkCount: function () {
return this.$tabs.find( '> .wpb_wrapper > .vc_element[data-tag="vc_tab"]' ).length != this.$tabs.find( '> .wpb_wrapper > .vc_element.vc_vc_tab' ).length;
},
beforeUpdate: function () {
this.$tabs.find( '.wpb_tabs_heading' ).remove();
window.vc.frame_window.vc_iframe.destroyTabs( this.$tabs );
},
updated: function () {
window.InlineShortcodeView_vc_tabs.__super__.updated.call( this );
this.$tabs.find( '.wpb_tabs_nav:first' ).remove();
this.buildNav();
window.vc.frame_window.vc_iframe.buildTabs( this.$tabs );
this.setSorting();
},
rowsColumnsConverted: function () {
_.each( window.vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ), function ( model ) {
if ( model.view.rowsColumnsConverted ) {
model.view.rowsColumnsConverted();
}
} );
},
addTab: function ( model ) {
if ( this.updateIfExistTab( model ) ) {
return false;
}
var $control = this.buildControlHtml( model ),
$cloned_tab;
if ( model.get( 'cloned' ) && ($cloned_tab = this.tabsControls().find( '[data-m-id=' + model.get( 'cloned_from' ).id + ']' )).length ) {
if ( !model.get( 'cloned_appended' ) ) {
$control.appendTo( this.tabsControls() );
model.set( 'cloned_appended', true );
}
} else {
$control.appendTo( this.tabsControls() );
}
this.changed();
return true;
},
cloneTabAfter: function ( model ) {
this.$tabs.find( '> .wpb_wrapper > .wpb_tabs_nav > div' ).remove();
this.buildTabs( model );
},
updateIfExistTab: function ( model ) {
var $tab = this.tabsControls().find( '[data-m-id=' + model.get( 'id' ) + ']' );
if ( $tab.length ) {
$tab.attr( 'aria-controls', 'tab-' + model.getParam( 'tab_id' ) )
.find( 'a' )
.attr( 'href', '#tab-' + model.getParam( 'tab_id' ) )
.text( model.getParam( 'title' ) );
return true;
}
return false;
},
buildControlHtml: function ( model ) {
var params = model.get( 'params' ),
$tab = $( '<li data-m-id="' + model.get( 'id' ) + '"><a href="#tab-' + model.getParam( 'tab_id' ) + '"></a></li>' );
$tab.data( 'model', model );
$tab.find( '> a' ).text( model.getParam( 'title' ) );
return $tab;
},
addElement: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
new window.vc.ShortcodesBuilder()
.create( {
shortcode: 'vc_tab',
params: {
tab_id: vc_guid() + '-' + this.tabsControls().find( 'li' ).length,
title: this.getDefaultTabTitle()
},
parent_id: this.model.get( 'id' )
} )
.render();
},
getDefaultTabTitle: function () {
return window.i18nLocale.tab;
},
setSorting: function () {
if ( this.hasUserAccess() ) {
window.vc.frame_window.vc_iframe.setTabsSorting( this );
}
},
stopSorting: function ( event, ui ) {
this.tabsControls().find( '> li' ).each( function ( key, value ) {
var model = $( this ).data( 'model' );
model.save( { order: key }, { silent: true } );
} );
},
placeElement: function ( $view, activity ) {
var model = window.vc.shortcodes.get( $view.data( 'modelId' ) );
if ( model && model.get( 'place_after_id' ) ) {
$view.insertAfter( window.vc.$page.find( '[data-model-id=' + model.get( 'place_after_id' ) + ']' ) );
model.unset( 'place_after_id' );
} else {
$view.insertAfter( this.tabsControls() );
}
this.changed();
},
removeTab: function ( model ) {
if ( 1 === window.vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ).length ) {
return this.model.destroy();
}
var $tab = this.tabsControls().find( '[data-m-id=' + model.get( 'id' ) + ']' ),
index = $tab.index();
if ( this.tabsControls().find( '[data-m-id]:eq(' + (index + 1) + ')' ).length ) {
window.vc.frame_window.vc_iframe.setActiveTab( this.$tabs, (index + 1) );
} else if ( this.tabsControls().find( '[data-m-id]:eq(' + (index - 1) + ')' ).length ) {
window.vc.frame_window.vc_iframe.setActiveTab( this.$tabs, (index - 1) );
} else {
window.vc.frame_window.vc_iframe.setActiveTab( this.$tabs, 0 );
}
$tab.remove();
},
clone: function ( e ) {
_.each( window.vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ), function ( model ) {
model.set( 'active_before_cloned', this.active_model_id === model.get( 'id' ) );
}, this );
window.InlineShortcodeView_vc_tabs.__super__.clone.call( this, e );
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,21 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_tour = window.InlineShortcodeView_vc_tabs.extend( {
render: function () {
_.bindAll( this, 'stopSorting' );
this.$tabs = this.$el.find( '> .wpb_tour' );
window.InlineShortcodeView_vc_tabs.__super__.render.call( this );
this.buildNav();
return this;
},
beforeUpdate: function () {
this.$tabs.find( '.wpb_tour_heading,.wpb_tour_next_prev_nav' ).remove();
vc.frame_window.vc_iframe.destroyTabs( this.$tabs );
},
updated: function () {
this.$tabs.find( '.wpb_tour_next_prev_nav' ).appendTo( this.$tabs );
window.InlineShortcodeView_vc_tour.__super__.updated.call( this );
}
} );
})();

View File

@@ -0,0 +1,4 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_carousel = window.InlineShortcodeView_vc_images_carousel.extend( {} );
})();

View File

@@ -0,0 +1,32 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_basic_grid = vc.shortcode_view.extend( {
render: function ( e ) {
window.InlineShortcodeView_vc_basic_grid.__super__.render.call( this, e );
this.initGridJs( true );
return this;
},
parentChanged: function () {
window.InlineShortcodeView_vc_basic_grid.__super__.parentChanged.call( this );
this.initGridJs();
},
initGridJs: function ( useAddActivity ) {
var model = this.model;
if ( true === model.get( 'grid_activity' ) ) {
return false;
}
model.set( 'grid_activity', true );
if ( true === useAddActivity ) {
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_iframe.gridInit( model.get( 'id' ) );
model.set( 'grid_activity', false );
} );
} else {
vc.frame_window.vc_iframe.gridInit( model.get( 'id' ) );
model.set( 'grid_activity', false );
}
}
} );
})();

View File

@@ -0,0 +1,4 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_masonry_grid = window.InlineShortcodeView_vc_basic_grid.extend();
})();

View File

@@ -0,0 +1,4 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_masonry_media_grid = window.InlineShortcodeView_vc_basic_grid.extend();
})();

View File

@@ -0,0 +1,4 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_media_grid = window.InlineShortcodeView_vc_basic_grid.extend();
})();

View File

@@ -0,0 +1,17 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_gallery = window.InlineShortcodeView.extend( {
render: function () {
var model_id = this.model.get( 'id' );
window.InlineShortcodeView_vc_gallery.__super__.render.call( this );
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_iframe.vc_gallery( model_id );
} );
return this;
},
parentChanged: function () {
window.InlineShortcodeView_vc_gallery.__super__.parentChanged.call( this );
vc.frame_window.vc_iframe.vc_gallery( this.model.get( 'id' ) );
}
} );
})();

View File

@@ -0,0 +1,15 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_images_carousel = window.InlineShortcodeView.extend( {
render: function () {
var model_id = this.model.get( 'id' );
window.InlineShortcodeView_vc_images_carousel.__super__.render.call( this );
vc.frame_window.vc_iframe.addActivity( function () {
this.vc_iframe.vc_imageCarousel( model_id );
} );
return this;
}
} );
})();

View File

@@ -0,0 +1,29 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_single_image = window.InlineShortcodeView.extend( {
render: function () {
var model_id = this.model.get( 'id' );
window.InlineShortcodeView_vc_single_image.__super__.render.call( this );
vc.frame_window.vc_iframe.addActivity( function () {
if ( 'undefined' !== typeof (this.vc_image_zoom) ) {
this.vc_image_zoom( model_id );
}
} );
return this;
},
parentChanged: function () {
var model_id = this.model.get( 'id' );
window.InlineShortcodeView_vc_single_image.__super__.parentChanged.call( this );
if ( 'undefined' !== typeof (vc.frame_window.vc_image_zoom) ) {
_.defer( function () {
vc.frame_window.vc_image_zoom( model_id );
} );
}
return this;
}
} );
})();

View File

@@ -0,0 +1,40 @@
(function () {
'use strict';
function ttaMapChildEvents( model ) {
var child_tag = 'vc_tta_section';
window.vc.events.on(
'shortcodes:' + child_tag + ':add:parent:' + model.get( 'id' ),
function ( model ) {
var active_tab_index, models, parent_model;
parent_model = window.vc.shortcodes.get( model.get( 'parent_id' ) );
active_tab_index = parseInt( parent_model.getParam( 'active_section' ), 10 );
if ( 'undefined' === typeof (active_tab_index) ) {
active_tab_index = 1;
}
models = _.pluck( _.sortBy( window.vc.shortcodes.where( { parent_id: parent_model.get( 'id' ) } ),
function ( model ) {
return model.get( 'order' );
} ), 'id' );
if ( models.indexOf( model.get( 'id' ) ) === active_tab_index - 1 ) {
model.set( 'isActiveSection', true );
}
return model;
}
);
window.vc.events.on(
'shortcodes:' + child_tag + ':clone:parent:' + model.get( 'id' ),
function ( model ) {
if ( window.vc.ttaSectionActivateOnClone ) {
model.set( 'isActiveSection', true );
}
window.vc.ttaSectionActivateOnClone = false;
}
);
}
window.vc.events.on( 'shortcodes:vc_tta_accordion:add', ttaMapChildEvents );
window.vc.events.on( 'shortcodes:vc_tta_tabs:add', ttaMapChildEvents );
window.vc.events.on( 'shortcodes:vc_tta_tour:add', ttaMapChildEvents );
window.vc.events.on( 'shortcodes:vc_tta_pageable:add', ttaMapChildEvents );
})();

View File

@@ -0,0 +1,198 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeView_vc_tta_accordion = window.InlineShortcodeViewContainer.extend( {
events: {},
childTag: 'vc_tta_section',
activeClass: 'vc_active',
// controls_selector: '#vc_controls-template-vc_tta_accordion',
defaultSectionTitle: window.i18nLocale.section,
initialize: function () {
_.bindAll( this, 'buildSortable', 'updateSorting' );
window.InlineShortcodeView_vc_tta_accordion.__super__.initialize.call( this );
},
render: function () {
window.InlineShortcodeViewContainer.__super__.render.call( this );
this.content(); // just to remove span inline-container anchor..
this.buildPagination();
return this;
},
addControls: function () {
this.$controls = $( '<div class="no-controls"></div>' );
this.$controls.appendTo( this.$el );
return this;
},
/**
* Add new element to Accordion.
* @param e
*/
addElement: function ( e ) {
if ( e && e.preventDefault ) {
e.preventDefault();
}
this.addSection( 'parent.prepend' === $( e.currentTarget ).data( 'vcControl' ) );
},
appendElement: function ( e ) {
return this.addElement( e );
},
prependElement: function ( e ) {
return this.addElement( e );
},
addSection: function ( prepend ) {
var shortcode, params, i;
shortcode = this.childTag;
params = {
shortcode: shortcode,
parent_id: this.model.get( 'id' ),
isActiveSection: true,
params: {
title: this.defaultSectionTitle
}
};
if ( prepend ) {
vc.activity = 'prepend';
params.order = this.getSiblingsFirstPositionIndex();
}
vc.builder.create( params );
// extend default params with settings presets if there are any
for ( i = vc.builder.models.length - 1; i >= 0; i -- ) {
shortcode = vc.builder.models[ i ].get( 'shortcode' );
}
vc.builder.render();
},
getSiblingsFirstPositionIndex: function () {
var order, first_shortcode;
order = 0;
first_shortcode = vc.shortcodes.sort().findWhere( { parent_id: this.model.get( 'id' ) } );
if ( first_shortcode ) {
order = first_shortcode.get( 'order' ) - 1;
}
return order;
},
changed: function () {
vc.frame_window.vc_iframe.buildTTA();
window.InlineShortcodeView_vc_tta_accordion.__super__.changed.call( this );
_.defer( this.buildSortable );
this.buildPagination();
},
updated: function () {
window.InlineShortcodeView_vc_tta_accordion.__super__.updated.call( this );
_.defer( this.buildSortable );
this.buildPagination();
},
buildSortable: function () {
if ( !vc_user_access().shortcodeEdit( this.model.get( 'shortcode' ) ) ) {
return;
}
if ( this.$el ) {
this.$el.find( '.vc_tta-panels' ).sortable( {
forcePlaceholderSize: true,
placeholder: 'vc_placeholder-row', // TODO: fix placeholder
start: this.startSorting,
over: function ( event, ui ) {
ui.placeholder.css( { maxWidth: ui.placeholder.parent().width() } );
ui.placeholder.removeClass( 'vc_hidden-placeholder' );
},
items: '> .vc_element',
handle: '.vc_tta-panel-heading, .vc_child-element-move',// TODO: change vc_column to vc_tta_section
update: this.updateSorting
} );
}
},
startSorting: function ( event, ui ) {
ui.placeholder.width( ui.item.width() );
},
updateSorting: function ( event, ui ) {
var self = this;
this.getPanelsList().find( '> .vc_element' ).each( function () {
var shortcode, model_id, $this;
$this = $( this );
model_id = $this.data( 'modelId' );
shortcode = vc.shortcodes.get( model_id );
shortcode.save( { 'order': self.getIndex( $this ) }, { silent: true } );
} );
// re-render pagination
this.buildPagination();
},
getIndex: function ( $element ) {
return $element.index();
},
getPanelsList: function () {
return this.$el.find( '.vc_tta-panels' );
},
parentChanged: function () {
window.InlineShortcodeView_vc_tta_accordion.__super__.parentChanged.call( this );
if ( 'undefined' !== typeof (vc.frame_window.vc_round_charts) ) {
vc.frame_window.vc_round_charts( this.model.get( 'id' ) );
}
if ( 'undefined' !== typeof (vc.frame_window.vc_line_charts) ) {
vc.frame_window.vc_line_charts( this.model.get( 'id' ) );
}
},
buildPagination: function () {
},
removePagination: function () {
this.$el.find( '.vc_tta-panels-container' ).find( ' > .vc_pagination' ).remove(); // TODO: check this
},
getPaginationList: function () {
var $accordions, classes, style_chunks, that, html, params;
params = this.model.get( 'params' );
if ( !_.isUndefined( params.pagination_style ) && params.pagination_style.length ) {
$accordions = this.$el.find( '[data-vc-accordion]' );
classes = [];
classes.push( 'vc_general' );
classes.push( 'vc_pagination' );
style_chunks = params.pagination_style.split( '-' );
classes.push( 'vc_pagination-style-' + style_chunks[ 0 ] );
classes.push( 'vc_pagination-shape-' + style_chunks[ 1 ] );
if ( !_.isUndefined( params.pagination_color ) && params.pagination_color.length ) {
classes.push( 'vc_pagination-color-' + params.pagination_color );
}
html = [];
html.push( '<ul class="' + classes.join( ' ' ) + '">' );
that = this;
$accordions.each( function () {
var section_classes, active_section, $this, $closest_panel, selector, a_html;
$this = $( this );
$closest_panel = $this.closest( '.vc_tta-panel' );
active_section = $closest_panel.hasClass( that.activeClass );
section_classes = [ 'vc_pagination-item' ];
if ( active_section ) {
section_classes.push( that.activeClass );
}
selector = $this.attr( 'href' );
if ( 0 !== selector.indexOf( '#' ) ) {
selector = '';
}
if ( $this.attr( 'data-vc-target' ) ) {
selector = $this.attr( 'data-vc-target' );
}
a_html = '<a href="javascript:;" data-vc-target="' + selector + '" class="vc_pagination-trigger" data-vc-tabs data-vc-container=".vc_tta"></a>';
html.push( '<li class="' + section_classes.join( ' ' ) + '" data-vc-tab>' + a_html + '</li>' );
} );
html.push( '</ul>' );
return $( html.join( '' ) );
}
return null;
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,4 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_tta_pageable = window.InlineShortcodeView_vc_tta_tour.extend( {} );
})();

View File

@@ -0,0 +1,141 @@
(function ( $ ) {
'use strict';
window.vc.ttaSectionActivateOnClone = false;
window.InlineShortcodeView_vc_tta_section = window.InlineShortcodeViewContainerWithParent.extend( {
events: {
'click > .vc_controls [data-vc-control="destroy"]': 'destroy',
'click > .vc_controls [data-vc-control="edit"]': 'edit',
'click > .vc_controls [data-vc-control="clone"]': 'clone',
'click > .vc_controls [data-vc-control="prepend"]': 'prependElement',
'click > .vc_controls [data-vc-control="append"]': 'appendElement',
'click > .vc_controls [data-vc-control="parent.destroy"]': 'destroyParent',
'click > .vc_controls [data-vc-control="parent.edit"]': 'editParent',
'click > .vc_controls [data-vc-control="parent.clone"]': 'cloneParent',
'click > .vc_controls [data-vc-control="parent.append"]': 'addSibling',
'click .vc_tta-panel-body > [data-js-panel-body].vc_empty-element': 'appendElement',
'click > .vc_controls .vc_control-btn-switcher': 'switchControls',
'mouseenter': 'resetActive',
'mouseleave': 'holdActive'
},
controls_selector: '#vc_controls-template-vc_tta_section',
previousClasses: false,
activeClass: 'vc_active',
render: function () {
var model = this.model;
window.InlineShortcodeView_vc_tta_section.__super__.render.call( this );
_.bindAll( this, 'bindAccordionEvents' );
this.refreshContent();
this.moveClasses();
_.defer( this.bindAccordionEvents );
if ( this.isAsActiveSection() ) {
window.vc.frame_window.vc_iframe.addActivity( function () {
var $accordion = window.vc.frame_window.jQuery(
'[data-vc-accordion][data-vc-target="[data-model-id=' + model.get( 'id' ) + ']"]' );
$accordion.trigger( 'click' );
} );
}
return this;
},
allowAddControl: function () {
return vc_user_access().shortcodeAll( 'vc_tta_section' );
},
clone: function ( e ) {
vc.ttaSectionActivateOnClone = true;
window.InlineShortcodeView_vc_tta_section.__super__.clone.call( this, e );
},
addSibling: function ( e ) {
window.InlineShortcodeView_vc_tta_section.__super__.addSibling.call( this, e );
},
parentChanged: function () {
window.InlineShortcodeView_vc_tta_section.__super__.parentChanged.call( this );
this.refreshContent( true );
return this;
},
changed: function () {
if ( this.allowAddControlOnEmpty() && 0 === this.$el.find( '.vc_element[data-tag]' ).length ) {
this.$el.addClass( 'vc_empty' ).find( '.vc_tta-panel-body > [data-js-panel-body]' ).addClass(
'vc_empty-element' );
} else {
this.$el.removeClass( 'vc_empty' ).find( '.vc_tta-panel-body > [data-js-panel-body].vc_empty-element' ).removeClass(
'vc_empty-element' );
}
},
moveClasses: function () {
var panelClassName;
if ( this.previousClasses ) {
this.$el.get( 0 ).className = this.$el.get( 0 ).className.replace( this.previousClasses, "" );
}
panelClassName = this.$el.find( '.vc_tta-panel' ).get( 0 ).className;
this.$el.attr( 'data-vc-content', this.$el.find( '.vc_tta-panel' ).data( 'vcContent' ) );
this.previousClasses = panelClassName;
this.$el.find( '.vc_tta-panel' ).get( 0 ).className = "";
this.$el.get( 0 ).className = this.$el.get( 0 ).className + " " + this.previousClasses;
// Fix data-vc-target for accordions:
this.$el.find( '.vc_tta-panel-title [data-vc-target]' ).attr( 'data-vc-target',
'[data-model-id=' + this.model.get( 'id' ) + ']' );
},
refreshContent: function ( noSectionUpdate ) {
var $controlsIcon, $controlsIconsPositionEl, parentModel, parentParams, paramsMap, parentLayout;
parentModel = vc.shortcodes.get( this.model.get( 'parent_id' ) );
if ( _.isObject( parentModel ) ) {
paramsMap = vc.getDefaultsAndDependencyMap( parentModel.get( 'shortcode' ) );
parentParams = _.extend( {}, paramsMap.defaults, parentModel.get( 'params' ) );
$controlsIcon = this.$el.find( '.vc_tta-controls-icon' );
if ( parentParams && !_.isUndefined( parentParams.c_icon ) && 0 < parentParams.c_icon.length ) {
if ( $controlsIcon.length ) {
$controlsIcon.attr( 'data-vc-tta-controls-icon', parentParams.c_icon );
} else {
this.$el.find( '[data-vc-tta-controls-icon-wrapper]' ).append(
$( '<i class="vc_tta-controls-icon" data-vc-tta-controls-icon="' + parentParams.c_icon + '"></i>' )
);
}
if ( !_.isUndefined( parentParams.c_position ) && 0 < parentParams.c_position.length ) {
$controlsIconsPositionEl = this.$el.find( '[data-vc-tta-controls-icon-position]' );
if ( $controlsIconsPositionEl.length ) {
$controlsIconsPositionEl.attr( 'data-vc-tta-controls-icon-position',
parentParams.c_position );
}
}
} else {
$controlsIcon.remove();
this.$el.find( '[data-vc-tta-controls-icon-position]' ).attr( 'data-vc-tta-controls-icon-position',
'' );
}
if ( true !== noSectionUpdate && parentModel.view && parentModel.view.sectionUpdated ) {
parentModel.view.sectionUpdated( this.model );
}
}
},
setAsActiveSection: function ( isActive ) {
this.model.set( 'isActiveSection', !!isActive );
},
isAsActiveSection: function () {
return !!this.model.get( 'isActiveSection' );
},
bindAccordionEvents: function () {
var that = this;
window.vc.frame_window.jQuery( '[data-vc-target="[data-model-id=' + this.model.get( 'id' ) + ']"]' )
.on( 'show.vc.accordion hide.vc.accordion',
function ( e ) {
that.setAsActiveSection( 'show' === e.type );
} );
},
destroy: function ( e ) {
var parentModel, parentId;
parentId = this.model.get( 'parent_id' );
window.InlineShortcodeView_vc_tta_section.__super__.destroy.call( this, e );
parentModel = vc.shortcodes.get( parentId );
if ( !vc.shortcodes.where( { parent_id: parentId } ).length ) {
parentModel.destroy();
} else {
if ( parentModel.view && parentModel.view.removeSection ) {
parentModel.view.removeSection( this.model.get( 'id' ) );
}
}
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,203 @@
(function ( $ ) {
'use strict';
window.InlineShortcodeView_vc_tta_tabs = window.InlineShortcodeView_vc_tta_accordion.extend( {
render: function () {
window.InlineShortcodeView_vc_tta_tabs.__super__.render.call( this );
_.bindAll( this, 'buildSortableNavigation', 'updateSortingNavigation' );
this.createTabs();
_.defer( this.buildSortableNavigation );
return this;
},
createTabs: function () {
var models = _.sortBy( vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ),
function ( model ) {
return model.get( 'order' );
} );
_.each( models, function ( model ) {
this.sectionUpdated( model, true );
}, this );
},
defaultSectionTitle: window.i18nLocale.tab,
addIcon: function ( model, html ) {
var icon, icon_class, icon_html;
if ( 'true' === model.getParam( 'add_icon' ) ) {
icon = model.getParam( 'i_icon_' + model.getParam( 'i_type' ) );
if ( !_.isUndefined( icon ) ) {
icon_class = 'vc_tta-icon' + ' ' + icon;
icon_html = '<i class="' + icon_class + '"></i>';
}
if ( 'right' === model.getParam( 'i_position' ) ) {
html += icon_html;
} else {
html = icon_html + html;
}
}
return html;
},
/**
*
* @param {Backbone.Model}model
*/
sectionUpdated: function ( model, justAppend ) {
// update build tabs, remove/add check orders and title/target
var $tabEl,
$navigation,
sectionId,
html, title, models, index, tabAdded;
tabAdded = false;
sectionId = model.get( 'id' );
$navigation = this.$el.find( '.vc_tta-tabs-container .vc_tta-tabs-list' );
$tabEl = $navigation.find( '[data-vc-target="[data-model-id=' + sectionId + ']"]' );
title = model.getParam( 'title' );
if ( $tabEl.length ) {
html = '<span class="vc_tta-title-text">' + title + '</span>';
html = this.addIcon( model, html );
$tabEl.html( html );
} else {
var $element;
html = '<span class="vc_tta-title-text">' + title + '</span>';
html = this.addIcon( model, html );
$element = $( '<li class="vc_tta-tab" data-vc-target-model-id="' + sectionId + '" data-vc-tab><a href="javascript:;" data-vc-use-cache="false" data-vc-tabs data-vc-target="[data-model-id=' + sectionId + ']" data-vc-container=".vc_tta">' + html + '</a></li>' );
if ( true !== justAppend ) {
models = _.pluck( _.sortBy( vc.shortcodes.where( { parent_id: this.model.get( 'id' ) } ),
function ( childModel ) {
return childModel.get( 'order' );
} ), 'id' );
index = models.indexOf( model.get( 'id' ) ) - 1;
if ( index > - 1 && $navigation.find( '[data-vc-tab]:eq(' + index + ')' ).length ) {
$element.insertAfter( $navigation.find( '[data-vc-tab]:eq(' + index + ')' ) );
tabAdded = true;
}
}
if ( !tabAdded ) {
$element.appendTo( $navigation );
}
if ( model.get( 'isActiveSection' ) ) {
$element.addClass( this.activeClass );
}
}
this.buildPagination();
},
getNextTab: function ( $viewTab ) {
var lastIndex, viewTabIndex, $nextTab, $navigationSections;
$navigationSections = this.$el.find( '.vc_tta-tabs-container .vc_tta-tabs-list' ).children();
lastIndex = $navigationSections.length - 1; // -1 because length starts from 1
viewTabIndex = $viewTab.index();
if ( viewTabIndex !== lastIndex ) {
$nextTab = $navigationSections.eq( viewTabIndex + 1 );
} else {
// If we are the last tab in in navigation lets make active previous
$nextTab = $navigationSections.eq( viewTabIndex - 1 );
}
return $nextTab;
},
removeSection: function ( modelId ) {
var $viewTab, $nextTab, tabIsActive;
$viewTab = this.$el.find( '.vc_tta-tabs-container .vc_tta-tabs-list [data-vc-target="[data-model-id=' + modelId + ']"]' ).parent();
tabIsActive = $viewTab.hasClass( this.activeClass );
// Make next tab active if needed
if ( tabIsActive ) {
$nextTab = this.getNextTab( $viewTab );
vc.frame_window.jQuery( $nextTab ).find( '[data-vc-target]' ).trigger( 'click' );
}
// Remove tab from navigation
$viewTab.remove();
this.buildPagination();
},
buildSortableNavigation: function () {
if ( !vc_user_access().shortcodeEdit( this.model.get( 'shortcode' ) ) ) {
return;
}
// this should be called when new tab added/removed/changed.
this.$el.find( '.vc_tta-tabs-container .vc_tta-tabs-list' ).sortable( {
items: '.vc_tta-tab',
forcePlaceholderSize: true,
placeholder: 'vc_tta-tab vc_placeholder-tta-tab',
helper: this.renderSortingHelper,
start: function ( event, ui ) {
ui.placeholder.width( ui.item.width() );
},
over: function ( event, ui ) {
ui.placeholder.css( { maxWidth: ui.placeholder.parent().width() } );
ui.placeholder.removeClass( 'vc_hidden-placeholder' );
},
update: this.updateSortingNavigation
} );
},
updateSorting: function ( event, ui ) {
window.InlineShortcodeView_vc_tta_tabs.__super__.updateSorting.call( this, event, ui );
this.updateTabsPositions( this.getPanelsList() );
},
updateSortingNavigation: function () {
var $tabs, self;
self = this;
$tabs = this.$el.find( '.vc_tta-tabs-list' );
// we are sorting a tabs navigation
$tabs.find( '> .vc_tta-tab' ).each( function () {
var shortcode, modelId, $li;
$li = $( this ).removeAttr( 'style' ); // TODO: Attensiton maybe e need to create method with filter
modelId = $li.data( 'vcTargetModelId' );
shortcode = vc.shortcodes.get( modelId );
shortcode.save( { 'order': self.getIndex( $li ) }, { silent: true } );
// now we need to sort panels
} );
this.updatePanelsPositions( $tabs );
},
updateTabsPositions: function ( $panels ) {
var $tabs, $elements, tabSortableData;
$tabs = this.$el.find( '.vc_tta-tabs-list' );
if ( $tabs.length ) {
$elements = [];
tabSortableData = $panels.sortable( 'toArray', { attribute: 'data-model-id' } );
_.each( tabSortableData, function ( value ) {
$elements.push( $tabs.find( '[data-vc-target-model-id="' + value + '"]' ) );
}, this );
$tabs.prepend( $elements );
}
this.buildPagination();
},
updatePanelsPositions: function ( $tabs ) {
var $elements, tabSortableData, $panels;
$panels = this.getPanelsList();
$elements = [];
tabSortableData = $tabs.sortable( 'toArray', { attribute: 'data-vc-target-model-id' } );
_.each( tabSortableData, function ( value ) {
$elements.push( $panels.find( '[data-model-id="' + value + '"]' ) );
}, this );
$panels.prepend( $elements );
this.buildPagination();
},
renderSortingHelper: function ( event, currentItem ) {
var helper, currentItemWidth, currentItemHeight;
helper = currentItem;
currentItemWidth = currentItem.width() + 1;
currentItemHeight = currentItem.height();
helper.width( currentItemWidth );
helper.height( currentItemHeight );
return helper;
},
buildPagination: function () {
var params;
this.removePagination();
// If tap-pos top append:
params = this.model.get( 'params' );
if ( !_.isUndefined( params.pagination_style ) && params.pagination_style.length ) {
if ( 'top' === params.tab_position ) {
this.$el.find( '.vc_tta-panels-container' ).append( this.getPaginationList() );
} else {
this.getPaginationList().insertBefore( this.$el.find( '.vc_tta-container .vc_tta-panels' ) );
}
}
}
} );
})( window.jQuery );

View File

@@ -0,0 +1,14 @@
(function () {
'use strict';
window.InlineShortcodeView_vc_tta_tour = window.InlineShortcodeView_vc_tta_tabs.extend( {
defaultSectionTitle: window.i18nLocale.section,
buildPagination: function () {
this.removePagination();
var params = this.model.get( 'params' );
if ( !_.isUndefined( params.pagination_style ) && params.pagination_style.length ) {
this.$el.find( '.vc_tta-panels-container' ).append( this.getPaginationList() );
}
}
} );
})();

View File

@@ -0,0 +1,28 @@
(function ( $ ) {
'use strict';
var minHeight = '340px';
function vc_jwplayer_resize( target ) {
window.jwplayer( target ).onReady( function () {
$( this.container ).css( 'min-height', minHeight );
} );
$( window.jwplayer( target ).container ).css( 'min-height', minHeight );
}
$( document ).on( 'ready', function () {
$( "div" ).filter( function () {
return this.id.match( /^jwplayer\-\d+$/ );
} ).each( function () {
vc_jwplayer_resize( this );
} );
} );
$( window ).on( 'vc_reload', function () {
$( "div" ).filter( function () {
return this.id.match( /^jwplayer\-\d+$/ );
} ).each( function () {
vc_jwplayer_resize( this );
} );
} );
})( window.jQuery );

View File

@@ -0,0 +1,14 @@
(function ( $ ) {
'use strict';
$( document ).on( 'acf/setup_fields', function () {
// Redeclare active editor.
setTimeout( function () {
if ( 'tinymce' === getUserSetting( 'editor' ) ) {
$( '#content-tmce' ).trigger( 'click' );
} else {
$( '#content-html' ).trigger( 'click' );
}
}, 10 );
} );
})( window.jQuery );

View File

@@ -0,0 +1,62 @@
(function ( $ ) {
'use strict';
$( '#content-html' ).on( 'click', function () {
window.setTimeout( function () {
window.wpActiveEditor = 'qtrans_textarea_content';
}, 10 );
} );
$( window ).ready( function () {
var activeLang = qtrans_get_active_language(),
$langs = $( '#vc_vendor_qtranslate_langs' );
$( 'option', $langs ).each( function () {
var $el = $( this );
if ( $el.val() == activeLang ) {
$el.prop( 'selected', true );
}
$( '#qtrans_select_' + $el.val() ).on( 'click', function () {
$el.prop( 'selected', true );
} );
} );
$langs.on( 'change', function () {
$( '#qtrans_select_' + $( this ).val() ).trigger( 'click' );
var link = $( ":selected", this ).attr( 'link' );
$( '.wpb_switch-to-front-composer' ).each( function () {
$( this ).attr( 'href', link );
} );
$( '#wpb-edit-inline' ).attr( 'href', link );
vc.shortcodes.fetch( { reset: true } );
} );
$langs.show();
if ( !window.vc ) {
window.vc = {};
}
vc.QtransResetContent = function () {
$( '#content-html' ).trigger( 'click' );
$( '#qtrans_textarea_content' ).css( 'minHeight', '300px' );
window.wpActiveEditor = 'qtrans_textarea_content';
};
vc.Storage.prototype.getContent = function () {
var content;
vc.QtransResetContent();
content = $( '#qtrans_textarea_content' ).val();
if ( vc.gridItemEditor && !content.length ) {
content = vcDefaultGridItemContent;
}
return content;
};
vc.Storage.prototype.setContent = function ( content ) {
$( '#content-html' ).trigger( 'click' );
$( '#qtrans_textarea_content' ).val( content );
vc.QtransResetContent();
};
} );
})( window.jQuery );

View File

@@ -0,0 +1,30 @@
(function ( $ ) {
'use strict';
$( '#vc_vendor_qtranslate_langs_front' ).on( 'change', function () {
vc.closeActivePanel();
$( '#vc_logo' ).addClass( 'vc_ui-wp-spinner' );
window.location.href = $( this ).val();
} );
vc.ShortcodesBuilder.prototype.getContent = function () {
var output, $postContent, lang, content;
$postContent = $( '#vc_vendor_qtranslate_postcontent' );
lang = $postContent.attr( 'data-lang' );
content = $postContent.val();
vc.shortcodes.sort();
output = this.modelsToString( vc.shortcodes.where( { parent_id: false } ) );
return qtrans_integrate( lang, output, content );
};
vc.ShortcodesBuilder.prototype.getTitle = function () {
var $titleContent, lang, content;
$titleContent = $( '#vc_vendor_qtranslate_posttitle' );
lang = $titleContent.attr( 'data-lang' );
content = $titleContent.val();
return qtrans_integrate( lang, vc.title, content );
};
})( window.jQuery );

View File

@@ -0,0 +1,20 @@
(function ( $ ) {
'use strict';
function hookLanguageSwitch( activeLang ) {
var $inline_href = $( '.wpb_switch-to-front-composer' );
if ( !$inline_href.data( 'raw-url' ) ) {
$inline_href.data( 'raw-url', $inline_href.attr( 'href' ) );
}
var new_url = $inline_href.data( 'raw-url' ) + '&lang=' + activeLang;
$inline_href.attr( 'href', new_url );
vc.shortcodes.fetch( { reset: true } );
}
$( function () {
var qtranslateManager = qTranslateConfig.js.get_qtx();
qtranslateManager.addLanguageSwitchListener( hookLanguageSwitch );
} );
})( window.jQuery );

View File

@@ -0,0 +1,18 @@
(function ( $ ) {
'use strict';
$( '#vc_vendor_qtranslatex_langs_front' ).on( 'change', function () {
vc.closeActivePanel();
$( '#vc_logo' ).addClass( 'vc_ui-wp-spinner' );
window.location.href = $( this ).val();
} );
var native_getContent = vc.ShortcodesBuilder.prototype.getContent;
vc.ShortcodesBuilder.prototype.getContent = function () {
var content = native_getContent();
$( '#content' ).val( content );
return content;
};
})( window.jQuery );

View File

@@ -0,0 +1,26 @@
(function ( $ ) {
'use strict';
$( document ).ready( function () {
$( 'body' ).on( 'adding_to_cart', function ( event, $button, data ) {
if ( $button && $button.hasClass( 'vc_gitem-link' ) ) {
$button
.addClass( 'vc-gitem-add-to-cart-loading-btn' )
.parents( '.vc_grid-item-mini' )
.addClass( 'vc-woocommerce-add-to-cart-loading' )
.append( $( '<div class="vc_wc-load-add-to-loader-wrapper"><div class="vc_wc-load-add-to-loader"></div></div>' ) );
}
} ).on( 'added_to_cart', function ( event, fragments, cart_hash, $button ) {
if ( 'undefined' === typeof ($button) ) {
$button = $( '.vc-gitem-add-to-cart-loading-btn' );
}
if ( $button && $button.hasClass( 'vc_gitem-link' ) ) {
$button
.removeClass( 'vc-gitem-add-to-cart-loading-btn' )
.parents( '.vc_grid-item-mini' )
.removeClass( 'vc-woocommerce-add-to-cart-loading' )
.find( '.vc_wc-load-add-to-loader-wrapper' ).remove();
}
} );
} );
})( window.jQuery );

View File

@@ -0,0 +1,45 @@
if ( !window.ajaxurl ) {
window.ajaxurl = window.location.href;
}
(function ( $ ) {
'use strict';
var vcWoocommerceProductAttributeFilterDependencyCallback;
vcWoocommerceProductAttributeFilterDependencyCallback = function () {
(function ( $, that ) {
var $filterDropdown, $empty;
$filterDropdown = $( '[data-vc-shortcode-param-name="filter"]', that.$content );
$filterDropdown.removeClass( 'vc_dependent-hidden' );
$empty = $( '#filter-empty', $filterDropdown );
if ( $empty.length ) {
$empty.parent().remove();
$( '.edit_form_line', $filterDropdown ).prepend( $( '<div class="vc_checkbox-label"><span>No values found</span></div>' ) );
}
$( 'select[name="attribute"]', that.$content ).on( 'change', function () {
$( '.vc_checkbox-label', $filterDropdown ).remove();
$filterDropdown.removeClass( 'vc_dependent-hidden' );
$.ajax( {
type: 'POST',
dataType: 'json',
url: window.ajaxurl,
data: {
action: 'vc_woocommerce_get_attribute_terms',
attribute: this.value,
_vcnonce: window.vcAdminNonce
}
} ).done( function ( data ) {
if ( 0 < data.length ) {
$( '.edit_form_line', $filterDropdown ).prepend( $( data ) );
} else {
$( '.edit_form_line', $filterDropdown ).prepend( $( '<div class="vc_checkbox-label"><span>No values found</span></div>' ) );
}
} );
} );
}( window.jQuery, this ));
};
window.vcWoocommerceProductAttributeFilterDependencyCallback = vcWoocommerceProductAttributeFilterDependencyCallback;
})( window.jQuery );

View File

@@ -0,0 +1,93 @@
/* global vc, YoastSEO, _, jQuery */
(function ( $ ) {
'use strict';
$( window ).on( 'YoastSEO:ready', function () {
var imageEventString, vcYoast, relevantData, pluginName, eventsList;
relevantData = {};
pluginName = 'vcVendorYoast';
eventsList = [
'sync',
'add',
'update'
];
var contentModification = function ( data ) {
data = _.reduce( relevantData, function ( memo, value, key ) {
if ( value.html ) {
memo = memo.replace( '"' + value.text + '"', value.html );
}
if ( value.image && value.param ) {
var i, imagesString = '', attachment;
for ( i = 0; value.image.length > i; i ++ ) {
attachment = window.wp.media.model.Attachment.get( value.image[ i ] );
if ( attachment.get( 'url' ) ) {
imagesString += '<img src=\'' + attachment.get( 'url' ) + '\' alt=\'' + (attachment.get( 'alt' ) || attachment.get( 'caption' ) || attachment.get( 'title' )) + '\'>';
}
}
memo += imagesString;
}
return memo;
}, data );
return data;
};
function getImageEventString( e ) {
return ' shortcodes:' + e + ':param:type:attach_image' + ' shortcodes:' + e + ':param:type:attach_images';
}
// add relevant data for images
imageEventString = _.reduce( eventsList, function ( memo, e ) {
return memo + getImageEventString( e );
}, '' );
vc.events.on( imageEventString, function ( model, param, settings ) {
if ( param && param.length > 0 ) {
var ids = param.split( /\s*,\s*/ );
_.each( ids, function ( id ) {
var attachment = window.wp.media.model.Attachment.get( id );
if ( !attachment.get( 'url' ) ) {
attachment.once( 'sync', function () {
YoastSEO.app.pluginReloaded( pluginName );
} );
attachment.fetch();
}
} );
relevantData[ model.get( 'id' ) + settings.param_name ] = {
image: ids,
paramName: settings.param_name,
param: param
};
}
} );
vc.events.on( getImageEventString( 'destroy' ), function ( model, param, settings ) {
delete relevantData[ model.get( 'id' ) + settings.param_name ];
} );
// Add relevant data to headings
vc.events.on( 'shortcodes:vc_custom_heading', function ( model, event ) {
var params, tagSearch;
params = model.get( 'params' );
params = _.extend( {}, vc.getDefaults( model.get( 'shortcode' ) ), params );
if ( 'destroy' === event ) {
delete relevantData[ model.get( 'id' ) ];
} else if ( params.text && params.font_container ) {
tagSearch = params.font_container.match( /tag:([^\|]+)/ );
if ( tagSearch[ 1 ] ) {
relevantData[ model.get( 'id' ) ] = {
html: '<' + tagSearch[ 1 ] + '>' + params.text + '</' + tagSearch[ 1 ] + '>',
text: params.text
};
}
}
} );
var VcVendorYoast = function () {
// init
YoastSEO.app.registerPlugin( pluginName, { status: 'ready' } );
YoastSEO.app.pluginReady( pluginName );
YoastSEO.app.registerModification( 'content', contentModification, pluginName, 5 );
};
vcYoast = new VcVendorYoast();
} );
})( window.jQuery );