ElixirVault/www/system-brs-core/cms/cmsTextManager/js/cmsTextManager.js

662 lines
49 KiB
JavaScript

var CmsTextManager = (function() {
function CmsTextManager(){
var _this = this;
_this.oTable = new CTable("data");
_this.oTable.loadTableData();
}
CmsTextManager.prototype.oFileUpload = {};
CmsTextManager.prototype.oTinyMceController = {};
CTable.prototype.tableObjectCallback = function(jqObj){
// Bind link button clicks;
jqObj.find("span.icon_link").click(function(){
var id = $(this).closest("ul").attr("id");
var specContainer = "<div class='specContainer'><div><span class='close'></span><ul class='dx col1'><li style='display: none;'>" +
"<label for='a_title'> Article Title? :</label><input type='text' id='a_title' readonly='' name='a_title' value=''>" +
"</li><li><label for='a_link'> Link to Article :</label><input type='text' id='a_link' readonly='' name='a_link' value=''>" +
"</li></ul></div></div>";
// If spec cnt. already exist remove it before appending a new one;
var oSpec = jqObj.find("div.specContainer");
if(oSpec.length > 0)
oSpec.remove();
// Append spec cnt, bind close button && link field;
jqObj.find('.table-bactions').append(specContainer);
jqObj.find('span.close').click(function(){ oSpec.remove(); });
oLink.click(function(){ $(this).select(); });
// Get link
var oLink = $("div.specContainer #a_link");
$.get("text-manager/action:f_link/id:" + id, function(data){
data = cJSON.parse(data);
if(data.title)
$("div.specContainer #a_title").val(data.title).parent().show();
if(data.link)
oLink.val(data.link).focus().select();
});
});
};
// Rewrite CBase form callback
CBlank.prototype.viewCallback = function(jqObj){
var _this = this;
jqObj.find(".settings").find("h3").click(function(){
var jqParent = $(this).parent();
if(jqParent.hasClass("load"))
_this.loadBlankBlockSubContent(jqParent);
else
_this.showHideSubContentPanel(jqParent);
});
this.oBtnPan.find("#fcancel").click(function(){
CBase.message.hide();
if(_this.isModiffied){
CBase.oTable.filterTableData(false);
}else{
CBase.oTable.show();
}
});
this.oBtnPan.find("#fsave").click(function(){
_this.saveBlankView();
});
_this.tabs = new Tabs($(jqObj).find(".tabs"));
// Bind base fields;
CBase.jsModule.baseFieldBinds(jqObj);
// Add date picked to date field
jqObj.find("#a_date").datepicker({dateFormat: 'dd/mm/yy'});
this.bindBlankActions(jqObj);
};
// Ajax load view call back on object append - if needed then to rewrite
CBlank.prototype.viewCallbackAfterAppend = function(jqObj, d){
CBase.oForm.disableShow = true;
// Bind Image data handlers
CBase.jsModule.oFileUpload = new FileUpload(jqObj, d.files, 10);
// Bind Tiny Mce controller with custom templates
CBase.jsModule.bindTinyMCE(jqObj);
var og = jqObj.find("#a_type");
if(og.length){
// Select type by filter
if(d && d.bNew){
jqObj.find("option[value='"+ $("#cl_name").val() +"']")
.prop("selected", true)
.trigger("chosen:updated");
}
// Bind type change show/hide fields
if(typeof CBase.dt.oShow != "undefined"){
// On type change show/hide fields
CBase.jsModule.bindShowHideFields(og.val(), jqObj, false);
og.change(function(){
CBase.jsModule.bindShowHideFields($(this).val(), $("#data"), true);
});
}
}
};
// Bind TinyMCE with custom templates
CmsTextManager.prototype.bindTinyMCE = function(jqObj) {
let _this = this;
let vAdditionalCfg = {
toolbar: 'undo redo | formatselect pageTplMenu | fontsizeselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | code | headingTpl sectionTpl tabsTpl numberIndexTpl infoCols3Tpl calloutTpl',
extended_valid_elements: 'div[class|id|data-animate|data-bs-parent|style],section[class],a[class|href|data-bs-toggle|aria-expanded|target],button[type|class|data-video-id|data-bs-toggle|data-bs-target|aria-label|aria-expanded],span[class|style],i[class|style],img[src|class|alt|width|height],ul[class],li[class],p[class|style],h6[class],h5[class],h4[class],svg[aria-hidden|focusable|role|viewBox|viewbox|xmlns],circle[fill|stroke|stroke-width|cx|cy|r]',
setup: function (editor) {
_this.oTinyMceController.editor = editor;
editor.ui.registry.addMenuButton('pageTplMenu', {
text: 'Page Templates',
tooltip: 'Insert page content template',
fetch: function (callback) {
callback([
{
type: 'menuitem',
text: 'Return Policy - Full',
onAction: function () {
var collapseGroupId = _this.oTinyMceController.buildUid('faqs-collapse-group');
var tab1Id = _this.oTinyMceController.buildUid('faqs-collapse-group1');
var tab2Id = _this.oTinyMceController.buildUid('faqs-collapse-group2');
var tab3Id = _this.oTinyMceController.buildUid('faqs-collapse-group3');
_this.oTinyMceController.insertTopLevelBlock(
'<section class="return-policy">' +
'<div class="container">' +
// '<div class="section-capture text-center">' +
// '<div class="section-title" data-animate="animate__fadeIn">' +
// '<h2 class="section-heading">Return policy</h2>' +
// '</div>' +
// '</div>' +
'<div class="number-index" id="' + collapseGroupId + '">' +
'<h6 class="font-18" data-animate="animate__fadeIn">Streamlined returns for easy solutions</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Our return policy simplifies the process, ensuring fast and easy returns. Follow our clear steps for refunds, exchanges, or store credits.</p>' +
'<a href="#" class="btn-style secondary-btn mst-23" data-animate="animate__fadeIn">Shop now</a>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<div class="other-tab" data-animate="animate__fadeIn">' +
'<a href="#' + tab1Id + '" class="d-flex flex-wrap align-items-baseline" data-bs-toggle="collapse" aria-expanded="true">' +
'<span class="width-calc-16 font-18 heading-weight">Refund process steps?</span>' +
'<span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span>' +
'</a>' +
'<div class="collapse show" id="' + tab1Id + '" data-bs-parent="#' + collapseGroupId + '">' +
'<div class="pst-18"><p>Start your refund by logging into your account and following the return steps.</p></div>' +
'</div>' +
'</div>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<div class="other-tab" data-animate="animate__fadeIn">' +
'<a href="#' + tab2Id + '" class="d-flex flex-wrap align-items-baseline" data-bs-toggle="collapse" aria-expanded="false">' +
'<span class="width-calc-16 font-18 heading-weight">How to exchange?</span>' +
'<span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span>' +
'</a>' +
'<div class="collapse" id="' + tab2Id + '" data-bs-parent="#' + collapseGroupId + '">' +
'<div class="pst-18"><p>Choose exchange during your return request and select the replacement product.</p></div>' +
'</div>' +
'</div>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<div class="other-tab" data-animate="animate__fadeIn">' +
'<a href="#' + tab3Id + '" class="d-flex flex-wrap align-items-baseline" data-bs-toggle="collapse" aria-expanded="false">' +
'<span class="width-calc-16 font-18 heading-weight">How to cancel?</span>' +
'<span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span>' +
'</a>' +
'<div class="collapse" id="' + tab3Id + '" data-bs-parent="#' + collapseGroupId + '">' +
'<div class="pst-18"><p>Cancel orders before shipping, or create a return request after delivery.</p></div>' +
'</div>' +
'</div>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<h6 class="font-18" data-animate="animate__fadeIn"><i class="ri-double-quotes-l icon-32 mer-4"></i>Quality service shapes how we value returns</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">We focus on clear instructions and timely support so every return stays simple and stress-free.</p>' +
'</div>' +
'</div>' +
'</section>'
);
},
},
{
type: 'menuitem',
text: 'Payment Policy - Full',
onAction: function () {
_this.oTinyMceController.insertTopLevelBlock(
'<section class="payment-policy">' +
'<div class="container">' +
//'<div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">Payment terms</h2></div></div>' +
'<div class="question-index">' +
'<h6 class="font-18" data-animate="animate__fadeIn">Secure transaction rules and payment process</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Discover the steps to ensure safe and seamless payments on our platform.</p>' +
'<p class="p-bullets mst-16">Ensure easy and secure transactions.</p>' +
'<p class="p-bullets mst-1">Follow steps for seamless payments.</p>' +
'<h6 class="font-18 mst-18" data-animate="animate__fadeIn">Top payment options</h6>' +
'<p class="p-bullets mst-18" data-animate="animate__fadeIn"><span class="heading-color heading-weight mer-4">Visa:</span> Secure Visa card payments processed quickly and easily.</p>' +
'<p class="p-bullets mst-1" data-animate="animate__fadeIn"><span class="heading-color heading-weight mer-4">Paypal:</span> Handling payments through paypal for secure transactions.</p>' +
'<a href="#" class="btn-style secondary-btn mst-23" data-animate="animate__fadeIn">Know more</a>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<h6 class="question-sub-index font-18" data-animate="animate__fadeIn">What payment methods can I use?</h6>' +
'<p class="p-bullets mst-18">We accept major cards, digital wallets and bank transfers.</p>' +
'<h6 class="question-sub-index font-18 mst-18">What should I do if my payment fails?</h6>' +
'<p class="p-bullets mst-18">Retry the payment and check your details. Contact support if needed.</p>' +
'</div>' +
'</div>' +
'</section>'
);
},
},
{
type: 'menuitem',
text: 'Privacy Policy - Full',
onAction: function () {
_this.oTinyMceController.insertTopLevelBlock(
'<section class="privacy-policy">' +
'<div class="container">' +
//'<div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">Privacy policy</h2></div></div>' +
'<div class="number-index">' +
'<p class="p-bullets" data-animate="animate__fadeIn">We use secure methods to store and manage your sensitive information.</p>' +
'<p class="p-bullets mst-1" data-animate="animate__fadeIn">Your data is used only to improve your experience.</p>' +
'<p class="p-bullets mst-1" data-animate="animate__fadeIn">We do not share your details without your consent.</p>' +
'<h6 class="number-sub-index font-18 mst-18" data-animate="animate__fadeIn">Liability</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">We protect your data with industry best practices.</p>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<h6 class="number-sub-index font-18" data-animate="animate__fadeIn">Trusted ways</h6>' +
'<p class="p-number mst-18" data-animate="animate__fadeIn">Visa: Secure Visa card payments processed quickly and easily.</p>' +
'<p class="p-number mst-6" data-animate="animate__fadeIn">Paypal: Secure digital wallet payments.</p>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<h6 class="number-sub-index font-18" data-animate="animate__fadeIn">How do we handle your data?</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Learn how we collect, secure and process your personal data.</p>' +
'<a href="#" class="btn-style secondary-btn mst-23" data-animate="animate__fadeIn">Know more</a>' +
'</div>' +
'</div>' +
'</section>'
);
},
},
{
type: 'menuitem',
text: 'Shipping Policy - Full',
onAction: function () {
_this.oTinyMceController.insertTopLevelBlock(
'<section class="shipping-policy">' +
'<div class="container">' +
//'<div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">Shipping policy</h2></div></div>' +
'<div class="number-index">' +
'<h6 class="number-sub-index font-18" data-animate="animate__fadeIn">Delivery</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Orders are processed within 1-2 business days and shipped with tracking.</p>' +
'<p class="p-bullets mst-16" data-animate="animate__fadeIn">Standard shipping takes 5-7 business days.</p>' +
'<p class="p-bullets mst-1" data-animate="animate__fadeIn">Expedited shipping options are available.</p>' +
'<h6 class="number-sub-index font-18 mst-18" data-animate="animate__fadeIn">Freight</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Shipping costs vary by location and order weight.</p>' +
'<p class="p-bullets mst-16" data-animate="animate__fadeIn">Charges are shown during checkout.</p>' +
'<h6 class="number-sub-index font-18 mst-18" data-animate="animate__fadeIn">Dispatch</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">You will receive a tracking number after dispatch.</p>' +
'</div>' +
'</div>' +
'</section>'
);
},
},
{
type: 'menuitem',
text: 'Terms & Conditions - Full',
onAction: function () {
_this.oTinyMceController.insertTopLevelBlock(
'<section class="terms-rules">' +
'<div class="container">' +
//'<div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">Terms &amp; conditions</h2></div></div>' +
'<div class="number-index">' +
'<h6 class="number-sub-index font-18" data-animate="animate__fadeIn">Restriction</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Access to our site is granted for personal use only.</p>' +
'<p class="mst-6" data-animate="animate__fadeIn">Unauthorized use may result in account restrictions.</p>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<h6 class="number-sub-index font-18" data-animate="animate__fadeIn">Usage rights</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Access and use of services are granted under specific conditions.</p>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<h6 class="number-sub-index font-18" data-animate="animate__fadeIn">Liability limits</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">We are not liable for indirect damages to the extent permitted by law.</p>' +
'</div>' +
'</div>' +
'</section>'
);
},
},
{
type: 'menuitem',
text: 'Cookie Policy - Full',
onAction: function () {
_this.oTinyMceController.insertTopLevelBlock(
'<section class="cookie">' +
'<div class="container">' +
//'<div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">Cookie</h2></div></div>' +
'<div class="number-index">' +
'<p data-animate="animate__fadeIn">We use cookies to improve your browsing experience and personalize content.</p>' +
'<p class="mst-6" data-animate="animate__fadeIn">You can adjust cookie settings in your browser.</p>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<h6 class="number-sub-index font-18" data-animate="animate__fadeIn">What is a cookie?</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">A cookie is a small data file stored on your device by a website.</p>' +
'<div class="pst-30 mst-30 bst" data-animate="animate__fadeIn"></div>' +
'<h6 class="number-sub-index font-18" data-animate="animate__fadeIn">Types of cookies on this site</h6>' +
'<h6 class="p-number font-18 mst-20" data-animate="animate__fadeIn">Essential function cookies</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Required for core website functionality and security.</p>' +
'<h6 class="p-number font-18 mst-18" data-animate="animate__fadeIn">Analytics tracking cookies</h6>' +
'<p class="mst-18" data-animate="animate__fadeIn">Used to analyze behavior and improve site performance.</p>' +
'</div>' +
'</div>' +
'</section>'
);
},
},
{
type: 'menuitem',
text: 'About Us - Full',
onAction: function () {
_this.oTinyMceController.insertTopLevelBlock(
'<section class="about-us">' +
'<div class="container">' +
'<div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">About story</h2></div></div>' +
'<div class="about-banner" data-animate="animate__fadeIn"><div class="banner-hover"><span class="d-block banner-img br-hidden"><img src="assets/image/other/about-banner1.jpg" class="w-100 img-fluid" alt="about-banner1"></span></div></div>' +
'<div class="about-service section-pt text-center"><div class="row row-mtm justify-content-md-center">' +
'<div class="col-12 col-lg-4" data-animate="animate__fadeIn"><div class="col-xxl-10 mx-xxl-auto"><h6 class="font-18">5000+ Happy customer</h6><p class="mst-18">Absolutely delighted with the service and support.</p></div></div>' +
'<div class="col-12 col-lg-4" data-animate="animate__fadeIn"><div class="col-xxl-10 mx-xxl-auto"><h6 class="font-18">29+ Awards won</h6><p class="mst-18">Recognized for quality, innovation and customer care.</p></div></div>' +
'<div class="col-12 col-lg-4" data-animate="animate__fadeIn"><div class="col-xxl-10 mx-xxl-auto"><h6 class="font-18">40+ years of experiences</h6><p class="mst-18">Long-term expertise with a modern approach to growth.</p></div></div>' +
'</div></div>' +
'</div>' +
'</section>' +
'<div class="about-us-banner section-ptb"><div class="container"><div class="about-banner" data-animate="animate__fadeIn"><div class="banner-hover"><span class="d-block banner-img br-hidden"><img src="assets/image/other/about-banner2.jpg" class="w-100 img-fluid" alt="about-banner2"></span></div></div></div></div>' +
'<section class="about-service section-pt text-center"><div class="container"><div class="row row-mtm justify-content-md-center">' +
'<div class="col-12 col-lg-6" data-animate="animate__fadeIn"><div class="col-lg-10 col-xl-9 col-xxl-7 mx-lg-auto"><h6 class="font-18">Leading with innovation since 1982</h6><p class="mst-18">We blend experience with modern solutions to deliver strong results.</p></div></div>' +
'<div class="col-12 col-lg-6" data-animate="animate__fadeIn"><div class="col-lg-10 col-xl-9 col-xxl-7 mx-lg-auto"><h6 class="font-18">Transforming ideas into success</h6><p class="mst-18">We turn clear vision and integrity into meaningful outcomes.</p></div></div>' +
'</div></div></section>' +
'<section class="about-team section-ptb"><div class="container"><div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">Our team</h2></div></div><div class="row row-mtm text-center">' +
'<div class="col-6 col-lg-3" data-animate="animate__fadeIn"><div class="about-team-content banner-hover"><div class="about-team-img"><span class="d-block banner-img br-hidden"><img src="assets/image/other/about-team1.jpg" class="w-100 img-fluid" alt="about-team1"></span></div><div class="about-team-info pst-25"><h6 class="font-18">Team member 1</h6><span class="d-block mst-6">Web designer</span></div></div></div>' +
'<div class="col-6 col-lg-3" data-animate="animate__fadeIn"><div class="about-team-content banner-hover"><div class="about-team-img"><span class="d-block banner-img br-hidden"><img src="assets/image/other/about-team2.jpg" class="w-100 img-fluid" alt="about-team2"></span></div><div class="about-team-info pst-25"><h6 class="font-18">Team member 2</h6><span class="d-block mst-6">Support staff</span></div></div></div>' +
'<div class="col-6 col-lg-3" data-animate="animate__fadeIn"><div class="about-team-content banner-hover"><div class="about-team-img"><span class="d-block banner-img br-hidden"><img src="assets/image/other/about-team3.jpg" class="w-100 img-fluid" alt="about-team3"></span></div><div class="about-team-info pst-25"><h6 class="font-18">Team member 3</h6><span class="d-block mst-6">Deputy sale</span></div></div></div>' +
'<div class="col-6 col-lg-3" data-animate="animate__fadeIn"><div class="about-team-content banner-hover"><div class="about-team-img"><span class="d-block banner-img br-hidden"><img src="assets/image/other/about-team4.jpg" class="w-100 img-fluid" alt="about-team4"></span></div><div class="about-team-info pst-25"><h6 class="font-18">Team member 4</h6><span class="d-block mst-6">Policy member</span></div></div></div>' +
'</div></div></section>'
);
},
},
{
type: 'menuitem',
text: 'FAQ - Full',
onAction: function () {
var faqTopId = _this.oTinyMceController.buildUid('faqs-collapse');
var faqTop1 = _this.oTinyMceController.buildUid('faqs-collapse1');
var faqTop2 = _this.oTinyMceController.buildUid('faqs-collapse2');
var faqTop3 = _this.oTinyMceController.buildUid('faqs-collapse3');
var faqTop4 = _this.oTinyMceController.buildUid('faqs-collapse4');
var faqGroupId = _this.oTinyMceController.buildUid('faqs-collapse-group');
var faqGroup1 = _this.oTinyMceController.buildUid('faqs-collapse-group1');
var faqGroup2 = _this.oTinyMceController.buildUid('faqs-collapse-group2');
var faqGroup3 = _this.oTinyMceController.buildUid('faqs-collapse-group3');
_this.oTinyMceController.insertTopLevelBlock(
'<section class="faqs section-pt">' +
'<div class="container">' +
//'<div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">Frequently asked questions</h2></div></div>' +
'<div class="faqs-collapse-group border-full border-radius" id="' + faqTopId + '">' +
'<div class="other-tab ptb-15 plr-15" data-animate="animate__fadeIn"><a href="#' + faqTop1 + '" class="d-flex flex-wrap align-items-baseline" data-bs-toggle="collapse" aria-expanded="true"><span class="width-calc-16 heading-weight">How do I track my order?</span><span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span></a><div class="collapse show" id="' + faqTop1 + '" data-bs-parent="#' + faqTopId + '"><div class="pst-9"><p>You can track your order in your account.</p></div></div></div>' +
'<div class="other-tab ptb-15 plr-15" data-animate="animate__fadeIn"><a href="#' + faqTop2 + '" class="d-flex flex-wrap align-items-baseline" data-bs-toggle="collapse" aria-expanded="false"><span class="width-calc-16 heading-weight">What is your return policy?</span><span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span></a><div class="collapse" id="' + faqTop2 + '" data-bs-parent="#' + faqTopId + '"><div class="pst-9"><p>We accept returns within policy terms.</p></div></div></div>' +
'<div class="other-tab ptb-15 plr-15" data-animate="animate__fadeIn"><a href="#' + faqTop3 + '" class="d-flex flex-wrap align-items-baseline" data-bs-toggle="collapse" aria-expanded="false"><span class="width-calc-16 heading-weight">Do you offer international shipping?</span><span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span></a><div class="collapse" id="' + faqTop3 + '" data-bs-parent="#' + faqTopId + '"><div class="pst-9"><p>Yes, shipping options vary by country.</p></div></div></div>' +
'<div class="other-tab ptb-15 plr-15" data-animate="animate__fadeIn"><a href="#' + faqTop4 + '" class="d-flex flex-wrap align-items-baseline" data-bs-toggle="collapse" aria-expanded="false"><span class="width-calc-16 heading-weight">Can I change my order after placing it?</span><span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span></a><div class="collapse" id="' + faqTop4 + '" data-bs-parent="#' + faqTopId + '"><div class="pst-9"><p>Contact support quickly after placing the order.</p></div></div></div>' +
'</div>' +
'</div>' +
'</section>' +
'<section class="faqs-service section-pt text-center"><div class="container"><div class="row row-mtm"><div class="col-12 col-md-6" data-animate="animate__fadeIn"><div class="col-lg-10 col-xl-9 col-xxl-7 d-flex flex-column align-items-center mx-lg-auto"><span class="primary-color icon-24 width-80 height-80 d-flex align-items-center justify-content-center extra-bg meb-25 rounded-circle"><i class="ri-phone-line d-block lh-1"></i></span><h6 class="font-18">Call the team</h6><p class="mst-8">Get in touch with our support crew anytime for assistance.</p></div></div><div class="col-12 col-md-6" data-animate="animate__fadeIn"><div class="col-lg-10 col-xl-9 col-xxl-7 d-flex flex-column align-items-center mx-lg-auto"><span class="primary-color icon-24 width-80 height-80 d-flex align-items-center justify-content-center extra-bg meb-25 rounded-circle"><i class="ri-user-line d-block lh-1"></i></span><h6 class="font-18">Help team crew</h6><p class="mst-8">Support squad dedicated to assisting with any issue.</p></div></div></div></div></section>' +
'<section class="faqs section-ptb"><div class="container"><div class="section-capture text-center"><div class="section-title" data-animate="animate__fadeIn"><h2 class="section-heading">Common queries</h2></div></div><div class="row row-mtm15" id="' + faqGroupId + '">' +
'<div class="other-tab" data-animate="animate__fadeIn"><div class="border-full border-radius"><a href="#' + faqGroup1 + '" class="d-flex flex-wrap align-items-baseline ptb-15 plr-15" data-bs-toggle="collapse" aria-expanded="true"><span class="width-calc-16 heading-weight">How do I place an order?</span><span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span></a><div class="collapse show" id="' + faqGroup1 + '" data-bs-parent="#' + faqGroupId + '"><div class="ptb-15 plr-15 bst"><p>Browse products, add to cart and proceed to checkout.</p></div></div></div></div>' +
'<div class="other-tab" data-animate="animate__fadeIn"><div class="border-full border-radius"><a href="#' + faqGroup2 + '" class="d-flex flex-wrap align-items-baseline ptb-15 plr-15" data-bs-toggle="collapse" aria-expanded="false"><span class="width-calc-16 heading-weight">How can I track my order status?</span><span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span></a><div class="collapse" id="' + faqGroup2 + '" data-bs-parent="#' + faqGroupId + '"><div class="ptb-15 plr-15 bst"><p>Use your tracking number in account or email link.</p></div></div></div></div>' +
'<div class="other-tab" data-animate="animate__fadeIn"><div class="border-full border-radius"><a href="#' + faqGroup3 + '" class="d-flex flex-wrap align-items-baseline ptb-15 plr-15" data-bs-toggle="collapse" aria-expanded="false"><span class="width-calc-16 heading-weight">What shipping options are available?</span><span class="other-tab-icon width-16 icon-16"><i class="ri-add-line d-block lh-1"></i></span></a><div class="collapse" id="' + faqGroup3 + '" data-bs-parent="#' + faqGroupId + '"><div class="ptb-15 plr-15 bst"><p>Standard, express and next-day options are available.</p></div></div></div></div>' +
'</div></div></section>'
);
},
},
]);
},
});
editor.ui.registry.addButton('headingTpl', {
text: 'Heading',
tooltip: 'Insert heading',
onAction: function () {
var padding = prompt("Add section top padding? (yes/no)", "yes").toLowerCase();
var addPadding = (padding === 'yes' || padding === 'y' || padding === '1');
_this.oTinyMceController.insertTopLevelBlock(
'<div class="section-capture text-center' + (addPadding ? ' section-pt' : '') + '">\n' +
'<div class="section-title animate__fadeIn animate__animated" data-animate="animate__fadeIn">\n' +
'<h2 class="section-heading">Write your ection header here...</h2>\n' +
'</div>\n' +
'</div>'
);
},
});
editor.ui.registry.addButton('sectionTpl', {
text: 'Section',
tooltip: 'Insert section',
onAction: function () {
_this.oTinyMceController.insertTopLevelBlock(
'<section class="section-ptb">' +
'<div class="container">' +
'<div class="section-content" data-animate="animate__fadeIn">' +
'<p>Write section content here...</p>' +
'</div>' +
'</div>' +
'</section>'
);
},
});
editor.ui.registry.addButton('tabsTpl', {
text: 'Tabs',
tooltip: 'Insert tabs block',
onAction: function () {
var count = parseInt(prompt("How many tabs?", "3"));
if(!count || count < 1 || count > 20) return;
var openFirstRaw = prompt("Should first tab be open? (yes/no)", "yes");
if(openFirstRaw === null) return;
var openFirst = openFirstRaw.toLowerCase();
var isFirstOpen = (openFirst === 'yes' || openFirst === 'y' || openFirst === '1');
let collapseId = _this.oTinyMceController.buildUid('collapse-tab');
var html = '<div class="tabs-section">' +
'<div class="container">' +
'<div class="tabs-block border-full border-radius" id="' + collapseId + '" data-animate="animate__fadeIn">';
for(var i = 1; i <= count; i++) {
let tabId = _this.oTinyMceController.buildUid('tab-' + i);
let isFirst = (i === 1);
let shouldBeOpen = (isFirst && isFirstOpen);
html += '<div class="collapse-tab ptb-30 plr-15 plr-md-30' + (!isFirst ? ' bst' : '') + '" data-animate="animate__fadeIn">' +
'<button type="button" class="w-100 d-flex align-items-center justify-content-between" data-bs-toggle="collapse" data-bs-target="#' + tabId + '" aria-expanded="' + (shouldBeOpen ? 'true' : 'false') + '">' +
'<span class="heading-weight">Tab ' + i + '</span>' +
'<span class="tab-icon icon-16"><i class="ri-add-line"></i></span>' +
'</button>' +
'<div class="collapse' + (shouldBeOpen ? ' show' : '') + '" id="' + tabId + '" data-bs-parent="#' + collapseId + '"><div class="pst-15"><p>Tab ' + i + ' content goes here...</p></div></div>' +
'</div>';
}
html += '</div></div></div>';
_this.oTinyMceController.insertTopLevelBlock(html);
},
});
// NUMBER-INDEX button
editor.ui.registry.addButton('numberIndexTpl', {
text: 'Numbered Index',
tooltip: 'Insert numbered index block',
onAction: function () {
var count = parseInt(prompt("How many sections?", "2"));
if(!count || count < 1 || count > 20) return;
var html = '<div class="number-index" data-animate="animate__fadeIn">';
for(var i = 1; i <= count; i++) {
html += '<h6 class="number-sub-index font-18">Section ' + i + '</h6>' +
'<p class="mst-18">Main paragraph text here...</p>' +
'<p class="mst-6">Supporting paragraph or details...</p>';
if(i < count) html += '<div class="pst-30 mst-30 bst"></div>';
}
html += '</div>';
_this.oTinyMceController.insertTopLevelBlock(html);
},
});
// INFO CARDS 3 COLUMNS button
editor.ui.registry.addButton('infoCols3Tpl', {
text: 'Info Cards',
tooltip: 'Insert info cards',
onAction: function () {
var count = parseInt(prompt("How many cards? (2-6)", "3"));
if(!count || count < 2 || count > 6) return;
var colClass = count === 2 ? 'col-lg-6' : (count === 4 ? 'col-lg-3' : 'col-lg-4');
var html = '<div class="about-service section-pt text-center" data-animate="animate__fadeIn">' +
'<div class="row row-mtm justify-content-md-center">';
for(var i = 1; i <= count; i++) {
html += '<div class="col-12 ' + colClass + '">' +
'<h6>Card Title ' + i + '</h6>' +
'<p class="mst-8">Card description text goes here...</p>' +
'</div>';
}
html += '</div></div>';
_this.oTinyMceController.insertTopLevelBlock(html);
},
});
// CALLOUT INFO BOX button
editor.ui.registry.addButton('calloutTpl', {
text: 'Callout Box',
tooltip: 'Insert callout/info box',
onAction: function () {
_this.oTinyMceController.insertTopLevelBlock(
'<div class="row row-mtm text-center" data-animate="animate__fadeIn">' +
'<div class="col-12 col-md-6">' +
'<div class="col-lg-10 col-xl-9 col-xxl-7 mx-lg-auto">' +
'<span class="icon-24 width-80 height-80 extra-bg rounded-circle d-flex align-items-center justify-content-center mx-auto mb-3">' +
'<i class="ri-phone-line" style="font-size: 40px;"></i>' +
'</span>' +
'<h6 class="font-18">Callout Title</h6>' +
'<p class="mst-8">Callout description text goes here...</p>' +
'</div>' +
'</div>' +
'</div>'
);
},
});
},
};
_this.oTinyMceController = new TinyMceController(jqObj, vAdditionalCfg);
};
// Save blank data check callback function
CBlank.prototype.saveBlankDataCheckCallback = function(jqObj){
// Manipulate save data object
if(jqObj && jqObj.article){
var jqObjArticle = $("");
for(var l in jqObj.article){
if(jqObj.article.hasOwnProperty(l)){
for(var k in jqObj.article[l]){
if(jqObj.article[l].hasOwnProperty(k)){
jqObjArticle = $("<div>" + jqObj.article[l][k] + "</div>");
jqObjArticle.find("a").each(function(){
if(!this.className.length)
$(this).addClass("link");
});
jqObj.article[l][k] = jqObjArticle.html();
}
}
}
}
}
return jqObj;
};
// Rewrite Save error callback function
CBlank.prototype.saveBlankErrorCallback = function(){
CBase.jsModule.showError();
};
// Update count classification selection availability
CmsTextManager.prototype.showError = function(){
var err = $(".v-error:first");
if(err.length){
if(!err.is(":visible")){
var id = err.closest("div.sbox").attr("id").substr(1);
$("#lang-" + id).trigger("click");
}
$('html, body').animate({scrollTop:err.find("input,textarea").offset().top-20}, 400);
}
};
CmsTextManager.prototype.baseFieldBinds = function(jqObj){
var _this = this;
// Replace spaces on blur
jqObj.find("input[id^='a_link-seg-']").bind("blur", function(){
$(this).val(_this.removeSpecial($(this).val().trim()));
});
// On title blur insert link segment based on title, if no segment entered
jqObj.find("textarea[id^='a_title-']").bind("blur", function(){
var u = $(this).closest("ul").find("input[id^='a_link-seg-']");
if(u.val() == "" && $(this).val() != "")
u.val(_this.removeSpecial($(this).val().trim()));
});
};
CmsTextManager.prototype.bindShowHideFields = function(id, jqObj, bReset){
if(bReset)
jqObj.find("#a_npk").val("");
// Hide all special fields li
if(CBase.dt.oShow['all']){
jqObj.find(CBase.dt.oShow['all']).each(function(){
if($(this).is("input") || $(this).is("textarea") || $(this).is("select")){
$(this).addClass("skip").closest("li").hide();
if(bReset)
$(this).val('')
}else if($(this).is("div") || $(this).is("ul")){
$(this).hide().find("textarea, select").addClass("skip");
if(bReset)
$(this).find("textarea, select").val('');
}
});
}
// Show all special fields we need to show for each type
if(id && CBase.dt.oShow[id] != undefined){
if(CBase.dt.oShow[id]["s"]){
jqObj.find(CBase.dt.oShow[id]['s']).each(function(){
if($(this).is("input") || $(this).is("select") || $(this).is("textarea"))
$(this).removeClass("skip").closest("li").fadeIn("normal");
else if($(this).is("div") || $(this).is("ul"))
$(this).fadeIn("normal").find("textarea, select").removeClass("skip");
});
}
}
};
/**
* Function to remove special characters from text, returns the result string
*
* @author Aivars Žukovskis <info@brsystems.lv>
* @category cmsTextmanager
*/
CmsTextManager.prototype.removeSpecial = function(text){
var specialChars = {
"ā" : "a",
"č" : "c",
"ē" : "e",
"ģ" : "g",
"ī" : "i",
"ķ" : "k",
"ļ" : "l",
"ņ" : "n",
"ū" : "u",
"š" : "s",
"ž" : "z",
" " : "-"
};
if(text.length) {
var lower = text.toLowerCase();
var result = "";
for(var i=0; i<lower.length; ++i) {
if(specialChars[lower[i]])
result += specialChars[lower[i]];
else
result += lower[i]
}
return result.replace(/[^a-zA-Z0-9-]/g,"");
}
return '';
};
return CmsTextManager;
})();