Refactor CMS page template for improved readability and consistency

- Adjusted indentation and spacing for better code structure in page.tpl
- Ensured consistent use of block syntax and formatting
- Maintained functionality of the Paypo iframe integration and CMS content display
This commit is contained in:
2025-04-09 23:17:52 +02:00
parent 9a626b304e
commit 709798f77c
17 changed files with 4489 additions and 4486 deletions

View File

@@ -2,7 +2,7 @@
* @Website: apollotheme.com - prestashop template provider
* @author Apollotheme <apollotheme@gmail.com>
* @copyright 2007-2018 Apollotheme
* @description:
* @description:
*/
imgId = null; // using for store object image select a source in function select image
function log(message) {
@@ -70,25 +70,25 @@ function htmlentitiesDecode(str) {
$('.' + key).data('form', dataObj[key]);
//DONGND:: install data animation for column and group
if (typeof dataObj[key].animation != 'undefined')
{
{
if ($('.' + key).find('.animation-button').first().length)
{
{
var animation_bt = $('.' + key).find('.animation-button').first();
var animation_type = dataObj[key].animation ? dataObj[key].animation : 'none';
var animation_delay = dataObj[key].animation_delay ? dataObj[key].animation_delay : 1;
var animation_duration = dataObj[key].animation_duration ? dataObj[key].animation_duration : 1;
var animation_iteration_count = dataObj[key].animation_iteration_count ? dataObj[key].animation_iteration_count : 1;
var animation_infinite = dataObj[key].animation_infinite ? dataObj[key].animation_infinite : 0;
var animation_infinite = dataObj[key].animation_infinite ? dataObj[key].animation_infinite : 0;
$globalthis.assignConfigAnimation(animation_bt, animation_type, animation_delay, animation_duration, animation_iteration_count, animation_infinite);
}
}
});
//DONGND:: fix can't click tab 1 when create new widget tab
$('.ApTabs:not(#default_ApTabs)').each(function(){
var activeTabId = $(this).data('form').active_tab;
//DONGND:: fix can't click tab 1 when create new widget tab
$('.ApTabs:not(#default_ApTabs)').each(function(){
var activeTabId = $(this).data('form').active_tab;
if (activeTabId != '' && parseInt(activeTabId))
{
$(this).find('.nav-tabs a').eq(parseInt(activeTabId)-1).tab('show');
@@ -149,7 +149,7 @@ function htmlentitiesDecode(str) {
handle: ".waction-drag"
});
// $( ".widget-row" ).addClass( $globalthis.classWidget )
// .find( ".waction-drag" ).addClass( $globalthis.classWidgetHeader );
// .find( ".waction-drag" ).addClass( $globalthis.classWidgetHeader );
};
this.downloadFile = function (filename, result) {
@@ -185,7 +185,7 @@ function htmlentitiesDecode(str) {
cls = cls.replace("col-sp-12", "col-sp-" + realValue);
$(column).attr("class", cls);
objColumn = {form_id: "form_" + $globalthis.getRandomNumber()};
objColumn.sm = widthCol;
objColumn.xs = widthCol;
objColumn.sp = widthCol;
@@ -317,7 +317,7 @@ function htmlentitiesDecode(str) {
btnElement = $(this);
$('.btn-fwidth').removeClass('active');
$(this).addClass('active');
//reset
//reset
if ($(this).hasClass('width-default')) {
$globalthis.windowWidth = $(window).width();
$('#home_wrapper').attr('class', 'default');
@@ -506,10 +506,9 @@ function htmlentitiesDecode(str) {
//edit group
$(document).on("click", ".btn-edit", function () {
if ($(this).data('type' == undefined) && $(this).data('type') == undefined) {
var type = $(this).closest('.widget-row').data("type");
} else
var type = $(this).data("type");
var type = $(this).data('type') !== undefined
? $(this).data('type')
: $(this).closest('.widget-row').data('type');
if (type.indexOf("apSub") == 0) {
if (type == "apSubAccordions") {
@@ -569,7 +568,7 @@ function htmlentitiesDecode(str) {
$('#modal_form .modal-footer').show();
$('#modal_form .modal-body').html(data);
$('#modal_form').removeClass('modal-new').addClass('modal-edit');
// FIX BUG : ApCategory khong save duoc icon cu, khi thay icon cho 1 category khac
// resetSelectedImage();
@@ -582,7 +581,7 @@ function htmlentitiesDecode(str) {
initFullSlider("edit");
}
hideFormLevel2();
$globalthis.setFormAction();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
@@ -591,7 +590,7 @@ function htmlentitiesDecode(str) {
}
});
});
$(document).on("click", ".btn-new-widget", function () {
var url = $globalthis.ajaxHomeUrl + '&ajax=1&action=renderList';
if ($(this).hasClass('tabcontent-action'))
@@ -917,7 +916,7 @@ function htmlentitiesDecode(str) {
$(this).closest('.translatable-field').find('.img-thumbnail').hide();
return false;
});
$(document).on("click", ".image-manager .img-link", function (e) {
e.stopPropagation();
var img = $(this).find("img");
@@ -927,7 +926,7 @@ function htmlentitiesDecode(str) {
var div = $(imgId).closest("div");
imgDest = $(div).find("img");
var widget = $(img).attr("data-widget");
if(widget == "ApImage360")
{
@@ -990,17 +989,17 @@ function htmlentitiesDecode(str) {
$(document).on("click", ".animation-button", function (e) {
var animation_wrapper = $(this).siblings('.animation-wrapper');
if (!$(this).hasClass('active'))
{
{
$(".animation-button.active").siblings('.animation-wrapper').hide();
$(".animation-button.active").removeClass('active');
//DONGND:: load config by data
//DONGND:: load config by data
$(this).addClass('active');
var animation_type = $(this).data('animation-type');
var animation_delay = $(this).data('animation-delay');
var animation_delay = $(this).data('animation-delay');
var animation_duration = $(this).data('animation-duration');
var animation_iteration_count = $(this).data('animation-iteration-count');
var animation_infinite = $(this).data('animation-infinite');
if (typeof animation_delay != 'undefined')
{
animation_wrapper.find('.animation_delay').val(animation_delay);
@@ -1009,7 +1008,7 @@ function htmlentitiesDecode(str) {
{
animation_wrapper.find('.animation_delay').val(1);
}
if (typeof animation_duration != 'undefined')
{
animation_wrapper.find('.animation_duration').val(animation_duration);
@@ -1018,7 +1017,7 @@ function htmlentitiesDecode(str) {
{
animation_wrapper.find('.animation_duration').val(1);
}
if (typeof animation_iteration_count != 'undefined')
{
animation_wrapper.find('.animation_iteration_count').val(animation_iteration_count);
@@ -1027,7 +1026,7 @@ function htmlentitiesDecode(str) {
{
animation_wrapper.find('.animation_iteration_count').val(1);
}
if (animation_infinite == 1)
{
animation_wrapper.find('.animation_infinite').attr( 'checked', 'checked' );
@@ -1036,24 +1035,24 @@ function htmlentitiesDecode(str) {
{
animation_wrapper.removeAttr('checked');
}
//DONGND:: change offset to right with column small
//DONGND:: change offset to right with column small
if ($(window).width()-$(this).offset().left < animation_wrapper.width())
{
animation_wrapper.addClass('offset-right');
}
animation_wrapper.show();
if (typeof animation_type != 'undefined')
{
animation_wrapper.find('.animation_select').val(animation_type).trigger('change');
animation_wrapper.find('.animation_select').val(animation_type).trigger('change');
}
else
{
animation_wrapper.find('.animation_select').val('none').trigger('change');
animation_wrapper.find('.animation_select').val('none').trigger('change');
}
// animation_wrapper.find('.animate-it').trigger('click');
}
else
{
@@ -1062,9 +1061,9 @@ function htmlentitiesDecode(str) {
animation_wrapper.removeClass('offset-right');
animation_wrapper.find('.animationSandbox').removeClass().removeAttr('style').addClass('animationSandbox');
}
});
//DONGND:: save config of animation to data form of column/group
$(document).on("click", ".btn-save-animation", function (e) {
var obj_parent = $(this).parents('.animation-wrapper');
@@ -1074,17 +1073,17 @@ function htmlentitiesDecode(str) {
var animation_duration = obj_parent.find('.animation_duration').val();
var animation_iteration_count = obj_parent.find('.animation_iteration_count').val();
var animation_infinite = obj_parent.find('.animation_infinite').is(':checked')? 1 : 0;
$globalthis.assignConfigAnimation(animation_bt, animation_type, animation_delay, animation_duration, animation_iteration_count, animation_infinite);
//DONGND:: update data form for group/column
if (obj_parent.hasClass('column-animation-wrapper'))
{
{
var main_obj = obj_parent.parents('.column-row');
}
if (obj_parent.hasClass('group-animation-wrapper'))
{
{
var main_obj = obj_parent.parents('.group-row');
}
if (typeof main_obj != 'undefined')
@@ -1095,10 +1094,10 @@ function htmlentitiesDecode(str) {
main_obj.data('form').animation_iteration_count = animation_iteration_count;
main_obj.data('form').animation_infinite = animation_infinite;
}
animation_bt.trigger('click');
});
//DONGND:: hide section select animation for column and group when click out
$(document).on("click", function (e) {
if ($('.animation-button.active').length)
@@ -1106,16 +1105,16 @@ function htmlentitiesDecode(str) {
e.stopPropagation();
var container = $('.animation-wrapper');
var container2 = $('.animation-button');
if (container.length && container.has(e.target).length === 0 && container2.has(e.target).length === 0 && !$(e.target).hasClass('animation-button') && !$(e.target).hasClass('animation-wrapper')) {
// container.hide();
if (container.length && container.has(e.target).length === 0 && container2.has(e.target).length === 0 && !$(e.target).hasClass('animation-button') && !$(e.target).hasClass('animation-wrapper')) {
// container.hide();
// $('.animation-button.active').siblings('.animation-wrapper').find('.animationSandbox').removeClass().removeAttr('style').addClass('animationSandbox');
// $('.animation-button.active').removeClass('active');
// $('.animation-button.active').removeClass('active');
$('.animation-button.active').trigger('click');
}
}
}
});
//DONGND:: active button for section select animation for column and group
$(document).on("change", '.animation_select', function (e) {
var wrapper_obj = $(this).parents('.animation-wrapper');
@@ -1132,24 +1131,24 @@ function htmlentitiesDecode(str) {
else
{
var iteration_number = wrapper_obj.find('.animation_iteration_count').val();
}
}
wrapper_obj.find('.animationSandbox').removeClass().removeAttr('style').attr('style','animation-duration: '+duration_time+'s; animation-delay: '+delay_time+'s; animation-iteration-count: '+iteration_number).addClass($(this).val() + ' animated animationSandbox').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass().removeAttr('style').addClass('animationSandbox');
});
}
});
//DONGND:: run demo with current config
$(document).on("click", '.animate-it', function (e) {
var wrapper_obj = $(this).parents('.animation-wrapper');
wrapper_obj.find('.animation_select').trigger('change');
});
//DONGND:: copy to clipboard
$(document).on("click", '.bt_copy_clipboard', function (e) {
$(document).on("click", '.bt_copy_clipboard', function (e) {
var text_copy = '';
if ($(this).hasClass('shortcode_key'))
{
text_copy = $('#shortcode_key').val();
@@ -1162,22 +1161,22 @@ function htmlentitiesDecode(str) {
{
text_copy = $('#shortcode_embedded_code').val();
};
if (text_copy != '')
{
var $temp = $("<input>");
$("body").append($temp);
$("body").append($temp);
$temp.val(text_copy).select();
document.execCommand("copy");
showSuccessMessage('Copy successful');
$temp.remove();
}
});
});
};
//DONGND:: assign config to data form column/group
this.assignConfigAnimation = function (obj_bt, data_type, data_delay, data_duration, data_iteration, data_infinite) {
this.assignConfigAnimation = function (obj_bt, data_type, data_delay, data_duration, data_iteration, data_infinite) {
obj_bt.data('animation-type', data_type);
obj_bt.data('animation-delay', data_delay);
obj_bt.data('animation-duration', data_duration);
@@ -1185,8 +1184,8 @@ function htmlentitiesDecode(str) {
obj_bt.data('animation-infinite', data_infinite);
var txt_default = obj_bt.find('.animation-status').data('text-default');
if (data_type != 'none')
{
obj_bt.addClass('btn-success');
{
obj_bt.addClass('btn-success');
var txt_infinite = obj_bt.find('.animation-status').data('text-infinite');
obj_bt.find('.animation-status').text(data_type + (data_infinite == 1 ? ' ('+txt_infinite+')' : ''));
}
@@ -1344,46 +1343,46 @@ function htmlentitiesDecode(str) {
};
// AJAX LOAD FORM, LOAD WIDGET
this.setFormAction = function () {
var $globalthis = this;
//DONGND:: slick custom enable/disable
$('#slick_custom_status').change(function(){
var $globalthis = this;
//DONGND:: slick custom enable/disable
$('#slick_custom_status').change(function(){
if($(this).val() == 1)
{
{
$('#slick_custom').parents('.form-group').show();
}
else
{
{
$('#slick_custom').parents('.form-group').hide();
}
});
});
//DONGND:: slick center mode enable/disable
$('#slick_centermode').change(function(){
$('#slick_centermode').change(function(){
if($(this).val() == 1)
{
{
$('#slick_centerpadding').parents('.form-group').show();
}
else
{
{
$('#slick_centerpadding').parents('.form-group').hide();
}
});
});
$('.form-action').change(function () {
var elementName = $(this).attr('name');
$('.' + elementName + '_sub').hide();
$('.' + elementName + '-' + $(this).val()).show();
//DONGND:: special fields of slick carousel
if ($(this).val() == 'slickcarousel')
{
{
$('#slick_custom_status').trigger('change');
$('#slick_centermode').trigger('change');
}
});
});
// Show tool tip, hint of label
$("#modal_form .label-tooltip").tooltip();
@@ -1541,7 +1540,7 @@ function htmlentitiesDecode(str) {
if ($(".select-class").length) {
$(".select-class").click(function () {
if ($(this).is(':checked')) {
$('.select-class').each(function() {
// REMOVE ALL CHECKBOX VALUE IN TEXT
var classChk = $(this).data("value");
@@ -1565,9 +1564,9 @@ function htmlentitiesDecode(str) {
$(elementText).val(classChk);
}
}
}
}
});
$(".chk-row").click(function () {
var classChk = $(this).data("value");
var elementText = $(this).closest('.well').find('.element_class').first();
@@ -1749,7 +1748,7 @@ function htmlentitiesDecode(str) {
// Reinit
var container = (currentTab === "widget" ? $containerWidget : $containerModule);
// Priority is action search, in the case text search is not empty
// Priority is action search, in the case text search is not empty
// will search and reset sub category is Show all
if (filterValue !== "*") {
$(".for-" + currentTab + " .btn").removeClass("is-checked");
@@ -1837,14 +1836,14 @@ function htmlentitiesDecode(str) {
contentHtml = "";
widgetType = '';
// FIX : widget AP_RAW_HTML always get content of AP_HTML which created before
$($("#configuration_form").serializeArray()).each(function (i, field) {
if (field.name.substring(0, 2).toLowerCase() == 'ap' && field.value == '1') {
widgetType = field.name;
}
});
if (typeof tinyMCE != "undefined" && widgetType != 'ApRawHtml') {
tinyMCE.triggerSave();
//var mce = tinyMCE.activeEditor.getContent();
@@ -1863,13 +1862,13 @@ function htmlentitiesDecode(str) {
});
$($("#configuration_form").serializeArray()).each(function (i, field) {
// SET EMPTY VALUE AFTER UPDATE LANGUAGE FOR OTHER FIELD
if( field.value == '_JS_EMPTY_VALUE_')
{
field.value = '';
}
if (field.name.substring(0, 2).toLowerCase() == 'ap' && field.value == '1') {
widgetType = field.name;
} else {
@@ -1935,10 +1934,10 @@ function htmlentitiesDecode(str) {
$(currentE).attr("href", "#" + ObjectForm.id);
}
if (type == "update") {
// SAVE ACTIVE
// SAVE ACTIVE
//DONGND:: fix can't save tab after update
if (widgetType != "ap_sub_tabs")
{
{
if ($(currentE).find('.btn-status').first().hasClass("deactive")) {
ObjectForm.active = 0;
} else {
@@ -1958,13 +1957,13 @@ function htmlentitiesDecode(str) {
} else {
$(currentE).data("form", ObjectForm);
}
//DONGND:: update name of tab after change
if (widgetType == "ap_sub_tabs")
{
$(currentE).text(ObjectForm['title_' + $globalthis.lang_id]);
}
//console.log(ObjectForm);
$(".label-tooltip").tooltip();
return true;
@@ -2095,7 +2094,7 @@ function htmlentitiesDecode(str) {
continue;
}
//default xs = 6-> 2 cols.but we set 2 cols, we have to assign again
//default xs = 6-> 2 cols.but we set 2 cols, we have to assign again
if (startSet && ((12 / parseInt(colDefault[$globalthis.arrayCol[j]])) < colNumber)) {
colDefault[$globalthis.arrayCol[j]] = finalVal;
}
@@ -2204,12 +2203,12 @@ function htmlentitiesDecode(str) {
//set hook to object
objects[iHook] = objHook;
});
//DONGND: enable save multithreading
if(checkSaveMultithreading == 1)
{
var i = 0;
doLoop(isValid);
doLoop(isValid);
}
else
{
@@ -2243,22 +2242,22 @@ function htmlentitiesDecode(str) {
}
});
};
//DONGND: function run save multithreading
function doLoop(isValid) {
function doLoop(isValid) {
var temp_obj = new Object();
temp_obj[i] = objects[i];
data = 'dataForm=' + JSON.stringify(temp_obj);
data = 'dataForm=' + JSON.stringify(temp_obj);
if(i+1 == Object.keys(objects).length)
{
data += '&dataLast=1';
};
if(i==0)
{
data += '&dataFirst=1';
};
$.ajax({
type: "POST",
headers: {"cache-control": "no-cache"},
@@ -2293,7 +2292,7 @@ function htmlentitiesDecode(str) {
$("#ap_loading").hide();
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
}
});
});
};
return false;
});
@@ -2329,7 +2328,7 @@ function htmlentitiesDecode(str) {
//console.log(objects);
$('#data_profile').val(JSON.stringify(objects));
$('#data_id_profile').val($('#current_profile').data('id'));
if($globalthis.isValid == true)
{
$("#form_data_profile button").click();
@@ -2338,10 +2337,10 @@ function htmlentitiesDecode(str) {
}
});
};
//DONGND:: submit shortcode
$(document).on("click", ".shortcode_save_btn, .shortcode_save_stay_btn", function () {
$(document).on("click", ".shortcode_save_btn, .shortcode_save_stay_btn", function () {
if ($(this).hasClass('shortcode_save_stay_btn'))
{
$('#stay_page').val(1);
@@ -2356,16 +2355,16 @@ function htmlentitiesDecode(str) {
objHook.groups = {};
// console.log($('.group-row'));
$('.hook-wrapper .group-row').each(function (iGroup) {
objHook.groups[iGroup] = $globalthis.getHookSubmit(this, true);
});
// console.log(objHook);
$('#shortcode_content').val(JSON.stringify(objHook));
$('#appagebuilder_shortcode_form').submit();
return false;
});
$(document).on("click", ".position-cover .list-position .position-name", function () {
var select = $(this).closest("ul");
var isRunning = (typeof $(select).attr("isRunning") != "undefined") ? $(select).attr("isRunning") : "";