first commit
This commit is contained in:
commit
eda9661806
3433 files changed
+595883
No files matched your search
@@ -0,0 +1,443 @@
|
||||
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
a.button {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
textarea,
|
||||
input,
|
||||
select {
|
||||
font: inherit;
|
||||
margin: 1px;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
p.help {
|
||||
margin: 4px 0;
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
abbr.required {
|
||||
color: #FF0000;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
img.alignright,
|
||||
.alignright {
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
img.alignleft,
|
||||
.alignleft {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
img.aligncenter {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
th.label {
|
||||
width: 107px;
|
||||
}
|
||||
|
||||
#media-upload #basic th.label {
|
||||
padding: 5px 5px 5px 0;
|
||||
}
|
||||
|
||||
.show-align {
|
||||
height: 200px;
|
||||
width: 480px;
|
||||
float: right;
|
||||
background-color: #f1f1f1;
|
||||
cursor: default;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#img-edit {
|
||||
border: 1px solid #dfdfdf;
|
||||
width: 623px;
|
||||
margin: 15px auto;
|
||||
}
|
||||
|
||||
#media-upload .media-upload-form table.describe {
|
||||
border-top-style: none;
|
||||
border-top-width: 0;
|
||||
}
|
||||
|
||||
#img_demo_txt {
|
||||
font-size: 9px;
|
||||
line-height: 13px;
|
||||
font-family: Monaco,"Courier New",Courier,monospace;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#img_demo {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#saveeditimg {
|
||||
padding: 10px 0 0 5px;
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
#sidemenu,
|
||||
#sidemenu li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#sidemenu li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#sidemenu a {
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
margin: 0;
|
||||
padding: 0pt 7px;
|
||||
background-color: #f9f9f9;
|
||||
border-color: #f9f9f9;
|
||||
border-bottom-color: #dfdfdf;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #21759B;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:active,
|
||||
a:focus {
|
||||
color: #D54E21;
|
||||
}
|
||||
|
||||
#sidemenu a.current {
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
font-weight: normal;
|
||||
background-color: #fff;
|
||||
border-color: #dfdfdf #dfdfdf #fff;
|
||||
color: #D54E21;
|
||||
}
|
||||
|
||||
#adv_settings .field label {
|
||||
padding: 0 5px 5px;
|
||||
}
|
||||
|
||||
#media-upload h3 {
|
||||
clear: both;
|
||||
padding: 0pt 0pt 3px;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
font-family: Georgia,"Times New Roman",Times,serif;
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
line-height: normal;
|
||||
margin: 0 0 10px -4px;
|
||||
padding: 15px 0 3px;
|
||||
border-bottom-color: #DADADA;
|
||||
color: #5A5A5A;
|
||||
}
|
||||
|
||||
#img_dim #width,
|
||||
#img_dim #height,
|
||||
#img_prop #border,
|
||||
#img_prop #vspace,
|
||||
#img_prop #hspace {
|
||||
width: 36px;
|
||||
}
|
||||
|
||||
#img_dim abbr {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#show_align_sp {
|
||||
width: 115px;
|
||||
}
|
||||
|
||||
#img_dim input,
|
||||
#img_prop input {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#basic .align .field label {
|
||||
padding: 0 0 0 24px;
|
||||
}
|
||||
|
||||
#basic {
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
#img_size {
|
||||
float: right;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background-color: #f1f1f1;
|
||||
padding: 5px 0;
|
||||
width: 45px;
|
||||
}
|
||||
|
||||
#img_size div {
|
||||
font-size: 10px;
|
||||
padding: 2px;
|
||||
border: 1px solid #f1f1f1;
|
||||
line-height: 15px;
|
||||
height: 15px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
color: #07273E;
|
||||
}
|
||||
|
||||
#img_size div#s100 {
|
||||
border-color: #A3A3A3;
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
|
||||
#img_size_div {
|
||||
width: 100px;
|
||||
float: left;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#img_size_title {
|
||||
margin: 0 7px 5px;
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#img_align_td {
|
||||
padding: 2px 0 8px;
|
||||
}
|
||||
|
||||
#media-upload tr.align td.field {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.describe td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#media-upload .describe th.label {
|
||||
padding-top: .5em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#media-upload .describe {
|
||||
border-top-width: 1px;
|
||||
border-top-style: solid;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
clear: both;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
.describe input[type="text"],
|
||||
.describe textarea {
|
||||
width: 460px;
|
||||
border: 1px solid #dfdfdf;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.media-upload-form label,
|
||||
.media-upload-form legend {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
color: #464646;
|
||||
}
|
||||
|
||||
.align .field label {
|
||||
display: inline;
|
||||
padding: 0 0 0 28px;
|
||||
margin: 0 1em 0 0;
|
||||
}
|
||||
|
||||
.image-align-none-label {
|
||||
background: url(../../../../../../wp-admin/images/align-none.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-left-label {
|
||||
background: url(../../../../../../wp-admin/images/align-left.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-center-label {
|
||||
background: url(../../../../../../wp-admin/images/align-center.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-right-label {
|
||||
background: url(../../../../../../wp-admin/images/align-right.png) no-repeat center left;
|
||||
}
|
||||
|
||||
div#media-upload-header {
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
height: 33px;
|
||||
background-color: #f9f9f9;
|
||||
border-bottom-color: #dfdfdf;
|
||||
}
|
||||
|
||||
body#media-upload ul#sidemenu {
|
||||
font-weight: normal;
|
||||
margin: 0 5px;
|
||||
position: relative;
|
||||
left: 0px;
|
||||
bottom: -4px;
|
||||
}
|
||||
|
||||
div#media-upload-error {
|
||||
margin: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#TB_window #TB_title {
|
||||
background-color: #222222;
|
||||
color: #CFCFCF;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* RTL */
|
||||
body#media-upload.rtl ul#sidemenu {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.rtl #basic .align .field label {
|
||||
display: block;
|
||||
float: right;
|
||||
padding: 0 24px 0 0;
|
||||
margin: 5px 3px 5px 5px;
|
||||
}
|
||||
|
||||
.rtl .align .field input {
|
||||
display: block;
|
||||
float: right;
|
||||
margin: 5px 15px 5px 0;
|
||||
}
|
||||
|
||||
.rtl tr.image-size label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rtl tr.image-size input {
|
||||
margin: 3px 15px 0 5px;
|
||||
}
|
||||
|
||||
.rtl .image-align-none-label,
|
||||
.rtl .image-align-left-label,
|
||||
.rtl .image-align-center-label,
|
||||
.rtl .image-align-right-label {
|
||||
background-position: center right;
|
||||
}
|
||||
|
||||
#media-upload.rtl .describe th.label {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.rtl .show-align,
|
||||
.rtl #img_size,
|
||||
.rtl .alignright,
|
||||
.rtl #img_demo.alignleft {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.rtl tr.image-size label,
|
||||
.rtl tr.image-size input,
|
||||
.rtl #img_dim label,
|
||||
.rtl #img_dim input,
|
||||
.rtl #img_prop label,
|
||||
.rtl #img_prop input,
|
||||
.rtl #img_size_div,
|
||||
.rtl .alignleft,
|
||||
.rtl #img_demo.alignright {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.rtl #img_dim label,
|
||||
.rtl #img_prop label {
|
||||
margin: 5px 0pt;
|
||||
}
|
||||
|
||||
.rtl #img_dim input,
|
||||
.rtl #img_prop input {
|
||||
margin: 0 5px 0 10px;
|
||||
}
|
||||
|
||||
.rtl #img_size_title {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retina display 2x icons
|
||||
*/
|
||||
@media print,
|
||||
(-o-min-device-pixel-ratio: 5/4),
|
||||
(-webkit-min-device-pixel-ratio: 1.25),
|
||||
(min-resolution: 120dpi) {
|
||||
.image-align-none-label {
|
||||
background: url(../../../../../../wp-admin/images/align-none-2x.png) no-repeat center left;
|
||||
background-size: auto 15px;
|
||||
}
|
||||
|
||||
.image-align-left-label {
|
||||
background: url(../../../../../../wp-admin/images/align-left-2x.png) no-repeat center left;
|
||||
background-size: auto 15px;
|
||||
}
|
||||
|
||||
.image-align-center-label {
|
||||
background: url(../../../../../../wp-admin/images/align-center-2x.png) no-repeat center left;
|
||||
background-size: auto 15px;
|
||||
}
|
||||
|
||||
.image-align-right-label {
|
||||
background: url(../../../../../../wp-admin/images/align-right-2x.png) no-repeat center left;
|
||||
background-size: auto 15px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title></title>
|
||||
|
||||
<link rel="stylesheet" href="css/editimage.css?ver=358-20121205" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="../../../../css/buttons.css?ver=358-20121205" type="text/css" media="all" />
|
||||
<script type="text/javascript" src="js/editimage.min.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js?ver=358-20121205"></script>
|
||||
<base target="_self" />
|
||||
</head>
|
||||
|
||||
<body id="media-upload" class="wp-core-ui" style="display:none;">
|
||||
<script type="text/javascript">
|
||||
if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
|
||||
document.body.className += ' rtl';
|
||||
</script>
|
||||
<div id="media-upload-header">
|
||||
<ul id="sidemenu">
|
||||
<li><a href="javascript:;" id="tab_basic" class="current" onclick="wpImage.setTabs(this);">{#wpeditimage.edit_img}</a></li>
|
||||
<li><a href="javascript:;" id="tab_advanced" onclick="wpImage.setTabs(this);">{#wpeditimage.adv_settings}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="img-edit">
|
||||
<form class="media-upload-form" action="" onsubmit="wpImage.update();">
|
||||
<div id="img_size_div">
|
||||
<div id="img_size_title">{#wpeditimage.size}</div>
|
||||
<div id="img_size" onmouseout="wpImage.showSizeRem()">
|
||||
<div id="s130" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s130}</div>
|
||||
<div id="s120" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s120}</div>
|
||||
<div id="s110" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s110}</div>
|
||||
<div id="s100" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s100}</div>
|
||||
<div id="s90" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s90}</div>
|
||||
<div id="s80" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s80}</div>
|
||||
<div id="s70" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s70}</div>
|
||||
<div id="s60" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s60}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="show-align" id="show_align">
|
||||
<img id="img_demo" src="img/image.png" alt="" />
|
||||
<span id="img_demo_txt">
|
||||
Lorem ipsum dolor sit amet consectetuer velit pretium euismod ipsum enim. Mi cursus at a mollis senectus id arcu gravida quis urna. Sed et felis id tempus Morbi mauris tincidunt enim In mauris. Pede eu risus velit libero natoque enim lorem adipiscing ipsum consequat. In malesuada et sociis tincidunt tempus pellentesque cursus convallis ipsum Suspendisse. Risus In ac quis ut Nunc convallis laoreet ante Suspendisse Nam. Amet amet urna condimentum Vestibulum sem at Curabitur lorem et cursus. Sodales tortor fermentum leo dui habitant Nunc Sed Vestibulum.
|
||||
Ut lorem In penatibus libero id ipsum sagittis nec elit Sed. Condimentum eget Vivamus vel consectetuer lorem molestie turpis amet tellus id. Condimentum vel ridiculus Fusce sed pede Nam nunc sodales eros tempor. Sit lacus magna dictumst Curabitur fringilla auctor id vitae wisi facilisi. Fermentum eget turpis felis velit leo Nunc Proin orci molestie Praesent. Curabitur tellus scelerisque suscipit ut sem amet cursus mi Morbi eu. Donec libero Vestibulum augue et mollis accumsan ornare condimentum In enim. Leo eget ac consectetuer quis condimentum malesuada.
|
||||
Condimentum commodo et Lorem fringilla malesuada libero volutpat sem tellus enim. Tincidunt sed at Aenean nec nonummy porttitor Nam Sed Nulla ut. Auctor leo In aliquet Curabitur eros et velit Quisque justo morbi. Et vel mauris sit nulla semper vitae et quis at dui. Id at elit laoreet justo eu mauris Quisque et interdum pharetra. Nullam accumsan interdum Maecenas condimentum quis quis Fusce a sollicitudin Sed. Non Quisque Vivamus congue porttitor non semper ipsum porttitor quis vel. Donec eros lacus volutpat et tincidunt sem convallis id venenatis sit. Consectetuer odio.
|
||||
Semper faucibus Morbi nulla convallis orci Aliquam Sed porttitor et Pellentesque. Venenatis laoreet lorem id a a Morbi augue turpis id semper. Arcu volutpat ac mauris Vestibulum fringilla Aenean condimentum nibh sed id. Sagittis eu lacus orci urna tellus tellus pretium Curabitur dui nunc. Et nibh eu eu nibh adipiscing at lorem Vestibulum adipiscing augue. Magna convallis Phasellus dolor malesuada Curabitur ornare adipiscing tellus Aliquam tempus. Id Aliquam Integer augue Nulla consectetuer ac Donec Curabitur tincidunt et. Id vel Nunc amet lacus dui magna ridiculus penatibus laoreet Duis. Enim sagittis nibh quis Nulla nec laoreet vel Maecenas mattis vel.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="div_basic">
|
||||
<table id="basic" class="describe">
|
||||
<tbody>
|
||||
|
||||
<tr class="align">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_align_td">
|
||||
<span class="alignleft">{#contextmenu.align}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field" id="img_align_td">
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignnone')" name="img_align" id="alignnone" value="alignnone" />
|
||||
<label for="alignnone" class="align image-align-none-label">{#wpeditimage.none}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignleft')" name="img_align" id="alignleft" value="alignleft" />
|
||||
<label for="alignleft" class="align image-align-left-label">{#contextmenu.left}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('aligncenter')" name="img_align" id="aligncenter" value="aligncenter" />
|
||||
<label for="aligncenter" class="align image-align-center-label">{#contextmenu.center}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignright')" name="img_align" id="alignright" value="alignright" />
|
||||
<label for="alignright" class="align image-align-right-label">{#contextmenu.right}</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_title">
|
||||
<span class="alignleft">{#wpeditimage.img_title}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_title" name="img_title" value="" aria-required="true" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_alt">
|
||||
<span class="alignleft">{#wpeditimage.alt}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_alt" name="img_alt" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="cap_field">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_cap">
|
||||
<span class="alignleft">{#wpeditimage.caption}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<textarea id="img_cap_text"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_href">
|
||||
<span class="alignleft" id="lb_link_href">{#advanced_dlg.link_url}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_href" name="link_href" value="" size="60" /><br />
|
||||
<input type="button" class="button" onclick="wpImage.I('link_href').value='';" value="{#wpeditimage.none}" />
|
||||
<input type="button" class="button" id="img_url_current" onclick="wpImage.img_seturl('current')" value="{#wpeditimage.current_link}" />
|
||||
<input type="button" class="button" id="img_url_img" onclick="wpImage.img_seturl('link')" value="{#wpeditimage.link_to_img}" />
|
||||
<p class="help">{#wpeditimage.link_help}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
<div id="div_advanced" style="display:none;">
|
||||
<h3>{#wpeditimage.adv_img_settings}</h3>
|
||||
<table id="adv_settings_img" class="describe">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_src">
|
||||
<span class="alignleft">{#wpeditimage.source}</span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_src" name="img_src" value="" onblur="wpImage.checkVal(this)" aria-required="true" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="img_dim">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label>
|
||||
<span class="alignleft">{#wpeditimage.size}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="width">{#wpeditimage.width}</label>
|
||||
<input type="text" maxlength="5" id="width" name="width" value="" />
|
||||
|
||||
<label for="height">{#wpeditimage.height}</label>
|
||||
<input type="text" maxlength="5" id="height" name="height" value="" />
|
||||
|
||||
<input type="button" class="button" id="orig_size" name="orig_size" value="{#wpeditimage.orig_size}" onclick="wpImage.origSize();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_classes">
|
||||
<span class="alignleft">{#wpeditimage.css}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_classes" name="img_classes" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_style">
|
||||
<span class="alignleft">{#advanced.style_select}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_style" name="img_style" value="" size="60" onblur="wpImage.demoSetStyle();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="img_prop">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_prop">
|
||||
<span class="alignleft">{#advanced.image_props_desc}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="border">{#advanced_dlg.image_border}</label>
|
||||
<input type="text" maxlength="5" id="border" name="border" value="" onblur="wpImage.updateStyle('border')" />
|
||||
|
||||
<label for="vspace">{#advanced_dlg.image_vspace}</label>
|
||||
<input type="text" maxlength="5" id="vspace" name="vspace" value="" onblur="wpImage.updateStyle('vspace')" />
|
||||
|
||||
<label for="hspace">{#advanced_dlg.image_hspace}</label>
|
||||
<input type="text" maxlength="5" id="hspace" name="hspace" value="" onblur="wpImage.updateStyle('hspace')" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>{#wpeditimage.adv_link_settings}</h3>
|
||||
<table id="adv_settings_link" class="describe">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_title">
|
||||
<span class="alignleft">{#advanced_dlg.link_titlefield}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_title" name="link_title" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_rel">
|
||||
<span class="alignleft">{#wpeditimage.link_rel}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_rel" name="link_rel" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_classes">
|
||||
<span class="alignleft">{#wpeditimage.css}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_classes" name="link_classes" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_style">
|
||||
<span class="alignleft">{#advanced.style_select}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_style" name="link_style" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label>
|
||||
<span class="alignleft">{#advanced_dlg.link_target}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="link_target">
|
||||
{#advanced_dlg.link_target_blank}
|
||||
</label>
|
||||
<input type="checkbox" id="link_target" name="link_target" value="_blank" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
<div id="saveeditimg">
|
||||
<input type="hidden" id="align" name="align" value="" />
|
||||
|
||||
<input type="submit" id="saveimg" class="button" value="{#update}" />
|
||||
<input type="button" class="button" id="cancelimg" name="cancelimg" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.wpEditImage",{url:"",editor:{},init:function(a,c){var d=this,b={};d.url=c;d.editor=a;d._createButtons();a.addCommand("WP_EditImage",d._editImage);a.onInit.add(function(e){e.dom.events.add(e.getBody(),"mousedown",function(g){var f;if(g.target.nodeName=="IMG"&&(f=e.dom.getParent(g.target,"div.mceTemp"))){if(tinymce.isGecko){e.selection.select(f)}else{if(tinymce.isWebKit){e.dom.events.prevent(g)}}}});e.dom.events.add(e.getBody(),"keydown",function(j){var k,f,i,h,g;if(j.keyCode==13){k=e.selection.getNode();f=e.dom.getParent(k,"dl.wp-caption");if(f){i=e.dom.getParent(f,"div.mceTemp")}if(i){e.dom.events.cancel(j);h=e.dom.create("p",{},"\uFEFF");e.dom.insertAfter(h,i);e.selection.setCursorLocation(h,0);return false}}});if("ontouchstart" in window){e.dom.events.add(e.getBody(),"touchstart",function(f){d._showButtons(f)})}});a.onMouseUp.add(function(f,g){if(tinymce.isWebKit||tinymce.isOpera){return}if(b.x&&(g.clientX!=b.x||g.clientY!=b.y)){var h=f.selection.getNode();if("IMG"==h.nodeName){window.setTimeout(function(){var e=f.dom.getParent(h,"dl.wp-caption"),i;if(h.width!=b.img_w||h.height!=b.img_h){h.className=h.className.replace(/size-[^ "']+/,"")}if(e){i=f.dom.getAttrib(h,"width")||h.width;i=parseInt(i,10);f.dom.setStyle(e,"width",10+i);f.execCommand("mceRepaint")}},100)}}b={}});a.onMouseDown.add(function(f,g){d._showButtons(g)});a.onBeforeSetContent.add(function(e,f){f.content=e.wpSetImgCaption(f.content)});a.onPostProcess.add(function(e,f){if(f.get){f.content=e.wpGetImgCaption(f.content)}});a.wpSetImgCaption=function(e){return d._do_shcode(e)};a.wpGetImgCaption=function(e){return d._get_shcode(e)};a.onBeforeExecCommand.add(function(e,h,g,j){var f,i;if(h=="mceInsertContent"){f=e.dom.getParent(e.selection.getNode(),"div.mceTemp");if(!f){return}i=e.dom.create("p");e.dom.insertAfter(i,f);e.selection.setCursorLocation(i,0)}})},_do_shcode:function(a){return a.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g,function(j,i,h){var d,m,k,l,f,g,e=tinymce.trim;d=i.match(/id=['"]([^'"]*)['"] ?/);if(d){i=i.replace(d[0],"")}m=i.match(/align=['"]([^'"]*)['"] ?/);if(m){i=i.replace(m[0],"")}k=i.match(/width=['"]([0-9]*)['"] ?/);if(k){i=i.replace(k[0],"")}h=e(h);g=h.match(/((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)([\s\S]*)/i);if(g&&g[2]){l=e(g[2]);g=e(g[1])}else{l=e(i).replace(/caption=['"]/,"").replace(/['"]$/,"");g=h}d=(d&&d[1])?d[1]:"";m=(m&&m[1])?m[1]:"alignnone";k=(k&&k[1])?k[1]:"";if(!k||!l){return h}f="mceTemp";if(m=="aligncenter"){f+=" mceIEcenter"}return'<div class="'+f+'"><dl id="'+d+'" class="wp-caption '+m+'" style="width: '+(10+parseInt(k))+'px"><dt class="wp-caption-dt">'+g+'</dt><dd class="wp-caption-dd">'+l+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div (?:id="attachment_|class="mceTemp)[^>]*>([\s\S]+?)<\/div>/g,function(d,c){var e=c.replace(/<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>/gi,function(i,f,l,j){var k,h,g;g=l.match(/width="([0-9]*)"/);g=(g&&g[1])?g[1]:"";if(!g||!j){return l}k=f.match(/id="([^"]*)"/);k=(k&&k[1])?k[1]:"";h=f.match(/class="([^"]*)"/);h=(h&&h[1])?h[1]:"";h=h.match(/align[a-z]+/)||"alignnone";j=j.replace(/\r\n|\r/g,"\n").replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g,function(b){return b.replace(/[\r\n\t]+/," ")});j=j.replace(/\s*\n\s*/g,"<br />");return'[caption id="'+k+'" align="'+h+'" width="'+g+'"]'+l+" "+j+"[/caption]"});if(e.indexOf("[caption")!==0){e=c.replace(/[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi,"<p>$1</p>$2")}return e})},_createButtons:function(){var b=this,a=tinymce.activeEditor,d=tinymce.DOM,e,c,f;if(d.get("wp_editbtns")){return}f=(window.devicePixelRatio&&window.devicePixelRatio>1)||(window.matchMedia&&window.matchMedia("(min-resolution:130dpi)").matches);d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:f?b.url+"/img/image-2x.png":b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){b._editImage();a.plugins.wordpress._hideButtons()});c=d.add("wp_editbtns","img",{src:f?b.url+"/img/delete-2x.png":b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(j){var g=tinymce.activeEditor,i=g.selection.getNode(),h;if(i.nodeName=="IMG"&&g.dom.getAttrib(i,"class").indexOf("mceItem")==-1){if((h=g.dom.getParent(i,"div"))&&g.dom.hasClass(h,"mceTemp")){g.dom.remove(h)}else{if(i.parentNode.nodeName=="A"&&i.parentNode.childNodes.length==1){i=i.parentNode}if(i.parentNode.nodeName=="P"&&i.parentNode.childNodes.length==1){i=i.parentNode}g.dom.remove(i)}g.execCommand("mceRepaint");return false}g.plugins.wordpress._hideButtons()})},_editImage:function(){var d=tinymce.activeEditor,e=this.url,g=d.selection.getNode(),c,f,a,b=g.className;if(b.indexOf("mceItem")!=-1||b.indexOf("wpGallery")!=-1||g.nodeNaLine truncated
|
||||
@@ -0,0 +1,325 @@
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpEditImage', {
|
||||
url: '',
|
||||
editor: {},
|
||||
|
||||
init: function(ed, url) {
|
||||
var t = this, mouse = {};
|
||||
|
||||
t.url = url;
|
||||
t.editor = ed;
|
||||
t._createButtons();
|
||||
|
||||
ed.addCommand('WP_EditImage', t._editImage);
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
ed.dom.events.add(ed.getBody(), 'mousedown', function(e) {
|
||||
var parent;
|
||||
|
||||
if ( e.target.nodeName == 'IMG' && ( parent = ed.dom.getParent(e.target, 'div.mceTemp') ) ) {
|
||||
if ( tinymce.isGecko )
|
||||
ed.selection.select(parent);
|
||||
else if ( tinymce.isWebKit )
|
||||
ed.dom.events.prevent(e);
|
||||
}
|
||||
});
|
||||
|
||||
// when pressing Return inside a caption move the caret to a new parapraph under it
|
||||
ed.dom.events.add(ed.getBody(), 'keydown', function(e) {
|
||||
var n, DL, DIV, P, content;
|
||||
|
||||
if ( e.keyCode == 13 ) {
|
||||
n = ed.selection.getNode();
|
||||
DL = ed.dom.getParent(n, 'dl.wp-caption');
|
||||
|
||||
if ( DL )
|
||||
DIV = ed.dom.getParent(DL, 'div.mceTemp');
|
||||
|
||||
if ( DIV ) {
|
||||
ed.dom.events.cancel(e);
|
||||
P = ed.dom.create('p', {}, '\uFEFF');
|
||||
ed.dom.insertAfter( P, DIV );
|
||||
ed.selection.setCursorLocation(P, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// iOS6 doesn't show the buttons properly on click, show them on 'touchstart'
|
||||
if ( 'ontouchstart' in window ) {
|
||||
ed.dom.events.add(ed.getBody(), 'touchstart', function(e){
|
||||
t._showButtons(e);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// resize the caption <dl> when the image is soft-resized by the user
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
if ( tinymce.isWebKit || tinymce.isOpera )
|
||||
return;
|
||||
|
||||
if ( mouse.x && (e.clientX != mouse.x || e.clientY != mouse.y) ) {
|
||||
var n = ed.selection.getNode();
|
||||
|
||||
if ( 'IMG' == n.nodeName ) {
|
||||
window.setTimeout(function(){
|
||||
var DL = ed.dom.getParent(n, 'dl.wp-caption'), width;
|
||||
|
||||
if ( n.width != mouse.img_w || n.height != mouse.img_h )
|
||||
n.className = n.className.replace(/size-[^ "']+/, '');
|
||||
|
||||
if ( DL ) {
|
||||
width = ed.dom.getAttrib(n, 'width') || n.width;
|
||||
width = parseInt(width, 10);
|
||||
ed.dom.setStyle(DL, 'width', 10 + width);
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
mouse = {};
|
||||
});
|
||||
|
||||
// show editimage buttons
|
||||
ed.onMouseDown.add(function(ed, e){
|
||||
t._showButtons(e);
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = ed.wpSetImgCaption(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = ed.wpGetImgCaption(o.content);
|
||||
});
|
||||
|
||||
ed.wpSetImgCaption = function(content) {
|
||||
return t._do_shcode(content);
|
||||
};
|
||||
|
||||
ed.wpGetImgCaption = function(content) {
|
||||
return t._get_shcode(content);
|
||||
};
|
||||
|
||||
// When inserting content, if the caret is inside a caption create new paragraph under
|
||||
// and move the caret there
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
var node, p;
|
||||
|
||||
if ( cmd == 'mceInsertContent' ) {
|
||||
node = ed.dom.getParent(ed.selection.getNode(), 'div.mceTemp');
|
||||
|
||||
if ( !node )
|
||||
return;
|
||||
|
||||
p = ed.dom.create('p');
|
||||
ed.dom.insertAfter( p, node );
|
||||
ed.selection.setCursorLocation(p, 0);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_do_shcode : function(content) {
|
||||
return content.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g, function(a,b,c){
|
||||
var id, cls, w, cap, div_cls, img, trim = tinymce.trim;
|
||||
|
||||
id = b.match(/id=['"]([^'"]*)['"] ?/);
|
||||
if ( id )
|
||||
b = b.replace(id[0], '');
|
||||
|
||||
cls = b.match(/align=['"]([^'"]*)['"] ?/);
|
||||
if ( cls )
|
||||
b = b.replace(cls[0], '');
|
||||
|
||||
w = b.match(/width=['"]([0-9]*)['"] ?/);
|
||||
if ( w )
|
||||
b = b.replace(w[0], '');
|
||||
|
||||
c = trim(c);
|
||||
img = c.match(/((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)([\s\S]*)/i);
|
||||
|
||||
if ( img && img[2] ) {
|
||||
cap = trim( img[2] );
|
||||
img = trim( img[1] );
|
||||
} else {
|
||||
// old captions shortcode style
|
||||
cap = trim(b).replace(/caption=['"]/, '').replace(/['"]$/, '');
|
||||
img = c;
|
||||
}
|
||||
|
||||
id = ( id && id[1] ) ? id[1] : '';
|
||||
cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
|
||||
w = ( w && w[1] ) ? w[1] : '';
|
||||
|
||||
if ( !w || !cap )
|
||||
return c;
|
||||
|
||||
div_cls = 'mceTemp';
|
||||
if ( cls == 'aligncenter' )
|
||||
div_cls += ' mceIEcenter';
|
||||
|
||||
return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+( 10 + parseInt(w) )+
|
||||
'px"><dt class="wp-caption-dt">'+img+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
|
||||
});
|
||||
},
|
||||
|
||||
_get_shcode : function(content) {
|
||||
return content.replace(/<div (?:id="attachment_|class="mceTemp)[^>]*>([\s\S]+?)<\/div>/g, function(a, b){
|
||||
var ret = b.replace(/<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>/gi, function(a,b,c,cap){
|
||||
var id, cls, w;
|
||||
|
||||
w = c.match(/width="([0-9]*)"/);
|
||||
w = ( w && w[1] ) ? w[1] : '';
|
||||
|
||||
if ( !w || !cap )
|
||||
return c;
|
||||
|
||||
id = b.match(/id="([^"]*)"/);
|
||||
id = ( id && id[1] ) ? id[1] : '';
|
||||
|
||||
cls = b.match(/class="([^"]*)"/);
|
||||
cls = ( cls && cls[1] ) ? cls[1] : '';
|
||||
cls = cls.match(/align[a-z]+/) || 'alignnone';
|
||||
|
||||
cap = cap.replace(/\r\n|\r/g, '\n').replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
|
||||
// no line breaks inside HTML tags
|
||||
return a.replace(/[\r\n\t]+/, ' ');
|
||||
});
|
||||
|
||||
// convert remaining line breaks to <br>
|
||||
cap = cap.replace(/\s*\n\s*/g, '<br />');
|
||||
|
||||
return '[caption id="'+id+'" align="'+cls+'" width="'+w+'"]'+c+' '+cap+'[/caption]';
|
||||
});
|
||||
|
||||
if ( ret.indexOf('[caption') !== 0 ) {
|
||||
// the caption html seems brocken, try to find the image that may be wrapped in a link
|
||||
// and may be followed by <p> with the caption text.
|
||||
ret = b.replace(/[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi, '<p>$1</p>$2');
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
},
|
||||
|
||||
_createButtons : function() {
|
||||
var t = this, ed = tinymce.activeEditor, DOM = tinymce.DOM, editButton, dellButton, isRetina;
|
||||
|
||||
if ( DOM.get('wp_editbtns') )
|
||||
return;
|
||||
|
||||
isRetina = ( window.devicePixelRatio && window.devicePixelRatio > 1 ) || // WebKit, Opera
|
||||
( window.matchMedia && window.matchMedia('(min-resolution:130dpi)').matches ); // Firefox, IE10, Opera
|
||||
|
||||
DOM.add(document.body, 'div', {
|
||||
id : 'wp_editbtns',
|
||||
style : 'display:none;'
|
||||
});
|
||||
|
||||
editButton = DOM.add('wp_editbtns', 'img', {
|
||||
src : isRetina ? t.url+'/img/image-2x.png' : t.url+'/img/image.png',
|
||||
id : 'wp_editimgbtn',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wpeditimage.edit_img')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(editButton, 'mousedown', function(e) {
|
||||
t._editImage();
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
dellButton = DOM.add('wp_editbtns', 'img', {
|
||||
src : isRetina ? t.url+'/img/delete-2x.png' : t.url+'/img/delete.png',
|
||||
id : 'wp_delimgbtn',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wpeditimage.del_img')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
|
||||
var ed = tinymce.activeEditor, el = ed.selection.getNode(), parent;
|
||||
|
||||
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {
|
||||
if ( (parent = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(parent, 'mceTemp') ) {
|
||||
ed.dom.remove(parent);
|
||||
} else {
|
||||
if ( el.parentNode.nodeName == 'A' && el.parentNode.childNodes.length == 1 )
|
||||
el = el.parentNode;
|
||||
|
||||
if ( el.parentNode.nodeName == 'P' && el.parentNode.childNodes.length == 1 )
|
||||
el = el.parentNode;
|
||||
|
||||
ed.dom.remove(el);
|
||||
}
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
return false;
|
||||
}
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
},
|
||||
|
||||
_editImage : function() {
|
||||
var ed = tinymce.activeEditor, url = this.url, el = ed.selection.getNode(), vp, H, W, cls = el.className;
|
||||
|
||||
if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' )
|
||||
return;
|
||||
|
||||
vp = tinymce.DOM.getViewPort();
|
||||
H = 680 < (vp.h - 70) ? 680 : vp.h - 70;
|
||||
W = 650 < vp.w ? 650 : vp.w;
|
||||
|
||||
ed.windowManager.open({
|
||||
file: url + '/editimage.html',
|
||||
width: W+'px',
|
||||
height: H+'px',
|
||||
inline: true
|
||||
});
|
||||
},
|
||||
|
||||
_showButtons : function(e) {
|
||||
var ed = this.editor, target = e.target;
|
||||
|
||||
if ( target.nodeName != 'IMG' ) {
|
||||
if ( target.firstChild && target.firstChild.nodeName == 'IMG' && target.childNodes.length == 1 ) {
|
||||
target = target.firstChild;
|
||||
} else {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ed.dom.getAttrib(target, 'class').indexOf('mceItem') == -1 ) {
|
||||
mouse = {
|
||||
x: e.clientX,
|
||||
y: e.clientY,
|
||||
img_w: target.clientWidth,
|
||||
img_h: target.clientHeight
|
||||
};
|
||||
|
||||
if ( e.type == 'touchstart' ) {
|
||||
ed.selection.select(target);
|
||||
ed.dom.events.cancel(e);
|
||||
}
|
||||
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
ed.plugins.wordpress._showButtons(target, 'wp_editbtns');
|
||||
}
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Edit Image',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage);
|
||||
})();
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 946 B |
@@ -0,0 +1,613 @@
|
||||
|
||||
var tinymce = null, tinyMCEPopup, tinyMCE, wpImage;
|
||||
|
||||
tinyMCEPopup = {
|
||||
init: function() {
|
||||
var t = this, w, ti;
|
||||
|
||||
// Find window & API
|
||||
w = t.getWin();
|
||||
tinymce = w.tinymce;
|
||||
tinyMCE = w.tinyMCE;
|
||||
t.editor = tinymce.EditorManager.activeEditor;
|
||||
t.params = t.editor.windowManager.params;
|
||||
t.features = t.editor.windowManager.features;
|
||||
|
||||
// Setup local DOM
|
||||
t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
|
||||
t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
|
||||
},
|
||||
|
||||
getWin : function() {
|
||||
return (!window.frameElement && window.dialogArguments) || opener || parent || top;
|
||||
},
|
||||
|
||||
getParam : function(n, dv) {
|
||||
return this.editor.getParam(n, dv);
|
||||
},
|
||||
|
||||
close : function() {
|
||||
var t = this;
|
||||
|
||||
// To avoid domain relaxing issue in Opera
|
||||
function close() {
|
||||
t.editor.windowManager.close(window);
|
||||
tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
|
||||
};
|
||||
|
||||
if (tinymce.isOpera)
|
||||
t.getWin().setTimeout(close, 0);
|
||||
else
|
||||
close();
|
||||
},
|
||||
|
||||
execCommand : function(cmd, ui, val, a) {
|
||||
a = a || {};
|
||||
a.skip_focus = 1;
|
||||
|
||||
this.restoreSelection();
|
||||
return this.editor.execCommand(cmd, ui, val, a);
|
||||
},
|
||||
|
||||
storeSelection : function() {
|
||||
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
|
||||
},
|
||||
|
||||
restoreSelection : function() {
|
||||
var t = tinyMCEPopup;
|
||||
|
||||
if ( tinymce.isIE )
|
||||
t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
|
||||
}
|
||||
}
|
||||
tinyMCEPopup.init();
|
||||
|
||||
wpImage = {
|
||||
preInit : function() {
|
||||
// import colors stylesheet from parent
|
||||
var ed = tinyMCEPopup.editor, win = tinyMCEPopup.getWin(), styles = win.document.styleSheets, url, i;
|
||||
|
||||
for ( i = 0; i < styles.length; i++ ) {
|
||||
url = styles.item(i).href;
|
||||
if ( url && url.indexOf('colors') != -1 ) {
|
||||
document.getElementsByTagName('head')[0].appendChild( ed.dom.create('link', {rel:'stylesheet', href: url}) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
I : function(e) {
|
||||
return document.getElementById(e);
|
||||
},
|
||||
|
||||
current : '',
|
||||
link : '',
|
||||
link_rel : '',
|
||||
target_value : '',
|
||||
current_size_sel : 's100',
|
||||
width : '',
|
||||
height : '',
|
||||
align : '',
|
||||
img_alt : '',
|
||||
|
||||
setTabs : function(tab) {
|
||||
var t = this;
|
||||
|
||||
if ( 'current' == tab.className ) return false;
|
||||
t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none';
|
||||
t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none';
|
||||
t.I('tab_basic').className = t.I('tab_advanced').className = '';
|
||||
tab.className = 'current';
|
||||
return false;
|
||||
},
|
||||
|
||||
img_seturl : function(u) {
|
||||
var t = this, rel = t.I('link_rel').value;
|
||||
|
||||
if ( 'current' == u ) {
|
||||
t.I('link_href').value = t.current;
|
||||
t.I('link_rel').value = t.link_rel;
|
||||
} else {
|
||||
t.I('link_href').value = t.link;
|
||||
if ( rel ) {
|
||||
rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' );
|
||||
t.I('link_rel').value = tinymce.trim(rel);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
imgAlignCls : function(v) {
|
||||
var t = this, cls = t.I('img_classes').value;
|
||||
|
||||
t.I('img_demo').className = t.align = v;
|
||||
|
||||
cls = cls.replace( /align[^ "']+/gi, '' );
|
||||
cls += (' ' + v);
|
||||
cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' );
|
||||
|
||||
if ( 'aligncenter' == v ) {
|
||||
t.I('hspace').value = '';
|
||||
t.updateStyle('hspace');
|
||||
}
|
||||
|
||||
t.I('img_classes').value = cls;
|
||||
},
|
||||
|
||||
showSize : function(el) {
|
||||
var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size;
|
||||
|
||||
size = parseInt(id.substring(1)) / 200;
|
||||
demo.width = Math.round(w * size);
|
||||
demo.height = Math.round(h * size);
|
||||
|
||||
t.showSizeClear();
|
||||
el.style.borderColor = '#A3A3A3';
|
||||
el.style.backgroundColor = '#E5E5E5';
|
||||
},
|
||||
|
||||
showSizeSet : function() {
|
||||
var t = this, s130, s120, s110;
|
||||
|
||||
if ( (t.width * 1.3) > parseInt(t.preloadImg.width) ) {
|
||||
s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110');
|
||||
|
||||
s130.onclick = s120.onclick = s110.onclick = null;
|
||||
s130.onmouseover = s120.onmouseover = s110.onmouseover = null;
|
||||
s130.style.color = s120.style.color = s110.style.color = '#aaa';
|
||||
}
|
||||
},
|
||||
|
||||
showSizeRem : function() {
|
||||
var t = this, demo = t.I('img_demo'), f = document.forms[0];
|
||||
|
||||
demo.width = Math.round(f.width.value * 0.5);
|
||||
demo.height = Math.round(f.height.value * 0.5);
|
||||
t.showSizeClear();
|
||||
t.I(t.current_size_sel).style.borderColor = '#A3A3A3';
|
||||
t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5';
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
showSizeClear : function() {
|
||||
var divs = this.I('img_size').getElementsByTagName('div'), i;
|
||||
|
||||
for ( i = 0; i < divs.length; i++ ) {
|
||||
divs[i].style.borderColor = '#f1f1f1';
|
||||
divs[i].style.backgroundColor = '#f1f1f1';
|
||||
}
|
||||
},
|
||||
|
||||
imgEditSize : function(el) {
|
||||
var t = this, f = document.forms[0], W, H, w, h, id;
|
||||
|
||||
if ( ! t.preloadImg || ! t.preloadImg.width || ! t.preloadImg.height )
|
||||
return;
|
||||
|
||||
W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100';
|
||||
|
||||
size = parseInt(id.substring(1)) / 100;
|
||||
|
||||
w = Math.round(w * size);
|
||||
h = Math.round(h * size);
|
||||
|
||||
f.width.value = Math.min(W, w);
|
||||
f.height.value = Math.min(H, h);
|
||||
|
||||
t.current_size_sel = id;
|
||||
t.demoSetSize();
|
||||
},
|
||||
|
||||
demoSetSize : function(img) {
|
||||
var demo = this.I('img_demo'), f = document.forms[0];
|
||||
|
||||
demo.width = f.width.value ? Math.round(f.width.value * 0.5) : '';
|
||||
demo.height = f.height.value ? Math.round(f.height.value * 0.5) : '';
|
||||
},
|
||||
|
||||
demoSetStyle : function() {
|
||||
var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom;
|
||||
|
||||
if (demo) {
|
||||
dom.setAttrib(demo, 'style', f.img_style.value);
|
||||
dom.setStyle(demo, 'width', '');
|
||||
dom.setStyle(demo, 'height', '');
|
||||
}
|
||||
},
|
||||
|
||||
origSize : function() {
|
||||
var t = this, f = document.forms[0], el = t.I('s100');
|
||||
|
||||
f.width.value = t.width = t.preloadImg.width;
|
||||
f.height.value = t.height = t.preloadImg.height;
|
||||
t.showSizeSet();
|
||||
t.demoSetSize();
|
||||
t.showSize(el);
|
||||
},
|
||||
|
||||
init : function() {
|
||||
var ed = tinyMCEPopup.editor, h;
|
||||
|
||||
h = document.body.innerHTML;
|
||||
document.body.innerHTML = ed.translate(h);
|
||||
window.setTimeout( function(){wpImage.setup();}, 500 );
|
||||
},
|
||||
|
||||
setup : function() {
|
||||
var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor,
|
||||
d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa;
|
||||
|
||||
document.dir = tinyMCEPopup.editor.getParam('directionality','');
|
||||
|
||||
if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) )
|
||||
t.I('cap_field').style.display = 'none';
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
if (el.nodeName != 'IMG')
|
||||
return;
|
||||
|
||||
f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src');
|
||||
ed.dom.setStyle(el, 'float', '');
|
||||
t.getImageData();
|
||||
c = ed.dom.getAttrib(el, 'class');
|
||||
|
||||
if ( DL = dom.getParent(el, 'dl') ) {
|
||||
dlc = ed.dom.getAttrib(DL, 'class');
|
||||
dlc = dlc.match(/align[^ "']+/i);
|
||||
if ( dlc && ! dom.hasClass(el, dlc) ) {
|
||||
c += ' '+dlc;
|
||||
tinymce.trim(c);
|
||||
}
|
||||
|
||||
DD = ed.dom.select('dd.wp-caption-dd', DL);
|
||||
if ( DD && DD[0] )
|
||||
caption = ed.serializer.serialize(DD[0]).replace(/^<p>/, '').replace(/<\/p>$/, '');
|
||||
}
|
||||
|
||||
f.img_cap_text.value = caption;
|
||||
f.img_title.value = ed.dom.getAttrib(el, 'title');
|
||||
f.img_alt.value = ed.dom.getAttrib(el, 'alt');
|
||||
f.border.value = ed.dom.getAttrib(el, 'border');
|
||||
f.vspace.value = ed.dom.getAttrib(el, 'vspace');
|
||||
f.hspace.value = ed.dom.getAttrib(el, 'hspace');
|
||||
f.align.value = ed.dom.getAttrib(el, 'align');
|
||||
f.width.value = t.width = ed.dom.getAttrib(el, 'width');
|
||||
f.height.value = t.height = ed.dom.getAttrib(el, 'height');
|
||||
f.img_classes.value = c;
|
||||
f.img_style.value = ed.dom.getAttrib(el, 'style');
|
||||
|
||||
// Move attribs to styles
|
||||
if ( dom.getAttrib(el, 'hspace') )
|
||||
t.updateStyle('hspace');
|
||||
|
||||
if ( dom.getAttrib(el, 'border') )
|
||||
t.updateStyle('border');
|
||||
|
||||
if ( dom.getAttrib(el, 'vspace') )
|
||||
t.updateStyle('vspace');
|
||||
|
||||
if ( pa = ed.dom.getParent(el, 'A') ) {
|
||||
f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href');
|
||||
f.link_title.value = ed.dom.getAttrib(pa, 'title');
|
||||
f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel');
|
||||
f.link_style.value = ed.dom.getAttrib(pa, 'style');
|
||||
t.target_value = ed.dom.getAttrib(pa, 'target');
|
||||
f.link_classes.value = ed.dom.getAttrib(pa, 'class');
|
||||
}
|
||||
|
||||
f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : '';
|
||||
|
||||
fname = link.substring( link.lastIndexOf('/') );
|
||||
fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
|
||||
t.link = link.substring( 0, link.lastIndexOf('/') ) + fname;
|
||||
|
||||
if ( c.indexOf('alignleft') != -1 ) {
|
||||
t.I('alignleft').checked = "checked";
|
||||
d.className = t.align = "alignleft";
|
||||
} else if ( c.indexOf('aligncenter') != -1 ) {
|
||||
t.I('aligncenter').checked = "checked";
|
||||
d.className = t.align = "aligncenter";
|
||||
} else if ( c.indexOf('alignright') != -1 ) {
|
||||
t.I('alignright').checked = "checked";
|
||||
d.className = t.align = "alignright";
|
||||
} else if ( c.indexOf('alignnone') != -1 ) {
|
||||
t.I('alignnone').checked = "checked";
|
||||
d.className = t.align = "alignnone";
|
||||
}
|
||||
|
||||
if ( t.width && t.preloadImg.width )
|
||||
t.showSizeSet();
|
||||
|
||||
document.body.style.display = '';
|
||||
},
|
||||
|
||||
remove : function() {
|
||||
var ed = tinyMCEPopup.editor, p, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
if (el.nodeName != 'IMG') return;
|
||||
|
||||
if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
|
||||
ed.dom.remove(p);
|
||||
else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
|
||||
ed.dom.remove(p);
|
||||
else ed.dom.remove(el);
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null,
|
||||
DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html,
|
||||
id, cap_id = '', cap, DT, DD, cap_width, div_cls, lnk = '', pa, aa, caption;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
|
||||
if (el.nodeName != 'IMG') return;
|
||||
if (f.img_src.value === '') {
|
||||
t.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( f.img_cap_text.value != '' && f.width.value != '' ) {
|
||||
do_caption = 1;
|
||||
img_class = img_class.replace( /align[^ "']+\s?/gi, '' );
|
||||
}
|
||||
|
||||
A = ed.dom.getParent(el, 'a');
|
||||
P = ed.dom.getParent(el, 'p');
|
||||
DL = ed.dom.getParent(el, 'dl');
|
||||
DIV = ed.dom.getParent(el, 'div');
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
|
||||
if ( f.width.value != el.width || f.height.value != el.height )
|
||||
img_class = img_class.replace(/size-[^ "']+/, '');
|
||||
|
||||
ed.dom.setAttribs(el, {
|
||||
src : f.img_src.value,
|
||||
title : f.img_title.value,
|
||||
alt : f.img_alt.value,
|
||||
width : f.width.value,
|
||||
height : f.height.value,
|
||||
style : f.img_style.value,
|
||||
'class' : img_class
|
||||
});
|
||||
|
||||
if ( f.link_href.value ) {
|
||||
// Create new anchor elements
|
||||
if ( A == null ) {
|
||||
if ( ! f.link_href.value.match(/https?:\/\//i) )
|
||||
f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value);
|
||||
|
||||
ed.getDoc().execCommand("unlink", false, null);
|
||||
tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
|
||||
tinymce.each(ed.dom.select("a"), function(n) {
|
||||
if ( ed.dom.getAttrib(n, 'href') == '#mce_temp_url#' ) {
|
||||
|
||||
ed.dom.setAttribs(n, {
|
||||
href : f.link_href.value,
|
||||
title : f.link_title.value,
|
||||
rel : f.link_rel.value,
|
||||
target : (f.link_target.checked == true) ? '_blank' : '',
|
||||
'class' : f.link_classes.value,
|
||||
style : f.link_style.value
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ed.dom.setAttribs(A, {
|
||||
href : f.link_href.value,
|
||||
title : f.link_title.value,
|
||||
rel : f.link_rel.value,
|
||||
target : (f.link_target.checked == true) ? '_blank' : '',
|
||||
'class' : f.link_classes.value,
|
||||
style : f.link_style.value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ( do_caption ) {
|
||||
cap_width = 10 + parseInt(f.width.value);
|
||||
div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
|
||||
caption = f.img_cap_text.value;
|
||||
|
||||
caption = caption.replace(/\r\n|\r/g, '\n').replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
|
||||
return a.replace(/[\r\n\t]+/, ' ');
|
||||
});
|
||||
|
||||
caption = caption.replace(/\s*\n\s*/g, '<br />');
|
||||
|
||||
if ( DL ) {
|
||||
ed.dom.setAttribs(DL, {
|
||||
'class' : 'wp-caption '+t.align,
|
||||
style : 'width: '+cap_width+'px;'
|
||||
});
|
||||
|
||||
if ( DIV )
|
||||
ed.dom.setAttrib(DIV, 'class', div_cls);
|
||||
|
||||
if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') )
|
||||
ed.dom.setHTML(DD, caption);
|
||||
|
||||
} else {
|
||||
if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] )
|
||||
cap_id = 'attachment_'+id[1];
|
||||
|
||||
if ( f.link_href.value && (lnk = ed.dom.getParent(el, 'a')) ) {
|
||||
if ( lnk.childNodes.length == 1 ) {
|
||||
html = ed.dom.getOuterHTML(lnk);
|
||||
} else {
|
||||
html = ed.dom.getOuterHTML(lnk);
|
||||
html = html.match(/<a [^>]+>/i);
|
||||
html = html+ed.dom.getOuterHTML(el)+'</a>';
|
||||
}
|
||||
} else {
|
||||
html = ed.dom.getOuterHTML(el);
|
||||
}
|
||||
|
||||
html = '<dl id="'+cap_id+'" class="wp-caption '+t.align+'" style="width: '+cap_width+
|
||||
'px"><dt class="wp-caption-dt">'+html+'</dt><dd class="wp-caption-dd">'+caption+'</dd></dl>';
|
||||
|
||||
cap = ed.dom.create('div', {'class': div_cls}, html);
|
||||
|
||||
if ( P ) {
|
||||
P.parentNode.insertBefore(cap, P);
|
||||
if ( P.childNodes.length == 1 )
|
||||
ed.dom.remove(P);
|
||||
else if ( lnk && lnk.childNodes.length == 1 )
|
||||
ed.dom.remove(lnk);
|
||||
else ed.dom.remove(el);
|
||||
} else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) {
|
||||
pa.appendChild(cap);
|
||||
if ( lnk && lnk.childNodes.length == 1 )
|
||||
ed.dom.remove(lnk);
|
||||
else ed.dom.remove(el);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( DL && DIV ) {
|
||||
if ( f.link_href.value && (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa);
|
||||
else html = ed.dom.getOuterHTML(el);
|
||||
|
||||
P = ed.dom.create('p', {}, html);
|
||||
DIV.parentNode.insertBefore(P, DIV);
|
||||
ed.dom.remove(DIV);
|
||||
}
|
||||
}
|
||||
|
||||
if ( f.img_classes.value.indexOf('aligncenter') != -1 ) {
|
||||
if ( P && ( ! P.style || P.style.textAlign != 'center' ) )
|
||||
ed.dom.setStyle(P, 'textAlign', 'center');
|
||||
} else {
|
||||
if ( P && P.style && P.style.textAlign == 'center' )
|
||||
ed.dom.setStyle(P, 'textAlign', '');
|
||||
}
|
||||
|
||||
if ( ! f.link_href.value && A ) {
|
||||
b = ed.selection.getBookmark();
|
||||
ed.dom.remove(A, 1);
|
||||
ed.selection.moveToBookmark(b);
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
// Handle align
|
||||
if (ty == 'align') {
|
||||
dom.setStyle(img, 'float', '');
|
||||
dom.setStyle(img, 'vertical-align', '');
|
||||
|
||||
v = f.align.value;
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right')
|
||||
dom.setStyle(img, 'float', v);
|
||||
else
|
||||
img.style.verticalAlign = v;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle border
|
||||
if (ty == 'border') {
|
||||
dom.setStyle(img, 'border', '');
|
||||
|
||||
v = f.border.value;
|
||||
if (v || v == '0') {
|
||||
if (v == '0')
|
||||
img.style.border = '0';
|
||||
else
|
||||
img.style.border = v + 'px solid black';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hspace
|
||||
if (ty == 'hspace') {
|
||||
dom.setStyle(img, 'marginLeft', '');
|
||||
dom.setStyle(img, 'marginRight', '');
|
||||
|
||||
v = f.hspace.value;
|
||||
if (v) {
|
||||
img.style.marginLeft = v + 'px';
|
||||
img.style.marginRight = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle vspace
|
||||
if (ty == 'vspace') {
|
||||
dom.setStyle(img, 'marginTop', '');
|
||||
dom.setStyle(img, 'marginBottom', '');
|
||||
|
||||
v = f.vspace.value;
|
||||
if (v) {
|
||||
img.style.marginTop = v + 'px';
|
||||
img.style.marginBottom = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Merge
|
||||
f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
|
||||
this.demoSetStyle();
|
||||
}
|
||||
},
|
||||
|
||||
checkVal : function(f) {
|
||||
|
||||
if ( f.value == '' ) {
|
||||
// if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width;
|
||||
// if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height;
|
||||
if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src;
|
||||
}
|
||||
},
|
||||
|
||||
resetImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.width.value = f.height.value = '';
|
||||
},
|
||||
|
||||
updateImageData : function() {
|
||||
var f = document.forms[0], t = wpImage, w = f.width.value, h = f.height.value;
|
||||
|
||||
if ( !w && h )
|
||||
w = f.width.value = t.width = Math.round( t.preloadImg.width / (t.preloadImg.height / h) );
|
||||
else if ( w && !h )
|
||||
h = f.height.value = t.height = Math.round( t.preloadImg.height / (t.preloadImg.width / w) );
|
||||
|
||||
if ( !w )
|
||||
f.width.value = t.width = t.preloadImg.width;
|
||||
|
||||
if ( !h )
|
||||
f.height.value = t.height = t.preloadImg.height;
|
||||
|
||||
t.showSizeSet();
|
||||
t.demoSetSize();
|
||||
if ( f.img_style.value )
|
||||
t.demoSetStyle();
|
||||
},
|
||||
|
||||
getImageData : function() {
|
||||
var t = wpImage, f = document.forms[0];
|
||||
|
||||
t.preloadImg = new Image();
|
||||
t.preloadImg.onload = t.updateImageData;
|
||||
t.preloadImg.onerror = t.resetImageData;
|
||||
t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value);
|
||||
}
|
||||
};
|
||||
|
||||
window.onload = function(){wpImage.init();}
|
||||
wpImage.preInit();
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&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(1)},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.Line truncated
|
||||
Reference in new issue
Block a user