Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
/**
* Created by Ovidiu on 7/20/2017.
*/
var TVE = window.TVE || {},
TVE_Ult_Ext = window.TVE_Ult_Ext = TVE_Ult_Ext || {};
(function ( $ ) {
/**
* On TCB Main Ready
*/
$( window ).on( 'tcb_main_ready', function () {
TVE.Views.Components.ultimatum_countdown = require( './ultimatum-countdown-component' );
TVE_Ult_Ext.UltimatumCountdown = require( './modals/ultimatum-countdown' );
} );
})( jQuery );

View File

@@ -0,0 +1,101 @@
/**
* Created by Ovidiu on 7/20/2017.
*/
var _instance = null,
shortcode_base = TVE.shortcode_manager;
module.exports = TVE.modal.base.extend( {
after_initialize: function () {
this.$el.addClass( 'medium' );
this.$campaign = this.$el.find( '#tve_ult_campaign' );
this.$shortcode = this.$el.find( '#tve_ult_shortcode' );
},
before_open: function () {
if ( ! TVE.ActiveElement.hasClass( 'tcb-elem-placeholder' ) ) {
var _config = this.get_config();
if ( typeof _config[ 'tve_ult_campaign' ] !== 'undefined' && typeof _config[ 'tve_ult_shortcode' ] !== 'undefined' ) {
this.$campaign.val( _config[ 'tve_ult_campaign' ] ).trigger( 'change' );
this.$shortcode.val( _config[ 'tve_ult_shortcode' ] );
}
}
},
/**
* Returns Ultimatum Shortcode Settings
*
* @returns {*}
*/
get_config: function () {
var shortcode_config = shortcode_base( TVE.ActiveElement.find( '.thrive-shortcode-config' ), 'ultimatum_shortcode' );
return shortcode_config.get();
},
campaign_changed: function ( event, dom ) {
var _$shortcode = this.$shortcode;
_$shortcode.html( '' );
if ( dom.value ) {
jQuery.each( tve_ult_page_data.tu_shortcode_campaigns[ dom.value ].designs, function ( id, name ) {
var $option = jQuery( '<option/>' ).text( name ).val( id );
_$shortcode.append( $option );
}, this );
}
},
generate_countdown_html: function () {
var self = this,
$target = TVE.ActiveElement;
this.countdown_ajax( {
tve_ult_campaign: this.$campaign.val(),
tve_ult_shortcode: this.$shortcode.val()
} ).done( function ( response ) {
if ( response ) {
$target.html( response ).removeClass( 'tcb-elem-placeholder' );
TVE.inner.window.TCB_Front.handleIframes( $target, true );
TVE.Editor_Page.focus_element( $target );
$target.find( '.thrv_countdown_timer' ).tve_countdown_timer().update();
if ( typeof TVE.Components.countdown.updateElement === 'function' ) {
TVE.Components.countdown.updateElement( $target.find( '.tve-countdown' ) );
}
}
} ).error( function ( error ) {
TVE.page_message( error.responseText, 2, 5000 );
} ).complete( function () {
TVE.main.overlay( 'close' );
self.close();
} );
},
countdown_ajax: function ( data, ajax_param ) {
var params = {
type: 'post',
dataType: 'json',
url: tve_ult_page_data.ajaxurl
};
TVE.main.overlay();
data.action = 'tve_ult_fetch_countdown_for_editor';
data._nonce = tve_ult_page_data.security;
params.data = data;
if ( ajax_param ) {
for ( var k in ajax_param ) {
params[ k ] = ajax_param[ k ];
}
}
return jQuery.ajax( params, data );
}
}, {
/**
* "Singleton" implementation for modal instance
*
* @param el
*/
get_instance: function ( el ) {
if ( ! _instance ) {
_instance = new TVE_Ult_Ext.UltimatumCountdown( {
el: el
} );
}
return _instance;
}
} );

View File

@@ -0,0 +1,19 @@
/**
* Created by Ovidiu on 7/20/2017.
*/
module.exports = TVE.Views.Base.component.extend( {
controls_init: function () {
},
placeholder_action: function () {
var campaignShortcodes = TVE_Ult_Ext.UltimatumCountdown.get_instance( TVE.modal.get_element( 'campaign-shotcodes' ) );
campaignShortcodes.open( {
top: '20%'
} );
},
/**
* Callback for change countdown button inside the Ultimatum Countdown Options Menu
*/
change_countdown: function () {
this.placeholder_action();
}
} );

View File

@@ -0,0 +1,198 @@
/**
* Created by Ovidiu on 7/21/2017.
*/
(function ( $ ) {
module.exports = {
tpl_ajax: function ( data, ajax_param, no_loader ) {
var params = {
type: 'post',
dataType: 'json',
url: tve_ult_page_data.ajaxurl
};
if ( typeof no_loader === 'undefined' || ! no_loader ) {
TVE.main.overlay();
}
data.action = tve_ult_page_data.tpl_action;
data.design_id = data.design_id || tve_ult_page_data.design_id;
data.post_id = tve_ult_page_data.post_id;
data.security = tve_ult_page_data.security;
params.data = data;
if ( ajax_param ) {
for ( var k in ajax_param ) {
params[k] = ajax_param[k];
}
}
return jQuery.ajax( params, data );
},
/**
* actions related to a state
* @param data
* @param ajax_param
* @returns {*}
*/
state_ajax: function ( data, ajax_param ) {
var params = {
type: 'post',
dataType: 'json',
url: tve_ult_page_data.ajaxurl
};
data.action = tve_ult_page_data.state_action;
data.design_id = data.design_id || tve_ult_page_data.design_id;
data.post_id = tve_ult_page_data.post_id;
data.security = tve_ult_page_data.security;
params.data = data;
if ( ajax_param ) {
for ( var k in ajax_param ) {
params[k] = ajax_param[k];
}
}
return jQuery.ajax( params, data );
},
stateResponse: function ( response, self ) {
if ( ! response || response.success === false ) {
var _msg = 'Something went wrong';
if ( response && response.success === false ) {
_msg += ': ' + response.message;
}
TVE.page_message( _msg, true );
TVE.main.overlay( 'close' );
return;
}
/**
* Insert response only if main page content is returned.
*/
if ( response.main_page_content ) {
self.insertResponse( response );
}
jQuery( '.design-states' ).replaceWith( response.state_bar );
TVE.main.overlay( 'close' );
},
insertResponse: function ( response ) {
if ( ! response || response.success === false ) {
TVE.page_message( 'Something went wrong' + (
response && response.success === false ? ': ' + response.message : ''
), true );
setTimeout( function () {
TVE.main.overlay( 'close' );
}, 1 );
return;
}
/**
* callback to be applied when all css files are loaded and available
*/
function on_resources_loaded() {
/**
* javascript page data
*/
tve_ult_page_data = jQuery.extend( tve_ult_page_data, response.tve_ult_page_data, true );
/**
* javascript params that need updating
*/
TVE.CONST = jQuery.extend( TVE.CONST, response.tve_path_params, true );
TVE.inner_$( '#tve-ult-editor-replace' ).replaceWith( response.main_page_content );
TVE.Editor_Page.initEditorActions();
}
/**
* browser-compliant way of accessing stylesheet rules
*/
var sheet, cssRules, _link = document.createElement( 'link' );
if ( 'sheet' in _link ) {
sheet = 'sheet';
cssRules = 'cssRules';
} else {
sheet = 'styleSheet';
cssRules = 'rules';
}
/** custom CSS */
TVE.inner_$( '.tve_custom_style,.tve_user_custom_style' ).remove();
TVE.CSS_Rule_Cache.clear();
/**
* Clear also the Global Rules
*/
TVE.USE_GLOBALSHEET = true;
TVE.CSS_Rule_Cache.clear();
TVE.USE_GLOBALSHEET = false;
if ( response.custom_css && response.custom_css.length ) {
TVE.inner_$( 'head' ).append( response.custom_css );
}
/**
* Refresh the style node
*/
TVE.Editor_Page.content_manager.refresh_global_style_node();
/**
* checks if all the added CSS <link> elements are available (finished loading and applied)
*
* @param {jQuery} $jq_links collection of added <link> nodes
* @param {Function} complete_callback
*/
function check_loaded( $jq_links, complete_callback ) {
var all_loaded = true;
window.tvu_loaded_count = window.tvu_loaded_count || 1;
window.tvu_loaded_count ++;
$jq_links.each( function () {
/** firefox throws an Error when testing this condition and the css is not loaded yet */
try {
if ( ! this[sheet] || ! this[sheet][cssRules] || ! this[sheet][cssRules].length ) {
all_loaded = false;
return false; // break the loop
}
} catch ( e ) {
all_loaded = false;
return false;
}
} );
if ( all_loaded || window.tvu_loaded_count > 40 ) {
complete_callback();
} else {
setTimeout( function () {
check_loaded( $jq_links, complete_callback );
}, 500 );
}
}
var found = false,
$css_list = jQuery();
TVE.inner_$.each( response.css, function ( _id, href ) {
if ( ! TVE.inner_$( 'link#' + _id + '-css' ).length ) {
found = true;
var $link = TVE.inner_$( '<link />', {
rel: 'stylesheet',
type: 'text/css',
id: _id + '-css',
href: href
} ).appendTo( 'head' );
/* for some reason, <link>s from google fonts always have empty cssRules fields - we cannot be sure when those are loaded using the check_loaded function */
if ( href.indexOf( 'fonts.googleapis' ) === - 1 ) {
$css_list = $css_list.add( $link );
}
}
} );
if ( found ) {
check_loaded( $css_list, on_resources_loaded );
} else {
on_resources_loaded()
}
}
}
})( jQuery );

View File

@@ -0,0 +1,150 @@
module.exports = {
tvu_set_01:
{
'.tve_countdown_2 .tve_t_part':
{
'background': '',
'border-color': '',
}
},
tvu_set_02:
{
'.tve_countdown_2 .tve_t_part':
{
'background': '',
'border-color': '',
}
},
tvu_set_03:
{
'.tve_countdown_1 .tve_t_part [class*="part-"]':
{
'color': '',
}
},
tvu_set_05:
{
'.tve_countdown_2 .tve_t_part':
{
'background': '',
'border-color': '',
}
},
tvu_set_09:
{
'.tve_countdown_2 .tve_t_part':
{
'background': '',
'border-color': '',
}
},
tvu_set_10:
{
'.tve_countdown_2 .tve_t_part':
{
'background': '',
'border-color': '',
}
},
tvu_set_11:
{
'.tve_countdown_2 .tve_t_part':
{
'background': '',
'border-color': '',
}
},
tvu_set_12:
{
'.tve_countdown_2 .tve_t_part':
{
'background': '',
'border-color': '',
}
},
tvu_set_18:
{
'.tve_countdown_3 .tve_t_part .part-1':
{
'color': ''
},
'.tve_countdown_3 .tve_t_part .part-2':
{
'color': ''
}
},
tvu_set_22:
{
'.tve_countdown_3 .sc_timer_content':
{
'background': ''
}
},
tvu_set_20:
{
'.tve_countdown_3 .tve_t_part':
{
'background-color': '',
'border-color': ''
},
'.tve_countdown_3 .tve_t_part::before':
{
'border-color': ''
},
'.tve_countdown_3 .tve_t_part::after':
{
'border-color': ''
}
},
tvu_set_23:
{
'.tve_countdown_3 .sc_timer_content':
{
'border-color': ''
},
'.tve_countdown_3 .tve_t_part::before':
{
'border-color': '',
},
'.tve_countdown_3 .tve_t_part::after':
{
'border-color': '',
}
},
tvu_set_24:
{
'.tve_countdown_1 .t-digits':
{
'border-color': '',
},
},
tvu_set_25:
{
'.tve_countdown_3 .tve_t_part::after':
{
'background': '',
'border-color': ''
}
},
tvu_set_26:
{
'.tve_countdown_2 .tve_t_part':
{
'background': '',
}
},
tvu_set_27:
{
'.tve_countdown_2 .tve_t_part':
{
'border-color': '',
}
},
tvu_set_28:
{
'.tve_countdown_2 .t-digits':
{
'border-color': '',
}
}
};

View File

@@ -0,0 +1,292 @@
/**
* Created by Ovidiu on 7/21/2017.
*/
var TVE_Ult_Int = window.TVE_Ult_Int = TVE_Ult_Int || {},
withCloudTpls = false,
EDITOR_INSTANCE = 1,
TU_FORM_EVENTS = [ 'tve_ult_close' ],
countdownSet = require( './countdown-sets-constants' );
( function ( $ ) {
/**
* On TCB Main Ready
*/
$( window ).on( 'tcb_main_ready', function () {
withCloudTpls = Boolean( parseInt( tve_ult_page_data.with_cloud_tpl ) )
if ( withCloudTpls ) {
TVE_Ult_Int.DesignTemplates = require( './modals/design-cloud-templates' );
} else {
TVE_Ult_Int.DesignTemplates = require( './modals/design-templates' );
}
TVE_Ult_Int.DesignReset = require( './modals/design-reset' );
TVE_Ult_Int.DesignSave = require( './modals/design-save' );
TVE_Ult_Int.AddEditState = require( './modals/add-edit-state' );
const _states = require( './states' );
TVE_Ult_Int.States = new _states( {
el: jQuery( '#tu-form-states' )[ 0 ]
} );
TVE_Ult_Int.savePreview = function ( designName = tve_ult_page_data.design_id, savePreviewCallback = null ) {
const saveCallback = function ( imgData ) {
const form = new FormData();
if ( imgData ) {
form.append( 'preview_file', imgData, designName + '.png' );
}
form.append( 'custom', 'save_thumbnail' );
form.append( 'action', tve_ult_page_data.tpl_action );
form.append( 'design_id', tve_ult_page_data.design_id );
form.append( 'post_id', tve_ult_page_data.post_id );
form.append( 'security', tve_ult_page_data.security );
form.append( 'file_name', designName );
$.ajax( {
type: 'POST',
url: tve_ult_page_data.ajaxurl,
data: form,
processData: false,
contentType: false,
} ).done( data => {
if ( typeof savePreviewCallback === 'function' ) {
savePreviewCallback( JSON.parse( data ) );
}
} );
}
TVE.Editor_Page.blur();
TVE.Editor_Page.editor.find( '.on_hover' ).removeClass( 'on_hover' );
TVE.generateElementPreview( TVE.Editor_Page.editor, saveCallback, {}, true );
}
function open_templates_modal() {
var modal = withCloudTpls ? 'design-cloud-templates' : 'design-templates',
designTemplatesModal = TVE_Ult_Int.DesignTemplates.get_instance( TVE.modal.get_element( modal ) );
designTemplatesModal.open( {
top: '5%',
css: {
width: '80%',
left: '10%'
},
dismissible: ( tve_ult_page_data.has_content )
} );
}
TVE.add_filter( 'editor_loaded_callback', function () {
$( TVE.main ).on( 'tcb.open_templates_picker', function ( event ) {
event.preventDefault();
open_templates_modal();
} );
TVE.main.sidebar_extra.tve_ult_save_template = function () {
var designSaveModal = TVE_Ult_Int.DesignSave.get_instance( TVE.modal.get_element( 'design-save' ) );
TVE.main.sidebar_extra.hide_drawers();
designSaveModal.open( {
top: '20%'
} );
return false;
};
TVE.main.sidebar_extra.tve_ult_reset_template = function () {
TVE.Editor_Page.blur();
var designResetsModal = TVE_Ult_Int.DesignReset.get_instance( TVE.modal.get_element( 'design-reset' ) );
designResetsModal.open( {
top: '20%'
} );
return false;
};
/**
* Open Template Chooser if the variation is empty
*/
if ( ! tve_ult_page_data.has_content ) {
if ( withCloudTpls ) {
TVE.Editor_Page.editor.append( tve_ult_page_data.placeholder );
}
open_templates_modal();
}
/**
* Backwards Compatibility:
* Adds thrv-inline-text class to countdown elements that doesn't have it on caption class
*/
TVE.inner_$( '.thrv_countdown_timer .t-caption:not(.thrv-inline-text)' ).each( function () {
jQuery( this ).addClass( 'thrv-inline-text' );
} );
TVE.StorageManager.unset( 'tvu_design-' + tve_ult_page_data.design_id );
} );
/**
* The countdown color form TU sets is now editable
*/
TVE.add_action( 'tcb.element.focus', function ( $element ) {
if ( $element.hasClass( 'thrv_countdown_timer' ) && tve_ult_page_data.tpl_action ) {
//get the templates set
var setID = TVE.inner_$( '.tl-style' ).attr( 'id' );
TVE.Components.countdown_old.controls.Color.config.css_suffix = '';
if ( countdownSet[ setID ] ) {
TVE.Components.countdown_old.controls.Color.config.config.style_default_color = countdownSet[ setID ];
}
}
} );
/**
* Mark all ajax requests that are sent from the current editor page with a special parameter that applies to Thrive Ultimatum
*/
TVE.add_filter( 'tcb.editor.default_ajax_config', function ( params ) {
params.data.ultimatum_editor_page = 1;
return params;
} );
TVE.add_filter( 'tve.countdown.state', function ( states ) {
if ( TVE.CONST.post_type === 'tve_ult_campaign' ) {
states = [];
}
return states;
} );
if ( withCloudTpls ) {
TVE.add_action( 'tcb_after_cloud_template_css_inserted', function ( $content ) {
if ( $content.attr( 'tvu-tpl-id' ) && $content.attr( 'tvu-tpl-id' ).indexOf( `ultimatum_${tve_ult_page_data.design_type}` ) !== - 1 ) {
TVE.Editor_Page.save( true );
}
} );
TVE.add_filter( 'tcb_save_post_data_before', function ( data ) {
var $ultDesign = TVE.Editor_Page.editor.find( `[tvu-tpl-id*="ultimatum_${tve_ult_page_data.design_type}"]` );
if ( $ultDesign.length ) {
data.tve_ult_tpl = `${$ultDesign.first().attr( 'tvu-tpl-id' )}`;
}
if ( TVE.CONST.post_type === 'tve_ult_campaign' ) {
var sizes = {
m: '600px',
t: '1023px',
d: '1366px'
}
data[ 'form-height' ] = {};
var $container = TVE.Editor_Page.editor.find( '.tve-editor-main-content' ),
initialWidth = TVE.main.$frame.width();
if ( $container.length === 0 ) {
$container = TVE.Editor_Page.editor;
}
/* fox for margin collapse */
$container.css( 'border', '1px solid transparent' )
/* save form height so we can prepare a placeholder for it. */
for ( var device in sizes ) {
TVE.main.$frame.width( sizes[ device ] );
data[ 'form-height' ][ device ] = $container.outerHeight( true );
}
$container.css( 'border', '' )
TVE.main.$frame.width( initialWidth );
}
return data;
} )
TVE.add_action( 'tve.save_post.success', function () {
TVE.StorageManager.set( 'tvu_design-' + tve_ult_page_data.design_id, true );
TVE_Ult_Int.savePreview();
} );
TVE.add_filter( 'tcb.elem.type', ( type, $element ) => {
if ( type === 'icon' && $element.tcbHasClass( 'tve-ult-bar-close-editable' ) ) {
type = 'ultimatum_close';
}
return type;
} );
TVE.add_action( 'tcb.element.click', function ( event, data ) {
if ( event.currentTarget.classList.contains( 'tve-ult-cloud-placeholder' ) ) {
open_templates_modal();
}
} );
}
/**
* Ultimatum froala control
*/
TVE.add_filter( 'tcb_froala_config', function () {
return {
linkEventActions: {
getHtml: function () {
var opts = TVE.Components.animation.options.actions;
var actions = {
tve_ult_close: opts.tve_ult_close
};
return TVE.tpl( 'froala-ult' )( {
actions: actions,
current_id: ++ EDITOR_INSTANCE
} );
},
bindEvents: function ( $popup ) {
$popup.on( 'change', '.fr-extra-action', function ( e ) {
$popup.find( '.ult-action-config' ).hide();
if ( ! this.checked ) {
$popup.find( '.fr-link-atts,.fr-link-url,.tve-top-tabs' ).show();
} else {
$popup.find( '.ult-action-opts-' + this.getAttribute( 'data-key' ) ).show();
$popup.find( '.fr-link-atts,.fr-link-url,.tve-top-tabs' ).hide();
$popup.find( '.fr-extra-action' ).not( this ).prop( 'checked', false );
}
} );
},
hasSelected: function ( $popup ) {
return $popup.find( '.fr-extra-action:checked' ).length;
},
getEventConfig: function ( $popup ) {
var key = $popup.find( '.fr-extra-action:checked' ).attr( 'data-key' );
return {
a: key,
t: 'click',
config: {
s: $popup.find( '.ult-action-opts-' + key + ' select[name="s"]' ).val(),
anim: $popup.find( '.ult-action-opts-' + key + ' select[name="a"]' ).val()
}
}
},
reset: function ( $popup ) {
$popup.find( '.fr-extra-action' ).prop( 'checked', false );
$popup.find( '.fr-link-atts,.fr-link-url,.tve-top-tabs' ).show();
$popup.find( '.ult-action-config' ).hide();
},
updateFromLink: function ( $link, $popup ) {
var ult_event = false;
this.reset( $popup );
if ( $link.hasClass( 'tve_evt_manager_listen' ) ) {
var evt = TVE.EventManager.get( $link, 'click' );
if ( evt && TU_FORM_EVENTS.includes( evt.a ) ) {
$popup.find( '.fr-extra-action[data-key="' + evt.a + '"]' ).prop( 'checked', true ).trigger( 'change' );
$popup.find( '.ult-action-opts-' + evt.a + ' select[name="s"]' ).val( evt.config.s );
ult_event = true;
$popup.find( '.ult-action-opts-' + evt.a + ' select[name="a"]' ).val( evt.config.anim || 'instant' );
}
}
return ult_event;
}
}
};
} );
} );
} )( jQuery );

View File

@@ -0,0 +1,63 @@
/**
* Created by Ovidiu on 7/25/2017.
*/
var _instance = null,
_utils = require( '../_utils' );
module.exports = TVE.modal.base.extend( {
after_initialize: function ( args ) {
this.$el.addClass( 'medium' );
},
before_open: function () {
this.$( 'input#tve-ult-state-name' ).val( '' );
if ( this.state_id && this.state_name ) {
this.$( 'input#tve-ult-state-name' ).val( this.state_name );
}
},
save: function () {
var _name = this.$( 'input#tve-ult-state-name' ).val(),
self = this;
if ( _name && _name.length > 0 ) {
TVE.main.overlay();
TVE.Editor_Page.save( false, function () {
if ( self.state_id && self.state_name ) {
_utils.state_ajax( {
custom_action: 'edit_name',
post_title: _name,
id: self.state_id
} ).done( function ( response ) {
_utils.stateResponse( response, _utils );
self.close();
} );
} else {
_utils.state_ajax( {
custom_action: 'add',
post_title: _name
} ).done( function ( response ) {
_utils.stateResponse( response, _utils );
self.close();
} );
}
} );
} else {
TVE.page_message( tve_ult_page_data.L.state_name_required, true, 5000 );
}
}
}, {
/**
* "Singleton" implementation for modal instance
*
* @param el
*/
get_instance: function ( el ) {
if ( ! _instance ) {
_instance = new TVE_Ult_Int.AddEditState( {
el: el
} );
}
return _instance;
}
} );

View File

@@ -0,0 +1,194 @@
( function ( $ ) {
var _instance = null,
_utils = require( '../_utils' );
module.exports = TVE.CloudTemplatesCategories.extend( {
$$type: 'ultimatum_' + tve_ult_page_data.design_type,
templateName: TVE.ucFirst( tve_ult_page_data.design_type === 'bar' ? 'ribbon' : tve_ult_page_data.design_type ),
categoryId: 'countdown_type',
before_open: function () {
this.applyTo = TVE.Editor_Page.editor.children( '.thrv_wrapper' );
if ( ! TVE.ActiveElement ) {
TVE.ActiveElement = this.applyTo.addClass( 'edit_mode' );
}
if ( ! TVE.CONST[ this.collectionName ] ) {
this.fetchTemplates( this.$$type );
} else {
this.$( '[data-item="Saved Templates"] .lp-group-count' ).text( tve_ult_page_data.saved_tpls.length )
}
this.resetFilters();
if ( ! this.applyTo.hasClass( 'tcb-ct-placeholder' ) && this.applyTo.attr( 'tcb-template-name' ) ) {
this.$warning.show().find( '.tcb-notification-content' ).html( TVE.t.warning_change_ct.replace( /%s/g, this.templateName ) );
} else {
this.$warning.hide();
}
this.selectDefault();
},
selectDefault: function () {
this.filter( {}, this.$typesWrapper.find( '[data-item="Cloud Templates"]' ) );
},
on_success: function ( response ) {
if ( response.error ) {
return this.on_error( {responseJSON: response} );
}
this.collection.reset( response.templates );
this.build_preview();
/**
* Render Types
*/
this.types = {};
_.each( response.templates, ( tpl ) => {
const type = tpl.config[ `tve_tpl_${this.$$type}_meta` ][ this.categoryId ];
if ( type && ! this.types[ type ] ) {
this.types[ type ] = 0;
}
this.types[ type ] ++;
} );
this.$typesWrapper.empty()
.append( this.group_item( {group: 'All Cloud Templates', counter: response.templates.length} ) )
_.each( this.types, ( counter, groupKey ) => {
this.$typesWrapper.append( this.group_item( {group: groupKey, counter: counter} ) )
} );
this.$typesWrapper.append( this.group_item( {group: 'Saved Templates', counter: tve_ult_page_data.saved_tpls.length} ) );
this.selectDefault();
TVE.CONST[ this.collectionName ] = response.templates;
},
/**
* Build the preview
*
* Called from reset collection
*/
build_preview: function () {
var html = '',
self = this;
if ( this.filters.group.length > 0 ) {
if ( this.filters.group[ 0 ].indexOf( 'Cloud' ) !== - 1 ) {
this.collection.reset( TVE.CONST[ this.collectionName ] );
} else if ( this.filters.group[ 0 ].indexOf( 'Countdown' ) !== - 1 ) {
this.collection.reset( TVE.CONST[ this.collectionName ].filter( t => t.config[ `tve_tpl_${this.$$type}_meta` ][ this.categoryId ] === this.filters.group[ 0 ] ) );
} else {
this.collection.reset( tve_ult_page_data.saved_tpls );
}
}
this.instance.collection.each( function ( model ) {
html += self.item_template( {
item: model.toJSON(),
selected: '',
} );
} );
if ( html.length ) {
this.$content.html( html );
var dynamicImageWidth = parseInt( this.$content.find( this.itemClass ).outerWidth( true ) );
this.$content.find( 'img' ).each( function () {
var imageRation = this.getAttribute( 'data-ratio' );
if ( imageRation ) {
$( this ).closest( '.cloud-template-item' ).css( 'height', dynamicImageWidth * parseFloat( imageRation ) );
}
} );
this.applyMasonry();
} else {
this.$content.html( this.no_templates() );
}
this.on_finished();
},
/**
* Download a template
*
* @param id
*/
select_template: function ( id ) {
this.selected = String( id );
this.applyTo.addClass( 'tcb-block-placeholder tcb-elem-placeholder' ).empty();
this.close();
TVE.inner_$( 'html' ).stop().animate( {
scrollTop: this.applyTo.offset().top - 50
}, {duration: 500} );
if ( this.selected.indexOf( 'tvu-tpl' ) !== - 1 ) {
this.saveSavedTemplate();
} else {
this.save();
}
},
saveSavedTemplate: function () {
var self = this;
_utils.tpl_ajax( {
custom: 'get_saved_tpl',
tpl_id: this.selected
} ).done( function ( response ) {
self.applyTo.replaceWith( $( response.content ) );
TVE.Editor_Page.content_manager.insert_head_css( response.inline_css ).done( function () {
TVE.Editor_Page.editor.find( '[data-css]' ).addBack( '[data-css]' ).each( function () {
TVE.inner_$( this ).head_css_clone();
} );
TVE.main.overlay( true );
TVE.Editor_Page.save( true );
} )
} )
},
alter_wrapper_attributes: function ( attributes, data ) {
/**
* Force the proper active element
*/
if ( this.applyTo.length > 1 ) {
this.applyTo = this.applyTo.filter( ':not(style)' );
TVE.ClickedElement = TVE.ActiveElement = this.applyTo;
}
return {
'tcb-template-name': data.name,
'tcb-template-id': data.id,
'tvu-tpl-id': 'cloud_' + data.type + '-' + data.id,
'tcb-template-pack': data.pack,
'data-keep-css_id': 1,
}
},
afterTemplateCssApplied: function () {
TVE.Editor_Page.editor.children( 'style' ).slice( 1 ).remove();
}
}, {
/**
* "Singleton" implementation for modal instance
*
* @param el
*/
get_instance: function ( el ) {
if ( ! _instance ) {
_instance = new TVE_Ult_Int.DesignTemplates( {
el: el
} );
_instance.$el.addClass( 'tcb-modal-cloud-templates-categories' )
}
return _instance;
}
} );
} )( jQuery );

View File

@@ -0,0 +1,36 @@
/**
* Created by Ovidiu on 7/21/2017.
*/
var _instance = null,
_utils = require( '../_utils' );
module.exports = TVE.modal.base.extend( {
after_initialize: function () {
this.$el.addClass( 'medium' );
},
reset: function () {
var self = this;
_utils.tpl_ajax( {
custom: 'reset'
} ).done( function ( response ) {
_utils.insertResponse( response );
self.close();
TVE.main.overlay( 'close' );
} );
}
}, {
/**
* "Singleton" implementation for modal instance
*
* @param el
*/
get_instance: function ( el ) {
if ( ! _instance ) {
_instance = new TVE_Ult_Int.DesignReset( {
el: el
} );
}
return _instance;
}
} );

View File

@@ -0,0 +1,74 @@
/**
* Created by Ovidiu on 7/21/2017.
*/
var _instance = null,
_utils = require( '../_utils' );
module.exports = TVE.modal.base.extend( {
after_initialize: function () {
this.$el.addClass( 'medium' );
},
checkUniqueName: function ( name ) {
var unique = true;
tve_ult_page_data.saved_tpls.forEach( function ( tpl ) {
if ( tpl.name === name ) {
unique = false;
}
} )
return unique;
},
save: function () {
var _name = this.$( 'input#tve-template-name' ).val(),
self = this;
if ( _name && _name.length > 0 ) {
_name = _name.trim();
if ( this.checkUniqueName( _name ) ) {
TVE.main.editor_settings.save( null, null, function () {
_utils.tpl_ajax( {
custom: 'save',
name: _name
} ).done( function ( response ) {
if ( response && response.saved_tpls ) {
tve_ult_page_data.saved_tpls = response.saved_tpls;
}
TVE_Ult_Int.savePreview( _name, data => {
const tplIndex = tve_ult_page_data.saved_tpls.findIndex( tpl => tpl.name === _name );
/**
* set the thumb
*/
if ( tplIndex !== - 1 ) {
tve_ult_page_data.saved_tpls[ tplIndex ].thumb = data.thumb;
tve_ult_page_data.saved_tpls[ tplIndex ].thumb_size = data.thumb_size;
}
}
);
self.close();
TVE.main.overlay( 'close' );
} );
} );
} else {
TVE.page_message( tve_ult_page_data.L.tpl_existing_name, true, 5000 );
}
} else {
TVE.page_message( tve_ult_page_data.L.tpl_name_required, true, 5000 );
}
}
}, {
/**
* "Singleton" implementation for modal instance
*
* @param el
*/
get_instance: function ( el ) {
if ( ! _instance ) {
_instance = new TVE_Ult_Int.DesignSave( {
el: el
} );
}
return _instance;
}
} );

View File

@@ -0,0 +1,129 @@
/**
* Created by Ovidiu on 7/21/2017.
*/
var _instance = null,
_utils = require( '../_utils' );
module.exports = TVE.modal.base.extend( {
saved_tpl_delete_confirmation: TVE.tpl( 'landing-pages/delete-confirmation' ),
events: function () {
return _.extend( {}, TVE.modal.base.prototype.events(), {
'click .tcb-cancel-delete-template': 'no_delete_template',
'click .tcb-apply-delete-template': 'yes_delete_template'
} );
},
after_initialize: function () {
this.$el.addClass( 'medium' );
this.$tabs = this.$( '.tab-item' );
this.$content = this.$( '.tve-tab-content' );
},
tab_click: function ( event ) {
var tab = event.currentTarget.getAttribute( 'data-content' );
this.$tabs.removeClass( 'active' );
event.currentTarget.classList.add( 'active' );
this.$content.removeClass( 'active' );
this.$content.filter( '[data-content="' + tab + '"]' ).addClass( 'active' );
if ( tab === 'saved' ) {
this.get_saved();
}
},
/**
* Returns the save templates preview
*/
get_saved: function () {
var self = this;
this.$( '.tve-saved-templates-list' ).html( tve_ult_page_data.L.fetching_saved_templates );
_utils.tpl_ajax( {
custom: 'get_saved'
}, {
dataType: 'html'
}, true ).done( function ( response ) {
TVE.main.overlay( 'close' );
self.$( '.tve-saved-templates-list' ).html( response );
} );
},
select_template: function ( event ) {
this.$( '.template-wrapper.active' ).removeClass( 'active' );
event.currentTarget.classList.toggle( 'active' );
},
/**
* Shows The Delete Confirmation View
*
* @param event
*/
delete_confirmation: function ( event ) {
var $templateItem = jQuery( event.currentTarget ).closest( '.tve-template-item' );
$templateItem.find( '.template-wrapper' ).hide();
$templateItem.append( this.saved_tpl_delete_confirmation() );
},
/**
* Cancel A Delete Action And Returns to Default State
*
* @param event
*/
no_delete_template: function ( event ) {
var $templateItem = jQuery( event.currentTarget ).closest( '.tve-template-item' );
$templateItem.find( '.template-wrapper' ).show();
$templateItem.find( '.tcb-delete-template-confirmation' ).remove();
},
/**
* Deletes A Saved Landing Page
*
* @param event
*/
yes_delete_template: function ( event ) {
var $templateItem = jQuery( event.currentTarget ).closest( '.tve-template-item' );
TVE.main.overlay();
_utils.tpl_ajax( {
custom: 'delete'
}, {
dataType: 'html'
}, true ).done( function () {
$templateItem.remove();
TVE.main.overlay( 'close' );
} );
},
save: function () {
var $template = this.$( '.tve-template-item .active' ),
self = this;
if ( $template && $template.length ) {
_utils.tpl_ajax( {
custom: 'choose',
tpl: $template.data( 'key' )
} ).done( function ( response ) {
_utils.insertResponse( response );
TVE.main.overlay( 'close' );
self.close();
} );
} else {
TVE.page_message( TVE.t.SelectTemplate, true, 5000 );
}
}
}, {
/**
* "Singleton" implementation for modal instance
*
* @param el
*/
get_instance: function ( el ) {
if ( ! _instance ) {
_instance = new TVE_Ult_Int.DesignTemplates( {
el: el
} );
}
return _instance;
}
} );

View File

