File manager - Edit - /home/jardides/www/Jardi-design/old/administrator/components/com_pagebuilderck/pro/assets/pagebuilderckparams.js
Back
/** * @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 = ''; 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('.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'); } // 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', '')); // 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) { } }); } } $ck(document).ready(function() { ckGetLibraryData(); });
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings