Keep state for image size, alignment and url in the uploader and for categories view on the write page, fixes #7520

git-svn-id: http://svn.automattic.com/wordpress/trunk@9654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-11-13 03:07:39 +00:00
parent 31fd853986
commit f4d7858bbd
4 changed files with 53 additions and 13 deletions

View File

@ -86,7 +86,11 @@ ul.widget-control-list div.widget-control-actions {
}
div.ui-tabs-panel {
border-color: #cee1ef;
border-color: #f1f1f1;
}
ul#category-tabs li.ui-tabs-selected {
background-color: #f1f1f1;
}
input.disabled,
@ -138,7 +142,6 @@ strong .post-com-count span {
background-color: #2583ad;
}
#post-body ul#category-tabs li.ui-tabs-selected,
#login form .submit input, .search-box .button,
#ed_reply_toolbar {
background-color: #cee1ef !important;

View File

@ -773,13 +773,11 @@ function image_link_input_fields($post, $url_type='') {
elseif ( $url_type == 'post' )
$url = $link;
return "<input type='text' name='attachments[$post->ID][url]' value='" . attribute_escape($url) . "' /><br />
<button type='button' class='button url-$post->ID' title=''>" . __('None') . "</button>
<button type='button' class='button url-$post->ID' title='" . attribute_escape($file) . "'>" . __('File URL') . "</button>
<button type='button' class='button url-$post->ID' title='" . attribute_escape($link) . "'>" . __('Post URL') . "</button>
<script type='text/javascript'>
jQuery('button.url-$post->ID').bind('click', function(){jQuery(this).siblings('input').val(jQuery(this).attr('title'));});
</script>\n";
return "<input type='text' class='urlfield' name='attachments[$post->ID][url]' value='" . attribute_escape($url) . "' /><br />
<button type='button' class='button urlnone' title=''>" . __('None') . "</button>
<button type='button' class='button urlfile' title='" . attribute_escape($file) . "'>" . __('File URL') . "</button>
<button type='button' class='button urlpost' title='" . attribute_escape($link) . "'>" . __('Post URL') . "</button>
";
}
/**
@ -1679,13 +1677,13 @@ function type_form_image() {
<tr class="align">
<th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
<td class="field">
<input name="align" id="align-none" value="alignnone" onclick="addExtImage.align=this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '').' />
<input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '').' />
<label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
<input name="align" id="align-left" value="alignleft" onclick="addExtImage.align=this.value" type="radio"' . ($default_align == 'left' ? ' checked="checked"' : '').' />
<input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'left' ? ' checked="checked"' : '').' />
<label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
<input name="align" id="align-center" value="aligncenter" onclick="addExtImage.align=this.value" type="radio"' . ($default_align == 'center' ? ' checked="checked"' : '').' />
<input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'center' ? ' checked="checked"' : '').' />
<label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
<input name="align" id="align-right" value="alignright" onclick="addExtImage.align=this.value" type="radio"' . ($default_align == 'right' ? ' checked="checked"' : '').' />
<input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'right' ? ' checked="checked"' : '').' />
<label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
</td>
</tr>

View File

@ -190,6 +190,12 @@ jQuery(document).ready( function($) {
jQuery('#newcat').focus();
return false;
} );
$('a[href="#categories-all"]').click(function(){deleteUserSetting('cats');});
$('a[href="#categories-pop"]').click(function(){setUserSetting('cats','pop');});
if ( 'pop' == getUserSetting('cats') )
$('a[href="#categories-pop"]').click();
jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
var stamp = $('#timestamp').html();
var visibility = $('#post-visibility-display').html();

View File

@ -247,3 +247,36 @@ function uploadError(fileObj, error_code, message) {
wpQueueError(swfuploadL10n.security_error);
}
}
// remember the last used image size, alignment and url
jQuery(document).ready(function($){
var align = getUserSetting('align') || '', imgsize = getUserSetting('imgsize') || '';
$('tr.align input[type="radio"]').click(function(){
setUserSetting('align', $(this).val());
}).filter(function(){
if ( $(this).val() == align )
return true;
return false;
}).attr('checked','checked');
$('tr.image-size input[type="radio"]').click(function(){
setUserSetting('imgsize', $(this).val());
}).filter(function(){
if ( $(this).attr('disabled') || $(this).val() != imgsize )
return false;
return true;
}).attr('checked','checked');
$('tr.url button').click(function(){
var c = this.className || '';
c = c.replace(/.*?(url[^ '"]+).*/, '$1');
if (c) setUserSetting('urlbutton', c);
$(this).siblings('.urlfield').val( $(this).attr('title') );
});
$('tr.url .urlfield').each(function(){
var b = getUserSetting('urlbutton');
$(this).val( $(this).siblings('button.'+b).attr('title') );
});
});