Changeset 20114
- Timestamp:
- 03/05/2012 07:31:31 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/wp-admin.dev.css
r20102 r20114 3889 3889 } 3890 3890 3891 .media-item .edit-caption-controls { 3892 margin: 5px 0; 3893 width: 460px; 3894 } 3895 3896 .media-item .edit-caption-controls label { 3897 margin: 5px 0; 3898 display: block; 3899 } 3900 3901 .media-item .edit-caption-controls label span { 3902 width: 100px; 3903 float: left; 3904 line-height: 22px; 3905 } 3906 3907 .media-item .edit-caption-controls input[type="text"] { 3908 width: 335px; 3909 } 3910 3911 .media-item .caption-insert-link-buttons { 3912 text-align: right; 3913 margin: 5px 12px; 3914 } 3915 3916 .media-item .caption-insert-link-wrap { 3917 padding: 5px 0 5px 12px; 3918 background-color: #f8f8f8; 3919 border: 1px solid #eee; 3920 -webkit-border-radius: 3px; 3921 border-radius: 3px; 3922 } 3923 3924 .media-item .post_excerpt textarea { 3925 height: 60px; 3891 .media-item .post_excerpt textarea, 3892 .media-item .post_content textarea, 3893 .media-item textarea#caption { 3894 min-height: 5em; 3926 3895 } 3927 3896 -
trunk/wp-admin/includes/media.php
r19999 r20114 150 150 $width = $matches[1]; 151 151 152 $caption = preg_replace_callback( '/<[a-zA-Z][^<>]+>/', '_cleanup_image_add_caption', $caption ); 152 // look only for html tags with attributes 153 $caption = preg_replace_callback( '/<[a-zA-Z0-9]+ [^<>]+>/', '_cleanup_image_add_caption', $caption ); 153 154 $caption = str_replace( '"', '"', $caption ); 154 155 … … 166 167 // Private, preg_replace callback used in image_add_caption() 167 168 function _cleanup_image_add_caption($str) { 168 if ( isset($str[0]) ) 169 return str_replace( '"', "'", $str[0] ); 169 if ( isset($str[0]) ) { 170 // look for single quotes inside html attributes (for example in title) 171 $s = preg_replace_callback( '/="[^"]+"/', '_cleanup_image_add_caption2', $str[0] ); 172 return str_replace( '"', "'", $s ); 173 } 170 174 171 175 return ''; 176 } 177 178 // Private, preg_replace callback used in image_add_caption() 179 function _cleanup_image_add_caption2($str) { 180 return str_replace( "'", ''', $str ); 172 181 } 173 182 … … 796 805 $name = "attachments[{$edit_post->ID}][post_excerpt]"; 797 806 798 return ' 799 <textarea class="code" name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea> 800 <div class="edit-caption-controls hide-if-no-js"> 801 <input type="button" class="button caption-insert-link" value="' . esc_attr__('Insert Link') . '" /> 802 <div class="caption-insert-link-wrap hidden"> 803 <label><span>' . __('Link URL') . '</span> 804 <input type="text" value="" class="caption-insert-link-url" /></label> 805 <label><span>' . __('Linked text') . '</span> 806 <input type="text" value="" class="caption-insert-link-text" /></label> 807 <div class="caption-insert-link-buttons"> 808 <input type="button" class="button caption-cancel" value="' . esc_attr__('Cancel') . '" /> 809 <input type="button" class="button-primary caption-save" value="' . esc_attr__('Insert') . '" /> 810 <br class="clear" /> 811 </div></div></div> 812 '; 807 return '<textarea class="code" name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea>'; 813 808 } 814 809 … … 1548 1543 <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?> 1549 1544 if ( f.caption.value ) { 1550 caption = f.caption.value.replace(/<[a-z][^<>]+>/g, function(a){ 1545 caption = f.caption.value.replace(/<[a-zA-Z0-9]+ [^<>]+>/g, function(a){ 1546 a = a.replace(/="[^"]+"/, function(b){ 1547 return b.replace(/'/g, '''); 1548 }); 1551 1549 return a.replace(/"/g, "'"); 1552 1550 }); … … 1955 1953 <span class="alignleft"><label for="caption">' . __('Image Caption') . '</label></span> 1956 1954 </th> 1957 <td class="field">< input id="caption" name="caption" value="" type="text" /></td>1955 <td class="field"><textarea id="caption" class="code" name="caption"></textarea></td> 1958 1956 </tr> 1959 1957 '; -
trunk/wp-includes/js/plupload/handlers.dev.js
r19982 r20114 339 339 340 340 jQuery(document).ready(function($){ 341 var insert_link, bookmark;342 343 341 $('.media-upload-form').bind('click.uploader', function(e) { 344 var target = $(e.target), tr, c, el, textarea, sel, text, startPos, endPos; 345 346 if ( target.hasClass('caption-insert-link') ) { 347 el = target.siblings('div.caption-insert-link-wrap'), textarea = target.parent().siblings('textarea').get(0); 348 349 if ( document.selection ) { 350 textarea.focus(); 351 sel = document.selection.createRange(); 352 bookmark = sel.getBookmark(); 353 354 if ( sel.text ) 355 el.find('.caption-insert-link-text').val(sel.text); 356 357 } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) { 358 text = textarea.value; 359 startPos = textarea.selectionStart; 360 endPos = textarea.selectionEnd; 361 362 if ( startPos != endPos ) 363 el.find('.caption-insert-link-text').val( text.substring(startPos, endPos) ); 364 } 365 366 target.hide(); 367 el.show(); 368 el.find('.caption-insert-link-url').focus(); 369 } else if ( target.hasClass('caption-cancel') || target.hasClass('caption-save') ) { 370 el = target.closest('div.caption-insert-link-wrap'); 371 372 if ( target.hasClass('caption-save') ) 373 insert_link( el.closest('.edit-caption-controls').siblings('textarea'), el ); 374 375 el.hide(); 376 el.siblings('.caption-insert-link').show(); 377 } else if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment 342 var target = $(e.target), tr, c; 343 344 if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment 378 345 tr = target.closest('tr'); 379 346 380 if ( $(tr).hasClass('align') )347 if ( tr.hasClass('align') ) 381 348 setUserSetting('align', target.val()); 382 else if ( $(tr).hasClass('image-size') )349 else if ( tr.hasClass('image-size') ) 383 350 setUserSetting('imgsize', target.val()); 384 351 … … 428 395 } 429 396 }); 430 431 insert_link = function(textarea, parent) {432 var sel, content, startPos, endPos, scrollTop, text,433 url = parent.find('.caption-insert-link-url'), link_text = parent.find('.caption-insert-link-text');434 435 if ( !url.length || !link_text.length )436 return;437 438 textarea = textarea.get(0);439 content = "<a href='"+url.val()+"'>"+link_text.val()+"</a>";440 441 if ( document.selection ) {442 textarea.focus();443 sel = document.selection.createRange();444 445 if ( bookmark ) {446 sel.moveToBookmark( bookmark );447 bookmark = '';448 }449 450 sel.text = content;451 textarea.focus();452 } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {453 text = textarea.value;454 startPos = textarea.selectionStart;455 endPos = textarea.selectionEnd;456 scrollTop = textarea.scrollTop;457 458 textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);459 460 textarea.focus();461 textarea.selectionStart = startPos + content.length;462 textarea.selectionEnd = startPos + content.length;463 textarea.scrollTop = scrollTop;464 }465 466 url.val('');467 link_text.val('');468 };469 397 470 398 // init and set the uploader -
trunk/wp-includes/js/tinymce/langs/wp-langs-en.js
r19986 r20114 500 500 img_title:"Title", 501 501 caption:"Caption", 502 insert_link:"Insert link",503 linked_text:"Linked text",504 502 alt:"Alternate Text" 505 503 }); -
trunk/wp-includes/js/tinymce/langs/wp-langs.php
r19993 r20114 543 543 'img_title' => __('Title'), 544 544 'caption' => __('Caption'), 545 'insert_link' => __('Insert link'),546 'linked_text' => __('Linked text'),547 545 'alt' => __('Alternate Text') 548 546 ); -
trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css
r19982 r20114 358 358 } 359 359 360 #img-edit .edit-caption-controls {361 margin: 5px 0;362 }363 364 #img-edit .edit-caption-controls label {365 margin: 5px 0;366 display: block;367 }368 369 #img-edit .edit-caption-controls label span {370 width: 100px;371 float: left;372 line-height: 22px;373 }374 375 #img-edit .edit-caption-controls input[type="text"] {376 width: 335px;377 }378 379 #img-edit .caption-insert-link-buttons {380 text-align: right;381 margin: 5px 12px;382 }383 384 #img-edit .caption-insert-link-wrap {385 padding: 5px 0 5px 12px;386 background-color: #f8f8f8;387 border: 1px solid #eee;388 -webkit-border-radius: 3px;389 border-radius: 3px;390 }391 392 360 #img-edit #img_cap_text { 393 361 font: normal 12px/18px monospace; -
trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
r19982 r20114 103 103 <td class="field"> 104 104 <textarea id="img_cap_text"></textarea> 105 106 <div class="edit-caption-controls">107 <input type="button" class="button caption-insert-link" value="{#wpeditimage.insert_link}" />108 109 <div class="caption-insert-link-wrap hidden">110 <label><span>{#advanced_dlg.link_url}</span>111 <input type="text" value="" class="caption-insert-link-url" /></label>112 113 <label><span>{#wpeditimage.linked_text}</span>114 <input type="text" value="" class="caption-insert-link-text" /></label>115 116 <div class="caption-insert-link-buttons">117 <input type="button" class="button caption-cancel" value="{#cancel}" />118 <input type="button" class="button-primary caption-save" value="{#insert}" />119 <br class="clear" />120 </div></div></div>121 105 </td> 122 106 </tr> -
trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js
r20013 r20114 187 187 cls = cls.match(/align[a-z]+/) || 'alignnone'; 188 188 189 cap = cap.replace(/<[a-z ][^<>]+>/g, function(a){189 cap = cap.replace(/<[a-zA-Z0-9]+ [^<>]+>/g, function(a){ // look only for html tags with attributes 190 190 a = a.replace(/="[^"]+"/, function(b){ 191 191 return b.replace(/'/g, '''); -
trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js
r19982 r20114 22 22 t.editor = tinymce.EditorManager.activeEditor; 23 23 t.params = t.editor.windowManager.params; 24 t.events = new tinymce.dom.EventUtils();25 24 26 25 // Setup local DOM … … 246 245 setup : function() { 247 246 var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, 248 d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa , bookmark, insert_link;247 d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa; 249 248 250 249 document.dir = tinyMCEPopup.editor.getParam('directionality',''); … … 331 330 332 331 document.body.style.display = ''; 333 334 tinyMCEPopup.events.add(document.body, 'click', function(e) {335 var target = e.target, parent = target.parentNode, tr, c, el, textarea, sel, text, startPos, endPos;336 337 if ( dom.hasClass(target, 'caption-insert-link') ) {338 el = dom.select('div.caption-insert-link-wrap', parent)[0], textarea = dom.select('#img_cap_text')[0];339 340 if ( document.selection ) {341 textarea.focus();342 sel = document.selection.createRange();343 bookmark = sel.getBookmark();344 345 if ( sel.text )346 dom.select('.caption-insert-link-text', el)[0].value = sel.text;347 348 } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {349 text = textarea.value;350 startPos = textarea.selectionStart;351 endPos = textarea.selectionEnd;352 353 if ( startPos != endPos )354 dom.select('.caption-insert-link-text', el)[0].value = text.substring(startPos, endPos);355 }356 357 dom.hide(target);358 dom.show(el);359 dom.select('.caption-insert-link-url', el)[0].focus();360 } else if ( dom.hasClass(target, 'caption-cancel') || dom.hasClass(target, 'caption-save') ) {361 if ( dom.hasClass(target, 'caption-save') )362 insert_link();363 364 dom.hide( dom.select('.caption-insert-link-wrap') );365 dom.show( dom.select('.caption-insert-link') );366 }367 });368 369 insert_link = function() {370 var sel, content, startPos, endPos, scrollTop, text, textarea = dom.select('#img_cap_text')[0],371 url = dom.select('.caption-insert-link-url')[0], link_text = dom.select('.caption-insert-link-text')[0];372 373 if ( !url || !link_text )374 return;375 376 content = "<a href='"+url.value+"'>"+link_text.value+"</a>";377 378 if ( document.selection ) {379 textarea.focus();380 sel = document.selection.createRange();381 382 if ( bookmark ) {383 sel.moveToBookmark( bookmark );384 bookmark = '';385 }386 387 sel.text = content;388 textarea.focus();389 } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {390 text = textarea.value;391 startPos = textarea.selectionStart;392 endPos = textarea.selectionEnd;393 scrollTop = textarea.scrollTop;394 395 textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);396 397 textarea.focus();398 textarea.selectionStart = startPos + content.length;399 textarea.selectionEnd = startPos + content.length;400 textarea.scrollTop = scrollTop;401 }402 403 url.value = '';404 link_text.value = '';405 };406 332 }, 407 333 -
trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
r19982 r20114 1 var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c<a.length;c++){e=a[c].split("=");f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}b=d.getWin();tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.params=d.editor.windowManager.params;d. events=new tinymce.dom.EventUtils();d.dom=d.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);d.editor.windowManager.onOpen.dispatch(d.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getParam:function(b,a){return this.editor.getParam(b,a)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark("simple")},restoreSelection:function(){var a=tinyMCEPopup;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}}};tinyMCEPopup.init();wpImage={preInit:function(){var a=tinyMCEPopup.editor,e=tinyMCEPopup.getWin(),d=e.document.styleSheets,b,c;for(c=0;c<d.length;c++){b=d.item(c).href;if(b&&b.indexOf("colors")!=-1){document.getElementsByTagName("head")[0].appendChild(a.dom.create("link",{rel:"stylesheet",href:b}));break}}},I:function(a){return document.getElementById(a)},current:"",link:"",link_rel:"",target_value:"",current_size_sel:"s100",width:"",height:"",align:"",img_alt:"",setTabs:function(b){var a=this;if("current"==b.className){return false}a.I("div_advanced").style.display=("tab_advanced"==b.id)?"block":"none";a.I("div_basic").style.display=("tab_basic"==b.id)?"block":"none";a.I("tab_basic").className=a.I("tab_advanced").className="";b.className="current";return false},img_seturl:function(b){var c=this,a=c.I("link_rel").value;if("current"==b){c.I("link_href").value=c.current;c.I("link_rel").value=c.link_rel}else{c.I("link_href").value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,"");c.I("link_rel").value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I("img_classes").value;c.I("img_demo").className=c.align=b;a=a.replace(/align[^ "']+/gi,"");a+=(" "+b);a=a.replace(/\s+/g," ").replace(/^\s/,"");if("aligncenter"==b){c.I("hspace").value="";c.updateStyle("hspace")}c.I("img_classes").value=a},showSize:function(e){var c=this,f=c.I("img_demo"),a=c.width,d=c.height,g=e.id||"s100",b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor="#A3A3A3";e.style.backgroundColor="#E5E5E5"},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)>parseInt(b.preloadImg.width)){d=b.I("s130"),c=b.I("s120"),a=b.I("s110");d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color="#aaa"}},showSizeRem:function(){var a=this,c=a.I("img_demo"),b=document.forms[0];c.width=Math.round(b.width.value*0.5);c.height=Math.round(b.height.value*0.5);a.showSizeClear();a.I(a.current_size_sel).style.borderColor="#A3A3A3";a.I(a.current_size_sel).style.backgroundColor="#E5E5E5";return false},showSizeClear:function(){var b=this.I("img_size").getElementsByTagName("div"),a;for(a=0;a<b.length;a++){b[a].style.borderColor="#f1f1f1";b[a].style.backgroundColor="#f1f1f1"}},imgEditSize:function(g){var d=this,i=document.forms[0],a,c,b,e,j;if(!d.preloadImg||!d.preloadImg.width||!d.preloadImg.height){return}a=parseInt(d.preloadImg.width),c=parseInt(d.preloadImg.height),b=d.width||a,e=d.height||c,j=g.id||"s100";size=parseInt(j.substring(1))/100;b=Math.round(b*size);e=Math.round(e*size);i.width.value=Math.min(a,b);i.height.value=Math.min(c,e);d.current_size_sel=j;d.demoSetSize()},demoSetSize:function(a){var c=this.I("img_demo"),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):"";c.height=b.height.value?Math.round(b.height.value*0.5):""},demoSetStyle:function(){var b=document.forms[0],a=this.I("img_demo"),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,"style",b.img_style.value);c.setStyle(a,"width","");c.setStyle(a,"height","")}},origSize:function(){var a=this,c=document.forms[0],b=a.I("s100");c.width.value=a.width=a.preloadImg.width;c.height.value=a.height=a.preloadImg.height;a.showSizeSet();a.demoSetSize();a.showSize(b)},init:function(){var a=tinyMCEPopup.editor,b;b=document.body.innerHTML;document.body.innerHTML=a.translate(b);window.setTimeout(function(){wpImage.setup()},500)},setup:function(){var s=this,n,e,o,g,k=document.forms[0],j=tinyMCEPopup.editor,m=s.I("img_demo"),i=tinyMCEPopup.dom,a,h,r="",q,p,l,b;document.dir=tinyMCEPopup.editor.getParam("directionality","");if(tinyMCEPopup.editor.getParam("wpeditimage_disable_captions",false)){s.I("cap_field").style.display="none"}tinyMCEPopup.restoreSelection();e=j.selection.getNode();if(e.nodeName!="IMG"){return}k.img_src.value=m.src=o=j.dom.getAttrib(e,"src");j.dom.setStyle(e,"float","");s.getImageData();n=j.dom.getAttrib(e,"class");if(a=i.getParent(e,"dl")){q=j.dom.getAttrib(a,"class");q=q.match(/align[^ "']+/i);if(q&&!i.hasClass(e,q)){n+=" "+q;tinymce.trim(n)}h=j.dom.select("dd.wp-caption-dd",a);if(h&&h[0]){r=j.serializer.serialize(h[0]).replace(/^<p>/,"").replace(/<\/p>$/,"")}}k.img_cap_text.value=r;k.img_title.value=j.dom.getAttrib(e,"title");k.img_alt.value=j.dom.getAttrib(e,"alt");k.border.value=j.dom.getAttrib(e,"border");k.vspace.value=j.dom.getAttrib(e,"vspace");k.hspace.value=j.dom.getAttrib(e,"hspace");k.align.value=j.dom.getAttrib(e,"align");k.width.value=s.width=j.dom.getAttrib(e,"width");k.height.value=s.height=j.dom.getAttrib(e,"height");k.img_classes.value=n;k.img_style.value=j.dom.getAttrib(e,"style");if(i.getAttrib(e,"hspace")){s.updateStyle("hspace")}if(i.getAttrib(e,"border")){s.updateStyle("border")}if(i.getAttrib(e,"vspace")){s.updateStyle("vspace")}if(p=j.dom.getParent(e,"A")){k.link_href.value=s.current=j.dom.getAttrib(p,"href");k.link_title.value=j.dom.getAttrib(p,"title");k.link_rel.value=s.link_rel=j.dom.getAttrib(p,"rel");k.link_style.value=j.dom.getAttrib(p,"style");s.target_value=j.dom.getAttrib(p,"target");k.link_classes.value=j.dom.getAttrib(p,"class")}k.link_target.checked=(s.target_value&&s.target_value=="_blank")?"checked":"";g=o.substring(o.lastIndexOf("/"));g=g.replace(/-[0-9]{2,4}x[0-9]{2,4}/,"");s.link=o.substring(0,o.lastIndexOf("/"))+g;if(n.indexOf("alignleft")!=-1){s.I("alignleft").checked="checked";m.className=s.align="alignleft"}else{if(n.indexOf("aligncenter")!=-1){s.I("aligncenter").checked="checked";m.className=s.align="aligncenter"}else{if(n.indexOf("alignright")!=-1){s.I("alignright").checked="checked";m.className=s.align="alignright"}else{if(n.indexOf("alignnone")!=-1){s.I("alignnone").checked="checked";m.className=s.align="alignnone"}}}}if(s.width&&s.preloadImg.width){s.showSizeSet()}document.body.style.display="";tinyMCEPopup.events.add(document.body,"click",function(v){var w=v.target,z=w.parentNode,y,x,t,A,f,B,u,d;if(i.hasClass(w,"caption-insert-link")){t=i.select("div.caption-insert-link-wrap",z)[0],A=i.select("#img_cap_text")[0];if(document.selection){A.focus();f=document.selection.createRange();l=f.getBookmark();if(f.text){i.select(".caption-insert-link-text",t)[0].value=f.text}}else{if(A.selectionStart||A.selectionStart=="0"){B=A.value;u=A.selectionStart;d=A.selectionEnd;if(u!=d){i.select(".caption-insert-link-text",t)[0].value=B.substring(u,d)}}}i.hide(w);i.show(t);i.select(".caption-insert-link-url",t)[0].focus()}else{if(i.hasClass(w,"caption-cancel")||i.hasClass(w,"caption-save")){if(i.hasClass(w,"caption-save")){b()}i.hide(i.select(".caption-insert-link-wrap"));i.show(i.select(".caption-insert-link"))}}});b=function(){var u,v,w,f,t,y,x=i.select("#img_cap_text")[0],d=i.select(".caption-insert-link-url")[0],c=i.select(".caption-insert-link-text")[0];if(!d||!c){return}v="<a href='"+d.value+"'>"+c.value+"</a>";if(document.selection){x.focus();u=document.selection.createRange();if(l){u.moveToBookmark(l);l=""}u.text=v;x.focus()}else{if(x.selectionStart||x.selectionStart=="0"){y=x.value;w=x.selectionStart;f=x.selectionEnd;t=x.scrollTop;x.value=y.substring(0,w)+v+y.substring(f,y.length);x.focus();x.selectionStart=w+v.length;x.selectionEnd=w+v.length;x.scrollTop=t}}d.value="";c.value=""}},remove:function(){var a=tinyMCEPopup.editor,c,b;tinyMCEPopup.restoreSelection();b=a.selection.getNode();if(b.nodeName!="IMG"){return}if((c=a.dom.getParent(b,"div"))&&a.dom.hasClass(c,"mceTemp")){a.dom.remove(c)}else{if((c=a.dom.getParent(b,"A"))&&c.childNodes.length==1){a.dom.remove(c)}else{a.dom.remove(b)}}a.execCommand("mceRepaint");tinyMCEPopup.close();return},update:function(){var m=this,v=document.forms[0],g=tinyMCEPopup.editor,e,x,d=null,n,h,p,r,o=null,k=v.img_classes.value,l,q,u="",j,i,s,a,z,w="",c,y;tinyMCEPopup.restoreSelection();e=g.selection.getNode();if(e.nodeName!="IMG"){return}if(v.img_src.value===""){m.remove();return}if(v.img_cap_text.value!=""&&v.width.value!=""){o=1;k=k.replace(/align[^ "']+\s?/gi,"")}p=g.dom.getParent(e,"a");h=g.dom.getParent(e,"p");n=g.dom.getParent(e,"dl");r=g.dom.getParent(e,"div");tinyMCEPopup.execCommand("mceBeginUndoLevel");if(v.width.value!=e.width||v.height.value!=e.height){k=k.replace(/size-[^ "']+/,"")}g.dom.setAttribs(e,{src:v.img_src.value,title:v.img_title.value,alt:v.img_alt.value,width:v.width.value,height:v.height.value,style:v.img_style.value,"class":k});if(v.link_href.value){if(p==null){if(!v.link_href.value.match(/https?:\/\//i)){v.link_href.value=tinyMCEPopup.editor.documentBaseURI.toAbsolute(v.link_href.value)}if(tinymce.isWebKit&&g.dom.hasClass(e,"aligncenter")){g.dom.removeClass(e,"aligncenter");d=1}tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});if(d){g.dom.addClass(e,"aligncenter")}tinymce.each(g.dom.select("a"),function(b){if(g.dom.getAttrib(b,"href")=="#mce_temp_url#"){g.dom.setAttribs(b,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?"_blank":"","class":v.link_classes.value,style:v.link_style.value})}})}else{g.dom.setAttribs(p,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?"_blank":"","class":v.link_classes.value,style:v.link_style.value})}}if(o){a=10+parseInt(v.width.value);z=(m.align=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";if(n){g.dom.setAttribs(n,{"class":"wp-caption "+m.align,style:"width: "+a+"px;"});if(r){g.dom.setAttrib(r,"class",z)}if((i=g.dom.getParent(e,"dt"))&&(s=i.nextSibling)&&g.dom.hasClass(s,"wp-caption-dd")){g.dom.setHTML(s,v.img_cap_text.value)}}else{if((q=v.img_classes.value.match(/wp-image-([0-9]{1,6})/))&&q[1]){u="attachment_"+q[1]}if(v.link_href.value&&(w=g.dom.getParent(e,"a"))){if(w.childNodes.length==1){l=g.dom.getOuterHTML(w)}else{l=g.dom.getOuterHTML(w);l=l.match(/<a[^>]+>/i);l=l+g.dom.getOuterHTML(e)+"</a>"}}else{l=g.dom.getOuterHTML(e)}l='<dl id="'+u+'" class="wp-caption '+m.align+'" style="width: '+a+'px"><dt class="wp-caption-dt">'+l+'</dt><dd class="wp-caption-dd">'+v.img_cap_text.value+"</dd></dl>";j=g.dom.create("div",{"class":z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,"TD,TH,LI")){c.appendChild(j);if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&&r){if(v.link_href.value&&(y=g.dom.getParent(e,"a"))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create("p",{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf("aligncenter")!=-1){if(h&&(!h.style||h.style.textAlign!="center")){g.dom.setStyle(h,"textAlign","center")}}else{if(h&&h.style&&h.style.textAlign=="center"){g.dom.setStyle(h,"textAlign","")}}if(!v.link_href.value&&p){x=g.selection.getBookmark();g.dom.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand("mceEndUndoLevel");g.execCommand("mceRepaint");tinyMCEPopup.close()},updateStyle:function(a){var e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create("img",{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a=="align"){e.setStyle(b,"float","");e.setStyle(b,"vertical-align","");c=d.align.value;if(c){if(c=="left"||c=="right"){e.setStyle(b,"float",c)}else{b.style.verticalAlign=c}}}if(a=="border"){e.setStyle(b,"border","");c=d.border.value;if(c||c=="0"){if(c=="0"){b.style.border="0"}else{b.style.border=c+"px solid black"}}}if(a=="hspace"){e.setStyle(b,"marginLeft","");e.setStyle(b,"marginRight","");c=d.hspace.value;if(c){b.style.marginLeft=c+"px";b.style.marginRight=c+"px"}}if(a=="vspace"){e.setStyle(b,"marginTop","");e.setStyle(b,"marginBottom","");c=d.vspace.value;if(c){b.style.marginTop=c+"px";b.style.marginBottom=c+"px"}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==""){if(a.id=="img_src"){a.value=this.I("img_demo").src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=""},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&&c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&&!c){c=d.height.value=b.height=Math.round(b.preloadImg.height/(b.preloadImg.width/a))}}if(!a){d.width.value=b.width=b.preloadImg.width}if(!c){d.height.value=b.height=b.preloadImg.height}b.showSizeSet();b.demoSetSize();if(d.img_style.value){b.demoSetStyle()}},getImageData:function(){var a=wpImage,b=document.forms[0];a.preloadImg=new Image();a.preloadImg.onload=a.updateImageData;a.preloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit();1 var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(""+document.location.search).replace(/^\?/,"").split("&");f={};for(c=0;c<a.length;c++){e=a[c].split("=");f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}b=d.getWin();tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.params=d.editor.windowManager.params;d.dom=d.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);d.editor.windowManager.onOpen.dispatch(d.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getParam:function(b,a){return this.editor.getParam(b,a)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark("simple")},restoreSelection:function(){var a=tinyMCEPopup;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}}};tinyMCEPopup.init();wpImage={preInit:function(){var a=tinyMCEPopup.editor,e=tinyMCEPopup.getWin(),d=e.document.styleSheets,b,c;for(c=0;c<d.length;c++){b=d.item(c).href;if(b&&b.indexOf("colors")!=-1){document.getElementsByTagName("head")[0].appendChild(a.dom.create("link",{rel:"stylesheet",href:b}));break}}},I:function(a){return document.getElementById(a)},current:"",link:"",link_rel:"",target_value:"",current_size_sel:"s100",width:"",height:"",align:"",img_alt:"",setTabs:function(b){var a=this;if("current"==b.className){return false}a.I("div_advanced").style.display=("tab_advanced"==b.id)?"block":"none";a.I("div_basic").style.display=("tab_basic"==b.id)?"block":"none";a.I("tab_basic").className=a.I("tab_advanced").className="";b.className="current";return false},img_seturl:function(b){var c=this,a=c.I("link_rel").value;if("current"==b){c.I("link_href").value=c.current;c.I("link_rel").value=c.link_rel}else{c.I("link_href").value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,"");c.I("link_rel").value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I("img_classes").value;c.I("img_demo").className=c.align=b;a=a.replace(/align[^ "']+/gi,"");a+=(" "+b);a=a.replace(/\s+/g," ").replace(/^\s/,"");if("aligncenter"==b){c.I("hspace").value="";c.updateStyle("hspace")}c.I("img_classes").value=a},showSize:function(e){var c=this,f=c.I("img_demo"),a=c.width,d=c.height,g=e.id||"s100",b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor="#A3A3A3";e.style.backgroundColor="#E5E5E5"},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)>parseInt(b.preloadImg.width)){d=b.I("s130"),c=b.I("s120"),a=b.I("s110");d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color="#aaa"}},showSizeRem:function(){var a=this,c=a.I("img_demo"),b=document.forms[0];c.width=Math.round(b.width.value*0.5);c.height=Math.round(b.height.value*0.5);a.showSizeClear();a.I(a.current_size_sel).style.borderColor="#A3A3A3";a.I(a.current_size_sel).style.backgroundColor="#E5E5E5";return false},showSizeClear:function(){var b=this.I("img_size").getElementsByTagName("div"),a;for(a=0;a<b.length;a++){b[a].style.borderColor="#f1f1f1";b[a].style.backgroundColor="#f1f1f1"}},imgEditSize:function(g){var d=this,i=document.forms[0],a,c,b,e,j;if(!d.preloadImg||!d.preloadImg.width||!d.preloadImg.height){return}a=parseInt(d.preloadImg.width),c=parseInt(d.preloadImg.height),b=d.width||a,e=d.height||c,j=g.id||"s100";size=parseInt(j.substring(1))/100;b=Math.round(b*size);e=Math.round(e*size);i.width.value=Math.min(a,b);i.height.value=Math.min(c,e);d.current_size_sel=j;d.demoSetSize()},demoSetSize:function(a){var c=this.I("img_demo"),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):"";c.height=b.height.value?Math.round(b.height.value*0.5):""},demoSetStyle:function(){var b=document.forms[0],a=this.I("img_demo"),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,"style",b.img_style.value);c.setStyle(a,"width","");c.setStyle(a,"height","")}},origSize:function(){var a=this,c=document.forms[0],b=a.I("s100");c.width.value=a.width=a.preloadImg.width;c.height.value=a.height=a.preloadImg.height;a.showSizeSet();a.demoSetSize();a.showSize(b)},init:function(){var a=tinyMCEPopup.editor,b;b=document.body.innerHTML;document.body.innerHTML=a.translate(b);window.setTimeout(function(){wpImage.setup()},500)},setup:function(){var q=this,l,b,m,e,j=document.forms[0],i=tinyMCEPopup.editor,k=q.I("img_demo"),h=tinyMCEPopup.dom,a,g,p="",o,n;document.dir=tinyMCEPopup.editor.getParam("directionality","");if(tinyMCEPopup.editor.getParam("wpeditimage_disable_captions",false)){q.I("cap_field").style.display="none"}tinyMCEPopup.restoreSelection();b=i.selection.getNode();if(b.nodeName!="IMG"){return}j.img_src.value=k.src=m=i.dom.getAttrib(b,"src");i.dom.setStyle(b,"float","");q.getImageData();l=i.dom.getAttrib(b,"class");if(a=h.getParent(b,"dl")){o=i.dom.getAttrib(a,"class");o=o.match(/align[^ "']+/i);if(o&&!h.hasClass(b,o)){l+=" "+o;tinymce.trim(l)}g=i.dom.select("dd.wp-caption-dd",a);if(g&&g[0]){p=i.serializer.serialize(g[0]).replace(/^<p>/,"").replace(/<\/p>$/,"")}}j.img_cap_text.value=p;j.img_title.value=i.dom.getAttrib(b,"title");j.img_alt.value=i.dom.getAttrib(b,"alt");j.border.value=i.dom.getAttrib(b,"border");j.vspace.value=i.dom.getAttrib(b,"vspace");j.hspace.value=i.dom.getAttrib(b,"hspace");j.align.value=i.dom.getAttrib(b,"align");j.width.value=q.width=i.dom.getAttrib(b,"width");j.height.value=q.height=i.dom.getAttrib(b,"height");j.img_classes.value=l;j.img_style.value=i.dom.getAttrib(b,"style");if(h.getAttrib(b,"hspace")){q.updateStyle("hspace")}if(h.getAttrib(b,"border")){q.updateStyle("border")}if(h.getAttrib(b,"vspace")){q.updateStyle("vspace")}if(n=i.dom.getParent(b,"A")){j.link_href.value=q.current=i.dom.getAttrib(n,"href");j.link_title.value=i.dom.getAttrib(n,"title");j.link_rel.value=q.link_rel=i.dom.getAttrib(n,"rel");j.link_style.value=i.dom.getAttrib(n,"style");q.target_value=i.dom.getAttrib(n,"target");j.link_classes.value=i.dom.getAttrib(n,"class")}j.link_target.checked=(q.target_value&&q.target_value=="_blank")?"checked":"";e=m.substring(m.lastIndexOf("/"));e=e.replace(/-[0-9]{2,4}x[0-9]{2,4}/,"");q.link=m.substring(0,m.lastIndexOf("/"))+e;if(l.indexOf("alignleft")!=-1){q.I("alignleft").checked="checked";k.className=q.align="alignleft"}else{if(l.indexOf("aligncenter")!=-1){q.I("aligncenter").checked="checked";k.className=q.align="aligncenter"}else{if(l.indexOf("alignright")!=-1){q.I("alignright").checked="checked";k.className=q.align="alignright"}else{if(l.indexOf("alignnone")!=-1){q.I("alignnone").checked="checked";k.className=q.align="alignnone"}}}}if(q.width&&q.preloadImg.width){q.showSizeSet()}document.body.style.display=""},remove:function(){var a=tinyMCEPopup.editor,c,b;tinyMCEPopup.restoreSelection();b=a.selection.getNode();if(b.nodeName!="IMG"){return}if((c=a.dom.getParent(b,"div"))&&a.dom.hasClass(c,"mceTemp")){a.dom.remove(c)}else{if((c=a.dom.getParent(b,"A"))&&c.childNodes.length==1){a.dom.remove(c)}else{a.dom.remove(b)}}a.execCommand("mceRepaint");tinyMCEPopup.close();return},update:function(){var m=this,v=document.forms[0],g=tinyMCEPopup.editor,e,x,d=null,n,h,p,r,o=null,k=v.img_classes.value,l,q,u="",j,i,s,a,z,w="",c,y;tinyMCEPopup.restoreSelection();e=g.selection.getNode();if(e.nodeName!="IMG"){return}if(v.img_src.value===""){m.remove();return}if(v.img_cap_text.value!=""&&v.width.value!=""){o=1;k=k.replace(/align[^ "']+\s?/gi,"")}p=g.dom.getParent(e,"a");h=g.dom.getParent(e,"p");n=g.dom.getParent(e,"dl");r=g.dom.getParent(e,"div");tinyMCEPopup.execCommand("mceBeginUndoLevel");if(v.width.value!=e.width||v.height.value!=e.height){k=k.replace(/size-[^ "']+/,"")}g.dom.setAttribs(e,{src:v.img_src.value,title:v.img_title.value,alt:v.img_alt.value,width:v.width.value,height:v.height.value,style:v.img_style.value,"class":k});if(v.link_href.value){if(p==null){if(!v.link_href.value.match(/https?:\/\//i)){v.link_href.value=tinyMCEPopup.editor.documentBaseURI.toAbsolute(v.link_href.value)}if(tinymce.isWebKit&&g.dom.hasClass(e,"aligncenter")){g.dom.removeClass(e,"aligncenter");d=1}tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});if(d){g.dom.addClass(e,"aligncenter")}tinymce.each(g.dom.select("a"),function(b){if(g.dom.getAttrib(b,"href")=="#mce_temp_url#"){g.dom.setAttribs(b,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?"_blank":"","class":v.link_classes.value,style:v.link_style.value})}})}else{g.dom.setAttribs(p,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?"_blank":"","class":v.link_classes.value,style:v.link_style.value})}}if(o){a=10+parseInt(v.width.value);z=(m.align=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";if(n){g.dom.setAttribs(n,{"class":"wp-caption "+m.align,style:"width: "+a+"px;"});if(r){g.dom.setAttrib(r,"class",z)}if((i=g.dom.getParent(e,"dt"))&&(s=i.nextSibling)&&g.dom.hasClass(s,"wp-caption-dd")){g.dom.setHTML(s,v.img_cap_text.value)}}else{if((q=v.img_classes.value.match(/wp-image-([0-9]{1,6})/))&&q[1]){u="attachment_"+q[1]}if(v.link_href.value&&(w=g.dom.getParent(e,"a"))){if(w.childNodes.length==1){l=g.dom.getOuterHTML(w)}else{l=g.dom.getOuterHTML(w);l=l.match(/<a[^>]+>/i);l=l+g.dom.getOuterHTML(e)+"</a>"}}else{l=g.dom.getOuterHTML(e)}l='<dl id="'+u+'" class="wp-caption '+m.align+'" style="width: '+a+'px"><dt class="wp-caption-dt">'+l+'</dt><dd class="wp-caption-dd">'+v.img_cap_text.value+"</dd></dl>";j=g.dom.create("div",{"class":z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,"TD,TH,LI")){c.appendChild(j);if(w&&w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&&r){if(v.link_href.value&&(y=g.dom.getParent(e,"a"))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create("p",{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf("aligncenter")!=-1){if(h&&(!h.style||h.style.textAlign!="center")){g.dom.setStyle(h,"textAlign","center")}}else{if(h&&h.style&&h.style.textAlign=="center"){g.dom.setStyle(h,"textAlign","")}}if(!v.link_href.value&&p){x=g.selection.getBookmark();g.dom.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand("mceEndUndoLevel");g.execCommand("mceRepaint");tinyMCEPopup.close()},updateStyle:function(a){var e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create("img",{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a=="align"){e.setStyle(b,"float","");e.setStyle(b,"vertical-align","");c=d.align.value;if(c){if(c=="left"||c=="right"){e.setStyle(b,"float",c)}else{b.style.verticalAlign=c}}}if(a=="border"){e.setStyle(b,"border","");c=d.border.value;if(c||c=="0"){if(c=="0"){b.style.border="0"}else{b.style.border=c+"px solid black"}}}if(a=="hspace"){e.setStyle(b,"marginLeft","");e.setStyle(b,"marginRight","");c=d.hspace.value;if(c){b.style.marginLeft=c+"px";b.style.marginRight=c+"px"}}if(a=="vspace"){e.setStyle(b,"marginTop","");e.setStyle(b,"marginBottom","");c=d.vspace.value;if(c){b.style.marginTop=c+"px";b.style.marginBottom=c+"px"}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==""){if(a.id=="img_src"){a.value=this.I("img_demo").src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=""},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&&c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&&!c){c=d.height.value=b.height=Math.round(b.preloadImg.height/(b.preloadImg.width/a))}}if(!a){d.width.value=b.width=b.preloadImg.width}if(!c){d.height.value=b.height=b.preloadImg.height}b.showSizeSet();b.demoSetSize();if(d.img_style.value){b.demoSetStyle()}},getImageData:function(){var a=wpImage,b=document.forms[0];a.preloadImg=new Image();a.preloadImg.onload=a.updateImageData;a.preloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit();
Note: See TracChangeset
for help on using the changeset viewer.