Your IP : 216.73.216.215


Current Path : /home/sunflowe/www2/j30/components/com_jce/editor/tiny_mce/plugins/caption/
Upload File :
Current File : /home/sunflowe/www2/j30/components/com_jce/editor/tiny_mce/plugins/caption/editor_plugin.js

/* caption - 2.1.13 | 31 March 2016 | http://www.joomlacontenteditor.net | Copyright (C) 2006 - 2016 Ryan Demmer. All rights reserved | GNU/GPL Version 2 - http://www.gnu.org/licenses/gpl-2.0.html */
(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.CaptionPlugin',{init:function(ed,url){function isCaption(n){return n&&ed.dom.getParent(n,'.mceItemCaption');}
ed.onInit.add(function(){if(!ed.settings.compress.css){ed.dom.loadCSS(url+"/css/content.css");}});ed.onSetContent.add(function(ed){var dom=ed.dom;each(dom.select('.jce_caption, .wf_caption',ed.getBody()),function(n){dom.addClass(n,'mceItemCaption');});});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){each(dom.select('.jce_caption, .wf_caption',o.node),function(n){dom.addClass(n,'mceItemCaption');});}
if(o.get){each(dom.select('.mceCaption',o.node),function(n){dom.removeClass(n,'mceItemCaption');});}
each(dom.select('.jce_caption, .wf_caption',o.node),function(n){var w=0,mw=dom.getStyle(n,'max-width');each(n.childNodes,function(c){if(c.nodeName==="IMG"){w=c.getAttribute('width');if(ed.getParam('caption_responsive',1)){ed.dom.setStyle(c,'width','100%');}
var img=new Image();img.onload=function(){var iw=img.width,ih=img.height;dom.setStyle(n,'max-width',w||iw);dom.setAttrib(c,'width',w||iw);}
img.src=c.src;}
if(c.nodeName==="SPAN"){if(ed.dom.getStyle(c,'max-width')){ed.dom.setStyle(c,'max-width',null);}}});dom.setStyle(n,'display','block');if(ed.getParam('caption_responsive',1)){ed.dom.setStyle(n,'width','100%');}
dom.setAttrib(n,'data-mce-style',n.style.cssText);});});ed.addCommand('mceCaption',function(){var se=ed.selection,n=se.getNode(),p=ed.dom.getParent(n,'.mceItemCaption');if((n.nodeName==='SPAN'&&p)||n===p){n=ed.dom.select('img',p)[0];}
if(n.nodeName!=='IMG'){return false;}
ed.dom.select(n);ed.windowManager.open({file:ed.getParam('site_url')+'index.php?option=com_jce&view=editor&layout=plugin&plugin=caption',width:530+ed.getLang('caption.delta_width',0),height:540+ed.getLang('caption.delta_height',0),inline:1,popup_css:false},{plugin_url:url});});ed.addCommand('mceCaptionDelete',function(){var c,m,f,a,se=ed.selection,n=se.getNode();c=ed.dom.getParent(n,'.mceItemCaption');if(c){tinymce.each(ed.dom.select('img',c),function(o){var styles={};tinymce.each(['Top','Right','Bottom','Left'],function(s){styles['margin'+s]=ed.dom.getStyle(c,'margin'+s);});f=ed.dom.getStyle(c,'float');if(f==='left'||f==='right'){styles.float=f;}
a=ed.dom.getStyle(c,'vertical-align');if(a==='top'||a==='middle'||a==='bottom'){styles.verticalAlign=a;}
if(styles.marginLeft&&styles.marginLeft==='auto'&&styles.marginRight&&styles.marginRight==='auto'){styles.display='block';}
styles.width="";ed.dom.setStyles(o,styles);ed.dom.setAttrib(o,'data-mce-style',o.style.cssText);});ed.dom.remove(ed.dom.select('span, div',c));ed.dom.remove(c,true);}});ed.addButton('caption_add',{title:'caption.desc',cmd:'mceCaption',image:url+'/img/caption_add.png'});ed.addButton('caption_delete',{title:'caption.delete',cmd:'mceCaptionDelete',image:url+'/img/caption_delete.png'});ed.onNodeChange.add(function(ed,cm,n,co){var s=isCaption(n);cm.setDisabled('formatselect',s);cm.setDisabled('blockquote',s);cm.setActive('caption_delete',s);cm.setActive('caption_add',s);cm.setDisabled('caption_add',!s);cm.setDisabled('caption_delete',!s);if(!s&&n.nodeName=='IMG'){cm.setDisabled('caption_add',false);}
if(s){if(tinymce.isIE&&document.documentMode>=9){if(n.nodeName=='IMG'){ed.selection.select(n);}}
if(n.nodeName==="IMG"){var p=ed.dom.getParent(n,'.mceItemCaption');ed.dom.setStyle(p,'max-width',n.getAttribute('width'));ed.dom.setAttrib(p,'data-mce-style',p.style.cssText);}}});},getInfo:function(){return{longname:'Caption',author:'Ryan Demmer',authorurl:'http://www.joomlacontenteditor.net',infourl:'http://www.joomlacontenteditor.net',version:'2.1.13'};}});tinymce.PluginManager.add('caption',tinymce.plugins.CaptionPlugin);})();