Файловый менеджер - Редактировать - /home/kunzqhe/www/wp-content/plugins/builder-mosaic/assets/admin.js
Ðазад
(function ($, Themify, api,document) { 'use strict'; let is_loaded = null, cssText='.grid-stack .grid-stack-item{position:absolute;left:0;top:0;padding:0}.grid-stack.grid-stack-1{width:auto;margin-left:0;height:auto!important}.grid-stack.grid-stack-1 .builder_mosaic_item.grid-stack-item{position:relative;top:0;left:0;width:auto;margin-bottom:20px}'; const args=builderMosaicAdmin, top = window.top, st=top.document.createElement('style'), loadedSt={}, base=8.333, selector='.grid-stack .grid-stack-item', setCss=function(left,w){ if(loadedSt['l'+left]===undefined){ loadedSt['l'+left]=true; let v=left*base; if(left%3===0){ v=Math.round(v); } st.textContent+=selector+'[data-gs-x="'+left+'"]{left:'+v+'%}'; } if(loadedSt['w'+w]===undefined){ loadedSt['w'+w]=true; let v=w*base; if(w%3===0){ v=Math.round(v); } st.textContent+=selector+'[data-gs-width="'+w+'"]{width:'+v+'%}'; } }; st.textContent=cssText; top.document.head.appendChild(st); cssText=null; api.Constructor['tile_grid'] = { render: function (data, self) { let is_updating = false, Grid = null, Grid_el = null; const _this = this, // load dependencies load_dependencies = function (callback) { if (is_loaded === null) { const url=args.jqui; top.Themify.LoadAsync(url + 'core.min.js', function () { top.Themify.LoadAsync(url + 'widget.min.js', function () { top.Themify.LoadAsync(url + 'mouse.min.js', function () { top.Themify.LoadAsync(url + 'draggable.min.js', function () { top.Themify.LoadAsync(url + 'droppable.min.js', function () { top.Themify.LoadAsync(url + 'resizable.min.js', function () { top.Themify.LoadAsync(args.path + 'assets/gridstack.js', function () { top.Themify.LoadAsync(args.path + 'assets/gridstack.jQueryUI.js', function(){ is_loaded = true; callback(); }, args.v); }, args.v); }, themify_vars.wp, false, function () { return typeof top.jQuery.fn.resizable !== 'undefined'; }); }, themify_vars.wp, false, function () { return typeof top.jQuery.fn.droppable !== 'undefined'; }); }, themify_vars.wp, false, function () { return typeof top.jQuery.fn.draggable !== 'undefined'; }); }, themify_vars.wp, false, function () { return typeof top.jQuery.fn.mouse !== 'undefined'; }); }, themify_vars.wp, false, function () { return typeof top.jQuery.widget !== 'undefined'; }); }, themify_vars.wp, false, function () { return typeof top.jQuery.ui !== 'undefined'; }); } else { callback(); } }, save_grid = function () { const data = [], items = top.document.getElementsByClassName('grid-stack-item'); for (let i = 0, len = items.length; i < len; ++i) { let $this = $(items[i]); if ($this.is(':visible')) { let node = top.jQuery($this).data('_gridstack_node'); data.push({ x: node.x, y: node.y, width: node.width, height: node.height }); } } return JSON.stringify(data); }, update_template = function (template, remove) { is_updating = false; if (remove === undefined) { remove = true; } if (remove) { Grid.removeAll(); } for (let i in template) { let item=document.createElement('div'), div=document.createElement('div'); item.className='grid-stack-item-content'; div.appendChild(item); Grid.addWidget(div, template[i]); setCss(template[i].x,template[i].width); } is_updating = true; if (remove) { Grid_el.triggerHandler('change.tile_grid_change'); } }; if (is_loaded === null) { top.Themify.LoadCss(args.admin_css, args.v); } const wr = document.createElement('div'), mosaic = document.createElement('div'), template = document.createElement('div'), icon = document.createElement('span'), panel = document.createElement('div'), presets = document.createElement('div'), save_preset = document.createElement('a'), hidden = self.hidden.render({id: data.id, class: 'builder_tile_grid_template', type: 'hidden', control: {control_type: 'change'}}, self), editor = document.createElement('div'), stack = document.createElement('div'), actions = document.createElement('div'), add_tile = document.createElement('a'), remove_tile = document.createElement('a'), selectWrap = self.select.render({id: 'layout'}, self), select = selectWrap.querySelector('select'); wr.className = 'builder_tile_grid'; mosaic.id = 'mosaic-presets'; template.className = 'load-template'; icon.className = 'template-grid-icon'; panel.className = 'load-template-panel'; presets.className = 'presets'; editor.id = 'tile-grid-editor'; stack.className = 'grid-stack'; save_preset.href = '#'; save_preset.id = 'tftp-save-preset'; save_preset.setAttribute('data-prompt', args.labels['name']); save_preset.textContent = args.labels['save']; actions.className = 'builder_grid_actions'; add_tile.className = 'tb_builder_add_tile'; add_tile.textContent = args.labels['add']; remove_tile.className = 'tb_builder_remove_tile'; remove_tile.textContent = args.labels['remove']; for (let i in data.options) { let a = document.createElement('a'); a.className = 'tb_mosaic_preset'; a.width = a.height = 70; a.setAttribute('data-index', i); a.setAttribute('data-template', data.options[i].template); presets.appendChild(a); } panel.appendChild(presets); panel.appendChild(document.createTextNode(args.labels['custom'])); panel.appendChild(document.createElement('br')); panel.appendChild(selectWrap); template.appendChild(panel); icon.appendChild(api.Utils.getIcon('ti-layout-column3')); icon.appendChild(document.createTextNode(args.labels['template'])); icon.appendChild(api.Utils.getIcon('ti-angle-down')); template.appendChild(icon); mosaic.appendChild(save_preset); mosaic.appendChild(template); editor.appendChild(stack); actions.appendChild(add_tile); actions.appendChild(remove_tile); wr.appendChild(mosaic); wr.appendChild(hidden); wr.appendChild(editor); wr.appendChild(actions); add_tile.addEventListener('click', function (e) { e.preventDefault(); e.stopPropagation(); const item=document.createElement('div'), div=document.createElement('div'); item.className='grid-stack-item-content'; div.appendChild(item); const gridItem = Grid.addWidget(div, {x:undefined, y:undefined, width:3, height:2,autoPosition:true}); setCss(gridItem.getAttribute('data-gs-x'),gridItem.getAttribute('data-gs-width')); }); remove_tile.addEventListener('click', function (e) { e.preventDefault(); e.stopPropagation(); const el = Grid_el.find('.selected'); if (el.length > 0) { Grid.removeWidget(el); } }); select.addEventListener('change', function (e) { const id = this.value; if (typeof args.presets[ id ] !== 'object') { return; } update_template($.parseJSON(args.presets[ id ].content)); }, {passive: true}); presets.addEventListener('click', function (e) { e.preventDefault(); e.stopPropagation(); if (e.target.classList.contains('tb_mosaic_preset')) { update_template($(e.target).data('template')); } }); /** * Populate the Custom Presets <select> field */ const populate_custom_presets = function (settings) { if (typeof args.presets === 'object') { const fr = document.createDocumentFragment(); fr.appendChild(document.createElement('option')); for (let i in args.presets) { let opt = document.createElement('option'); opt.value = i; opt.textContent = args.presets[i].title; if (settings !== undefined && i === settings['layout']) { opt.selected = true; } fr.appendChild(opt); } select.innerHTML = ''; select.appendChild(fr); } }; save_preset.addEventListener('click', function (e) { e.preventDefault(); e.stopPropagation(); const name = prompt($(this).data('prompt'), $('#mod_title').val()); if (!name || Grid_el.length === 0) { return; } const grid = save_grid(); ThemifyBuilderCommon.showLoader('show'); $.ajax({ url: themifyBuilder.ajaxurl, type: 'POST', data: { action: 'builder_tiled_posts_save_preset', name: name, grid: grid }, success: function (data) { args.presets[ data ] = {title: name, content: grid}; populate_custom_presets({layout: data}); }, complete: function (data) { ThemifyBuilderCommon.showLoader('spinhide'); } }); }); document.addEventListener('tb_editing_mosaic', function () { load_dependencies(function () { const context = top.document; Grid_el = $('.grid-stack', context); Grid = new top.GridStack.init({ float: false, rtl: Themify.isRTL, resizable: { handles: 'e, se, s, sw, w' }, disableDrag: false, disableResize: false }, Grid_el[0]); Grid_el.on('click', '.grid-stack-item', function () {// Remove tile $(this).siblings().removeClass('selected').end().addClass('selected'); }); Grid_el.on('change.tile_grid_change', function (e, items) { if (is_updating) { hidden.value = save_grid(); Themify.triggerEvent(hidden, 'change'); } }); Grid.on('change', function(e, items) { for(let i=items.length-1;i>-1;--i){ setCss(items[i].x,items[i].width); } }); // add previously added tiles to the grid if (typeof self.values['template'] !== 'undefined') { update_template($.parseJSON(self.values['template']), false); } $('#tiled_posts_display', context).trigger('change.tiled_posts_display'); populate_custom_presets(data); const ptb_post_type = $('#post_type_ptb', context).find(':checked').length ? $('#post_type_ptb').find(':checked') : $('#post_type_ptb', context).find('input[type="radio"]:first').attr('checked', 'checked'); ptb_post_type.trigger('change'); }); const display = ThemifyBuilderCommon.Lightbox.$lightbox.find('#tiled_posts_display'), showTabs = function (v) { if (v !== undefined) { const selected = ThemifyBuilderCommon.Lightbox.$lightbox[0].querySelector('.tb_mosaic_tabs a[href$="_' + v + '"]'); if (selected) { selected.click(); } } }; display.on('change', function () { showTabs($(this).val()); }); showTabs(self.values[display[0].id]); Themify.body.one('themify_builder_lightbox_close', function () { display.off('change'); if (Grid_el) { Grid_el.off('change'); } Grid = Grid_el = null; }); ThemifyBuilderCommon.Lightbox.$lightbox.off('click.ptb_field_settings').on('click.ptb_field_settings', '.mosaic_ptb_field_group', function (e) { e.preventDefault(); e.stopPropagation(); $(this).toggleClass('expanded').nextUntil('.mosaic_ptb_field_group').toggle(); }); }, {once: true}); return wr; } }; }(jQuery, Themify, tb_app,document));
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка