Getting much better! Fixes #1566

git-svn-id: http://svn.automattic.com/wordpress/trunk@2776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2005-08-10 23:39:15 +00:00
parent c678e7821f
commit 4ada9a43a2
2 changed files with 38 additions and 9 deletions

View File

@ -100,12 +100,40 @@ tinyMCE.init({
<?php endif; ?>
<script type="text/javascript" src="dbx.js"></script>
<script type="text/javascript" src="dbx-key.js"></script>
<?php if ( current_user_can('manage_categories') ) : ?>
<script type="text/javascript" src="tw-sack.js"></script>
<script type="text/javascript">
var ajaxCat = new sack();
var newcat;
function newCatAddIn() {
var ajaxcat = document.createElement('p');
ajaxcat.id = 'ajaxcat';
newcat = document.createElement('input');
newcat.type = 'text';
newcat.name = 'newcat';
newcat.id = 'newcat';
newcat.size = '16';
newcat.setAttribute('autocomplete', 'off');
newcat.setAttribute('onkeypress', 'return ajaxNewCatKeyPress(event);');
var newcatSub = document.createElement('input');
newcatSub.type = 'button';
newcatSub.name = 'Button';
newcatSub.value = '+';
newcatSub.setAttribute('onclick', 'ajaxNewCat();');
ajaxcat.appendChild(newcat);
ajaxcat.appendChild(newcatSub);
document.getElementById('categorychecklist').parentNode.appendChild(ajaxcat);
}
addLoadEvent(newCatAddIn);
function getResponseElement() {
var p = document.getElementById('ajaxcatresponse');
var p = document.getElementById('ajaxcatresponse');
if (!p) {
p = document.createElement('p');
document.getElementById('categorydiv').appendChild(p);
@ -165,14 +193,15 @@ function newCatCompletion() {
newCheck.name = 'post_category[]';
newCheck.id = 'category-' + id;
var newLabelText = document.createTextNode(' ' + document.getElementById('newcat').value);
var newLabelText = document.createTextNode(' ' + newcat.value);
newLabel.appendChild(newLabelText);
Fat.fade_all();
newLabel.setAttribute('class', 'selectit');
}
newcat.value = '';
}
function ajaxNewCatKeyUp(e) {
function ajaxNewCatKeyPress(e) {
if (!e) {
if (window.event) {
e = window.event;
@ -182,6 +211,9 @@ function ajaxNewCatKeyUp(e) {
}
if (e.keyCode == 13) {
ajaxNewCat();
e.returnValue = false;
e.cancelBubble = true;
return false;
}
}
@ -199,6 +231,8 @@ function ajaxNewCat() {
</script>
<?php endif; ?>
<?php endif; ?>
<?php do_action('admin_head'); ?>
</head>
<body>

View File

@ -83,12 +83,7 @@ addLoadEvent(focusit);
<fieldset id="categorydiv" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Categories') ?></h3>
<div class="dbx-content"><div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div>
<p id="ajaxcat">
<input type="text" name="newcat" id="newcat" size="16" onkeyup="ajaxNewCatKeyUp(event);" />
<input type="button" name="Button" value="+" onclick="ajaxNewCat();" />
</p>
</div>
<div class="dbx-content"><div id="categorychecklist"><?php dropdown_categories(get_settings('default_category')); ?></div></div>
</fieldset>
<fieldset class="dbx-box">