Cleanup js files and prepare for concatenating, move most inline js to files

git-svn-id: http://svn.automattic.com/wordpress/trunk@10348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-01-12 13:43:17 +00:00
parent e47ab8d574
commit 1c9353ad2e
52 changed files with 583 additions and 675 deletions

View File

@ -912,7 +912,7 @@ case 'hidden-columns' :
$hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : ''; $hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : '';
$hidden = explode( ',', $_POST['hidden'] ); $hidden = explode( ',', $_POST['hidden'] );
$page = isset( $_POST['page'] )? $_POST['page'] : ''; $page = isset( $_POST['page'] )? $_POST['page'] : '';
if ( !preg_match( '/^[a-z-_]+$/', $page ) ) { if ( !preg_match( '/^[a-z_-]+$/', $page ) ) {
die(-1); die(-1);
} }
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();

View File

@ -24,37 +24,22 @@ wp_admin_css( 'css/global' );
wp_admin_css(); wp_admin_css();
wp_admin_css( 'css/colors' ); wp_admin_css( 'css/colors' );
wp_admin_css( 'css/ie' ); wp_admin_css( 'css/ie' );
wp_enqueue_script('utils');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
function convertEntities(o) { var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
var c = function(s) { var pagenow = '<?php echo substr($pagenow, 0, -4); ?>';
if (/&[^;]+;/.test(s)) {
var e = document.createElement("div");
e.innerHTML = s;
return !e.firstChild ? s : e.firstChild.nodeValue;
}
return s;
}
if ( typeof o === 'string' )
return c(o);
else if ( typeof o === 'object' )
for (var v in o) {
if ( typeof o[v] === 'string' )
o[v] = c(o[v]);
}
return o;
};
//]]> //]]>
</script> </script>
<?php <?php
if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) { if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
add_action( 'admin_footer', 'wp_tiny_mce' ); add_action( 'admin_footer', 'wp_tiny_mce' );
wp_enqueue_script('quicktags');
} }
$hook_suffix = ''; $hook_suffix = '';

View File

@ -287,21 +287,6 @@ if ( $page_links )
</div><!-- /col-container --> </div><!-- /col-container -->
</div><!-- /wrap --> </div><!-- /wrap -->
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var m = '<?php echo js_escape(__("You are about to delete the selected categories.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php <?php
inline_edit_term_row('categories'); inline_edit_term_row('categories');

View File

@ -376,21 +376,6 @@ if ( $page_links )
<?php } ?> <?php } ?>
</div> </div>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var m = '<?php echo js_escape(__("You are about to delete the selected comments.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php <?php
wp_comment_reply('-1', true, 'detail'); wp_comment_reply('-1', true, 'detail');
include('admin-footer.php'); ?> include('admin-footer.php'); ?>

View File

@ -276,9 +276,8 @@ function post_tags_meta_box($post, $box) {
<span class="ajaxtag"> <span class="ajaxtag">
<input type="text" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" /> <input type="text" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php _e('Add new tag'); ?>" />
<input type="button" class="button tagadd" value="<?php _e('Add'); ?>" tabindex="3" /> <input type="button" class="button tagadd" value="<?php _e('Add'); ?>" tabindex="3" />
</span> </span></p>
<p class="howto"><?php echo $helps; ?></p> <p class="howto"><?php echo $helps; ?></p>
</p>
<div class="tagchecklist"></div> <div class="tagchecklist"></div>
</div> </div>
<p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p> <p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p>

View File

@ -224,20 +224,5 @@ if ( $page_links )
</div><!-- /col-container --> </div><!-- /col-container -->
</div><!-- /wrap --> </div><!-- /wrap -->
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var m = '<?php echo js_escape(__("You are about to delete the selected link categories.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php inline_edit_term_row('edit-link-categories'); ?> <?php inline_edit_term_row('edit-link-categories'); ?>
<?php include('admin-footer.php'); ?> <?php include('admin-footer.php'); ?>

View File

@ -312,20 +312,5 @@ endif; // posts;
</div> </div>
<script type="text/javascript"> <?php
/* <![CDATA[ */ include('admin-footer.php');
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var m = '<?php echo js_escape(__("You are about to delete the selected pages.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
columns.init('edit-pages');
/* ]]> */
</script>
<?php include('admin-footer.php'); ?>

View File

@ -283,21 +283,6 @@ else
</div><!-- /col-container --> </div><!-- /col-container -->
</div><!-- /wrap --> </div><!-- /wrap -->
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var m = '<?php echo js_escape(__("You are about to delete the selected tags.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
/* ]]> */
</script>
<?php inline_edit_term_row('edit-tags'); ?> <?php inline_edit_term_row('edit-tags'); ?>
<?php <?php

View File

@ -296,20 +296,5 @@ if ( $page_links )
</div> </div>
<script type="text/javascript"> <?php
/* <![CDATA[ */ include('admin-footer.php');
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var m = '<?php echo js_escape(__("You are about to delete the selected posts.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
columns.init('edit');
/* ]]> */
</script>
<?php include('admin-footer.php'); ?>

View File

@ -308,6 +308,7 @@ if ( 0 === strpos( $content_func, 'media' ) )
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}} function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
//]]> //]]>
</script> </script>
<?php <?php

View File

@ -3076,104 +3076,6 @@ function find_posts_div($found_action = '') {
<input id="find-posts-submit" type="submit" class="button" value="<?php _e('Select'); ?>" /> <input id="find-posts-submit" type="submit" class="button" value="<?php _e('Select'); ?>" />
</div> </div>
</div> </div>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
findPosts = {
open : function(af_name, af_val) {
var st = document.documentElement.scrollTop || $(document).scrollTop();
if ( af_name && af_val )
$('#affected').attr('name', af_name).val(af_val);
$('#find-posts').show().draggable({
handle: '#find-posts-head'
}).resizable({
handles: 'all',
minHeight: 150,
minWidth: 280
}).css({'top':st+'px','left':'50%','marginLeft':'-200px'});
$('.ui-resizable-handle').css({
'backgroundColor': '#e5e5e5'
});
$('.ui-resizable-se').css({
'border': '0 none',
'width': '15px',
'height': '16px',
'background': 'transparent url(images/se.png) no-repeat scroll 0 0'
});
$('#find-posts-input').focus().keyup(function(e){
if (e.which == 27) findPosts.close(); // close on Escape
});
return false;
},
close : function() {
$('#find-posts-response').html('');
$('#find-posts').draggable('destroy').resizable('destroy').hide();
},
send : function() {
var post = {};
post['ps'] = $('#find-posts-input').val();
post['action'] = 'find_posts';
post['_ajax_nonce'] = $('#_ajax_nonce').val();
if ( $('#find-posts-pages:checked').val() )
post['pages'] = 1;
else
post['posts'] = 1;
$.ajax({
type : 'POST',
url : '<?php echo admin_url('admin-ajax.php'); ?>',
data : post,
success : function(x) { findPosts.show(x); },
error : function(r) { findPosts.error(r); }
});
},
show : function(x) {
if ( typeof(x) == 'string' ) {
this.error({'responseText': x});
return;
}
var r = wpAjax.parseAjaxResponse(x);
if ( r.errors )
this.error({'responseText': wpAjax.broken});
r = r.responses[0];
$('#find-posts-response').html(r.data);
},
error : function(r) {
var er = r.statusText;
if ( r.responseText )
er = r.responseText.replace( /<.[^<>]*?>/g, '' );
if ( er )
$('#find-posts-response').html(er);
}
};
$(document).ready(function(){
$('#find-posts-submit').click(function(e) {
if ( '' == $('#find-posts-response').html() )
e.preventDefault();
});
});
})(jQuery);
/* ]]> */
</script>
<?php <?php
} }

View File

@ -1,5 +1,5 @@
jQuery(document).ready( function($) { jQuery(document).ready( function($) {
var myConfirm = function() { return '' !== $('#newcat').val(); }; var myConfirm = function() { return '' !== $('#newcat').val(); };
$('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>') $('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>');
$('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response', confirm: myConfirm } ); $('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response', confirm: myConfirm } );
} ); } );

View File

@ -31,9 +31,4 @@ jQuery(document).ready(function($) {
else else
$('#the-list').wpList({ addAfter: addAfter2 }); $('#the-list').wpList({ addAfter: addAfter2 });
if ( jQuery('#link-category-search-input').size() ) {
columns.init('edit-link-categories');
} else {
columns.init('categories');
}
}); });

View File

@ -1 +1 @@
jQuery(document).ready(function(c){var b=false,e,d,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}e=function(h,g){var f,i;f=c("<span>"+c("name",h).text()+"</span>").html();i=c("cat",h).attr("id");b[b.length]=new Option(f,i);d(h,g)};d=function(f,h){var g=c(h.parsed.responses[0].data);if(g.length==1){inlineEditTax.addEvents(c(g.id))}};a=function(g,f){var i=c("cat",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};if(b){c("#the-list").wpList({addAfter:e,delAfter:a})}else{c("#the-list").wpList({addAfter:d})}if(jQuery("#link-category-search-input").size()){columns.init("edit-link-categories")}else{columns.init("categories")}}); jQuery(document).ready(function(c){var b=false,e,d,a;if(document.forms.addcat.category_parent){b=document.forms.addcat.category_parent.options}e=function(h,g){var f,i;f=c("<span>"+c("name",h).text()+"</span>").html();i=c("cat",h).attr("id");b[b.length]=new Option(f,i);d(h,g)};d=function(f,h){var g=c(h.parsed.responses[0].data);if(g.length==1){inlineEditTax.addEvents(c(g.id))}};a=function(g,f){var i=c("cat",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};if(b){c("#the-list").wpList({addAfter:e,delAfter:a})}else{c("#the-list").wpList({addAfter:d})}});

View File

@ -1,247 +1,4 @@
var wpCookies = {
// The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL.
each : function(o, cb, s) {
var n, l;
if (!o)
return 0;
s = s || o;
if (typeof(o.length) != 'undefined') {
for (n=0, l = o.length; n<l; n++) {
if (cb.call(s, o[n], n, o) === false)
return 0;
}
} else {
for (n in o) {
if (o.hasOwnProperty(n)) {
if (cb.call(s, o[n], n, o) === false)
return 0;
}
}
}
return 1;
},
getHash : function(n) {
var v = this.get(n), h;
if (v) {
this.each(v.split('&'), function(v) {
v = v.split('=');
h = h || {};
h[v[0]] = v[1];
});
}
return h;
},
setHash : function(n, v, e, p, d, s) {
var o = '';
this.each(v, function(v, k) {
o += (!o ? '' : '&') + k + '=' + v;
});
this.set(n, o, e, p, d, s);
},
get : function(n) {
var c = document.cookie, e, p = n + "=", b;
if (!c)
return;
b = c.indexOf("; " + p);
if (b == -1) {
b = c.indexOf(p);
if (b != 0)
return null;
} else
b += 2;
e = c.indexOf(";", b);
if (e == -1)
e = c.length;
return decodeURIComponent(c.substring(b + p.length, e));
},
set : function(n, v, e, p, d, s) {
document.cookie = n + "=" + encodeURIComponent(v) +
((e) ? "; expires=" + e.toGMTString() : "") +
((p) ? "; path=" + p : "") +
((d) ? "; domain=" + d : "") +
((s) ? "; secure" : "");
},
remove : function(n, p) {
var d = new Date();
d.setTime(d.getTime() - 1000);
this.set(n, '', d, p, d);
}
};
// Returns the value as string. Second arg or empty string is returned when value is not set.
function getUserSetting( name, def ) {
var o = getAllUserSettings();
if ( o.hasOwnProperty(name) )
return o[name];
if ( typeof def != 'undefined' )
return def;
return '';
}
// Both name and value must be only ASCII letters, numbers or underscore
// and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
function setUserSetting( name, value, del ) {
var c = 'wp-settings-'+userSettings.uid, o = wpCookies.getHash(c) || {}, d = new Date(), p,
n = name.toString().replace(/[^A-Za-z0-9_]/, ''), v = value.toString().replace(/[^A-Za-z0-9_]/, '');
if ( del ) delete o[n];
else o[n] = v;
d.setTime( d.getTime() + 31536000000 );
p = userSettings.url;
wpCookies.setHash(c, o, d, p );
wpCookies.set('wp-settings-time-'+userSettings.uid, userSettings.time, d, p );
}
function deleteUserSetting( name ) {
setUserSetting( name, '', 1 );
}
// Returns all settings as js object.
function getAllUserSettings() {
return wpCookies.getHash('wp-settings-'+userSettings.uid) || {};
}
jQuery(document).ready( function($) {
var lastClicked = false, checks, first, last, checked;
// pulse
$('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
// Basic form validation
if ( ( 'undefined' != typeof wpAjax ) && $.isFunction( wpAjax.validateForm ) ) {
$('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } );
}
// Move .updated and .error alert boxes
$('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
$('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');
// screen settings tab
$('#show-settings-link').click(function () {
if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
$('#contextual-help-link-wrap').addClass('invisible');
}
$('#screen-options-wrap').slideToggle('fast', function(){
if ( $(this).hasClass('screen-options-open') ) {
$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
$('#contextual-help-link-wrap').removeClass('invisible');
$(this).removeClass('screen-options-open');
} else {
$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
$(this).addClass('screen-options-open');
}
});
return false;
});
// help tab
$('#contextual-help-link').click(function () {
if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
$('#screen-options-link-wrap').addClass('invisible');
}
$('#contextual-help-wrap').slideToggle('fast', function(){
if ( $(this).hasClass('contextual-help-open') ) {
$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
$('#screen-options-link-wrap').removeClass('invisible');
$(this).removeClass('contextual-help-open');
} else {
$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
$(this).addClass('contextual-help-open');
}
});
return false;
});
// check all checkboxes
$( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
if ( 'undefined' == e.shiftKey ) { return true; }
if ( e.shiftKey ) {
if ( !lastClicked ) { return true; }
checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
first = checks.index( lastClicked );
last = checks.index( this );
checked = $(this).attr('checked');
if ( 0 < first && 0 < last && first != last ) {
checks.slice( first, last ).attr( 'checked', function(){
if ( $(this).parents('tr').is(':visible') )
return checked ? 'checked' : '';
return '';
});
}
}
lastClicked = this;
return true;
} );
$( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
if ( 'undefined' == typeof toggleWithKeyboard)
toggleWithKeyboard = false;
var c = $(this).attr('checked'), toggle = e.shiftKey || toggleWithKeyboard;
$(this).parents( 'form:first' ).find( 'table tbody:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
if ( $(this).parents('tr').is(':hidden') )
return '';
if ( toggle )
return $(this).attr( 'checked' ) ? '' : 'checked';
else if (c)
return 'checked';
return '';
});
$(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
if ( toggle )
return '';
else if (c)
return 'checked';
return '';
});
});
});
var showNotice, adminMenu, columns; var showNotice, adminMenu, columns;
// stub for doing better warnings
showNotice = {
warn : function(text) {
if ( confirm(text) )
return true;
return false;
},
note : function(text) {
alert(text);
}
};
(function($){ (function($){
// sidebar admin menu // sidebar admin menu
adminMenu = { adminMenu = {
@ -309,7 +66,7 @@ adminMenu = {
o = (t+h+10) - H; o = (t+h+10) - H;
m.css({'marginTop':'-'+o+'px'}); m.css({'marginTop':'-'+o+'px'});
} else if ( m.css('marginTop') ) { } else if ( m.css('marginTop') ) {
m.css({'marginTop':''}) m.css({'marginTop':''});
} }
m.addClass('sub-open'); m.addClass('sub-open');
}, },
@ -331,12 +88,10 @@ adminMenu = {
}; };
$(document).ready(function(){adminMenu.init();}); $(document).ready(function(){adminMenu.init();});
})(jQuery);
(function($){
// show/hide/save table columns // show/hide/save table columns
columns = { columns = {
init : function(page) { init : function() {
$('.hide-column-tog').click( function() { $('.hide-column-tog').click( function() {
var column = $(this).val(), show = $(this).attr('checked'); var column = $(this).val(), show = $(this).attr('checked');
if ( show ) { if ( show ) {
@ -344,25 +99,138 @@ columns = {
} else { } else {
$('.column-' + column).hide(); $('.column-' + column).hide();
} }
columns.save_manage_columns_state(page); columns.save_manage_columns_state();
} ); } );
}, },
save_manage_columns_state : function(page) { save_manage_columns_state : function() {
var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(','); var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
$.post('admin-ajax.php', { $.post(ajaxurl, {
action: 'hidden-columns', action: 'hidden-columns',
hidden: hidden, hidden: hidden,
hiddencolumnsnonce: $('#hiddencolumnsnonce').val(), hiddencolumnsnonce: $('#hiddencolumnsnonce').val(),
page: page page: pagenow
}); });
} }
} }
$(document).ready(function(){columns.init();});
})(jQuery); })(jQuery);
// stub for doing better warnings
showNotice = {
warn : function() {
var msg = commonL10n.warnDelete || '';
if ( confirm(msg) ) {
return true;
}
return false;
},
note : function(text) {
alert(text);
}
};
jQuery(document).ready( function($) { jQuery(document).ready( function($) {
var lastClicked = false, checks, first, last, checked;
// pulse
$('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
// Move .updated and .error alert boxes
$('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
$('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');
// show warnings
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
return showNotice.warn();
}
});
// screen settings tab
$('#show-settings-link').click(function () {
if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
$('#contextual-help-link-wrap').addClass('invisible');
}
$('#screen-options-wrap').slideToggle('fast', function(){
if ( $(this).hasClass('screen-options-open') ) {
$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
$('#contextual-help-link-wrap').removeClass('invisible');
$(this).removeClass('screen-options-open');
} else {
$('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
$(this).addClass('screen-options-open');
}
});
return false;
});
// help tab
$('#contextual-help-link').click(function () {
if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
$('#screen-options-link-wrap').addClass('invisible');
}
$('#contextual-help-wrap').slideToggle('fast', function(){
if ( $(this).hasClass('contextual-help-open') ) {
$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
$('#screen-options-link-wrap').removeClass('invisible');
$(this).removeClass('contextual-help-open');
} else {
$('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
$(this).addClass('contextual-help-open');
}
});
return false;
});
// check all checkboxes
$( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
if ( 'undefined' == e.shiftKey ) { return true; }
if ( e.shiftKey ) {
if ( !lastClicked ) { return true; }
checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
first = checks.index( lastClicked );
last = checks.index( this );
checked = $(this).attr('checked');
if ( 0 < first && 0 < last && first != last ) {
checks.slice( first, last ).attr( 'checked', function(){
if ( $(this).parents('tr').is(':visible') )
return checked ? 'checked' : '';
return '';
});
}
}
lastClicked = this;
return true;
} );
$( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
var c = $(this).attr('checked'), kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, toggle = e.shiftKey || kbtoggle;
$(this).parents( 'form:first' ).find( 'table tbody:visible' ).find( '.check-column :checkbox' ).attr( 'checked', function() {
if ( $(this).parents('tr').is(':hidden') )
return '';
if ( toggle )
return $(this).attr( 'checked' ) ? '' : 'checked';
else if (c)
return 'checked';
return '';
});
$(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
if ( toggle )
return '';
else if (c)
return 'checked';
return '';
});
});
});
(function(){
if ( 'undefined' != typeof google && google.gears ) return; if ( 'undefined' != typeof google && google.gears ) return;
var gf = false; var gf = false;
@ -387,5 +255,5 @@ jQuery(document).ready(function($){
if ( gf && gf.hasPermission ) if ( gf && gf.hasPermission )
return; return;
$('.turbo-nag').show(); jQuery('.turbo-nag').show();
}); })();

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
var theList, theExtraList; var theList, theExtraList, toggleWithKeyboard = false;
(function($) { (function($) {
setCommentsList = function() { setCommentsList = function() {
@ -332,11 +332,10 @@ commentReply = {
} }
}; };
toggleWithKeyboard = false;
$(document).ready(function(){ $(document).ready(function(){
var make_hotkeys_redirect, edit_comment, toggle_all, make_bulk; var make_hotkeys_redirect, edit_comment, toggle_all, make_bulk;
columns.init('edit-comments');
commentReply.init(); commentReply.init();
if ( typeof QTags != 'undefined' ) if ( typeof QTags != 'undefined' )
@ -358,8 +357,7 @@ $(document).ready(function(){
}; };
toggle_all = function() { toggle_all = function() {
toggleWithKeyboard = true; toggleWithKeyboard = true;
var master_checkbox = $('form#comments-form .check-column :checkbox:first'); $('#comments-form thead #cb input:checkbox').click().attr('checked', '');
master_checkbox.click().attr('checked', '');
toggleWithKeyboard = false; toggleWithKeyboard = false;
} }
make_bulk = function(value) { make_bulk = function(value) {

File diff suppressed because one or more lines are too long

View File

@ -113,7 +113,7 @@ inlineEditPost = {
}, },
edit : function(id) { edit : function(id) {
var t = this, fields, editRow, rowData, cats, status, pageOpt, f; var t = this, fields, editRow, rowData, cats, status, pageOpt, f, pageLevel, nextPage, pageLoop = true, nextLevel;
t.revert(); t.revert();
if ( typeof(id) == 'object' ) if ( typeof(id) == 'object' )
@ -159,7 +159,8 @@ inlineEditPost = {
// remove the current page and children from the parent dropdown // remove the current page and children from the parent dropdown
pageOpt = $('select[name="post_parent"] option[value="'+id+'"]', editRow); pageOpt = $('select[name="post_parent"] option[value="'+id+'"]', editRow);
if ( pageOpt.length > 0 ) { if ( pageOpt.length > 0 ) {
var pageLevel = pageOpt[0].className.split('-')[1], pageLoop = true, nextPage, nextLevel; pageLevel = pageOpt[0].className.split('-')[1];
nextPage = pageOpt;
while ( pageLoop ) { while ( pageLoop ) {
nextPage = nextPage.next('option'); nextPage = nextPage.next('option');
if (nextPage.length == 0) break; if (nextPage.length == 0) break;

File diff suppressed because one or more lines are too long

View File

@ -27,8 +27,8 @@ function send_to_editor(h) {
} }
// thickbox settings // thickbox settings
jQuery(document).ready(function($) { (function($) {
tb_position = function() { var tb_position = function() {
var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width; var tbWindow = $('#TB_window'), width = $(window).width(), H = $(window).height(), W = ( 720 < width ) ? 720 : width;
if ( tbWindow.size() ) { if ( tbWindow.size() ) {
@ -37,7 +37,6 @@ jQuery(document).ready(function($) {
tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
if ( typeof document.body.style.maxWidth != 'undefined' ) if ( typeof document.body.style.maxWidth != 'undefined' )
tbWindow.css({'top':'20px','margin-top':'0'}); tbWindow.css({'top':'20px','margin-top':'0'});
$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
}; };
return $('a.thickbox').each( function() { return $('a.thickbox').each( function() {
@ -56,6 +55,7 @@ jQuery(document).ready(function($) {
} }
}); });
$(window).resize( function() { tb_position() } ); $(window).resize(function(){ tb_position(); });
}); $(document).ready(function(){ tb_position(); });
})(jQuery);

View File

@ -1 +1 @@
function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){a.focus();if(tinymce.isIE){a.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}jQuery(document).ready(function(a){tb_position=function(){var e=a("#TB_window"),d=a(window).width(),c=a(window).height(),b=(720<d)?720:d;if(e.size()){e.width(b-50).height(c-45);a("#TB_iframeContent").width(b-50).height(c-75);e.css({"margin-left":"-"+parseInt(((b-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){e.css({top:"20px","margin-top":"0"})}a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"})}return a("a.thickbox").each(function(){var f=a(this).attr("href");if(!f){return}f=f.replace(/&width=[0-9]+/g,"");f=f.replace(/&height=[0-9]+/g,"");a(this).attr("href",f+"&width="+(b-80)+"&height="+(c-85))})};a("a.thickbox").click(function(){if(typeof tinyMCE!="undefined"&&tinyMCE.activeEditor){tinyMCE.get("content").focus();tinyMCE.activeEditor.windowManager.bookmark=tinyMCE.activeEditor.selection.getBookmark("simple")}});a(window).resize(function(){tb_position()})}); function send_to_editor(b){var a;if(typeof tinyMCE!="undefined"&&(a=tinyMCE.activeEditor)&&!a.isHidden()){a.focus();if(tinymce.isIE){a.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark)}if(b.indexOf("[caption")===0){if(a.plugins.wpeditimage){b=a.plugins.wpeditimage._do_shcode(b)}}else{if(b.indexOf("[gallery")===0){if(a.plugins.wpgallery){b=a.plugins.wpgallery._do_gallery(b)}}}a.execCommand("mceInsertContent",false,b)}else{if(typeof edInsertContent=="function"){edInsertContent(edCanvas,b)}else{jQuery(edCanvas).val(jQuery(edCanvas).val()+b)}}tb_remove()}(function(b){var a=function(){var f=b("#TB_window"),e=b(window).width(),d=b(window).height(),c=(720<e)?720:e;if(f.size()){f.width(c-50).height(d-45);b("#TB_iframeContent").width(c-50).height(d-75);f.css({"margin-left":"-"+parseInt(((c-50)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){f.css({top:"20px","margin-top":"0"})}}return b("a.thickbox").each(function(){var g=b(this).attr("href");if(!g){return}g=g.replace(/&width=[0-9]+/g,"");g=g.replace(/&height=[0-9]+/g,"");b(this).attr("href",g+"&width="+(c-80)+"&height="+(d-85))})};b("a.thickbox").click(function(){if(typeof tinyMCE!="undefined"&&tinyMCE.activeEditor){tinyMCE.get("content").focus();tinyMCE.activeEditor.windowManager.bookmark=tinyMCE.activeEditor.selection.getBookmark("simple")}});b(window).resize(function(){a()});b(document).ready(function(){a()})})(jQuery);

105
wp-admin/js/media.dev.js Normal file
View File

@ -0,0 +1,105 @@
var findPosts;
(function($){
findPosts = {
open : function(af_name, af_val) {
var st = document.documentElement.scrollTop || $(document).scrollTop();
if ( af_name && af_val ) {
$('#affected').attr('name', af_name).val(af_val);
}
$('#find-posts').show().draggable({
handle: '#find-posts-head'
}).resizable({
handles: 'all',
minHeight: 150,
minWidth: 280
}).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-200px'});
$('.ui-resizable-handle').css({
'backgroundColor': '#e5e5e5'
});
$('.ui-resizable-se').css({
'border': '0 none',
'width': '15px',
'height': '16px',
'background': 'transparent url(images/se.png) no-repeat scroll 0 0'
});
$('#find-posts-input').focus().keyup(function(e){
if (e.which == 27) { findPosts.close(); } // close on Escape
});
return false;
},
close : function() {
$('#find-posts-response').html('');
$('#find-posts').draggable('destroy').resizable('destroy').hide();
},
send : function() {
var post = {};
post['ps'] = $('#find-posts-input').val();
post['action'] = 'find_posts';
post['_ajax_nonce'] = $('#_ajax_nonce').val();
if ( $('#find-posts-pages:checked').val() ) {
post['pages'] = 1;
} else {
post['posts'] = 1;
}
$.ajax({
type : 'POST',
url : ajaxurl,
data : post,
success : function(x) { findPosts.show(x); },
error : function(r) { findPosts.error(r); }
});
},
show : function(x) {
if ( typeof(x) == 'string' ) {
this.error({'responseText': x});
return;
}
var r = wpAjax.parseAjaxResponse(x);
if ( r.errors ) {
this.error({'responseText': wpAjax.broken});
}
r = r.responses[0];
$('#find-posts-response').html(r.data);
},
error : function(r) {
var er = r.statusText;
if ( r.responseText ) {
er = r.responseText.replace( /<.[^<>]*?>/g, '' );
}
if ( er ) {
$('#find-posts-response').html(er);
}
}
};
$(document).ready(function() {
$('#find-posts-submit').click(function(e) {
if ( '' == $('#find-posts-response').html() )
e.preventDefault();
});
$('#doaction, #doaction2').click(function(e){
$('select[name^="action"]').each(function(){
if ( $(this).val() == 'attach' ) {
e.preventDefault();
findPosts.open();
}
});
});
});
})(jQuery);

1
wp-admin/js/media.js Normal file
View File

@ -0,0 +1 @@
var findPosts;(function(a){findPosts={open:function(d,c){var b=document.documentElement.scrollTop||a(document).scrollTop();if(d&&c){a("#affected").attr("name",d).val(c)}a("#find-posts").show().draggable({handle:"#find-posts-head"}).resizable({handles:"all",minHeight:150,minWidth:280}).css({top:b+50+"px",left:"50%",marginLeft:"-200px"});a(".ui-resizable-handle").css({backgroundColor:"#e5e5e5"});a(".ui-resizable-se").css({border:"0 none",width:"15px",height:"16px",background:"transparent url(images/se.png) no-repeat scroll 0 0"});a("#find-posts-input").focus().keyup(function(f){if(f.which==27){findPosts.close()}});return false},close:function(){a("#find-posts-response").html("");a("#find-posts").draggable("destroy").resizable("destroy").hide()},send:function(){var b={};b.ps=a("#find-posts-input").val();b.action="find_posts";b._ajax_nonce=a("#_ajax_nonce").val();if(a("#find-posts-pages:checked").val()){b.pages=1}else{b.posts=1}a.ajax({type:"POST",url:ajaxurl,data:b,success:function(c){findPosts.show(c)},error:function(c){findPosts.error(c)}})},show:function(b){if(typeof(b)=="string"){this.error({responseText:b});return}var c=wpAjax.parseAjaxResponse(b);if(c.errors){this.error({responseText:wpAjax.broken})}c=c.responses[0];a("#find-posts-response").html(c.data)},error:function(b){var c=b.statusText;if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#find-posts-response").html(c)}}};a(document).ready(function(){a("#find-posts-submit").click(function(b){if(""==a("#find-posts-response").html()){b.preventDefault()}});a("#doaction, #doaction2").click(function(b){a('select[name^="action"]').each(function(){if(a(this).val()=="attach"){b.preventDefault();findPosts.open()}})})})})(jQuery);

View File

@ -2,9 +2,9 @@ jQuery(document).ready( function($) {
postboxes.add_postbox_toggles('page'); postboxes.add_postbox_toggles('page');
make_slugedit_clickable(); make_slugedit_clickable();
jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } ); $('#title').blur( function() { if ( ($("#post_ID").val() > 0) || ($("#title").val().length == 0) ) return; autosave(); } );
var stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(); var stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), dotabkey = true;
function updateVisibility() { function updateVisibility() {
if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) { if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
@ -172,13 +172,13 @@ jQuery(document).ready( function($) {
}); });
// Custom Fields // Custom Fields
jQuery('#the-list').wpList( { addAfter: function( xml, s ) { $('#the-list').wpList( { addAfter: function( xml, s ) {
$('table#list-table').show(); $('table#list-table').show();
if ( jQuery.isFunction( autosave_update_post_ID ) ) { if ( $.isFunction( autosave_update_post_ID ) ) {
autosave_update_post_ID(s.parsed.responses[0].supplemental.postid); autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
} }
}, addBefore: function( s ) { }, addBefore: function( s ) {
s.data += '&post_id=' + jQuery('#post_ID').val(); s.data += '&post_id=' + $('#post_ID').val();
return s; return s;
} }
}); });
@ -196,4 +196,19 @@ jQuery(document).ready( function($) {
$('input#wp-preview').val(''); $('input#wp-preview').val('');
return false; return false;
}); });
// This code is meant to allow tabbing from Title to Post if tinyMCE is defined.
if ( typeof tinyMCE != 'undefined' ) {
$('#title')[$.browser.opera ? 'keypress' : 'keydown'](function (e) {
if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
if ( ($("#post_ID").val() < 1) && ($("#title").val().length > 0) ) { autosave(); }
if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
e.preventDefault();
dotabkey = false;
tinyMCE.activeEditor.focus();
return false;
}
}
});
}
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,3 @@
// this file contains all the scripts used in the post/edit page
// return an array with any duplicate, whitespace or values removed // return an array with any duplicate, whitespace or values removed
function array_unique_noempty(a) { function array_unique_noempty(a) {
var out = []; var out = [];
@ -37,11 +35,11 @@ function tag_update_quickclicks(taxbox) {
shown = false; shown = false;
jQuery.each( current_tags, function( key, val ) { jQuery.each( current_tags, function( key, val ) {
var txt; var txt, button_id;
val = jQuery.trim(val); val = jQuery.trim(val);
if ( !val.match(/^\s+$/) && '' != val ) { if ( !val.match(/^\s+$/) && '' != val ) {
var button_id = jQuery(taxbox).attr('id') + '-check-num-' + key; button_id = jQuery(taxbox).attr('id') + '-check-num-' + key;
txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> '; txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> ';
jQuery(taxbox).find('.tagchecklist').append(txt); jQuery(taxbox).find('.tagchecklist').append(txt);
jQuery( '#' + button_id ).click( new_tag_remove_tag ); jQuery( '#' + button_id ).click( new_tag_remove_tag );
@ -122,16 +120,77 @@ function tag_init() {
jQuery('.ajaxtag input.newtag').keypress( tag_press_key ); jQuery('.ajaxtag input.newtag').keypress( tag_press_key );
} }
var commentsBox, tagCloud;
(function($){ (function($){
commentsBox = {
st : 0,
get : function(total, num) {
var st = this.st, data;
if ( ! num )
num = 20;
this.st += num;
this.total = total;
$('.waiting').show();
data = {
'action' : 'get-comments',
'mode' : 'single',
'_ajax_nonce' : $('#add_comment_nonce').val(),
'post_ID' : $('#post_ID').val(),
'start' : st,
'num' : num
};
$.post(ajaxurl, data,
function(r) {
r = wpAjax.parseAjaxResponse(r);
$('#commentstatusdiv .widefat').show();
$('.waiting').hide();
if ( 'object' == typeof r && r.responses[0] ) {
$('#the-comment-list').append( r.responses[0].data );
theList = theExtraList = null;
$("a[className*=':']").unbind();
setCommentsList();
if ( commentsBox.st > commentsBox.total )
$('#show-comments').hide();
else
$('#show-comments').html(postL10n.showcomm);
return;
} else if ( 1 == r ) {
$('#show-comments').parent().html(postL10n.endcomm);
return;
}
$('#the-comment-list').append('<tr><td colspan="5">'+wpAjax.broken+'</td></tr>');
}
);
return false;
}
};
tagCloud = { tagCloud = {
init : function() { init : function() {
$('.tagcloud-link').click(function(){tagCloud.get($(this).attr('id')); $(this).unbind().click(function(){return false;}); return false;}); $('.tagcloud-link').click(function(){
tagCloud.get($(this).attr('id'));
$(this).unbind().click(function(){
$(this).siblings('.the-tagcloud').toggle();
return false;
});
return false;
});
}, },
get : function(id) { get : function(id) {
var tax = id.substr(id.indexOf('-')+1); var tax = id.substr(id.indexOf('-')+1);
$.post('admin-ajax.php', {'action':'get-tagcloud','tax':tax}, function(r, stat) { $.post(ajaxurl, {'action':'get-tagcloud','tax':tax}, function(r, stat) {
if ( 0 == r || 'success' != stat ) if ( 0 == r || 'success' != stat )
r = wpAjax.broken; r = wpAjax.broken;
@ -145,13 +204,13 @@ function tag_init() {
$('#'+id).after(r); $('#'+id).after(r);
}); });
} }
} };
$(document).ready(function(){tagCloud.init();});
})(jQuery); })(jQuery);
jQuery(document).ready( function($) { jQuery(document).ready( function($) {
var categoryTabs, newCat, newCatParent = false, newCatParentOption = false, noSyncChecks = false, syncChecks, catAddAfter; var categoryTabs, newCat, newCatParent = false, newCatParentOption = false, noSyncChecks = false, syncChecks, catAddAfter, dotabkey = true, stamp = $('#timestamp').html(), visibility = $('#post-visibility-display').html(), sticky = '';
tagCloud.init();
// postboxes // postboxes
postboxes.add_postbox_toggles('post'); postboxes.add_postbox_toggles('post');
@ -431,60 +490,18 @@ jQuery(document).ready( function($) {
return false; return false;
}); });
}); // This code is meant to allow tabbing from Title to Post if tinyMCE is defined.
if ( typeof tinyMCE != 'undefined' ) {
(function($){ $('#title')[$.browser.opera ? 'keypress' : 'keydown'](function (e) {
commentsBox = { if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
st : 0, if ( ($("#post_ID").val() < 1) && ($("#title").val().length > 0) ) { autosave(); }
if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
get : function(total, num) { e.preventDefault();
var st = this.st, data; dotabkey = false;
if ( ! num ) tinyMCE.activeEditor.focus();
num = 20;
this.st += num;
this.total = total;
$('.waiting').show();
data = {
'action' : 'get-comments',
'mode' : 'single',
'_ajax_nonce' : $('#add_comment_nonce').val(),
'post_ID' : $('#post_ID').val(),
'start' : st,
'num' : num
};
$.post('admin-ajax.php', data,
function(r) {
r = wpAjax.parseAjaxResponse(r);
$('#commentstatusdiv .widefat').show();
$('.waiting').hide();
if ( 'object' == typeof r && r.responses[0] ) {
$('#the-comment-list').append( r.responses[0].data );
theList = theExtraList = null;
$("a[className*=':']").unbind();
setCommentsList();
if ( commentsBox.st > commentsBox.total )
$('#show-comments').hide();
else
$('#show-comments').html(postL10n.showcomm);
return;
} else if ( 1 == r ) {
$('#show-comments').parent().html(postL10n.endcomm);
return;
}
$('#the-comment-list').append('<tr><td colspan="5">'+wpAjax.broken+'</td></tr>');
}
);
return false; return false;
} }
}; }
});
})(jQuery); }
});

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,4 @@
var postboxes;
(function($) { (function($) {
postboxes = { postboxes = {
add_postbox_toggles : function(page,args) { add_postbox_toggles : function(page,args) {

View File

@ -1 +1 @@
(function(a){postboxes={add_postbox_toggles:function(c,b){a(".postbox h3, .postbox .handlediv").click(function(){a(a(this).parent().get(0)).toggleClass("closed");postboxes.save_state(c)});a(".postbox h3 a").click(function(d){d.stopPropagation()});a(".hide-postbox-tog").click(function(){var d=jQuery(this).val();if(jQuery(this).attr("checked")){jQuery("#"+d).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(d)}}else{jQuery("#"+d).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(d)}}postboxes.save_state(c)});this.expandSidebar();this.init(c,b)},expandSidebar:function(b){if(b||a("#side-sortables > .postbox:visible").length){if(!a("#post-body").hasClass("has-sidebar")){a("#post-body").addClass("has-sidebar");var c=Math.min(a("#post-body").height(),300);a("#side-sortables").css({minHeight:c+"px",height:"auto"})}}else{a("#post-body").removeClass("has-sidebar");a("#side-sortables").css({minHeight:"0"});if(a.browser.msie&&a.browser.version.charAt(0)==7){a("#side-sortables").css({height:"0"})}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:[".meta-box-sortables"],items:"> .postbox",handle:".hndle",distance:2,tolerance:"pointer",toleranceMove:"tolerance",sort:function(f,d){if(a(document).width()-f.clientX<300){if(!a("#post-body").hasClass("has-sidebar")){var g=a("#side-sortables").offset();a("#side-sortables").append(d.item);a(d.placeholder).css({top:g.top,left:g.left}).width(a(d.item).width());postboxes.expandSidebar(1)}}},stop:function(){var d={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page:c};a(".meta-box-sortables").each(function(){d["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,d,function(){postboxes.expandSidebar()})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d});postboxes.expandSidebar()},pbshow:false,pbhide:false}}(jQuery)); var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){a(".postbox h3, .postbox .handlediv").click(function(){a(a(this).parent().get(0)).toggleClass("closed");postboxes.save_state(c)});a(".postbox h3 a").click(function(d){d.stopPropagation()});a(".hide-postbox-tog").click(function(){var d=jQuery(this).val();if(jQuery(this).attr("checked")){jQuery("#"+d).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(d)}}else{jQuery("#"+d).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(d)}}postboxes.save_state(c)});this.expandSidebar();this.init(c,b)},expandSidebar:function(b){if(b||a("#side-sortables > .postbox:visible").length){if(!a("#post-body").hasClass("has-sidebar")){a("#post-body").addClass("has-sidebar");var c=Math.min(a("#post-body").height(),300);a("#side-sortables").css({minHeight:c+"px",height:"auto"})}}else{a("#post-body").removeClass("has-sidebar");a("#side-sortables").css({minHeight:"0"});if(a.browser.msie&&a.browser.version.charAt(0)==7){a("#side-sortables").css({height:"0"})}}},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:[".meta-box-sortables"],items:"> .postbox",handle:".hndle",distance:2,tolerance:"pointer",toleranceMove:"tolerance",sort:function(f,d){if(a(document).width()-f.clientX<300){if(!a("#post-body").hasClass("has-sidebar")){var g=a("#side-sortables").offset();a("#side-sortables").append(d.item);a(d.placeholder).css({top:g.top,left:g.left}).width(a(d.item).width());postboxes.expandSidebar(1)}}},stop:function(){var d={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page:c};a(".meta-box-sortables").each(function(){d["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(postboxL10n.requestFile,d,function(){postboxes.expandSidebar()})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(postboxL10n.requestFile,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d});postboxes.expandSidebar()},pbshow:false,pbhide:false}}(jQuery));

View File

@ -24,5 +24,4 @@ jQuery(document).ready(function($) {
else else
$('#the-list').wpList({ addAfter: addAfter2 }); $('#the-list').wpList({ addAfter: addAfter2 });
columns.init('edit-tags');
}); });

View File

@ -1 +1 @@
jQuery(document).ready(function(c){var b=false,e,d,a;e=function(h,g){var f=c("<span>"+c("name",h).text()+"</span>").html(),i=c("tag",h).attr("id");b[b.length]=new Option(f,i)};d=function(f,h){var g=c(h.parsed.responses[0].data);if(g.length==1){inlineEditTax.addEvents(c(g.id))}};a=function(g,f){var i=c("tag",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};if(b){c("#the-list").wpList({addAfter:e,delAfter:a})}else{c("#the-list").wpList({addAfter:d})}columns.init("edit-tags")}); jQuery(document).ready(function(c){var b=false,e,d,a;e=function(h,g){var f=c("<span>"+c("name",h).text()+"</span>").html(),i=c("tag",h).attr("id");b[b.length]=new Option(f,i)};d=function(f,h){var g=c(h.parsed.responses[0].data);if(g.length==1){inlineEditTax.addEvents(c(g.id))}};a=function(g,f){var i=c("tag",g).attr("id"),h;for(h=0;h<b.length;h++){if(i==b[h].value){b[h]=null}}};if(b){c("#the-list").wpList({addAfter:e,delAfter:a})}else{c("#the-list").wpList({addAfter:d})}});

View File

@ -1,5 +0,0 @@
jQuery( function($) {
$('#users').wpList();
columns.init('users');
});

166
wp-admin/js/utils.dev.js Normal file
View File

@ -0,0 +1,166 @@
// utility functions
function convertEntities(o) {
var c, v;
c = function(s) {
if (/&[^;]+;/.test(s)) {
var e = document.createElement("div");
e.innerHTML = s;
return !e.firstChild ? s : e.firstChild.nodeValue;
}
return s;
}
if ( typeof o === 'string' ) {
return c(o);
} else if ( typeof o === 'object' ) {
for (v in o) {
if ( typeof o[v] === 'string' ) {
o[v] = c(o[v]);
}
}
}
return o;
}
var wpCookies = {
// The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL.
each : function(o, cb, s) {
var n, l;
if (!o)
return 0;
s = s || o;
if (typeof(o.length) != 'undefined') {
for (n=0, l = o.length; n<l; n++) {
if (cb.call(s, o[n], n, o) === false)
return 0;
}
} else {
for (n in o) {
if (o.hasOwnProperty(n)) {
if (cb.call(s, o[n], n, o) === false) {
return 0;
}
}
}
}
return 1;
},
getHash : function(n) {
var v = this.get(n), h;
if (v) {
this.each(v.split('&'), function(v) {
v = v.split('=');
h = h || {};
h[v[0]] = v[1];
});
}
return h;
},
setHash : function(n, v, e, p, d, s) {
var o = '';
this.each(v, function(v, k) {
o += (!o ? '' : '&') + k + '=' + v;
});
this.set(n, o, e, p, d, s);
},
get : function(n) {
var c = document.cookie, e, p = n + "=", b;
if (!c)
return;
b = c.indexOf("; " + p);
if (b == -1) {
b = c.indexOf(p);
if (b != 0)
return null;
} else {
b += 2;
}
e = c.indexOf(";", b);
if (e == -1)
e = c.length;
return decodeURIComponent(c.substring(b + p.length, e));
},
set : function(n, v, e, p, d, s) {
document.cookie = n + "=" + encodeURIComponent(v) +
((e) ? "; expires=" + e.toGMTString() : "") +
((p) ? "; path=" + p : "") +
((d) ? "; domain=" + d : "") +
((s) ? "; secure" : "");
},
remove : function(n, p) {
var d = new Date();
d.setTime(d.getTime() - 1000);
this.set(n, '', d, p, d);
}
};
// Returns the value as string. Second arg or empty string is returned when value is not set.
function getUserSetting( name, def ) {
var o = getAllUserSettings();
if ( o.hasOwnProperty(name) )
return o[name];
if ( typeof def != 'undefined' )
return def;
return '';
}
// Both name and value must be only ASCII letters, numbers or underscore
// and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
function setUserSetting( name, value, del ) {
if ( 'object' !== typeof userSettings )
return false;
var c = 'wp-settings-' + userSettings.uid, o = wpCookies.getHash(c) || {}, d = new Date(), p,
n = name.toString().replace(/[^A-Za-z0-9_]/, ''), v = value.toString().replace(/[^A-Za-z0-9_]/, '');
if ( del ) {
delete o[n];
} else {
o[n] = v;
}
d.setTime( d.getTime() + 31536000000 );
p = userSettings.url;
wpCookies.setHash(c, o, d, p);
wpCookies.set('wp-settings-time-'+userSettings.uid, userSettings.time, d, p);
return name;
}
function deleteUserSetting( name ) {
return setUserSetting( name, '', 1 );
}
// Returns all settings as js object.
function getAllUserSettings() {
if ( 'object' !== typeof userSettings )
return {};
return wpCookies.getHash('wp-settings-' + userSettings.uid) || {};
}

1
wp-admin/js/utils.js Normal file
View File

@ -0,0 +1 @@
function convertEntities(b){var d,a;d=function(c){if(/&[^;]+;/.test(c)){var f=document.createElement("div");f.innerHTML=c;return !f.firstChild?c:f.firstChild.nodeValue}return c};if(typeof b==="string"){return d(b)}else{if(typeof b==="object"){for(a in b){if(typeof b[a]==="string"){b[a]=d(b[a])}}}}return b}var wpCookies={each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},getHash:function(c){var a=this.get(c),b;if(a){this.each(a.split("&"),function(d){d=d.split("=");b=b||{};b[d[0]]=d[1]})}return b},setHash:function(i,a,f,c,h,b){var g="";this.each(a,function(e,d){g+=(!g?"":"&")+d+"="+e});this.set(i,g,f,c,h,b)},get:function(h){var g=document.cookie,f,d=h+"=",a;if(!g){return}a=g.indexOf("; "+d);if(a==-1){a=g.indexOf(d);if(a!=0){return null}}else{a+=2}f=g.indexOf(";",a);if(f==-1){f=g.length}return decodeURIComponent(g.substring(a+d.length,f))},set:function(h,a,f,c,g,b){document.cookie=h+"="+encodeURIComponent(a)+((f)?"; expires="+f.toGMTString():"")+((c)?"; path="+c:"")+((g)?"; domain="+g:"")+((b)?"; secure":"")},remove:function(c,a){var b=new Date();b.setTime(b.getTime()-1000);this.set(c,"",b,a,b)}};function getUserSetting(a,b){var c=getAllUserSettings();if(c.hasOwnProperty(a)){return c[a]}if(typeof b!="undefined"){return b}return""}function setUserSetting(a,i,k){if("object"!==typeof userSettings){return false}var h="wp-settings-"+userSettings.uid,e=wpCookies.getHash(h)||{},g=new Date(),b,f=a.toString().replace(/[^A-Za-z0-9_]/,""),j=i.toString().replace(/[^A-Za-z0-9_]/,"");if(k){delete e[f]}else{e[f]=j}g.setTime(g.getTime()+31536000000);b=userSettings.url;wpCookies.setHash(h,e,g,b);wpCookies.set("wp-settings-time-"+userSettings.uid,userSettings.time,g,b);return a}function deleteUserSetting(a){return setUserSetting(a,"",1)}function getAllUserSettings(){if("object"!==typeof userSettings){return{}}return wpCookies.getHash("wp-settings-"+userSettings.uid)||{}};

View File

@ -270,20 +270,5 @@ if ( $links ) {
</div> </div>
<script type="text/javascript"> <?php
/* <![CDATA[ */ include('admin-footer.php');
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(){
if ( $('select[name^="action"]').val() == 'delete' ) {
var m = '<?php echo js_escape(__("You are about to delete the selected links.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
}
});
});
})(jQuery);
columns.init('link-manager');
/* ]]> */
</script>
<?php include('admin-footer.php'); ?>

View File

@ -136,6 +136,7 @@ if ( isset($_GET['detached']) ) {
list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query(); list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
} }
wp_enqueue_script('media');
require_once('admin-header.php'); ?> require_once('admin-header.php'); ?>
<?php <?php
@ -410,26 +411,5 @@ if ( $page_links )
</div> </div>
<script type="text/javascript">
/* <![CDATA[ */
(function($){
$(document).ready(function(){
$('#doaction, #doaction2').click(function(e){
if ( $('select[name^="action"]').val() == 'delete' ) {
var m = '<?php echo js_escape(__("You are about to delete the selected attachments.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
return showNotice.warn(m);
} else if ( $('select[name^="action"]').val() == 'attach' ) {
e.preventDefault();
findPosts.open();
}
});
});
})(jQuery);
columns.init('upload');
/* ]]> */
</script>
<?php <?php
include('admin-footer.php'); include('admin-footer.php');
?>

View File

@ -36,7 +36,7 @@ if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
$title = __('Add New User'); $title = __('Add New User');
$parent_file = 'users.php'; $parent_file = 'users.php';
wp_enqueue_script('admin-users'); wp_enqueue_script('wp-ajax-response');
require_once ('admin-header.php'); require_once ('admin-header.php');
@ -137,7 +137,6 @@ foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name
</form> </form>
</div> </div>
<?php <?php
include('admin-footer.php'); include('admin-footer.php');
?> ?>

View File

@ -187,8 +187,6 @@ default:
exit; exit;
} }
wp_enqueue_script('admin-users');
include('admin-header.php'); include('admin-header.php');
$usersearch = isset($_GET['usersearch']) ? $_GET['usersearch'] : null; $usersearch = isset($_GET['usersearch']) ? $_GET['usersearch'] : null;

View File

@ -109,6 +109,11 @@ table#availablethemes td.bottom {
text-decoration: none; text-decoration: none;
} }
#TB_window #TB_title {
background-color: #222;
color: #cfcfcf;
}
.checkbox { .checkbox {
border: none; border: none;
margin: 0; margin: 0;

View File

@ -748,14 +748,13 @@ function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = '
/** /**
* @since 2.1 * @since 2.1
* @deprecated Use wp_print_scripts() or WP_Scripts. * @deprecated Use wp_tiny_mce().
* @see wp_print_scripts() * @see wp_tiny_mce()
* @see WP_Scripts
*/ */
function tinymce_include() { function tinymce_include() {
_deprecated_function(__FUNCTION__, '0.0', 'wp_print_scripts()/WP_Scripts'); _deprecated_function(__FUNCTION__, '0.0', 'wp_tiny_mce()');
wp_print_script('wp_tiny_mce'); wp_tiny_mce();
} }
/** /**

View File

@ -1530,27 +1530,9 @@ function the_editor($content, $id = 'content', $prev_id = 'title', $media_button
?> ?>
<script type="text/javascript"> <script type="text/javascript">
// <![CDATA[ /* <![CDATA[ */
edCanvas = document.getElementById('<?php echo $id; ?>'); edCanvas = document.getElementById('<?php echo $id; ?>');
<?php if ( user_can_richedit() && $prev_id ) { ?> /* ]]> */
var dotabkey = true;
// If tinyMCE is defined.
if ( typeof tinyMCE != 'undefined' ) {
// This code is meant to allow tabbing from Title to Post (TinyMCE).
jQuery('#<?php echo $prev_id; ?>')[jQuery.browser.opera ? 'keypress' : 'keydown'](function (e) {
if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
e.preventDefault();
dotabkey = false;
tinyMCE.activeEditor.focus();
return false;
}
}
});
}
<?php } ?>
// ]]>
</script> </script>
<?php <?php
} }

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
(function(C){C.ui={plugin:{add:function(E,F,H){var G=C.ui[E].prototype;for(var D in H){G.plugins[D]=G.plugins[D]||[];G.plugins[D].push([F,H[D]])}},call:function(D,F,E){var H=D.plugins[F];if(!H){return }for(var G=0;G<H.length;G++){if(D.options[H[G][0]]){H[G][1].apply(D.element,E)}}}},cssCache:{},css:function(D){if(C.ui.cssCache[D]){return C.ui.cssCache[D]}var E=C('<div class="ui-gen">').addClass(D).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[D]=!!((!(/auto|default/).test(E.css("cursor"))||(/^[1-9]/).test(E.css("height"))||(/^[1-9]/).test(E.css("width"))||!(/none/).test(E.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor"))));try{C("body").get(0).removeChild(E.get(0))}catch(F){}return C.ui.cssCache[D]},disableSelection:function(D){C(D).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(D){C(D).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(G,E){var D=/top/.test(E||"top")?"scrollTop":"scrollLeft",F=false;if(G[D]>0){return true}G[D]=1;F=G[D]>0?true:false;G[D]=0;return F}};var B=C.fn.remove;C.fn.remove=function(){C("*",this).add(this).triggerHandler("remove");return B.apply(this,arguments)};function A(E,F,G){var D=C[E][F].getter||[];D=(typeof D=="string"?D.split(/,?\s+/):D);return(C.inArray(G,D)!=-1)}C.widget=function(E,D){var F=E.split(".")[0];E=E.split(".")[1];C.fn[E]=function(J){var H=(typeof J=="string"),I=Array.prototype.slice.call(arguments,1);if(H&&A(F,E,J)){var G=C.data(this[0],E);return(G?G[J].apply(G,I):undefined)}return this.each(function(){var K=C.data(this,E);if(H&&K&&C.isFunction(K[J])){K[J].apply(K,I)}else{if(!H){C.data(this,E,new C[F][E](this,J))}}})};C[F][E]=function(I,H){var G=this;this.widgetName=E;this.widgetBaseClass=F+"-"+E;this.options=C.extend({},C.widget.defaults,C[F][E].defaults,H);this.element=C(I).bind("setData."+E,function(L,J,K){return G.setData(J,K)}).bind("getData."+E,function(K,J){return G.getData(J)}).bind("remove",function(){return G.destroy()});this.init()};C[F][E].prototype=C.extend({},C.widget.prototype,D)};C.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(D){return this.options[D]},setData:function(D,E){this.options[D]=E;if(D=="disabled"){this.element[E?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)},disable:function(){this.setData("disabled",true)}};C.widget.defaults={disabled:false};C.ui.mouse={mouseInit:function(){var D=this;this.element.bind("mousedown."+this.widgetName,function(E){return D.mouseDown(E)});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},mouseDown:function(F){(this._mouseStarted&&this.mouseUp(F));this._mouseDownEvent=F;var E=this,G=(F.which==1),D=(typeof this.options.cancel=="string"?C(F.target).parents().add(F.target).filter(this.options.cancel).length:false);if(!G||D||!this.mouseCapture(F)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){E._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(F)&&this.mouseDelayMet(F)){this._mouseStarted=(this.mouseStart(F)!==false);if(!this._mouseStarted){F.preventDefault();return true}}this._mouseMoveDelegate=function(H){return E.mouseMove(H)};this._mouseUpDelegate=function(H){return E.mouseUp(H)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return false},mouseMove:function(D){if(C.browser.msie&&!D.button){return this.mouseUp(D)}if(this._mouseStarted){this.mouseDrag(D);return false}if(this.mouseDistanceMet(D)&&this.mouseDelayMet(D)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,D)!==false);(this._mouseStarted?this.mouseDrag(D):this.mouseUp(D))}return !this._mouseStarted},mouseUp:function(D){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(D)}return false},mouseDistanceMet:function(D){return(Math.max(Math.abs(this._mouseDownEvent.pageX-D.pageX),Math.abs(this._mouseDownEvent.pageY-D.pageY))>=this.options.distance)},mouseDelayMet:function(D){return this._mouseDelayMet},mouseStart:function(D){},mouseDrag:function(D){},mouseStop:function(D){},mouseCapture:function(D){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery) (function(C){C.ui={plugin:{add:function(E,F,H){var G=C.ui[E].prototype;for(var D in H){G.plugins[D]=G.plugins[D]||[];G.plugins[D].push([F,H[D]])}},call:function(D,F,E){var H=D.plugins[F];if(!H){return }for(var G=0;G<H.length;G++){if(D.options[H[G][0]]){H[G][1].apply(D.element,E)}}}},cssCache:{},css:function(D){if(C.ui.cssCache[D]){return C.ui.cssCache[D]}var E=C('<div class="ui-gen">').addClass(D).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[D]=!!((!(/auto|default/).test(E.css("cursor"))||(/^[1-9]/).test(E.css("height"))||(/^[1-9]/).test(E.css("width"))||!(/none/).test(E.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(E.css("backgroundColor"))));try{C("body").get(0).removeChild(E.get(0))}catch(F){}return C.ui.cssCache[D]},disableSelection:function(D){C(D).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(D){C(D).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(G,E){var D=/top/.test(E||"top")?"scrollTop":"scrollLeft",F=false;if(G[D]>0){return true}G[D]=1;F=G[D]>0?true:false;G[D]=0;return F}};var B=C.fn.remove;C.fn.remove=function(){C("*",this).add(this).triggerHandler("remove");return B.apply(this,arguments)};function A(E,F,G){var D=C[E][F].getter||[];D=(typeof D=="string"?D.split(/,?\s+/):D);return(C.inArray(G,D)!=-1)}C.widget=function(E,D){var F=E.split(".")[0];E=E.split(".")[1];C.fn[E]=function(J){var H=(typeof J=="string"),I=Array.prototype.slice.call(arguments,1);if(H&&A(F,E,J)){var G=C.data(this[0],E);return(G?G[J].apply(G,I):undefined)}return this.each(function(){var K=C.data(this,E);if(H&&K&&C.isFunction(K[J])){K[J].apply(K,I)}else{if(!H){C.data(this,E,new C[F][E](this,J))}}})};C[F][E]=function(I,H){var G=this;this.widgetName=E;this.widgetBaseClass=F+"-"+E;this.options=C.extend({},C.widget.defaults,C[F][E].defaults,H);this.element=C(I).bind("setData."+E,function(L,J,K){return G.setData(J,K)}).bind("getData."+E,function(K,J){return G.getData(J)}).bind("remove",function(){return G.destroy()});this.init()};C[F][E].prototype=C.extend({},C.widget.prototype,D)};C.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(D){return this.options[D]},setData:function(D,E){this.options[D]=E;if(D=="disabled"){this.element[E?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)},disable:function(){this.setData("disabled",true)}};C.widget.defaults={disabled:false};C.ui.mouse={mouseInit:function(){var D=this;this.element.bind("mousedown."+this.widgetName,function(E){return D.mouseDown(E)});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},mouseDown:function(F){(this._mouseStarted&&this.mouseUp(F));this._mouseDownEvent=F;var E=this,G=(F.which==1),D=(typeof this.options.cancel=="string"?C(F.target).parents().add(F.target).filter(this.options.cancel).length:false);if(!G||D||!this.mouseCapture(F)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){E._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(F)&&this.mouseDelayMet(F)){this._mouseStarted=(this.mouseStart(F)!==false);if(!this._mouseStarted){F.preventDefault();return true}}this._mouseMoveDelegate=function(H){return E.mouseMove(H)};this._mouseUpDelegate=function(H){return E.mouseUp(H)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return false},mouseMove:function(D){if(C.browser.msie&&!D.button){return this.mouseUp(D)}if(this._mouseStarted){this.mouseDrag(D);return false}if(this.mouseDistanceMet(D)&&this.mouseDelayMet(D)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,D)!==false);(this._mouseStarted?this.mouseDrag(D):this.mouseUp(D))}return !this._mouseStarted},mouseUp:function(D){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(D)}return false},mouseDistanceMet:function(D){return(Math.max(Math.abs(this._mouseDownEvent.pageX-D.pageX),Math.abs(this._mouseDownEvent.pageY-D.pageY))>=this.options.distance)},mouseDelayMet:function(D){return this._mouseDelayMet},mouseStart:function(D){},mouseDrag:function(D){},mouseStop:function(D){},mouseCapture:function(D){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -57,3 +57,8 @@ var wpAjax = jQuery.extend( {
return !wpAjax.invalidateForm( selector.find('.form-required').andSelf().filter('.form-required:has(:input[value=""]), .form-required:input[value=""]') ).size(); return !wpAjax.invalidateForm( selector.find('.form-required').andSelf().filter('.form-required:has(:input[value=""]), .form-required:input[value=""]') ).size();
} }
}, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } ); }, wpAjax || { noPerm: 'You do not have permission to do that.', broken: 'An unidentified error has occurred.' } );
// Basic form validation
jQuery(document).ready( function($){
$('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } );
});

View File

@ -1 +1 @@
var wpAjax=jQuery.extend({unserialize:function(c){var d={},e,a,b,f;if(!c){return d}e=c.split("?");if(e[1]){c=e[1]}a=c.split("&");for(b in a){if(jQuery.isFunction(a.hasOwnProperty)&&!a.hasOwnProperty(b)){continue}f=a[b].split("=");d[f[0]]=f[1]}return d},parseAjaxResponse:function(a,f,g){var b={},c=jQuery("#"+f).html(""),d="";if(a&&typeof a=="object"&&a.getElementsByTagName("wp_ajax")){b.responses=[];b.errors=false;jQuery("response",a).each(function(){var h=jQuery(this),i=jQuery(this.firstChild),e;e={action:h.attr("action"),what:i.get(0).nodeName,id:i.attr("id"),oldId:i.attr("old_id"),position:i.attr("position")};e.data=jQuery("response_data",i).text();e.supplemental={};if(!jQuery("supplemental",i).children().each(function(){e.supplemental[this.nodeName]=jQuery(this).text()}).size()){e.supplemental=false}e.errors=[];if(!jQuery("wp_error",i).each(function(){var j=jQuery(this).attr("code"),m,l,k;m={code:j,message:this.firstChild.nodeValue,data:false};l=jQuery('wp_error_data[code="'+j+'"]',a);if(l){m.data=l.get()}k=jQuery("form-field",l).text();if(k){j=k}if(g){wpAjax.invalidateForm(jQuery("#"+g+' :input[name="'+j+'"]').parents(".form-field:first"))}d+="<p>"+m.message+"</p>";e.errors.push(m);b.errors=true}).size()){e.errors=false}b.responses.push(e)});if(d.length){c.html('<div class="error">'+d+"</div>")}return b}if(isNaN(a)){return !c.html('<div class="error"><p>'+a+"</p></div>")}a=parseInt(a,10);if(-1==a){return !c.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>")}else{if(0===a){return !c.html('<div class="error"><p>'+wpAjax.broken+"</p></div>")}}return true},invalidateForm:function(a){return jQuery(a).addClass("form-invalid").change(function(){jQuery(this).removeClass("form-invalid")})},validateForm:function(a){a=jQuery(a);return !wpAjax.invalidateForm(a.find(".form-required").andSelf().filter('.form-required:has(:input[value=""]), .form-required:input[value=""]')).size()}},wpAjax||{noPerm:"You do not have permission to do that.",broken:"An unidentified error has occurred."}); var wpAjax=jQuery.extend({unserialize:function(c){var d={},e,a,b,f;if(!c){return d}e=c.split("?");if(e[1]){c=e[1]}a=c.split("&");for(b in a){if(jQuery.isFunction(a.hasOwnProperty)&&!a.hasOwnProperty(b)){continue}f=a[b].split("=");d[f[0]]=f[1]}return d},parseAjaxResponse:function(a,f,g){var b={},c=jQuery("#"+f).html(""),d="";if(a&&typeof a=="object"&&a.getElementsByTagName("wp_ajax")){b.responses=[];b.errors=false;jQuery("response",a).each(function(){var h=jQuery(this),i=jQuery(this.firstChild),e;e={action:h.attr("action"),what:i.get(0).nodeName,id:i.attr("id"),oldId:i.attr("old_id"),position:i.attr("position")};e.data=jQuery("response_data",i).text();e.supplemental={};if(!jQuery("supplemental",i).children().each(function(){e.supplemental[this.nodeName]=jQuery(this).text()}).size()){e.supplemental=false}e.errors=[];if(!jQuery("wp_error",i).each(function(){var j=jQuery(this).attr("code"),m,l,k;m={code:j,message:this.firstChild.nodeValue,data:false};l=jQuery('wp_error_data[code="'+j+'"]',a);if(l){m.data=l.get()}k=jQuery("form-field",l).text();if(k){j=k}if(g){wpAjax.invalidateForm(jQuery("#"+g+' :input[name="'+j+'"]').parents(".form-field:first"))}d+="<p>"+m.message+"</p>";e.errors.push(m);b.errors=true}).size()){e.errors=false}b.responses.push(e)});if(d.length){c.html('<div class="error">'+d+"</div>")}return b}if(isNaN(a)){return !c.html('<div class="error"><p>'+a+"</p></div>")}a=parseInt(a,10);if(-1==a){return !c.html('<div class="error"><p>'+wpAjax.noPerm+"</p></div>")}else{if(0===a){return !c.html('<div class="error"><p>'+wpAjax.broken+"</p></div>")}}return true},invalidateForm:function(a){return jQuery(a).addClass("form-invalid").change(function(){jQuery(this).removeClass("form-invalid")})},validateForm:function(a){a=jQuery(a);return !wpAjax.invalidateForm(a.find(".form-required").andSelf().filter('.form-required:has(:input[value=""]), .form-required:input[value=""]')).size()}},wpAjax||{noPerm:"You do not have permission to do that.",broken:"An unidentified error has occurred."});jQuery(document).ready(function(a){a("form.validate").submit(function(){return wpAjax.validateForm(a(this))})});

View File

@ -42,7 +42,13 @@ function wp_default_scripts( &$scripts ) {
$scripts->default_version = get_bloginfo( 'version' ); $scripts->default_version = get_bloginfo( 'version' );
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent'), '20090106' ); $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090106' );
$scripts->localize( 'common', 'commonL10n', array(
'warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
) );
$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' ); $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", false, '1.6.1' );
@ -183,8 +189,6 @@ function wp_default_scripts( &$scripts ) {
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']) 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
) ); ) );
$scripts->add( 'admin-users', "/wp-admin/js/users$suffix.js", array('wp-lists'), '20090102' );
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' ); $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090102' ); $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20090102' );
@ -404,7 +408,6 @@ function wp_prototype_before_jquery( $js_array ) {
* @since 2.5.0 * @since 2.5.0
*/ */
function wp_just_in_time_script_localization() { function wp_just_in_time_script_localization() {
global $current_user;
wp_localize_script( 'autosave', 'autosaveL10n', array( wp_localize_script( 'autosave', 'autosaveL10n', array(
'autosaveInterval' => AUTOSAVE_INTERVAL, 'autosaveInterval' => AUTOSAVE_INTERVAL,
@ -414,13 +417,6 @@ function wp_just_in_time_script_localization() {
'savingText' => __('Saving Draft&#8230;'), 'savingText' => __('Saving Draft&#8230;'),
'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};' 'l10n_print_after' => 'try{convertEntities(autosaveL10n);}catch(e){};'
) ); ) );
$userid = isset($current_user) ? $current_user->ID : 0;
wp_localize_script( 'common', 'userSettings', array(
'url' => SITECOOKIEPATH,
'uid' => $userid,
'time' => time()
) );
} }
/** /**