@@ -0,0 +1,98 @@
/**
* Created by Ovidiu on 7/25/2017.
*/
var _utils = require( './_utils' );
module.exports = TVE.Views.Base.base_view.extend( {
after_initialize: function () {
this.dom = {
btn: this.$( '.states-button-container' )
};
},
expand: function () {
this.$( '.design-states' ).show();
this.dom.btn.hide();
},
collapse: function () {
this.$( '.design-states' ).hide();
this.dom.btn.show();
},
/**
* Add a new state
*
* @param e
*/
add: function ( e ) {
this.collapse();
var addEditStateModal = TVE_Ult_Int.AddEditState.get_instance( TVE.modal.get_element( 'add-edit-state' ) );
addEditStateModal.state_name = null;
addEditStateModal.state_id = null;
addEditStateModal.open( {
top: '20%'
} );
return false;
},
/**
* Edit a state name
*
* @param e
*/
edit: function ( e ) {
this.collapse();
var addEditStateModal = TVE_Ult_Int.AddEditState.get_instance( TVE.modal.get_element( 'add-edit-state' ) );
addEditStateModal.state_name = e.currentTarget.getAttribute( 'data-state-name' );
addEditStateModal.state_id = e.currentTarget.getAttribute( 'data-id' );
addEditStateModal.open( {
top: '20%'
} );
return false;
},
select: function ( e ) {
this.collapse();
TVE.main.overlay();
TVE.Editor_Page.save( false, function () {
_utils.state_ajax( {
custom_action: 'display',
id: e.currentTarget.getAttribute( 'data-id' )
} ).done( function ( response ) {
_utils.stateResponse( response, _utils )
} );
} );
return false;
},
duplicate: function ( e, link ) {
this.collapse();
TVE.main.overlay();
TVE.Editor_Page.save( false, function () {
_utils.state_ajax( {
custom_action: 'duplicate',
id: link.getAttribute( 'data-id' )
} ).done( function ( response ) {
_utils.stateResponse( response, _utils )
} );
} );
return false;
},
remove: function ( e, link ) {
this.collapse();
TVE.main.overlay();
_utils.state_ajax( {
custom_action: 'delete',
id: link.getAttribute( 'data-id' )
} ).done( function ( response ) {
TVE.page_message( 'State Deleted' );
_utils.stateResponse( response, _utils );
} );
return false;
}
} );

View File

@@ -0,0 +1 @@
(()=>{var t={1305:t=>{var e=null,n=TVE.shortcode_manager;t.exports=TVE.modal.base.extend({after_initialize:function(){this.$el.addClass("medium"),this.$campaign=this.$el.find("#tve_ult_campaign"),this.$shortcode=this.$el.find("#tve_ult_shortcode")},before_open:function(){if(!TVE.ActiveElement.hasClass("tcb-elem-placeholder")){var t=this.get_config();void 0!==t.tve_ult_campaign&&void 0!==t.tve_ult_shortcode&&(this.$campaign.val(t.tve_ult_campaign).trigger("change"),this.$shortcode.val(t.tve_ult_shortcode))}},get_config:function(){return n(TVE.ActiveElement.find(".thrive-shortcode-config"),"ultimatum_shortcode").get()},campaign_changed:function(t,e){var n=this.$shortcode;n.html(""),e.value&&jQuery.each(tve_ult_page_data.tu_shortcode_campaigns[e.value].designs,(function(t,e){var o=jQuery("<option/>").text(e).val(t);n.append(o)}),this)},generate_countdown_html:function(){var t=this,e=TVE.ActiveElement;this.countdown_ajax({tve_ult_campaign:this.$campaign.val(),tve_ult_shortcode:this.$shortcode.val()}).done((function(t){t&&(e.html(t).removeClass("tcb-elem-placeholder"),TVE.inner.window.TCB_Front.handleIframes(e,!0),TVE.Editor_Page.focus_element(e),e.find(".thrv_countdown_timer").tve_countdown_timer().update(),"function"==typeof TVE.Components.countdown.updateElement&&TVE.Components.countdown.updateElement(e.find(".tve-countdown")))})).error((function(t){TVE.page_message(t.responseText,2,5e3)})).complete((function(){TVE.main.overlay("close"),t.close()}))},countdown_ajax:function(t,e){var n={type:"post",dataType:"json",url:tve_ult_page_data.ajaxurl};if(TVE.main.overlay(),t.action="tve_ult_fetch_countdown_for_editor",t._nonce=tve_ult_page_data.security,n.data=t,e)for(var o in e)n[o]=e[o];return jQuery.ajax(n,t)}},{get_instance:function(t){return e||(e=new TVE_Ult_Ext.UltimatumCountdown({el:t})),e}})},9872:t=>{t.exports=TVE.Views.Base.component.extend({controls_init:function(){},placeholder_action:function(){TVE_Ult_Ext.UltimatumCountdown.get_instance(TVE.modal.get_element("campaign-shotcodes")).open({top:"20%"})},change_countdown:function(){this.placeholder_action()}})}},e={};function n(o){var a=e[o];if(void 0!==a)return a.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,n),i.exports}var o=window.TVE||{},a=window.TVE_Ult_Ext=a||{};jQuery(window).on("tcb_main_ready",(function(){o.Views.Components.ultimatum_countdown=n(9872),a.UltimatumCountdown=n(1305)}))})();

File diff suppressed because one or more lines are too long