<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[20114] trunk: Based on the current UX feedback, remove the "Insert Link" UI from under the caption fields, see #18311</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/20114">20114</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2012-03-05 07:31:31 +0000 (Mon, 05 Mar 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Based on the current UX feedback, remove the "Insert Link" UI from under the caption fields, see <a href="http://core.trac.wordpress.org/ticket/18311">#18311</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadmindevcss">trunk/wp-admin/css/wp-admin.dev.css</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpincludesjspluploadhandlersdevjs">trunk/wp-includes/js/plupload/handlers.dev.js</a></li>
<li><a href="#trunkwpincludesjstinymcelangswplangsenjs">trunk/wp-includes/js/tinymce/langs/wp-langs-en.js</a></li>
<li><a href="#trunkwpincludesjstinymcelangswplangsphp">trunk/wp-includes/js/tinymce/langs/wp-langs.php</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagecsseditimagecss">trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimageeditimagehtml">trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimageeditor_plugin_srcjs">trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagejseditimagedevjs">trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagejseditimagejs">trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadmindevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.dev.css (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.dev.css        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-admin/css/wp-admin.dev.css        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -3888,43 +3888,12 @@
</span><span class="cx">         padding-left: 15px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.media-item .edit-caption-controls {
-        margin: 5px 0;
-        width: 460px;
</del><ins>+.media-item .post_excerpt textarea,
+.media-item .post_content textarea,
+.media-item textarea#caption {
+ min-height: 5em;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-.media-item .edit-caption-controls label {
-        margin: 5px 0;
-        display: block;
-}
-
-.media-item .edit-caption-controls label span {
-        width: 100px;
-        float: left;
-        line-height: 22px;
-}
-
-.media-item .edit-caption-controls input[type="text"] {
-        width: 335px;
-}
-
-.media-item .caption-insert-link-buttons {
-        text-align: right;
-        margin: 5px 12px;
-}
-
-.media-item .caption-insert-link-wrap {
-        padding: 5px 0 5px 12px;
-        background-color: #f8f8f8;
-        border: 1px solid #eee;
-        -webkit-border-radius: 3px;
-        border-radius: 3px;
-}
-
-.media-item .post_excerpt textarea {
- height: 60px;
-}
-
</del><span class="cx"> /*------------------------------------------------------------------------------
</span><span class="cx"> 14.1 - Media Library
</span><span class="cx"> ------------------------------------------------------------------------------*/
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-admin/includes/media.php        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -149,7 +149,8 @@
</span><span class="cx">
</span><span class="cx">         $width = $matches[1];
</span><span class="cx">
</span><del>-        $caption = preg_replace_callback( '/<[a-zA-Z][^<>]+>/', '_cleanup_image_add_caption', $caption );
</del><ins>+        // look only for html tags with attributes
+        $caption = preg_replace_callback( '/<[a-zA-Z0-9]+ [^<>]+>/', '_cleanup_image_add_caption', $caption );
</ins><span class="cx">         $caption = str_replace(        '"', '&quot;', $caption );
</span><span class="cx">
</span><span class="cx">         $html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
</span><span class="lines">@@ -165,12 +166,20 @@
</span><span class="cx">
</span><span class="cx"> // Private, preg_replace callback used in image_add_caption()
</span><span class="cx"> function _cleanup_image_add_caption($str) {
</span><del>-        if ( isset($str[0]) )
-                return str_replace(        '"', "'", $str[0] );
</del><ins>+        if ( isset($str[0]) ) {
+                // look for single quotes inside html attributes (for example in title)
+                $s = preg_replace_callback( '/="[^"]+"/', '_cleanup_image_add_caption2', $str[0] );
+                return str_replace(        '"', "'", $s );
+        }
</ins><span class="cx">
</span><span class="cx">         return '';
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// Private, preg_replace callback used in image_add_caption()
+function _cleanup_image_add_caption2($str) {
+        return str_replace(        "'", '&#39;', $str );
+}
+
</ins><span class="cx"> /**
</span><span class="cx"> * {@internal Missing Short Description}}
</span><span class="cx"> *
</span><span class="lines">@@ -795,21 +804,7 @@
</span><span class="cx">         // post data is already escaped
</span><span class="cx">         $name = "attachments[{$edit_post->ID}][post_excerpt]";
</span><span class="cx">
</span><del>-        return '
-        <textarea class="code" name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea>
-        <div class="edit-caption-controls hide-if-no-js">
-        <input type="button" class="button caption-insert-link" value="' . esc_attr__('Insert Link') . '" />
-        <div class="caption-insert-link-wrap hidden">
-        <label><span>' . __('Link URL') . '</span>
-        <input type="text" value="" class="caption-insert-link-url" /></label>
-        <label><span>' . __('Linked text') . '</span>
-        <input type="text" value="" class="caption-insert-link-text" /></label>
-        <div class="caption-insert-link-buttons">
-        <input type="button" class="button caption-cancel" value="' . esc_attr__('Cancel') . '" />
-        <input type="button" class="button-primary caption-save" value="' . esc_attr__('Insert') . '" />
-        <br class="clear" />
-        </div></div></div>
-        ';
</del><ins>+        return '<textarea class="code" name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea>';
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1547,7 +1542,10 @@
</span><span class="cx">
</span><span class="cx"> <?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
</span><span class="cx">                 if ( f.caption.value ) {
</span><del>-                        caption = f.caption.value.replace(/<[a-z][^<>]+>/g, function(a){
</del><ins>+                        caption = f.caption.value.replace(/<[a-zA-Z0-9]+ [^<>]+>/g, function(a){
+                                a = a.replace(/="[^"]+"/, function(b){
+                                        return b.replace(/'/g, '&#39;');
+                                });
</ins><span class="cx">                                 return a.replace(/"/g, "'");
</span><span class="cx">                         });
</span><span class="cx">
</span><span class="lines">@@ -1954,7 +1952,7 @@
</span><span class="cx">                         <th valign="top" scope="row" class="label">
</span><span class="cx">                                 <span class="alignleft"><label for="caption">' . __('Image Caption') . '</label></span>
</span><span class="cx">                         </th>
</span><del>-                        <td class="field"><input id="caption" name="caption" value="" type="text" /></td>
</del><ins>+                        <td class="field"><textarea id="caption" class="code" name="caption"></textarea></td>
</ins><span class="cx">                 </tr>
</span><span class="cx"> ';
</span><span class="cx">         } else {
</span></span></pre></div>
<a id="trunkwpincludesjspluploadhandlersdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/plupload/handlers.dev.js (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/plupload/handlers.dev.js        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-includes/js/plupload/handlers.dev.js        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -338,48 +338,15 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> jQuery(document).ready(function($){
</span><del>-        var insert_link, bookmark;
-
</del><span class="cx">         $('.media-upload-form').bind('click.uploader', function(e) {
</span><del>-                var target = $(e.target), tr, c, el, textarea, sel, text, startPos, endPos;
</del><ins>+                var target = $(e.target), tr, c;
</ins><span class="cx">
</span><del>-                if ( target.hasClass('caption-insert-link') ) {
-                        el = target.siblings('div.caption-insert-link-wrap'), textarea = target.parent().siblings('textarea').get(0);
-
-                        if ( document.selection ) {
-                                textarea.focus();
-                                sel = document.selection.createRange();
-                                bookmark = sel.getBookmark();
-
-                                if ( sel.text )
-                                        el.find('.caption-insert-link-text').val(sel.text);
-
-                        } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
-                                text = textarea.value;
-                                startPos = textarea.selectionStart;
-                                endPos = textarea.selectionEnd;
-                                
-                                if ( startPos != endPos )
-                                        el.find('.caption-insert-link-text').val( text.substring(startPos, endPos) );
-                        }
-
-                        target.hide();
-                        el.show();
-                        el.find('.caption-insert-link-url').focus();
-                } else if ( target.hasClass('caption-cancel') || target.hasClass('caption-save') ) {
-                        el = target.closest('div.caption-insert-link-wrap');
-
-                        if ( target.hasClass('caption-save') )
-                                insert_link( el.closest('.edit-caption-controls').siblings('textarea'), el );
-                        
-                        el.hide();
-                        el.siblings('.caption-insert-link').show();
-                } else if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment
</del><ins>+                if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment
</ins><span class="cx">                         tr = target.closest('tr');
</span><span class="cx">
</span><del>-                        if ( $(tr).hasClass('align') )
</del><ins>+                        if ( tr.hasClass('align') )
</ins><span class="cx">                                 setUserSetting('align', target.val());
</span><del>-                        else if ( $(tr).hasClass('image-size') )
</del><ins>+                        else if ( tr.hasClass('image-size') )
</ins><span class="cx">                                 setUserSetting('imgsize', target.val());
</span><span class="cx">
</span><span class="cx">                 } else if ( target.is('button.button') ) { // remember the last used image link url
</span><span class="lines">@@ -427,46 +394,7 @@
</span><span class="cx">                         e.preventDefault();
</span><span class="cx">                 }
</span><span class="cx">         });
</span><del>-        
-        insert_link = function(textarea, parent) {
-                var sel, content, startPos, endPos, scrollTop, text,
-                        url = parent.find('.caption-insert-link-url'), link_text = parent.find('.caption-insert-link-text');
</del><span class="cx">
</span><del>-                if ( !url.length || !link_text.length )
-                        return;
-
-                textarea = textarea.get(0);
-                content = "<a href='"+url.val()+"'>"+link_text.val()+"</a>";
-
-                if ( document.selection ) {
-                        textarea.focus();
-                        sel = document.selection.createRange();
-
-                        if ( bookmark ) {
-                                sel.moveToBookmark( bookmark );
-                                bookmark = '';
-                        }
-
-                        sel.text = content;
-                        textarea.focus();
-                } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
-                        text = textarea.value;
-                        startPos = textarea.selectionStart;
-                        endPos = textarea.selectionEnd;
-                        scrollTop = textarea.scrollTop;
-
-                        textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
-
-                        textarea.focus();
-                        textarea.selectionStart = startPos + content.length;
-                        textarea.selectionEnd = startPos + content.length;
-                        textarea.scrollTop = scrollTop;
-                }
-
-                url.val('');
-                link_text.val('');
-        };
-
</del><span class="cx">         // init and set the uploader
</span><span class="cx">         uploader_init = function() {
</span><span class="cx">                 uploader = new plupload.Uploader(wpUploaderInit);
</span></span></pre></div>
<a id="trunkwpincludesjstinymcelangswplangsenjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/langs/wp-langs-en.js (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/langs/wp-langs-en.js        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-includes/js/tinymce/langs/wp-langs-en.js        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -499,7 +499,5 @@
</span><span class="cx"> s130:"130%",
</span><span class="cx"> img_title:"Title",
</span><span class="cx"> caption:"Caption",
</span><del>-insert_link:"Insert link",
-linked_text:"Linked text",
</del><span class="cx"> alt:"Alternate Text"
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkwpincludesjstinymcelangswplangsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/langs/wp-langs.php (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/langs/wp-langs.php        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-includes/js/tinymce/langs/wp-langs.php        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -542,8 +542,6 @@
</span><span class="cx">                 's130' => __('130%'),
</span><span class="cx">                 'img_title' => __('Title'),
</span><span class="cx">                 'caption' => __('Caption'),
</span><del>-                'insert_link' => __('Insert link'),
-                'linked_text' => __('Linked text'),
</del><span class="cx">                 'alt' => __('Alternate Text')
</span><span class="cx">         );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagecsseditimagecss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -357,38 +357,6 @@
</span><span class="cx">         color: #CFCFCF;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#img-edit .edit-caption-controls {
-        margin: 5px 0;
-}
-
-#img-edit .edit-caption-controls label {
-        margin: 5px 0;
-        display: block;
-}
-
-#img-edit .edit-caption-controls label span {
-        width: 100px;
-        float: left;
-        line-height: 22px;
-}
-
-#img-edit .edit-caption-controls input[type="text"] {
-        width: 335px;
-}
-
-#img-edit .caption-insert-link-buttons {
-        text-align: right;
-        margin: 5px 12px;
-}
-
-#img-edit .caption-insert-link-wrap {
-        padding: 5px 0 5px 12px;
-        background-color: #f8f8f8;
-        border: 1px solid #eee;
-        -webkit-border-radius: 3px;
-        border-radius: 3px;
-}
-
</del><span class="cx"> #img-edit #img_cap_text {
</span><span class="cx">         font: normal 12px/18px monospace;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimageeditimagehtml"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -102,22 +102,6 @@
</span><span class="cx">                         </th>
</span><span class="cx">                         <td class="field">
</span><span class="cx">                                 <textarea id="img_cap_text"></textarea>
</span><del>-
-                                <div class="edit-caption-controls">
-                                <input type="button" class="button caption-insert-link" value="{#wpeditimage.insert_link}" />
-
-                                <div class="caption-insert-link-wrap hidden">
-                                <label><span>{#advanced_dlg.link_url}</span>
-                                <input type="text" value="" class="caption-insert-link-url" /></label>
-
-                                <label><span>{#wpeditimage.linked_text}</span>
-                                <input type="text" value="" class="caption-insert-link-text" /></label>
-
-                                <div class="caption-insert-link-buttons">
-                                <input type="button" class="button caption-cancel" value="{#cancel}" />
-                                <input type="button" class="button-primary caption-save" value="{#insert}" />
-                                <br class="clear" />
-                                </div></div></div>
</del><span class="cx">                         </td>
</span><span class="cx">                 </tr>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimageeditor_plugin_srcjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">                                         cls = ( cls && cls[1] ) ? cls[1] : '';
</span><span class="cx">                                         cls = cls.match(/align[a-z]+/) || 'alignnone';
</span><span class="cx">
</span><del>-                                        cap = cap.replace(/<[a-z][^<>]+>/g, function(a){
</del><ins>+                                        cap = cap.replace(/<[a-zA-Z0-9]+ [^<>]+>/g, function(a){ // look only for html tags with attributes
</ins><span class="cx">                                                 a = a.replace(/="[^"]+"/, function(b){
</span><span class="cx">                                                         return b.replace(/'/g, '&#39;');
</span><span class="cx">                                                 });
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagejseditimagedevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -21,7 +21,6 @@
</span><span class="cx">                 tinyMCE = w.tinyMCE;
</span><span class="cx">                 t.editor = tinymce.EditorManager.activeEditor;
</span><span class="cx">                 t.params = t.editor.windowManager.params;
</span><del>-                t.events = new tinymce.dom.EventUtils();
</del><span class="cx">
</span><span class="cx">                 // Setup local DOM
</span><span class="cx">                 t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
</span><span class="lines">@@ -245,7 +244,7 @@
</span><span class="cx">
</span><span class="cx">         setup : function() {
</span><span class="cx">                 var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor,
</span><del>-                        d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa, bookmark, insert_link;
</del><ins>+                        d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa;
</ins><span class="cx">
</span><span class="cx">                 document.dir = tinyMCEPopup.editor.getParam('directionality','');
</span><span class="cx">
</span><span class="lines">@@ -330,79 +329,6 @@
</span><span class="cx">                         t.showSizeSet();
</span><span class="cx">                 
</span><span class="cx">                 document.body.style.display = '';
</span><del>-
-                tinyMCEPopup.events.add(document.body, 'click', function(e) {
-                        var target = e.target, parent = target.parentNode, tr, c, el, textarea, sel, text, startPos, endPos;
-
-                        if ( dom.hasClass(target, 'caption-insert-link') ) {
-                                el = dom.select('div.caption-insert-link-wrap', parent)[0], textarea = dom.select('#img_cap_text')[0];
-
-                                if ( document.selection ) {
-                                        textarea.focus();
-                                        sel = document.selection.createRange();
-                                        bookmark = sel.getBookmark();
-
-                                        if ( sel.text )
-                                                dom.select('.caption-insert-link-text', el)[0].value = sel.text;
-
-                                } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
-                                        text = textarea.value;
-                                        startPos = textarea.selectionStart;
-                                        endPos = textarea.selectionEnd;
-
-                                        if ( startPos != endPos )
-                                                dom.select('.caption-insert-link-text', el)[0].value = text.substring(startPos, endPos);
-                                }
-
-                                dom.hide(target);
-                                dom.show(el);
-                                dom.select('.caption-insert-link-url', el)[0].focus();
-                        } else if ( dom.hasClass(target, 'caption-cancel') || dom.hasClass(target, 'caption-save') ) {
-                                if ( dom.hasClass(target, 'caption-save') )
-                                        insert_link();
-
-                                dom.hide( dom.select('.caption-insert-link-wrap') );
-                                dom.show( dom.select('.caption-insert-link') );
-                        }
-                });
-
-                insert_link = function() {
-                        var sel, content, startPos, endPos, scrollTop, text, textarea = dom.select('#img_cap_text')[0],
-                                url = dom.select('.caption-insert-link-url')[0], link_text = dom.select('.caption-insert-link-text')[0];
-
-                        if ( !url || !link_text )
-                                return;
-
-                        content = "<a href='"+url.value+"'>"+link_text.value+"</a>";
-
-                        if ( document.selection ) {
-                                textarea.focus();
-                                sel = document.selection.createRange();
-
-                                if ( bookmark ) {
-                                        sel.moveToBookmark( bookmark );
-                                        bookmark = '';
-                                }
-
-                                sel.text = content;
-                                textarea.focus();
-                        } else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
-                                text = textarea.value;
-                                startPos = textarea.selectionStart;
-                                endPos = textarea.selectionEnd;
-                                scrollTop = textarea.scrollTop;
-
-                                textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
-
-                                textarea.focus();
-                                textarea.selectionStart = startPos + content.length;
-                                textarea.selectionEnd = startPos + content.length;
-                                textarea.scrollTop = scrollTop;
-                        }
-
-                        url.value = '';
-                        link_text.value = '';
-                };
</del><span class="cx">         },
</span><span class="cx">
</span><span class="cx">         remove : function() {
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagejseditimagejs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js (20113 => 20114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js        2012-03-04 13:03:48 UTC (rev 20113)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js        2012-03-05 07:31:31 UTC (rev 20114)
</span><span class="lines">@@ -1 +1 @@
</span><del>-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:"",se
tTabs: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.borderCo
lor="#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=docu
ment.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.restoreSelect
ion();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.valu
e=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.selec
tion.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.setAtt
rib(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){va
r 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.p
reloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit();
</del><span class="cx">\ No newline at end of file
</span><ins>+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(&quo
t;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&
quot;),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.nodeNam
e!="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&
quot;);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&
quot;>'+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.setSty
le(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.setS
tyle(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();
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>