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 @@
html.tve-html-editor{overflow:auto}html.tve-html-editor body{overflow:auto}body:before{display:none !important}.tve-ult-body-ribbon #tve_editor{padding:0 !important}.admin-bar .tve-ult-bar{top:32px}.tve_editor_page .tve-ult-bar.tvu-footer.tvu-triggered{bottom:150px}.tve_editor_page.tl-state-collapse .tve-ult-bar.tvu-footer{bottom:0}.tve-ult-widget{margin:0 auto;padding-top:20px;max-width:300px}.tve-ult-widget .thrv_ult_widget{outline:1px dotted #dedede}.tve-ult-widget .thrv_ult_widget.active_highlight,.tve-ult-widget .thrv_ult_widget.active_delete{outline:1px dashed red}.tve-html-editor .cnt{background:#fff;box-shadow:none;margin:0;padding:0}.tve-html-editor .cnt article{margin:0;padding:0}

View File

@@ -0,0 +1,19 @@
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="tcb-icon-ultimatum" viewBox="0 0 32 32">
<path fill="#424242" style="fill: var(--color3, #424242)" d="M16.826 28.949c-0.007 0.016-0.007 0.027-0.020 0.041h0.026l-0.006-0.041z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M16.673 28.949c-0.007 0.016-0.007 0.027-0.020 0.041h0.026l-0.006-0.041z"></path>
<path fill="#59a31d" style="fill: var(--color2, #59a31d)"
d="M26.909 23.986c-0.018 0.016 0.027 0.016-0.051 0.016 0.020-0.016-0.027-0.016 0.051-0.016zM29.339 22.4c-0.922 0-2.854 0.35-3.613 0.502-0.723 0.143-1.668 0.344-2.371 0.619-0.539 0.209-1.055 0.418-1.574 0.678-0.482 0.242-0.955 0.524-1.395 0.842l-0.432 0.318c-0.076 0.057-0.131 0.109-0.207 0.168-0.072 0.059-0.135 0.123-0.203 0.174-0.15 0.113-0.277 0.281-0.42 0.393-0.145 0.113-0.635 0.672-0.762 0.84l-0.461 0.652c-0.445 0.674-0.789 1.479-0.921 2.277-0.046 0.293-0.042 0.447-0.077 0.676-0.001 0.010-0.003 0.021-0.005 0.031v0.354c0.031 0.43 0.148 0.926 0.148 0.965h0.033c0.025-0.303 0.486-1.381 0.6-1.607l0.283-0.531c0.172-0.285 0.353-0.566 0.555-0.832 0.133-0.178 0.271-0.359 0.43-0.52 0.033-0.037 0.033-0.043 0.064-0.082 0.162-0.195 0.375-0.373 0.553-0.555l0.6-0.514c0.023-0.017 0.047-0.033 0.074-0.053l1.053-0.744c0.318-0.188 0.621-0.396 0.943-0.576 0.289-0.162 0.729-0.393 1.010-0.508l0.76-0.338c0.393-0.154 0.789-0.338 1.193-0.469l0.82-0.291c0.146-0.049 0.273-0.090 0.416-0.139 0.123-0.041 0.297-0.117 0.426-0.129l-0.904 0.42c-0.31 0.125-0.871 0.42-1.195 0.584l-0.871 0.467c-0.275 0.16-0.566 0.322-0.836 0.502l-0.801 0.553c-0.051 0.037-0.072 0.061-0.119 0.094-0.027 0.021-0.039 0.029-0.066 0.049l-0.174 0.15c-0.033 0.027-0.035 0.024-0.064 0.053-0.023 0.020-0.037 0.033-0.059 0.055l-0.758 0.795-0.842 1.164-0.338 0.563c-0.029 0.051-0.049 0.090-0.074 0.137-0.168 0.291-0.318 0.592-0.457 0.899l-0.066 0.164c0.227 0.051 1.475 0.039 1.777-0.004l0.559-0.061c0.916-0.1 1.971-0.354 2.777-0.754 0.039-0.018 0.072-0.031 0.113-0.047 0.031-0.014 0.066-0.033 0.098-0.049 0.041-0.021 0.059-0.035 0.102-0.061l0.203-0.109c0.137-0.072 0.26-0.158 0.381-0.238 0.144-0.098 0.299-0.205 0.428-0.322 0.189-0.17 0.393-0.35 0.551-0.547 0.023-0.029 0.045-0.045 0.068-0.076 0.258-0.318 0.467-0.666 0.693-1.006 0.334-0.498 0.644-1.008 0.916-1.549 0.582-1.168 0.746-1.315 1.477-2.231 0.031-0.035 0.031-0.043 0.066-0.078l0.391-0.377c0.162-0.141 0.369-0.287 0.572-0.361 0.18-0.066 0.271-0.1 0.52-0.1-0.174-0.258-0.91-0.275-1.387-0.279h-0.201zM26.909 23.986v0z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M6.567 27.001c2.243 1.711 4.916 2.693 7.73 2.84l0.078-1.498c-2.511-0.131-4.896-1.007-6.898-2.535l-0.91 1.193z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M27.471 15.351l1.498-0.065c-0.047-1.095-0.224-2.184-0.525-3.235l-1.441 0.413c0.268 0.937 0.425 1.909 0.468 2.887z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M28.028 10.824c-0.459-1.174-1.075-2.279-1.831-3.287l-1.199 0.9c0.675 0.899 1.224 1.885 1.634 2.932l1.396-0.545z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M23.643 4.927l-0.926 1.18c0.548 0.431 1.065 0.912 1.537 1.431l1.109-1.009c-0.527-0.582-1.106-1.12-1.72-1.602z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M21.69 3.622c-0.048-0.020-0.133-0.055-0.377-0.179l-0.676 1.339c0.311 0.157 0.418 0.201 0.468 0.219 0.030 0.018 0.075 0.048 0.175 0.113l0.486 0.315 0.813-1.261-0.479-0.311c-0.309-0.201-0.313-0.195-0.41-0.235z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M2.575 15.905c0-6.772 5.437-12.289 12.174-12.44v1.827l4.487-2.59-4.487-2.591v1.854c-7.564 0.152-13.674 6.341-13.674 13.94-0.001 3.911 1.657 7.667 4.548 10.307l1.012-1.107c-2.581-2.357-4.061-5.709-4.060-9.2z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)"
d="M18.775 11.604l-3.516 3.517c-0.076-0.011-0.151-0.023-0.231-0.023-0.171 0-0.333 0.034-0.487 0.082l-3.435-3.434-1.061 1.060 3.434 3.434c-0.049 0.155-0.083 0.317-0.083 0.488 0 0.079 0.012 0.155 0.024 0.23l-0.289 0.289 1.414 1.414 0.319-0.319c0.054 0.006 0.107 0.017 0.163 0.017 0.171 0 0.333-0.034 0.489-0.083l0.171 0.172 1.061-1.061-0.171-0.172c0.049-0.154 0.083-0.316 0.083-0.487 0-0.056-0.011-0.109-0.017-0.165l3.546-3.546-1.414-1.413z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M26.158 21.484c0.063-0.013 0.131-0.027 0.19-0.039 0.374-0.075 0.959-0.185 1.61-0.295 0.543-1.338 0.878-2.745 0.985-4.203l-1.496-0.11c-0.12 1.632-0.557 3.192-1.289 4.647z"></path>
</symbol>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,19 @@
<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-ultimatum" viewBox="0 0 32 32">
<path fill="#424242" style="fill: var(--color3, #424242)" d="M16.826 28.949c-0.007 0.016-0.007 0.027-0.020 0.041h0.026l-0.006-0.041z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M16.673 28.949c-0.007 0.016-0.007 0.027-0.020 0.041h0.026l-0.006-0.041z"></path>
<path fill="#59a31d" style="fill: var(--color2, #59a31d)"
d="M26.909 23.986c-0.018 0.016 0.027 0.016-0.051 0.016 0.020-0.016-0.027-0.016 0.051-0.016zM29.339 22.4c-0.922 0-2.854 0.35-3.613 0.502-0.723 0.143-1.668 0.344-2.371 0.619-0.539 0.209-1.055 0.418-1.574 0.678-0.482 0.242-0.955 0.524-1.395 0.842l-0.432 0.318c-0.076 0.057-0.131 0.109-0.207 0.168-0.072 0.059-0.135 0.123-0.203 0.174-0.15 0.113-0.277 0.281-0.42 0.393-0.145 0.113-0.635 0.672-0.762 0.84l-0.461 0.652c-0.445 0.674-0.789 1.479-0.921 2.277-0.046 0.293-0.042 0.447-0.077 0.676-0.001 0.010-0.003 0.021-0.005 0.031v0.354c0.031 0.43 0.148 0.926 0.148 0.965h0.033c0.025-0.303 0.486-1.381 0.6-1.607l0.283-0.531c0.172-0.285 0.353-0.566 0.555-0.832 0.133-0.178 0.271-0.359 0.43-0.52 0.033-0.037 0.033-0.043 0.064-0.082 0.162-0.195 0.375-0.373 0.553-0.555l0.6-0.514c0.023-0.017 0.047-0.033 0.074-0.053l1.053-0.744c0.318-0.188 0.621-0.396 0.943-0.576 0.289-0.162 0.729-0.393 1.010-0.508l0.76-0.338c0.393-0.154 0.789-0.338 1.193-0.469l0.82-0.291c0.146-0.049 0.273-0.090 0.416-0.139 0.123-0.041 0.297-0.117 0.426-0.129l-0.904 0.42c-0.31 0.125-0.871 0.42-1.195 0.584l-0.871 0.467c-0.275 0.16-0.566 0.322-0.836 0.502l-0.801 0.553c-0.051 0.037-0.072 0.061-0.119 0.094-0.027 0.021-0.039 0.029-0.066 0.049l-0.174 0.15c-0.033 0.027-0.035 0.024-0.064 0.053-0.023 0.020-0.037 0.033-0.059 0.055l-0.758 0.795-0.842 1.164-0.338 0.563c-0.029 0.051-0.049 0.090-0.074 0.137-0.168 0.291-0.318 0.592-0.457 0.899l-0.066 0.164c0.227 0.051 1.475 0.039 1.777-0.004l0.559-0.061c0.916-0.1 1.971-0.354 2.777-0.754 0.039-0.018 0.072-0.031 0.113-0.047 0.031-0.014 0.066-0.033 0.098-0.049 0.041-0.021 0.059-0.035 0.102-0.061l0.203-0.109c0.137-0.072 0.26-0.158 0.381-0.238 0.144-0.098 0.299-0.205 0.428-0.322 0.189-0.17 0.393-0.35 0.551-0.547 0.023-0.029 0.045-0.045 0.068-0.076 0.258-0.318 0.467-0.666 0.693-1.006 0.334-0.498 0.644-1.008 0.916-1.549 0.582-1.168 0.746-1.315 1.477-2.231 0.031-0.035 0.031-0.043 0.066-0.078l0.391-0.377c0.162-0.141 0.369-0.287 0.572-0.361 0.18-0.066 0.271-0.1 0.52-0.1-0.174-0.258-0.91-0.275-1.387-0.279h-0.201zM26.909 23.986v0z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M6.567 27.001c2.243 1.711 4.916 2.693 7.73 2.84l0.078-1.498c-2.511-0.131-4.896-1.007-6.898-2.535l-0.91 1.193z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M27.471 15.351l1.498-0.065c-0.047-1.095-0.224-2.184-0.525-3.235l-1.441 0.413c0.268 0.937 0.425 1.909 0.468 2.887z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M28.028 10.824c-0.459-1.174-1.075-2.279-1.831-3.287l-1.199 0.9c0.675 0.899 1.224 1.885 1.634 2.932l1.396-0.545z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M23.643 4.927l-0.926 1.18c0.548 0.431 1.065 0.912 1.537 1.431l1.109-1.009c-0.527-0.582-1.106-1.12-1.72-1.602z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M21.69 3.622c-0.048-0.020-0.133-0.055-0.377-0.179l-0.676 1.339c0.311 0.157 0.418 0.201 0.468 0.219 0.030 0.018 0.075 0.048 0.175 0.113l0.486 0.315 0.813-1.261-0.479-0.311c-0.309-0.201-0.313-0.195-0.41-0.235z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M2.575 15.905c0-6.772 5.437-12.289 12.174-12.44v1.827l4.487-2.59-4.487-2.591v1.854c-7.564 0.152-13.674 6.341-13.674 13.94-0.001 3.911 1.657 7.667 4.548 10.307l1.012-1.107c-2.581-2.357-4.061-5.709-4.060-9.2z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)"
d="M18.775 11.604l-3.516 3.517c-0.076-0.011-0.151-0.023-0.231-0.023-0.171 0-0.333 0.034-0.487 0.082l-3.435-3.434-1.061 1.060 3.434 3.434c-0.049 0.155-0.083 0.317-0.083 0.488 0 0.079 0.012 0.155 0.024 0.23l-0.289 0.289 1.414 1.414 0.319-0.319c0.054 0.006 0.107 0.017 0.163 0.017 0.171 0 0.333-0.034 0.489-0.083l0.171 0.172 1.061-1.061-0.171-0.172c0.049-0.154 0.083-0.316 0.083-0.487 0-0.056-0.011-0.109-0.017-0.165l3.546-3.546-1.414-1.413z"></path>
<path fill="#424242" style="fill: var(--color3, #424242)" d="M26.158 21.484c0.063-0.013 0.131-0.027 0.19-0.039 0.374-0.075 0.959-0.185 1.61-0.295 0.543-1.338 0.878-2.745 0.985-4.203l-1.496-0.11c-0.12 1.632-0.557 3.192-1.289 4.647z"></path>
</symbol>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1 @@
.states-button-container{position:fixed;right:52px;bottom:35px}.tve-right-side .states-button-container{right:auto;left:35px}.states-button-container button{box-sizing:content-box;color:#fff;border:0;background:#52c578;border-radius:100%;box-shadow:0 2px 12px rgba(0,0,0,.25);padding:10px;height:20px;width:20px;font-size:20px;line-height:20px}.design-states{width:180px;padding:10px 15px;display:none;position:fixed;right:52px;bottom:35px;background:#fff;border-radius:3px;box-shadow:0 8px 12px rgba(0,0,0,.25)}.tve-right-side .design-states{right:auto;left:35px}.design-states span.title{display:block;padding-top:8px}.design-states .state-close{position:absolute;top:13px;right:13px}.btn-icon{border:0;background:none;padding:0}ul.state-steps{list-style:none;padding-bottom:10px}ul.state-steps>li{text-transform:uppercase;display:block;color:#555;background-color:#dadfdf;position:relative;padding:20px 0;margin:10px 0 0;font-size:14px;cursor:pointer;box-shadow:0 2px 3px rgba(0,0,0,.25);border-radius:2px;text-align:center}ul.state-steps>li.state-active,ul.state-steps>li.state-active:hover{background-color:#39c}ul.state-steps>li.state-active .state-name,ul.state-steps>li.state-active:hover .state-name{color:#fff}ul.state-steps>li.state-active .state-clone:before,ul.state-steps>li.state-active:hover .state-clone:before{color:#fff}ul.state-steps>li.state-active .state-clone:hover,ul.state-steps>li.state-active:hover .state-clone:hover{border-color:#fff}ul.state-steps>li.tl-multistep-open .lightbox-step-add-menu{transition:all .2s ease;opacity:1;visibility:visible;bottom:70px}ul.state-steps>li.state-add{background:none;box-shadow:none;border:1px dashed #ccc;cursor:pointer;color:#8d8d8d}ul.state-steps>li.state-add:hover{background:none;border:1px dashed hsl(0,0%,70%)}ul.state-steps>li:hover{background-color:hsl(180,7.2463768116%,81.4705882353%)}ul.state-steps>li:hover .state-delete,ul.state-steps>li:hover .state-edit,ul.state-steps>li:hover .state-clone{display:block}ul.state-steps .state-delete,ul.state-steps .state-edit,ul.state-steps .state-clone{font-size:14px;cursor:pointer;top:7px;height:17px;width:17px;position:absolute;padding:0;display:none;color:#606060}ul.state-steps .state-delete{right:7px;color:#f44551}ul.state-steps .state-clone{font-size:12px;left:7px}ul.state-steps .state-edit{font-size:12px;top:30px;left:7px}ul.state-steps .state-name{color:#666}.tve-tab-content{max-height:300px;overflow:auto}

View File

@@ -0,0 +1 @@
.tve-ult-preload-form{min-height:var(--tu-placeholder-height-d);position:relative;display:block;background:rgba(153,162,165,.1);overflow:hidden}@keyframes shimmer{100%{transform:translateX(100%)}}.tve-ult-preload-form::after{position:absolute;top:0;right:0;bottom:0;left:0;transform:translateX(-100%);background-image:linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.2) 20%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0));animation:shimmer 2s infinite;content:""}@media(max-width: 1023px){.tve-ult-preload-form{min-height:var(--tu-placeholder-height-t)}}@media(max-width: 767px){.tve-ult-preload-form{min-height:var(--tu-placeholder-height-m)}}

