File manager - Edit - /home/jardides/www/Jardi-design/plugins/editors-xtd/mediaboxckbutton/assets/mediaboxckbutton.js
Back
/** * @copyright Copyright (C) 2015 Cédric KEIFLIN alias ced1870 * http://www.joomlack.fr * http://www.template-creator.com * @license GNU/GPL * */ if (typeof jInsertFieldValue != 'function') { function jInsertFieldValue(value, id) { var $ = jQuery.noConflict(); var old_value = $("#" + id).val(); if (old_value != value) { var $elem = $("#" + id); $elem.val(value); $elem.trigger("change"); if (typeof($elem.get(0).onchange) === "function") { $elem.get(0).onchange(); } // jMediaRefreshPreview(id); } } } function showMediaboxckButton(edname, attribtype, attribname, uriroot) { window.uriroot = uriroot; // event.preventDefault(); if (typeof(tinyMCE) == 'undefined') return; var editor = tinyMCE.get(edname); var dom = editor.dom; selectionNode = editor.selection.getNode(); focusedNode = editor.selection.getSel().anchorNode; selectionNodeInitial = null; var startTagString = '{mediabox'; var enTagString = '{/mediabox}'; var searchAll = false; var type = 'none'; var action = 'add'; var taghtmlOriginal = ''; var params = {'src' : '', 'w' : '', 'h' : '', 'alb' : '', 't' : '', 'dir' : '', 'gallery' : ''}; var text = editor.selection.getContent({format: 'text'}); if (selectionNode.tagName.toLowerCase() == 'a' || (focusedNode.tagName && focusedNode.tagName.toLowerCase() == 'a') ) { type = 'link'; } else { if ("innerText" in focusedNode) { var content = contentOriginal = focusedNode.innerText; } else { var content = contentOriginal = focusedNode.innerHTML || focusedNode.textContent; } if (selectionNode.tagName.toLowerCase() == 'img') { content = contentOriginal = editor.selection.getContent(); // needed to avoid the mce tags in the source code var cursorPos = content.replace(' ', ' ').indexOf(selectionNode.outerHTML); } else { var cursorPos = editor.selection.getRng().startOffset; } var existingTag = searchMediaboxckTags(editor, content, cursorPos); if (existingTag) { type = 'tag'; action = 'update'; var regSearch = /{mediabox(.*?)}(.*?){\/mediabox}/; var result = existingTag.match(regSearch); taghtmlOriginal = existingTag; if (result) { params = typeof(result[1]) != 'undefined' && result[1] ? getMediaboxckparamsFromTag(result[1].trim()) : params; text = typeof(result[2]) != 'undefined' ? result[2] : text; } } } if (type == 'link') { // if we are on an image, check if a link aready exists and then take it as reference if (dom.getParent(selectionNode, 'a[href]')) { selectionNodeInitial = selectionNode; selectionNode = dom.getParent(selectionNode, 'a[href]'); } selectionNodeInitial = selectionNodeInitial || selectionNode; var anchorElm = dom.getParent(selectionNode, 'a'); onlyText = isOnlyTextSelected(editor, anchorElm); var text = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : editor.selection.getContent({format: 'text'}); if (anchorElm) action = 'update'; if (selectionNode.title) params['t'] = selectionNode.title; if (selectionNode.href) params['src'] = jQuery(selectionNode).attr('href'); // need jquery to avoid http in the href if (jQuery(selectionNode).attr('data-gallery')) params['gallery'] = (jQuery(selectionNode).attr('data-gallery') == '1') ? '1' : ''; if (jQuery(selectionNode).attr('data-dir')) params['dir'] = jQuery(selectionNode).attr('data-dir'); var linkattr = []; if (selectionNode.attribtype) { linkattr = selectionNode.attribtype.split(/[\[\]]/); } if (linkattr[1]) { linkattr = linkattr[1]; WH = linkattr.split(' '); WHL = WH.length; if (WHL>1) { params['w'] = WH[WHL-2]; params['h'] = WH[WHL-1]; params['alb'] = (WHL-3 == 0) ? WH[WHL-3] : ''; } else if (WHL==1) { params['alb'] = WH[0]; } } } // begin the contruction of the popup var insertLinkButton = null; var insertTagButton = null; if (type == 'link' || (type == 'tag' && action != 'update') || type == 'none') { var insertLinkButtonTxt = (action == 'update' ? Joomla.JText._('PLG_MEDIABOXCKBUTTON_UPDATE_LINK') : Joomla.JText._('PLG_MEDIABOXCKBUTTON_INSERT_LINK') ); var insertLinkButton = { name: 'insertLinkButton', text: insertLinkButtonTxt, classes: 'btn primary widget', onclick: function() { anchorElm = dom.getParent(selectionNode, 'a'); var mediaboxckAttrs = getMediaboxckAttrs(); onlyText = isOnlyTextSelected(editor, anchorElm); var rel = []; rel[0] = (mediaboxckAttrs['alb'] ? mediaboxckAttrs['alb'] : ''); rel[1] = (mediaboxckAttrs['w'] && mediaboxckAttrs['h'] ? mediaboxckAttrs['w'] : ''); rel[2] = (mediaboxckAttrs['w'] && mediaboxckAttrs['h'] ? mediaboxckAttrs['h'] : ''); rel = rel.join(' ').trim(); rel = attribname + (rel ? '[' + rel + ']' : ''); var linkAttrs = { href: mediaboxckAttrs['src'], rel: attribtype == 'rel' ? rel : null, // todo verif si à mettre sur rel ou class "class": attribtype == 'className' ? rel : null, title: mediaboxckAttrs['t'] ? mediaboxckAttrs['t'] : null, "data-dir": (mediaboxckAttrs['dir'] ? mediaboxckAttrs['dir'] : ''), "data-gallery": (mediaboxckAttrs['gallery'] == 'checked' && mediaboxckAttrs['dir'] ? '1' : '') }; if (anchorElm) { editor.focus(); if (onlyText && jQuery('#mediaboxck_popup_text').val() != params.t) { if ("innerText" in anchorElm) { anchorElm.innerText = jQuery('#mediaboxck_popup_text').val(); } else { anchorElm.textContent = jQuery('#mediaboxck_popup_text').val(); } } dom.setAttribs(anchorElm, linkAttrs); editor.selection.select(anchorElm); editor.undoManager.add(); } else { if (onlyText) { editor.insertContent(dom.createHTML('a', linkAttrs, dom.encode(jQuery('#mediaboxck_popup_text').val()))); } else { editor.execCommand('mceInsertLink', false, linkAttrs); } } editor.windowManager.close(); }, id: 'insertmediaboxcklink' }; } if (type == 'tag' || (type == 'link' && action != 'update') || type == 'none') { var insertTagButtonTxt = (action == 'update' ? Joomla.JText._('PLG_MEDIABOXCKBUTTON_UPDATE_TAG') : Joomla.JText._('PLG_MEDIABOXCKBUTTON_INSERT_TAG') ); var insertTagButton = { name: 'insertTagButton', text: insertTagButtonTxt, classes: 'btn primary widget', onclick: function() { var taghtml = getMediaboxckTag(editor); if (taghtml) { if (action == 'update') { var new_content = editor.getContent().replace(taghtmlOriginal, taghtml); editor.setContent(new_content); } else { editor.insertContent(taghtml); } editor.windowManager.close(); } }, id: 'insertmediaboxcktag' }; } // load the popup var popupButtons = [insertLinkButton, insertTagButton]; showMediaboxPopup(editor, params, text, popupButtons, action, edname, taghtmlOriginal, attribname, attribtype); // neede for actual mediamanger, to be improved SqueezeBox.initialize({}); SqueezeBox.assign(jQuery('a.mediaboxckmodal'), { parse: 'rel' }); // init elements inside the popup initTabs(jQuery('#mediaboxck_popup_source_fielset')); jQuery('#mediabox_popup .hasTooltip').tooltip({"html": true,"container": "body"}); jQuery('#insertmediaboxcktag').click(function() { var taghtml = getMediaboxckTag(editor); if (taghtml) { if (action == 'update') { var new_content = editor.getContent().replace(taghtmlOriginal, taghtml); editor.setContent(new_content); } else { // editor.insertContent(taghtml); jInsertEditorText(taghtml, editor); } // editor.windowManager.close(); jQuery('#mediaboxckmodal').modal('hide'); } }); jQuery('#insertmediaboxcklink').click(function() { anchorElm = dom.getParent(selectionNode, 'a'); var mediaboxckAttrs = getMediaboxckAttrs(); onlyText = isOnlyTextSelected(editor, anchorElm); var rel = []; rel[0] = (mediaboxckAttrs['alb'] ? mediaboxckAttrs['alb'] : ''); rel[1] = (mediaboxckAttrs['w'] && mediaboxckAttrs['h'] ? mediaboxckAttrs['w'] : ''); rel[2] = (mediaboxckAttrs['w'] && mediaboxckAttrs['h'] ? mediaboxckAttrs['h'] : ''); rel = rel.join(' ').trim(); rel = attribname + (rel ? '[' + rel + ']' : ''); var linkAttrs = { href: mediaboxckAttrs['src'], rel: attribtype == 'rel' ? rel : '', // todo verif si à mettre sur rel ou class "class": attribtype == 'className' ? rel : '', title: mediaboxckAttrs['t'] ? mediaboxckAttrs['t'] : '', "data-dir": (mediaboxckAttrs['dir'] ? mediaboxckAttrs['dir'] : ''), "data-gallery": (mediaboxckAttrs['gallery'] == 'checked' && mediaboxckAttrs['dir'] ? '1' : '') }; if (anchorElm) { editor.focus(); if (onlyText && jQuery('#mediaboxck_popup_text').val() != params.t) { if ("innerText" in anchorElm) { anchorElm.innerText = jQuery('#mediaboxck_popup_text').val(); } else { anchorElm.textContent = jQuery('#mediaboxck_popup_text').val(); } } dom.setAttribs(anchorElm, linkAttrs); editor.selection.select(anchorElm); editor.undoManager.add(); } else { if (onlyText) { var taghtml = dom.createHTML('a', linkAttrs, dom.encode(jQuery('#mediaboxck_popup_text').val())); // editor.insertContent(dom.createHTML('a', linkAttrs, dom.encode(jQuery('#mediaboxck_popup_text').val()))); jInsertEditorText(taghtml, editor); } else { editor.execCommand('mceInsertLink', false, linkAttrs); } } jQuery('#mediaboxckmodal').modal('hide'); }); if (params['dir']) { jQuery('#mediaboxck_popup_accordeonbutton_media_directory').trigger('click'); } else { jQuery('#mediaboxck_popup_accordeonbutton_media_single').trigger('click'); } } function searchMediaboxckTags(editor, content, cursorPos) { var startTagString = '{mediabox'; var enTagString = '{/mediabox}'; var editorContent = editor.getContent({format: "html"}); var editorOffset = editorContent.indexOf(content); var tagsPositions = []; var allTags = editorContent.split(startTagString); cursorPos = cursorPos + editorOffset; for (i=1; i<allTags.length; i++) { tagsPositions[i] = []; if (i > 1) { var prevEnd = tagsPositions[i-1]['next']; } else { var prevEnd = allTags[i-1].length; } var endTagPos = allTags[i].indexOf(enTagString); tagsPositions[i]['start'] = prevEnd + 1; tagsPositions[i]['end'] = startTagString.length + tagsPositions[i]['start'] + endTagPos + enTagString.length; tagsPositions[i]['next'] = startTagString.length + prevEnd + allTags[i].length; tagsPositions[i]['code'] = startTagString + allTags[i].substr(0, endTagPos + enTagString.length); if (cursorPos > tagsPositions[i]['start'] && cursorPos < tagsPositions[i]['end']) { return tagsPositions[i]['code']; } } return false; } function getMediaboxckparamsFromTag(params) { params = params.split('|'); if (params.length <= 0) return; var src = '', w = '', h = '', alb = '', t = '', dir = '', gallery = ''; for (i = 0; i < params.length; i++) { // src= : source media to show in the popup // w= : lightbox width in px // h= : lightbox height in px // alb= : album name to group the medias and show the navigation // t= : title and description shown under the media, separate them with a double point :: // dir= : load automatically all the images contained in the folder src = params[i].test('src=') ? params[i].replace('src=','') : src; w = params[i].test('w=') ? params[i].replace('w=','') : w; h = params[i].test('h=') ? params[i].replace('h=','') : h; alb = params[i].test('alb=') ? params[i].replace('alb=','') : alb; t = params[i].test('t=') ? params[i].replace('t=','') : t; dir = params[i].test('dir=') ? params[i].replace('dir=','') : dir; gallery = params[i].test('gallery=') ? params[i].replace('gallery=','') : gallery; } var arrayParams = {'src' : src, 'w' : w, 'h' : h, 'alb' : alb, 't' : t, 'dir' : dir, 'gallery' : gallery}; return arrayParams; } function createMediaboxPopup(params, text) { var title = params.t; if (title) { title = title.split('::'); var desc = title[1] ? title[1] : ''; title = title[0]; } else { title = ''; var desc = ''; } if (selectionNodeInitial && selectionNodeInitial.tagName.toLowerCase() == 'img' && selectionNodeInitial.src) { var codeText = '<div style="text-align:center;padding:5px;"><img src="' + selectionNodeInitial.src + '" style="width: auto;height:100px;"/></div>'; } else if (/<img/.test(text)) { var codeText = '<div style="text-align:center;padding:5px;"><img src="' + uriroot + '/' + jQuery(text).attr('src') + '" style="width: auto;height:100px;"/></div>'; codeText += '<input type="hidden" value="' + text.replace(/"/g,'_QQ_') + '" id="mediaboxck_popup_text" />'; } else { var codeText = '<div><label>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_TEXT') + '</label><input type="text" value="' + text + '" id="mediaboxck_popup_text" /></div>'; } code = '<div id="mediabox_popup">'; code += '<div id="mediabox_popup_left">'; // code += '<div><label>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_TEXT') + '</label><input type="text" value="' + text + '" id="mediaboxck_popup_text" /></div>'; code += codeText; code += '<hr />'; code += '<div><label>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_TITLE') + '</label><input type="text" value="' + title + '" id="mediaboxck_popup_title" /></div>'; code += '<div><label>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_DESCRIPTION') + '</label><input type="text" value="' + desc + '" id="mediaboxck_popup_description" /></div>'; code += '<div><fieldset id="mediaboxck_popup_source_fielset"><legend>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE') + '</legend>'; code += '<div class="btn-group" id="mediaboxck_source_choice">'; code += '<a id="mediaboxck_popup_accordeonbutton_media_single" class="btn mediaboxck_popup_accordeonbutton active" data-target="src" onclick="jQuery(\'#mediabox_popup_right\').removeClass(\'mediaboxck_popup_show_folders\');jQuery(\'#insertmediaboxcklink\').fadeIn();jQuery(\'#galleryoption\').fadeOut();getSourcePreview();">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_MEDIA_SINGLE') + '</a>'; code += '<a id="mediaboxck_popup_accordeonbutton_media_directory" class="btn mediaboxck_popup_accordeonbutton" data-target="dir" onclick="jQuery(\'#galleryoption\').fadeIn();">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_MEDIA_DIRECTORY') + '</a>'; code += '</div>'; code += '<div class="mediaboxck_popup_accordeoncontent open">'; code += '<div><label class="hasTooltip" title="' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_NOTES') + '">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE') + '</label><input type="text" value="' + params.src + '" id="mediaboxck_popup_source" placeholder="E.g.: images/sample/sample.jpg" onchange="getSourcePreview()"/></div>'; code += '<div><a class="mediaboxckmodal btn btn-primary" href="' + uriroot + '/administrator/index.php?option=com_media&view=images&tmpl=component&fieldid=mediaboxck_popup_source" rel="{handler: \'iframe\', size: {x: 800, y: 500}}">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SELECT_IMAGE') + '</a></div>'; code += '</div>'; code += '<div class="mediaboxck_popup_accordeoncontent">'; code += '<div><label class="hasTooltip" title="' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_DIRECTORY_NOTES') + '">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_DIRECTORY') + '</label><input type="text" value="' + params.dir + '" id="mediaboxck_popup_source_dir" placeholder="E.g.: images/sample" /></div>'; code += '<div><a class="btn btn-primary" href="javascript:void(0)" " onclick="getFoldersList()">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_SELECT_DIRECTORY') + '</a></div>'; code += '<div id="galleryoption"><label class="hasTooltip" title="' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_GALLERY_DESC') + '">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_GALLERY') + '</label><input type="checkbox" ' + (params.gallery ? 'checked="true"' : '') + ' value="' + params.gallery + '" id="mediaboxck_popup_gallery" placeholder=""/></div>'; code += '</div>'; code += '</fieldset></div>'; code += '<div><fieldset><legend>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_DIMENSIONS') + '</legend>'; code += '<div><p>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_DIMENSIONS_NOTES') + '</p></div>'; code += '<div><label>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_WIDTH') + '</label><input type="text" value="' + params.w + '" id="mediaboxck_popup_width" placeholder="E.g.: 640px"/></div>'; code += '<div><label>' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_HEIGHT') + '</label><input type="text" value="' + params.h + '" id="mediaboxck_popup_height" placeholder="E.g.: 480px"/></div>'; code += '</fieldset></div>'; code += '<div><label class="hasTooltip" title="' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_ALBUM_DESC') + '">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_ALBUM') + '</label><input type="text" value="' + params.alb + '" id="mediaboxck_popup_album" placeholder="E.g. : cars"/></div>'; code += '</div>'; // end left code += '<div id="mediabox_popup_right">'; code += '</div>'; // end right code += '<div style="clear:both;"></div>'; code += '</div>'; return code; } function initTabs(container) { jQuery('.mediaboxck_popup_accordeoncontent:not(.open)', container).hide(); jQuery('.mediaboxck_popup_accordeonbutton', container).each( function(i, button) { this.tab = jQuery('.mediaboxck_popup_accordeoncontent', container).eq(i); jQuery(button).click(function(){ if (jQuery(this).hasClass('active')) { // if is opened return; } else { // if is closed jQuery('.mediaboxck_popup_accordeonbutton', container).removeClass('active'); jQuery(this).addClass('active'); jQuery('.mediaboxck_popup_accordeoncontent', container).hide(); this.tab.fadeIn(); } }); }); } function getMediaboxckTag(editor) { // open tag var taghtml = '{mediabox'; // start loop to get the params var tagparams = []; if (jQuery('#mediaboxck_popup_width').val()) tagparams.push('w=' + jQuery('#mediaboxck_popup_width').val()); if (jQuery('#mediaboxck_popup_height').val()) tagparams.push('h=' + jQuery('#mediaboxck_popup_height').val()); if (jQuery('#mediaboxck_popup_album').val()) tagparams.push('alb=' + jQuery('#mediaboxck_popup_album').val()); if (jQuery('#mediaboxck_popup_gallery').attr('checked')) tagparams.push('gallery=1'); var newtitle = jQuery('#mediaboxck_popup_title').val() + (jQuery('#mediaboxck_popup_description').val() ? '::' + jQuery('#mediaboxck_popup_description').val() : ''); if (newtitle) tagparams.push('t=' + newtitle); var srctag = jQuery('#mediaboxck_source_choice .active').length ? jQuery('#mediaboxck_source_choice .active').attr('data-target') : 'src'; if (srctag == 'dir') { if (jQuery('#mediaboxck_popup_source_dir').val() == '') { alert(Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_MISSING') ); jQuery('#mediaboxck_popup_source_dir').focus().addClass('invalid'); return false; } tagparams.push('dir=' + jQuery('#mediaboxck_popup_source_dir').val()); } else { if (jQuery('#mediaboxck_popup_source').val() == '') { alert(Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_MISSING') ); jQuery('#mediaboxck_popup_source').focus().addClass('invalid'); return false; } tagparams.push('src=' + jQuery('#mediaboxck_popup_source').val()); } if (tagparams.length) taghtml += ' ' + tagparams.join('|'); taghtml += '}'; taghtml += jQuery('#mediaboxck_popup_text').val() || editor.selection.getContent(); taghtml = taghtml.replace(/_QQ_/g, '"'); // close tag taghtml += '{/mediabox}'; return taghtml; } function getMediaboxckAttrs() { var tagparams = []; tagparams['w'] = jQuery('#mediaboxck_popup_width').val(); tagparams['h'] = jQuery('#mediaboxck_popup_height').val(); tagparams['alb'] = jQuery('#mediaboxck_popup_album').val(); tagparams['gallery'] = jQuery('#mediaboxck_popup_gallery').attr('checked'); var newtitle = jQuery('#mediaboxck_popup_title').val() + (jQuery('#mediaboxck_popup_description').val() ? '::' + jQuery('#mediaboxck_popup_description').val() : ''); tagparams['t'] = newtitle; var srctag = jQuery('#mediaboxck_source_choice .active').length ? jQuery('#mediaboxck_source_choice .active').attr('data-target') : 'src'; if (srctag == 'dir') { if (jQuery('#mediaboxck_popup_source_dir').val() == '') { alert(Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_MISSING') ); jQuery('#mediaboxck_popup_source_dir').focus().addClass('invalid'); return false; } tagparams['src'] = '#'; tagparams['dir'] = jQuery('#mediaboxck_popup_source_dir').val(); } else { if (jQuery('#mediaboxck_popup_source').val() == '') { alert(Joomla.JText._('PLG_MEDIABOXCKBUTTON_SOURCE_MISSING') ); jQuery('#mediaboxck_popup_source').focus().addClass('invalid'); return false; } tagparams['src'] = jQuery('#mediaboxck_popup_source').val(); tagparams['dir'] = ''; } return tagparams; } function getFoldersList() { jQuery('#mediabox_popup_right').addClass('mediaboxck_popup_show_folders'); if (jQuery('#mediaboxck_popup_listfolders').length) { return; } jQuery('#mediabox_popup_right').empty().append('<div class="loadingck"></div>'); var myurl = 'index.php?option=com_ajax&format=raw&plugin=Mediabox_ck&group=system'; jQuery.ajax({ type: 'POST', url: myurl, data: { method: 'AjaxListFolders' } }).done(function(response) { jQuery('#mediabox_popup_right').empty().append('<div id="mediaboxck_popup_listfolders">' + response + '</div>').removeClass('loadingck'); jQuery('#mediabox_popup_right').addClass('mediaboxck_popup_show_folders'); }).fail(function() { alert('Failed'); }); } function getSourcePreview() { // if (jQuery('#mediaboxck_popup_sourcepreview').length) { // return; // } var allowedSrc = ['png', 'jpg', 'bmp', 'gif', 'tif']; var imageSrc = jQuery('#mediaboxck_popup_source').val(); var isImage = imageSrc.substr(imageSrc.length-4, 1) == '.' && allowedSrc.indexOf(imageSrc.substr(-3, 3)) > 0 ; if (isImage) { jQuery('#mediabox_popup_right').addClass('mediaboxck_popup_show_preview'); jQuery('#mediabox_popup_right').empty().append('<div id="mediaboxck_popup_sourcepreview"><div class="mediaboxck_popup_title">' + Joomla.JText._('PLG_MEDIABOXCKBUTTON_PREVIEW') + '</div><img src="' + uriroot + '/' + imageSrc + '"/></div>').removeClass('loadingck'); } } function selectfolderck(folder) { jQuery('#mediaboxck_popup_source_dir').val(jQuery(folder).attr('data-foldername').replace(/\\/g, '/')); jQuery('#mediabox_popup_right').removeClass('mediaboxck_popup_show_folders'); } function isOnlyTextSelected(editor, anchorElm) { var html = editor.selection.getContent(); // Partial html and not a fully selected anchor element if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') == -1)) { return false; } if (anchorElm) { var nodes = anchorElm.childNodes, i; if (nodes.length === 0) { return false; } for (i = nodes.length - 1; i >= 0; i--) { if (nodes[i].nodeType != 3) { return false; } } } return true; } function showMediaboxPopup(editor, params, text, buttons, action, edname, taghtmlOriginal, attribname, attribtype) { // if (! $ck('#mediaboxckmodal').length) { jQuery('#mediaboxckmodal').remove(); var popup = document.createElement('div'); popup.id = 'mediaboxckmodal'; popup.className = 'mediaboxckmodal modal hide fade'; document.body.appendChild(popup); buttonshtml = ''; for (i=0;i<buttons.length;i++) { if (buttons[i]) buttonshtml += '<button id="' + buttons[i].id + '" class="btn btn-primary" data-dismiss="modal" aria-hidden="true" ><i class="icon icon-checkmark"></i>' + buttons[i].text + '</button>' } // onclick="' + buttons[i].name + 'Click(\''+edname+'\', \''+action+'\', \''+taghtmlOriginal+'\', \''+attribname+'\', \''+attribtype+'\' )" popup.innerHTML = '<div class="modal-header">' +'<button type="button" class="close" data-dismiss="modal">×</button>' +'<h3>Mediabox CK - Edition</h3>' +'</div>' +'<div class="modal-body">' // + '<link rel="stylesheet" href="' + window.uriroot + '/plugins/system/mediaboxck/assets/mediaboxck.css" type="text/css" />' + createMediaboxPopup(params, text) +'</div>' +'<div class="modal-footer">' + buttonshtml +'<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon icon-cancel"></i>' + Joomla.JText._('JCANCEL') + '</button>' +'</div>'; var BSmodal = jQuery('#mediaboxckmodal'); BSmodal.css('z-index', '44444'); // } else { // var BSmodal = jQuery('#mediaboxckmodal'); // } BSmodal.modal('show'); }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings