File manager - Edit - /home/jardides/www/Jardi-design/j37/plugins/system/pagebuilderckparams/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 - http://www.template-creator.com - http://www.joomlack.fr */ /*=================================*/ /* Favorite management /*=================================*/ var BLOCCKSTYLESBACKUP = ''; var FAVORITELOCKED = ''; function ckShowFavoritePopup(blocid) { FAVORITELOCKED = 1; blocid = '#' + blocid; bloc = $ck(blocid); $ck('.cssfocus').removeClass('cssfocus'); bloc.addClass('cssfocus'); BLOCCKSTYLESBACKUP = $ck('> .ckstyle', bloc).html(); $ck('#popup_favoriteck').fadeIn(); $ck('body').css('position', 'relative').animate({'left':'310px'}); $ck('#workspaceck').css('margin-left', '0') // .attr('mlback', $ck('#workspaceck').css('margin-left')).css('margin-left', '0'); // $ck('.objid', $ck('#popup_favoriteck')).text(bloc.attr('id')); FAVORITELOCKED = 0; } function ckCloseFavoritePopup(force) { if (! force ) force = false; if ( $ck('#popup_favoriteck').hasClass('stick') && !force ) { BLOCCKSTYLESBACKUP = $ck('> .ckstyle', $ck('.cssfocus')).html(); return; } $ck('#popup_favoriteck').fadeOut(); $ck('body').animate({'left':'0', complete: function() {$ck('body').css('position', '')}}); $ck('#workspaceck').css('margin-left', ''); // $ck('.cssfocus').removeClass('cssfocus'); } function ckGetFavorite() { var bloc = $ck('.cssfocus'); 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 = URIBASE + "/index.php?option=com_pagebuilderck&task=ajaxSaveFavorite"; $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 = URIBASE + "/index.php?option=com_pagebuilderck&task=ajaxLoadFavorite"; $ck.ajax({ type: "POST", url: myurl, data: { name: name, folder: folder } }).done(function(code) { if (apply == 1) { ckApplyFavorite(code, thumb); ckCloseFavoritePopup(); } 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('.cssfocus'); $ck('> .ckstyle', focusbloc).empty().html(BLOCCKSTYLESBACKUP); } } function ckPreviewFavoriteDirect(thumb) { if ( FAVORITELOCKED == 1 ) return; thumb = $ck(thumb); focusbloc = $ck('.cssfocus'); //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('.cssfocus'); 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('> .' + 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 = URIBASE + "/index.php?option=com_pagebuilderck&task=ajaxRemoveFavorite"; 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'), 'ckSaveFavoritePopup'); } function ckSaveFavoritePopup(blocid, workspace) { ckSaveEditionPopup(blocid, workspace, 'ckAfterSaveFavoritePopup'); } function ckAfterSaveFavoritePopup() { var favorite = $ck('.cssfocus'); 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'}); }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings