AnonSec Shell
Server IP : 46.105.57.169  /  Your IP : 216.73.216.144
Web Server : Apache
System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : maitricfuz ( 93378)
PHP Version : 8.4.10
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/maitricfuz/www/new-saint-martin/media/com_pagebuilderck/assets/pro/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/maitricfuz/www/new-saint-martin/media/com_pagebuilderck/assets/pro/pagebuilderckparams.js
/**
 * @name		Page Builder CK
 * @package		com_pagebuilderck
 * @copyright	Copyright (C) 2015. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 * @author		Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr
 */
 
/*=================================*/
/*		Favorite management
/*=================================*/

var BLOCCKSTYLESBACKUP = '';
var FAVORITELOCKED = '';

$ck(document).ready(function() {
	ckGetLibraryData();
});

function ckShowFavoritePopup(blocid) {
	ckCloseEdition();
	FAVORITELOCKED = 1;
	blocid = '.workspaceck #' + blocid;
	bloc = $ck(blocid);
	$ck('.editfocus').removeClass('editfocus');
	bloc.addClass('editfocus');
	BLOCCKSTYLESBACKUP = $ck('> .ckstyle', bloc).html();
	$ck('#popup_favoriteck').fadeIn();
	FAVORITELOCKED = 0;
}

function ckCloseFavoritePopup(force) {
	if (! force ) force = false;
	$ck('#popup_favoriteck .editfocus').removeClass('editfocus');
	if ( $ck('#popup_favoriteck').hasClass('stick') && !force ) {
		BLOCCKSTYLESBACKUP = $ck('> .ckstyle', $ck('.editfocus')).html();
		return;
	}
	$ck('#popup_favoriteck').fadeOut();
}


function ckGetFavorite() {
	var bloc = $ck('.editfocus');
	var cssbloc = new Object();
	cssbloc['class'] = bloc.attr('class');
	blocstyle = ($ck('> .ckstyle', bloc).length && $ck('> .ckstyle', bloc).html()) ? $ck('> .ckstyle', bloc).html() : '';
	blocss = '';
	if (blocstyle) {
		var id = new RegExp(bloc.attr('id'), "g");
		blocstyle = blocstyle.replace(id, "|ID|");
		blocss = blocstyle;
		var uri = new RegExp(URIBASE + "/", "g");
		blocstyle = blocstyle.replace(uri, "|URIBASE|");
	}
	cssbloc['css'] = blocss;
	cssbloc['style'] = blocstyle;
	$ck('> .ckprops', bloc).each(function(i, ckprops) {
		ckprops = $ck(ckprops);
		text = 'class="' + ckprops.attr('class') + '" ';
		fieldslist = ckprops.attr('fieldslist') != 'undefined' ? ckprops.attr('fieldslist').split(',') : Array();
		text += 'fieldslist="' + ckprops.attr('fieldslist') + '" ';
//		fieldslist.each(function(fieldname) {
		for (var f = 0;f < fieldslist.length; f++ ) {
//			text += fieldname + '="' + ckprops.attr(fieldname) + '" ';
			text += fieldslist[f] + '="' + ckprops.attr(fieldslist[f]) + '" ';
		}
//		});
		cssbloc['ckprops' + i] = text;
	});

	return cssbloc;
}

function ckSaveFavorite(id) {
	if (! id) id = -1;
	var favorite = ckGetFavorite();
	var favoriteStyle = favorite['style'];
	favoritestring = JSON.stringify(favorite);
	favoritestring = favoritestring.replace(/#/g, "|di|");
	
	var myurl = PAGEBUILDERCK.URIPBCK + "&task=ajaxSaveFavorite&" + PAGEBUILDERCK.TOKEN;
	$ck.ajax({
		type: "POST",
		url: myurl,
		data: {
			favorite: favoritestring,
			id: id,
			focusclass: $ck('.focus').attr('class')
			}
	}).done(function(code) {
		try {
			response = JSON.parse(code);
			if (response.status == '1') {
				// $ck('#showfavorites > div').append('<div class="favoritethumb" onmouseout="ckRestoreBeforeFavorite()" onmouseover="ckPreviewFavoriteDirect(this)" onclick="ckLoadFavorite(\'favorite' + code + '\', \'favorites\', 1)"><img src="'+URIBASE+'/components/com_pagebuilderck/images/favorite.png" style="height:32px;width:32px;margin:0;padding:0;" />'
						// + '<div class="favoritethumbstyles">'+favoriteStyle+'</div>'
						// + '</div>');
				if (id == -1) ckAddFavoriteToList(response.msg, favorite);
//				alert(Joomla.JText._('CK_SUCCESS_CREATING_FAVORITEFILE', 'Success !'));
			} else {
				alert(Joomla.JText._('CK_FAILED', 'Failed'));
			}
		}
		catch(err) {
			alert( 'ERROR : ' + err.message );
		}
	}).fail(function(code) {
		alert(Joomla.JText._('CK_FAILED', 'Failed'));
	});
}

function ckAddFavoriteToList(i, favorite) {
	var name = 'favorite' + i;
	var html = '<div class="pbckmyfavoriterow clearfix">'
					+ '<div id="pbckmyfavorite' + name + '" data-name="' + name + '" style="margin:0px !important;" class="favoritethumb pbckmyfavorite" data-merge="0" onmouseout="ckRestoreBeforeFavorite()" onmouseover="ckPreviewFavoriteDirect(this)" onclick="ckLoadFavorite(\'' + name + '\', \'favorites\', 1, this)">'
						+ '<div class="themeindice">' + i + '</div>'
						+ '<div class="ckstyle">' + favorite['style'].replace(/\|di\|/g,'#').replace(/\|ID\|/g, 'pbckmyfavorite' + name) + '</div>'
						+ '<div class="inner">'
							+ 'Lorem ipsum dolor sit amet'
							+ '<div class="favoritethumbstyles">' + favorite['style'] + '</div>'
						+ '</div>'
					+ '</div>'
					+ '<div class="ckbutton" onclick="ckEditFavorite(this);"><span class="fa fa-edit"></span> ' + Joomla.JText._('CK_EDIT') + '</div>'
					+ '<div class="ckbutton" onclick="ckRemoveFavorite(this);"><span class="fa fa-remove" style="color:red;"></span> ' + Joomla.JText._('CK_DELETE') + '</div>'
				+ '</div>';
	$ck('#tab_favoritecustom > .inner').prepend(html);
	var newfavorite = $ck('#pbckmyfavorite' + name);
	j = 0;
	while (favorite['ckprops' + j]) {
		blocClass = $ck('<div ' + favorite['ckprops' + j] + ' />', newfavorite).removeClass('ckprops').attr('class');
		$ck('> .' + blocClass, newfavorite).remove();
		newfavorite.prepend('<div ' + favorite['ckprops' + j] + ' />');
		j++;
	}
	return html;
}

function ckLoadFavorite(name, folder, apply, thumb) {
	FAVORITELOCKED = 1;
	valid = '1';
	if (apply == 1) {
		valid = confirm(Joomla.JText._('CK_ERASE_WITH_NEW_FAVORITE', 'WARNING : This will erase your data with the new favorite, continue ?'));
		if (valid == null || valid == "") {
			FAVORITELOCKED = 0;
			ckRestoreBeforeFavorite();
			return;
		}
	} else {
		
	}

	$ck(document.body).append('<div id="ckwaitoverlay"></div>');
	var myurl = PAGEBUILDERCK.URIPBCK + "&task=ajaxLoadFavorite&" + PAGEBUILDERCK.TOKEN;
	$ck.ajax({
		type: "POST",
		url: myurl,
		data: {
			name: name,
			folder: folder
		}
	}).done(function(code) {
		if (apply == 1) {
			ckApplyFavorite(code, thumb);
			ckCloseFavoritePopup();
			ckSaveAction();
		} else {
			previewFavorite(code);
		}
		$ck('#ckwaitoverlay').remove();
	}).fail(function() {
		alert(Joomla.JText._('CK_FAILED', 'Failed'));
		$ck('#ckwaitoverlay').remove();
	});
}

function ckRestoreBeforeFavorite() {
	if ( FAVORITELOCKED == 1 )
		return;
	if (BLOCCKSTYLESBACKUP != 'undefined') {
		focusbloc = $ck('.editfocus');
		$ck('> .ckstyle', focusbloc).empty().html(BLOCCKSTYLESBACKUP);
	}
}

function ckPreviewFavoriteDirect(thumb) {
	if ( FAVORITELOCKED == 1 )
		return;
	thumb = $ck(thumb);
	
	focusbloc = $ck('.editfocus');

	//BLOCCKSTYLESBACKUP = $ck('> .ckstyle', focusbloc).html();
	if (thumb.attr('data-merge') === '1') {
		var stylecode = thumb.find('.favoritethumbstyles').text();
//		var re = /\/\*shadow start\*\/(.*?)\/\*shadow end\*\//gi; 
		var re = /(\/\*shadow start\*\/([\s\S]*)?\/\*shadow end\*\/)/gi; 
		stylecode = stylecode.replace(/\|di\|/g, "#");
		stylecode = stylecode.replace(/\|ID\|/g, focusbloc.attr('id')).replace(/\|URIBASE\|/g, URIBASE + "/");
		var focusblocstyle = $ck('> .ckstyle', focusbloc).text();
		focusblocstyle = focusblocstyle.replace(re, '');
		focusblocstyle = focusblocstyle + stylecode;
		$ck('> .ckstyle', focusbloc).empty().append('<style>' + focusblocstyle + '</style>');
	} else {
		var stylecode = thumb.find('.favoritethumbstyles').html();
		stylecode = stylecode.replace(/\|di\|/g, "#");
		stylecode = stylecode.replace(/\|ID\|/g, focusbloc.attr('id')).replace(/\|URIBASE\|/g, URIBASE + "/");
		$ck('> .ckstyle', focusbloc).empty().append(stylecode);
	}
}

function ckApplyFavorite(code, thumb) {
	focusbloc = $ck('.editfocus');
	if (! focusbloc.length) {
		alert('No block selected');
		return;
	}

	thumb = $ck(thumb);
	code = code.replace(/\|di\|/g, "#");
	bloc = $ck.parseJSON(code);
	
	if (!bloc)
		return;

	j = 0;
	if (thumb.attr('data-merge') === '1') {
		while (bloc['ckprops' + j]) {
			blocClass = $ck('<div ' + bloc['ckprops' + j] + ' />', focusbloc).removeClass('ckprops').attr('class');
			ckpropshtml = $ck('> .' + blocClass, focusbloc);
			var re = /(\/\*shadow start\*\/([\s\S]*)?\/\*shadow end\*\/)/gi;
			blocstyle = bloc['style'].replace(/\|ID\|/g, focusbloc.attr('id')).replace(/\|URIBASE\|/g, URIBASE + "/");
			blocstyle = '/*shadow start*/' + blocstyle + '/*shadow end*/';
			if ($ck('> .ckstyle', focusbloc).html().match(re)) {
				var blocstyle = $ck('> .ckstyle', focusbloc).html().replace(re, blocstyle);
				$ck('> .ckstyle', focusbloc).empty().append(blocstyle);
			} else {
				$ck('> .ckstyle', focusbloc).append(blocstyle);
			}
			if (ckpropshtml.length) {
				var blocmerge = $ck('<div ' + bloc['ckprops' + j] + ' />');
				var fieldslistmerge = blocmerge.attr('fieldslist').split(',');

				for (k=0;k<fieldslistmerge.length;k++) {
					if (! ckpropshtml.attr(fieldslistmerge[k])) {
						ckpropshtml.attr('fieldslist', ckpropshtml.attr('fieldslist') + ',' + fieldslistmerge[k]);
					}
					ckpropshtml.attr(fieldslistmerge[k], blocmerge.attr(fieldslistmerge[k]));
				}
			} else {
				focusbloc.prepend('<div ' + bloc['ckprops' + j] + ' />');
			}
			j++;
		}
	} else {
		$ck('> .ckstyle', focusbloc).empty();
//		$ck('> .ckprops', focusbloc).remove();
		while (bloc['ckprops' + j]) {
			blocClass = $ck('<div ' + bloc['ckprops' + j] + ' />', focusbloc).removeClass('ckprops').attr('class');
			$ck('> .ckprops.' + blocClass, focusbloc).remove();
			$ck('> .' + blocClass, focusbloc).remove();
			focusbloc.prepend('<div ' + bloc['ckprops' + j] + ' />');
			j++;
		}

		if (bloc['style']) {
			blocstyle = bloc['style'].replace(/\|ID\|/g, focusbloc.attr('id')).replace(/\|URIBASE\|/g, URIBASE + "/");
			$ck('> .ckstyle', focusbloc).empty().append('<style>' + blocstyle + '</style>');
		}
	}
	
	FAVORITELOCKED = 0;
}

function ckRemoveFavorite(btn) {
	if (!confirm(Joomla.JText._('CK_CONFIRM_DELETE','CK_CONFIRM_DELETE'))) return;
	var favorite = $ck($ck(btn).parents('.pbckmyfavoriterow')[0]).find('> .pbckmyfavorite');
	var myurl = PAGEBUILDERCK.URIPBCK + "&task=ajaxRemoveFavorite&" + PAGEBUILDERCK.TOKEN;
	var name = favorite.attr('data-name');
	$ck.ajax({
		type: "POST",
		url: myurl,
		data: {
			name: name,
		}
	}).done(function(code) {
		try {
			response = JSON.parse(code);
			if (response.status == '1') {
				$ck('#pbckmyfavorite' + name).parent().remove();
				alert(Joomla.JText._('CK_SUCCESS', 'Success !'));
			} else {
				alert(Joomla.JText._('CK_FAILED', 'Failed'));
			}
		}
		catch(err) {
			alert( 'ERROR : ' + err.message );
		}
	}).fail(function() {
		alert(Joomla.JText._('CK_FAILED', 'Failed'));
	});
}

function ckEditFavorite(btn) {
	var bloc = $ck($ck(btn).parents('.pbckmyfavoriterow')[0]).find('> .pbckmyfavorite');
	ckShowCssPopup(bloc.attr('id'), 'ckAfterSaveFavoritePopup');
	$ck('#popup_favoriteck').hide();
}

// function ckSaveFavoritePopup(blocid, workspace) {
	// ckSaveEditionPopup(blocid, workspace, 'ckAfterSaveFavoritePopup');
// }

function ckAfterSaveFavoritePopup() {
	var favorite = $ck('.pbckmyfavorite.editfocus');
	var stylecode = favorite.find('> .ckstyle').html();
	var id = new RegExp(favorite.attr('id'), "g");
	stylecode = stylecode.replace(id, "|ID|");
	var uri = new RegExp(URIBASE + "/", "g");
	stylecode = stylecode.replace(uri, "|URIBASE|");
	stylecode = stylecode.replace(/#/g, "|di|");
	favorite.find('.favoritethumbstyles').html(stylecode);

	ckSaveFavorite(favorite.attr('data-name').replace('favorite', ''));
	$ck('#popup_favoriteck').show();
	// show the favorite panel again for interaction with the user
	// ckShowFavoritePopup();
}


/*=================================*/
/*		Favorite management
/*=================================*/

function ckShowLibraryPopup() {
	CKBox.open({style: {padding: '10px'}, url: 'index.php?option=com_pagebuilderck&view=library&tmpl=component'});
}



/*=================================*/
/*		Library management
/*=================================*/

function ckMakeLibraryItemsDraggable() {
	var frame = $ck('#cklibraryiframe').contents();
	frame.find('.ckgalleryitem').draggable({
		connectToSortable: ".workspaceck",
//		connectToSortable: connectToSortable,
		helper: "clone",
//		 appendTo: "window.parent.body",
		forcePlaceholderSize: true,
		zIndex: "999999",
		tolerance: "pointer",
		start: function( event, ui ){
			$ck('#menuck').css('overflow', 'visible');
			$ck(window.parent.body).append($ck(ui.helper));
		},
		stop: function( event, ui ){
			$ck('#menuck').css('overflow', '');
		}
	});
}

function ckFilterLibraryByCats (cat) {
	if (cat == 'all') {
		$ck('#cklibraryiframe section').show();
		return;
	}
	$ck('#cklibraryiframe section').hide();
	$ck('#cklibraryiframe section[data-id="' + cat.toLowerCase() + '"]').show();
}

function ckCapitalize(s) {
	return s[0].toUpperCase() + s.slice(1);
}

function ckGetLibraryData() {
	var librarycontainer = $ck('#cklibraryiframe');
	var customcategories = librarycontainer.find('.ckgallerysection').detach();
	librarycontainer.addClass('ckwait');
	sessionStorage.setItem('pagebuilderck_library_categories','');
	if (window.sessionStorage && sessionStorage.getItem('pagebuilderck_library_categories')) {
		var categorieshtml = sessionStorage.getItem('pagebuilderck_library_categories');
		librarycontainer.append(categorieshtml);
		librarycontainer.removeClass('ckwait');
	} else {
		var url = 'https://media.joomlack.fr/api/pagebuilderck/pages';
		$ck.ajax({
			url: url,
			dataType: 'jsonp',
//	cache: true,
			jsonpCallback: "joomlack_jsonpcallback",
			timeout: 20000,
			success: function (response) {
				librarycontainer.removeClass('ckwait');
				var buttonhtml = '';
				var sectionhtml = '';
				for (var cat in response) {
					buttonhtml += '<option value="' + ckCapitalize(cat) + '">' + ckCapitalize(cat) + '</option>';

					sectionhtml += 	'<section data-id="' + cat.toLowerCase() + '" class="ckgallerysection">'
											+ '<h2>' + ckCapitalize(cat) + '</h2>'
											+ '<div>';
											
					for (var i=0;i<response[cat].length;i++) {
						var item = response[cat][i];
						var dataid = cat.toLowerCase() + '-' + item['name'].toLowerCase();
						sectionhtml += 	 	'<div class="ckgalleryitem" data-id="' + dataid + '" data-category="' + cat.toLowerCase() + '" data-name="' + item['name'] + '">'
//												+ '<div class="ckgalleryitemtitle">' + ckCapitalize(item['name']) + '</div>'
												+ '<img src="' + item['thumb'] + '" />'
//												+ '<div class="ckgalleryitemloadbtn"><button class="ckbutton" onclick="ckLoadGalleryItem(\'' + cat.toLowerCase() + '\', \'' + item['name'] + '\')">' + Joomla.JText._('CK_IMPORT') + '</button></div>'
											+ '</div>'
//											+ '<div class="ckgalleryitempreview" id="' + dataid + 'preview" data-id="' + dataid + '" style="display: none;">'
//												+ '<h2 class="ckgalleryitempreviewtitle">' + ckCapitalize(item['name']) + '</h2>'
//												+ '<div class="ckgalleryitempreviewimg ckwait"></div>'
//											+ '</div>'
											;
					}
					sectionhtml += 			'</div>'
										+ '</section>';
				}
				// add custom libraries
				if (customcategories.length) {
					customcategories.each(function() {
						$cat = $ck(this);
						buttonhtml += '<option value="' + $cat.attr('data-id') + '">' + ckCapitalize($cat.attr('data-id')) + '</option>';
						sectionhtml += this.outerHTML;
					});
				}
				var categorieshtml = 	'<div id="filtertoolbar">'
											+ '<select onclick="ckFilterLibraryByCats(this.value)">'
											+ '<option value="all">All</option>'
											+ buttonhtml
											+ '</select>'
										+ '</div>'
										+ sectionhtml
										+ '<div style="clear:both;"></div>';
				sessionStorage.setItem('pagebuilderck_library_categories', categorieshtml);
				librarycontainer.append(categorieshtml);
				librarycontainer.removeClass('ckwait');
				ckMakeLibraryItemsDraggable();
			},
			fail: function() {
				alert('Error : Unable to connect to the library. Please contact an administrator');
			},
			complete: function() {

			},
			error: function(request, status, error) {

			}
		});
	}
}

function ckLoadPreset(folder, name) {
	let valid = confirm(Joomla.JText._('CK_ERASE_WITH_NEW_FAVORITE', 'WARNING : This will erase your data with the new favorite, continue ?'));
	if (valid == null || valid == "") {
		return;
	}

	$ck(document.body).append('<div id="ckwaitoverlay"></div>');
	var myurl = PAGEBUILDERCK.URIPBCK + "&task=library.loadPreset&" + PAGEBUILDERCK.TOKEN;
	$ck.ajax({
		type: "POST",
		url: myurl,
		data: {
			name: name,
			folder: folder
		}
	}).done(function(code) {
		if (code === 'error') {
			alert(Joomla.JText._('Error : Can not get the data. Please retry and contact the developer.'));
		} else {
			ckApplyPreset(code);
			$ck('#ckwaitoverlay').remove();
		}
	}).fail(function() {
		alert(Joomla.JText._('CK_FAILED', 'Failed'));
		$ck('#ckwaitoverlay').remove();
	});
}

function ckApplyPreset(code) {
	var focus = $ck('.editfocus');
	var tempdiv = document.createElement('div');
	tempdiv.innerHTML = code;
	var props = $ck(tempdiv).find('.ckprops');
	var re = new RegExp('ID', 'g');
//	var ckstylepreset = $ck(tempdiv).find('.ckstyle-preset');

	focus.find('.ckprops[class*="styles"]').remove();
	if (props.length) {
		props.each(function() {
			let prop = $ck(this);
			let cssclass = prop.attr('class').replace('ckprops', '').trim();
			focus.find('.ckprops.'  + cssclass).remove();
			focus.prepend(this.outerHTML);
		});
	}

//	focus.find('.ckstyle-preset').remove()
//	if (ckstylepreset.length) {
//		ckstylepreset.html(ckstylepreset.html().replace(re,'#' + focus.attr('id')));
//		focus.prepend(ckstylepreset[0].outerHTML);
//	}
	ckShowEditionPopup(focus.attr('id'), '', 'ckOpenPanelForPreset');
}

function ckOpenPanelForPreset() {
	ckSaveEditionPanel(1);
}

function ckAfterCloseEditionPopup() {
	setTimeout( function() {
		jQuery(window).trigger('resize');
	},1500);
}

function ckSetPresetLayout() {
	var focus = $ck('.editfocus');
	if ($ck('#elementscontainer #preset_layout').length 
			&& $ck('#elementscontainer #preset_layout').val()
			&& $ck('#elementscontainer #preset_layout').val() !== 'default'
			) {
			focus.attr('data-preset-layout', $ck('#elementscontainer #preset_layout').val());
	} else {
		focus.removeAttr('data-preset-layout');
	}
}

Anon7 - 2022
AnonSec Team