View File

@@ -0,0 +1,144 @@
/* State manager styles */
.states-button-container {
position: fixed;
right: 52px;
bottom: 35px;
.tve-right-side & {
right: auto;
left: 35px;
}
button {
box-sizing: content-box;
color: white;
border: 0;
background: #52c578;
border-radius: 100%;
box-shadow: 0 2px 12px rgba(0, 0, 0, .25);
padding: 10px;
height: 20px;
width: 20px;
font-size: 20px;
line-height: 20px;
}
}
.design-states {
width: 180px;
padding: 10px 15px;
display: none;
position: fixed;
right: 52px;
bottom: 35px;
background: white;
border-radius: 3px;
box-shadow: 0 8px 12px rgba(0, 0, 0, .25);
.tve-right-side & {
right: auto;
left: 35px;
}
span.title {
display: block;
padding-top: 8px;
}
.state-close {
position: absolute;
top: 13px;
right: 13px;
}
}
.btn-icon {
border: 0;
background: none;
padding: 0;
}
ul.state-steps {
list-style: none;
padding-bottom: 10px;
> li {
text-transform: uppercase;
display: block;
color: #555555;
background-color: #dadfdf;
position: relative;
padding: 20px 0;
margin: 10px 0 0;
font-size: 14px;
cursor: pointer;
box-shadow: 0 2px 3px rgba(0, 0, 0, .25);
border-radius: 2px;
text-align: center;
&.state-active, &.state-active:hover {
background-color: #3399cc;
.state-name {
color: #fff;
}
.state-clone {
&:before {
color: #fff;
}
&:hover {
border-color: #fff;
}
}
}
&.tl-multistep-open {
.lightbox-step-add-menu {
transition: all .2s ease;
opacity: 1;
visibility: visible;
bottom: 70px;
}
}
&.state-add {
background: none;
box-shadow: none;
border: 1px dashed #cccccc;
cursor: pointer;
color: #8d8d8d;
&:hover {
background: none;
border: 1px dashed darken(#cccccc, 10);
}
}
//Show (duplicate, delete, edit) buttons on list hover
&:hover {
background-color: darken(#dadfdf, 5);
.state-delete,
.state-edit,
.state-clone {
display: block;
}
}
}
.state-delete,
.state-edit,
.state-clone {
font-size: 14px;
cursor: pointer;
top: 7px;
height: 17px;
width: 17px;
position: absolute;
padding: 0;
display: none;
color: #606060;
}
.state-delete {
right: 7px;
color: #f44551;
}
.state-clone {
font-size: 12px;
left: 7px;
}
.state-edit {
font-size: 12px;
top: 30px;
left: 7px;
}
.state-name {
color: #666666;
}
}

View File

@@ -0,0 +1,8 @@
$borderStyles: 'none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset';
@mixin icon-size($size) {
font-size: $size;
line-height: $size;
width: $size;
height: $size;
}

View File

@@ -0,0 +1,80 @@
@import "variables";
html.tve-html-editor {
overflow: auto;
body {
overflow: auto;
}
}
body {
&:before {
display: none !important;
}
}
.tve-ult-body-ribbon {
#tve_editor {
padding: 0 !important;
}
}
/* ribbon styles */
.tve-ult-bar {
.admin-bar & {
top: 32px;
}
.tve_editor_page & {
&.tvu-footer.tvu-triggered {
bottom: 150px;
}
}
.tve_editor_page.tl-state-collapse & {
&.tvu-footer {
bottom: 0;
}
}
}
/* Widget - editor page */
.tve-ult-widget {
margin: 0 auto;
padding-top: 20px;
max-width: 300px;
.thrv_ult_widget {
outline: 1px dotted #dedede;
&.active_highlight, &.active_delete {
outline: 1px dashed #ff0000;
}
}
}
//edit mode conflict with theme
.tve-html-editor {
.cnt {
background: #fff;
box-shadow: none;
margin: 0;
padding: 0;
article {
margin: 0;
padding: 0;
}
}
}
//
//#tve_cpanel_onpage {
// &.menu_elem_ult_design {
// #tve_submenu_save {
// display: none;
// }
// }
//}
//
//#tve_lightbox_frame {
// .tu-tpl-menu li {
// > span {
// display: block;
// }
// }
//}

View File

@@ -0,0 +1,6 @@
@import "states";
.tve-tab-content {
max-height: 300px;
overflow: auto;
}

View File

@@ -0,0 +1,33 @@
.tve-ult-preload-form {
min-height: var(--tu-placeholder-height-d);
position: relative;
display: block;
background: rgba(153, 162, 165, .1);
overflow: hidden;
@keyframes shimmer {
100% {
transform: translateX(100%);
}
}
&::after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
transform: translateX(-100%);
background-image: linear-gradient(90deg, rgba(#fff, 0) 0, rgba(#fff, 0.2) 20%, rgba(#fff, 0.5) 60%, rgba(#fff, 0));
animation: shimmer 2s infinite;
content: '';
}
@media(max-width: 1023px) {
min-height: var(--tu-placeholder-height-t);
}
@media(max-width: 767px) {
min-height: var(--tu-placeholder-height-m);
}
}

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