-
+ 7704485A9CF9484536AECFF06DC6F77D758F35530DD23ECAC4A00A76B819930764522464D70D56417F53B2B63B68E8DD2C9FE62094D61DB7CFE1A4E6B9A89A03mp-wp/wp-admin/js/common.js(0 . 0)(1 . 395)
48481
48482 wpCookies = {
48483 // The following functions are from Cookie.js class in TinyMCE, Moxiecode, used under LGPL.
48484
48485 each : function(o, cb, s) {
48486 var n, l;
48487
48488 if (!o)
48489 return 0;
48490
48491 s = s || o;
48492
48493 if (typeof(o.length) != 'undefined') {
48494 for (n=0, l = o.length; n<l; n++) {
48495 if (cb.call(s, o[n], n, o) === false)
48496 return 0;
48497 }
48498 } else {
48499 for (n in o) {
48500 if (o.hasOwnProperty(n)) {
48501 if (cb.call(s, o[n], n, o) === false)
48502 return 0;
48503 }
48504 }
48505 }
48506 return 1;
48507 },
48508
48509 getHash : function(n) {
48510 var v = this.get(n), h;
48511
48512 if (v) {
48513 this.each(v.split('&'), function(v) {
48514 v = v.split('=');
48515 h = h || {};
48516 h[v[0]] = v[1];
48517 });
48518 }
48519 return h;
48520 },
48521
48522 setHash : function(n, v, e, p, d, s) {
48523 var o = '';
48524
48525 this.each(v, function(v, k) {
48526 o += (!o ? '' : '&') + k + '=' + v;
48527 });
48528
48529 this.set(n, o, e, p, d, s);
48530 },
48531
48532 get : function(n) {
48533 var c = document.cookie, e, p = n + "=", b;
48534
48535 if (!c)
48536 return;
48537
48538 b = c.indexOf("; " + p);
48539
48540 if (b == -1) {
48541 b = c.indexOf(p);
48542
48543 if (b != 0)
48544 return null;
48545 } else
48546 b += 2;
48547
48548 e = c.indexOf(";", b);
48549
48550 if (e == -1)
48551 e = c.length;
48552
48553 return decodeURIComponent(c.substring(b + p.length, e));
48554 },
48555
48556 set : function(n, v, e, p, d, s) {
48557 document.cookie = n + "=" + encodeURIComponent(v) +
48558 ((e) ? "; expires=" + e.toGMTString() : "") +
48559 ((p) ? "; path=" + p : "") +
48560 ((d) ? "; domain=" + d : "") +
48561 ((s) ? "; secure" : "");
48562 },
48563
48564 remove : function(n, p) {
48565 var d = new Date();
48566
48567 d.setTime(d.getTime() - 1000);
48568
48569 this.set(n, '', d, p, d);
48570 }
48571 };
48572
48573 // Returns the value as string. Second arg or empty string is returned when value is not set.
48574 function getUserSetting( name, def ) {
48575 var o = getAllUserSettings();
48576
48577 if ( o.hasOwnProperty(name) )
48578 return o[name];
48579
48580 if ( typeof def != 'undefined' )
48581 return def;
48582
48583 return '';
48584 }
48585
48586 // Both name and value must be only ASCII letters, numbers or underscore
48587 // and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
48588 function setUserSetting( name, value, del ) {
48589 var c = 'wp-settings-'+userSettings.uid, o = wpCookies.getHash(c) || {}, d = new Date();
48590 var n = name.toString().replace(/[^A-Za-z0-9_]/, ''), v = value.toString().replace(/[^A-Za-z0-9_]/, '');
48591
48592 if ( del ) delete o[n];
48593 else o[n] = v;
48594
48595 d.setTime( d.getTime() + 31536000000 );
48596 p = userSettings.url;
48597
48598 wpCookies.setHash(c, o, d, p );
48599 wpCookies.set('wp-settings-time-'+userSettings.uid, userSettings.time, d, p );
48600 }
48601
48602 function deleteUserSetting( name ) {
48603 setUserSetting( name, '', 1 );
48604 }
48605
48606 // Returns all settings as js object.
48607 function getAllUserSettings() {
48608 return wpCookies.getHash('wp-settings-'+userSettings.uid) || {};
48609 }
48610
48611
48612 jQuery(document).ready( function($) {
48613 // pulse
48614 $('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
48615
48616 // show things that should be visible, hide what should be hidden
48617 $('.hide-if-no-js').removeClass('hide-if-no-js');
48618 $('.hide-if-js').hide();
48619
48620 // Basic form validation
48621 if ( ( 'undefined' != typeof wpAjax ) && $.isFunction( wpAjax.validateForm ) ) {
48622 $('form.validate').submit( function() { return wpAjax.validateForm( $(this) ); } );
48623 }
48624
48625 // Move .updated and .error alert boxes
48626 $('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
48627 $('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');
48628
48629 // screen settings tab
48630 $('#show-settings-link').click(function () {
48631 if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
48632 $('#contextual-help-link-wrap').addClass('invisible');
48633 }
48634 $('#screen-options-wrap').slideToggle('fast', function(){
48635 if ( $(this).hasClass('screen-options-open') ) {
48636 $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
48637 $('#contextual-help-link-wrap').removeClass('invisible');
48638 $(this).removeClass('screen-options-open');
48639
48640 } else {
48641 $('#show-settings-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
48642 $(this).addClass('screen-options-open');
48643 }
48644 });
48645 return false;
48646 });
48647
48648 // help tab
48649 $('#contextual-help-link').click(function () {
48650 if ( ! $('#contextual-help-wrap').hasClass('contextual-help-open') ) {
48651 $('#screen-options-link-wrap').addClass('invisible');
48652 }
48653 $('#contextual-help-wrap').slideToggle('fast', function(){
48654 if ( $(this).hasClass('contextual-help-open') ) {
48655 $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right.gif")'});
48656 $('#screen-options-link-wrap').removeClass('invisible');
48657 $(this).removeClass('contextual-help-open');
48658 } else {
48659 $('#contextual-help-link').css({'backgroundImage':'url("images/screen-options-right-up.gif")'});
48660 $(this).addClass('contextual-help-open');
48661 }
48662 });
48663 return false;
48664 });
48665
48666 // check all checkboxes
48667 var lastClicked = false;
48668 $( 'table:visible tbody .check-column :checkbox' ).click( function(e) {
48669 if ( 'undefined' == e.shiftKey ) { return true; }
48670 if ( e.shiftKey ) {
48671 if ( !lastClicked ) { return true; }
48672 var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
48673 var first = checks.index( lastClicked );
48674 var last = checks.index( this );
48675 var checked = $(this).attr('checked');
48676 if ( 0 < first && 0 < last && first != last ) {
48677 checks.slice( first, last ).attr( 'checked', function(){
48678 if ( $(this).parents('tr').is(':visible') )
48679 return checked ? 'checked' : '';
48680
48681 return '';
48682 });
48683 }
48684 }
48685 lastClicked = this;
48686 return true;
48687 } );
48688 $( 'thead :checkbox, tfoot :checkbox' ).click( function(e) {
48689 var c = $(this).attr('checked');
48690 if ( 'undefined' == typeof toggleWithKeyboard)
48691 toggleWithKeyboard = false;
48692 var toggle = e.shiftKey || toggleWithKeyboard;
48693 $(this).parents( 'form:first' ).find( 'table tbody:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
48694 if ( $(this).parents('tr').is(':hidden') )
48695 return '';
48696 if ( toggle )
48697 return $(this).attr( 'checked' ) ? '' : 'checked';
48698 else if (c)
48699 return 'checked';
48700 return '';
48701 });
48702 $(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column :checkbox' ).attr( 'checked', function() {
48703 if ( toggle )
48704 return '';
48705 else if (c)
48706 return 'checked';
48707 return '';
48708 });
48709 });
48710 });
48711
48712 var showNotice, adminMenu, columns;
48713
48714 // stub for doing better warnings
48715 showNotice = {
48716 warn : function(text) {
48717 if ( confirm(text) )
48718 return true;
48719
48720 return false;
48721 },
48722
48723 note : function(text) {
48724 alert(text);
48725 }
48726 };
48727
48728 (function($){
48729 // sidebar admin menu
48730 adminMenu = {
48731
48732 init : function() {
48733 $('#adminmenu div.wp-menu-toggle').each( function() {
48734 if ( $(this).siblings('.wp-submenu').length )
48735 $(this).click(function(){ adminMenu.toggle( $(this).siblings('.wp-submenu') ); });
48736 else
48737 $(this).hide();
48738 });
48739 $('#adminmenu li.menu-top .wp-menu-image').click( function() { window.location = $(this).siblings('a.menu-top')[0].href; } );
48740 this.favorites();
48741
48742 $('.wp-menu-separator').click(function(){
48743 if ( $('#wpcontent').hasClass('folded') ) {
48744 adminMenu.fold(1);
48745 setUserSetting( 'mfold', 'o' );
48746 } else {
48747 adminMenu.fold();
48748 setUserSetting( 'mfold', 'f' );
48749 }
48750 });
48751
48752 if ( 'f' != getUserSetting( 'mfold' ) ) {
48753 this.restoreMenuState();
48754 } else {
48755 this.fold();
48756 }
48757 },
48758
48759 restoreMenuState : function() {
48760 $('#adminmenu li.wp-has-submenu').each(function(i, e) {
48761 var v = getUserSetting( 'm'+i );
48762 if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open
48763
48764 if ( 'o' == v ) $(e).addClass('wp-menu-open');
48765 else if ( 'c' == v ) $(e).removeClass('wp-menu-open');
48766 });
48767 },
48768
48769 toggle : function(el) {
48770
48771 el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' );
48772
48773 $('#adminmenu li.wp-has-submenu').each(function(i, e) {
48774 var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c';
48775 setUserSetting( 'm'+i, v );
48776 });
48777
48778 return false;
48779 },
48780
48781 fold : function(off) {
48782 if (off) {
48783 $('#wpcontent').removeClass('folded');
48784 $('#adminmenu li.wp-has-submenu').unbind();
48785 } else {
48786 $('#wpcontent').addClass('folded');
48787 $('#adminmenu li.wp-has-submenu').hoverIntent({
48788 over: function(e){
48789 var m = $(this).find('.wp-submenu'), t = e.clientY, H = $(window).height(), h = m.height(), o;
48790
48791 if ( (t+h+10) > H ) {
48792 o = (t+h+10) - H;
48793 m.css({'marginTop':'-'+o+'px'});
48794 } else if ( m.css('marginTop') ) {
48795 m.css({'marginTop':''})
48796 }
48797 m.addClass('sub-open');
48798 },
48799 out: function(){ $(this).find('.wp-submenu').removeClass('sub-open').css({'marginTop':''}); },
48800 timeout: 220,
48801 sensitivity: 8,
48802 interval: 100
48803 });
48804
48805 }
48806 },
48807
48808 favorites : function() {
48809 $('#favorite-inside').width($('#favorite-actions').width()-4);
48810 $('#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) } );
48811
48812 $('#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) } );
48813 }
48814 };
48815
48816 $(document).ready(function(){adminMenu.init();});
48817 })(jQuery);
48818
48819 (function($){
48820 // show/hide/save table columns
48821 columns = {
48822 init : function(page) {
48823 $('.hide-column-tog').click( function() {
48824 var column = $(this).val();
48825 var show = $(this).attr('checked');
48826 if ( show ) {
48827 $('.column-' + column).show();
48828 } else {
48829 $('.column-' + column).hide();
48830 }
48831 columns.save_manage_columns_state(page);
48832 } );
48833 },
48834
48835 save_manage_columns_state : function(page) {
48836 var hidden = $('.manage-column').filter(':hidden').map(function() { return this.id; }).get().join(',');
48837 $.post('admin-ajax.php', {
48838 action: 'hidden-columns',
48839 hidden: hidden,
48840 hiddencolumnsnonce: $('#hiddencolumnsnonce').val(),
48841 page: page
48842 });
48843 }
48844 }
48845
48846 })(jQuery);
48847
48848
48849 jQuery(document).ready(function($){
48850 if ( 'undefined' != typeof google && google.gears ) return;
48851
48852 var gf = false;
48853 if ( 'undefined' != typeof GearsFactory ) {
48854 gf = new GearsFactory();
48855 } else {
48856 try {
48857 gf = new ActiveXObject('Gears.Factory');
48858 if ( factory.getBuildInfo().indexOf('ie_mobile') != -1 )
48859 gf.privateSetGlobalObject(this);
48860 } catch (e) {
48861 if ( ( 'undefined' != typeof navigator.mimeTypes ) && navigator.mimeTypes['application/x-googlegears'] ) {
48862 gf = document.createElement("object");
48863 gf.style.display = "none";
48864 gf.width = 0;
48865 gf.height = 0;
48866 gf.type = "application/x-googlegears";
48867 document.documentElement.appendChild(gf);
48868 }
48869 }
48870 }
48871 if ( gf && gf.hasPermission )
48872 return;
48873
48874 $('.turbo-nag').show();
48875 });