2009-01-12 14:43:17 +01:00
|
|
|
var showNotice, adminMenu, columns;
|
|
|
|
(function($){
|
|
|
|
// sidebar admin menu
|
|
|
|
adminMenu = {
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
init : function() {
|
|
|
|
$('#adminmenu div.wp-menu-toggle').each( function() {
|
|
|
|
if ( $(this).siblings('.wp-submenu').length )
|
|
|
|
$(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); });
|
|
|
|
else
|
|
|
|
$(this).hide();
|
|
|
|
});
|
|
|
|
$('#adminmenu li.menu-top .wp-menu-image').click( function() { window.location = $(this).siblings('a.menu-top')[0].href; } );
|
|
|
|
this.favorites();
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
$('.wp-menu-separator').click(function(){
|
2009-04-04 19:07:31 +02:00
|
|
|
if ( $('body').hasClass('folded') ) {
|
2009-01-12 14:43:17 +01:00
|
|
|
adminMenu.fold(1);
|
|
|
|
setUserSetting( 'mfold', 'o' );
|
|
|
|
} else {
|
|
|
|
adminMenu.fold();
|
|
|
|
setUserSetting( 'mfold', 'f' );
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
2009-01-12 14:43:17 +01:00
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
if ( 'f' != getUserSetting( 'mfold' ) ) {
|
|
|
|
this.restoreMenuState();
|
|
|
|
} else {
|
|
|
|
this.fold();
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
restoreMenuState : function() {
|
|
|
|
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
|
|
|
|
var v = getUserSetting( 'm'+i );
|
|
|
|
if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
if ( 'o' == v ) $(e).addClass('wp-menu-open');
|
|
|
|
else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
|
2009-01-02 16:08:58 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
toggle : function(el) {
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' );
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
$('#adminmenu li.wp-has-submenu').each(function(i, e) {
|
|
|
|
var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
|
|
|
|
setUserSetting( 'm'+i, v );
|
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
return false;
|
|
|
|
},
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
fold : function(off) {
|
|
|
|
if (off) {
|
2009-04-04 19:07:31 +02:00
|
|
|
$('body').removeClass('folded');
|
2009-01-12 14:43:17 +01:00
|
|
|
$('#adminmenu li.wp-has-submenu').unbind();
|
|
|
|
} else {
|
2009-04-04 19:07:31 +02:00
|
|
|
$('body').addClass('folded');
|
2009-01-12 14:43:17 +01:00
|
|
|
$('#adminmenu li.wp-has-submenu').hoverIntent({
|
|
|
|
over: function(e){
|
|
|
|
var m = $(this).find('.wp-submenu'), t = e.clientY, H = $(window).height(), h = m.height(), o;
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
if ( (t+h+10) > H ) {
|
|
|
|
o = (t+h+10) - H;
|
|
|
|
m.css({'marginTop':'-'+o+'px'});
|
|
|
|
} else if ( m.css('marginTop') ) {
|
|
|
|
m.css({'marginTop':''});
|
|
|
|
}
|
|
|
|
m.addClass('sub-open');
|
|
|
|
},
|
|
|
|
out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); },
|
|
|
|
timeout: 220,
|
|
|
|
sensitivity: 8,
|
|
|
|
interval: 100
|
|
|
|
});
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
}
|
2009-01-02 16:08:58 +01:00
|
|
|
},
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
favorites : function() {
|
|
|
|
$('#favorite-inside').width($('#favorite-actions').width()-4);
|
|
|
|
$('#favorite-toggle, #favorite-inside').bind( 'mouseenter', function(){$('#favorite-inside').removeClass('slideUp').addClass('slideDown'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideDown') ) { $('#favorite-inside').slideDown(100); $('#favorite-first').addClass('slide-down'); }}, 200) } );
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
$('#favorite-toggle, #favorite-inside').bind( 'mouseleave', function(){$('#favorite-inside').removeClass('slideDown').addClass('slideUp'); setTimeout(function(){if ( $('#favorite-inside').hasClass('slideUp') ) { $('#favorite-inside').slideUp(100, function(){ $('#favorite-first').removeClass('slide-down'); } ); }}, 300) } );
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
$(document).ready(function(){adminMenu.init();});
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
// show/hide/save table columns
|
|
|
|
columns = {
|
|
|
|
init : function() {
|
|
|
|
$('.hide-column-tog').click( function() {
|
|
|
|
var column = $(this).val(), show = $(this).attr('checked');
|
|
|
|
if ( show ) {
|
|
|
|
$('.column-' + column).show();
|
|
|
|
} else {
|
|
|
|
$('.column-' + column).hide();
|
|
|
|
}
|
|
|
|
columns.save_manage_columns_state();
|
|
|
|
} );
|
|
|
|
},
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
save_manage_columns_state : function() {
|
|
|
|
var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
|
|
|
|
$.post(ajaxurl, {
|
|
|
|
action: 'hidden-columns',
|
|
|
|
hidden: hidden,
|
2009-04-05 10:25:10 +02:00
|
|
|
screenoptionnonce: $('#screenoptionnonce').val(),
|
2009-01-12 14:43:17 +01:00
|
|
|
page: pagenow
|
|
|
|
});
|
|
|
|
}
|
2009-01-02 16:08:58 +01:00
|
|
|
}
|
2009-03-27 23:47:47 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
$(document).ready(function(){columns.init();});
|
2009-03-27 23:47:47 +01:00
|
|
|
|
|
|
|
screenOptions = {
|
|
|
|
init : function() {
|
2009-04-05 10:25:10 +02:00
|
|
|
$('.screen-per-page').change(function() {
|
2009-04-05 10:34:51 +02:00
|
|
|
var option = this.id, value = parseInt($(this).val(), 10);
|
2009-04-05 10:25:10 +02:00
|
|
|
if ( isNaN(value) ) {
|
|
|
|
$(this).val('');
|
|
|
|
return;
|
|
|
|
}
|
2009-03-27 23:58:53 +01:00
|
|
|
screenOptions.save_screen_option(option, value);
|
2009-04-05 10:25:10 +02:00
|
|
|
}).parents('form').submit(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
2009-03-27 23:58:53 +01:00
|
|
|
});
|
2009-03-27 23:47:47 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
save_screen_option : function (option, value) {
|
|
|
|
$.post(ajaxurl, {
|
|
|
|
action: 'set-screen-option',
|
|
|
|
option: option,
|
|
|
|
value: value,
|
|
|
|
screenoptionnonce: $('#screenoptionnonce').val(),
|
|
|
|
page: pagenow
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function(){screenOptions.init();});
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
})(jQuery);
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
// stub for doing better warnings
|
|
|
|
showNotice = {
|
|
|
|
warn : function() {
|
|
|
|
var msg = commonL10n.warnDelete || '';
|
|
|
|
if ( confirm(msg) ) {
|
|
|
|
return true;
|
|
|
|
}
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
return false;
|
|
|
|
},
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
note : function(text) {
|
|
|
|
alert(text);
|
|
|
|
}
|
|
|
|
};
|
2009-01-02 16:08:58 +01:00
|
|
|
|
|
|
|
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');
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
// show warnings
|
|
|
|
$('#doaction, #doaction2').click(function(){
|
|
|
|
if ( $('select[name^="action"]').val() == 'delete' ) {
|
|
|
|
return showNotice.warn();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2009-01-02 16:08:58 +01:00
|
|
|
// 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;
|
|
|
|
});
|
2009-02-03 18:44:41 +01:00
|
|
|
$('#contextual-help-link-wrap, #screen-options-link-wrap').show();
|
2009-01-02 16:08:58 +01:00
|
|
|
|
|
|
|
// 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) {
|
2009-01-12 14:43:17 +01:00
|
|
|
var c = $(this).attr('checked'), kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, toggle = e.shiftKey || kbtoggle;
|
|
|
|
|
2009-01-02 16:08:58 +01:00
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
$(this).parents( 'form:first' ).find( 'table tbody:visible' ).find( '.check-column :checkbox' ).attr( 'checked', function() {
|
2009-01-02 16:08:58 +01:00
|
|
|
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 '';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
(function(){
|
2009-01-02 16:08:58 +01:00
|
|
|
if ( 'undefined' != typeof google && google.gears ) return;
|
|
|
|
|
|
|
|
var gf = false;
|
|
|
|
if ( 'undefined' != typeof GearsFactory ) {
|
|
|
|
gf = new GearsFactory();
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
gf = new ActiveXObject('Gears.Factory');
|
|
|
|
if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
|
|
|
|
gf.privateSetGlobalObject(this);
|
|
|
|
} catch (e) {
|
|
|
|
if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
|
|
|
|
gf = document.createElement("object");
|
|
|
|
gf.style.display = "none";
|
|
|
|
gf.width = 0;
|
|
|
|
gf.height = 0;
|
|
|
|
gf.type = "application/x-googlegears";
|
|
|
|
document.documentElement.appendChild(gf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( gf && gf.hasPermission )
|
|
|
|
return;
|
|
|
|
|
2009-01-12 14:43:17 +01:00
|
|
|
jQuery('.turbo-nag').show();
|
|
|
|
})();
|