WordPress.org

Make WordPress Core

Changeset 18926


Ignore:
Timestamp:
10/10/2011 04:19:05 AM (8 years ago)
Author:
azaozz
Message:

Make iPad support usable again, add viewport meta, see #18863

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/misc.php

    r18752 r18926  
    585585<?php
    586586}
    587 ?>
     587
     588function _ipad_meta() {
     589    if ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPad') !== false ) { ?>
     590        <meta name="viewport" id="ipad-viewportmeta" content="width=750, initial-scale=1, maximum-scale=1">
     591    <?php
     592    }
     593}
     594add_action('admin_head', '_ipad_meta');
     595
  • trunk/wp-admin/js/common.dev.js

    r18901 r18926  
    188188$(document).ready( function() {
    189189    var lastClicked = false, checks, first, last, checked, menu = $('#adminmenu'),
    190         pageInput = $('input.current-page'), currentPage = pageInput.val(), folded;
     190        pageInput = $('input.current-page'), currentPage = pageInput.val(), folded, vp = document.getElementById('ipad-viewportmeta');
    191191
    192192    // admin menu
     
    357357
    358358    }).triggerHandler('resize');
     359
     360    // iPad orientation scale fix
     361    if ( vp ) {
     362        document.body.addEventListener('gesturestart', function(){
     363            if ( vp.content.indexOf('maximum-scale=1') != -1 )
     364                vp.content = 'width=750px, maximum-scale=5, initial-scale=1';
     365        }, false);
     366        document.body.addEventListener('gestureend', function(){
     367            setTimeout(function(){
     368                if ( vp.content.indexOf('maximum-scale=1') == -1 )
     369                    vp.content = 'width=750px, maximum-scale=1, initial-scale=1';
     370            }, 2000);
     371        }, false);
     372    }
    359373});
    360374
  • trunk/wp-admin/js/common.js

    r18901 r18926  
    1 var showNotice,adminMenu,columns,validateForm,screenMeta,autofold_menu;(function(a){adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}};columns={init:function(){var b=this;a(".hide-column-tog","#adv-settings").click(function(){var d=a(this),c=d.val();if(d.prop("checked")){b.checked(c)}else{b.unchecked(c)}columns.saveManageColumnsState()})},saveManageColumnsState:function(){var b=this.hidden();a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})},checked:function(b){a(".column-"+b).show();this.colSpanChange(+1)},unchecked:function(b){a(".column-"+b).hide();this.colSpanChange(-1)},hidden:function(){return a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return a(".hide-column-tog").not(":checked").map(function(){var b=this.id;return b.substring(b,b.length-5)}).get().join(",")}},colSpanChange:function(b){var d=a("table").find(".colspanchange"),c;if(!d.length){return}c=parseInt(d.attr("colspan"),10)+b;d.attr("colspan",c.toString())}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").find("input:visible").change(function(){a(this).closest(".form-invalid").removeClass("form-invalid")}).size()};showNotice={warn:function(){var b=commonL10n.warnDelete||"";if(confirm(b)){return true}return false},note:function(b){alert(b)}};screenMeta={element:null,toggles:null,page:null,padding:null,top:null,map:{"wp-admin-bar-screen-options":"screen-options-wrap","wp-admin-bar-help":"contextual-help-wrap"},init:function(){screenMeta.element=a("#screen-meta");screenMeta.toggles=a(".screen-meta-toggle");screenMeta.page=a("#wpcontent");screenMeta.toggles.click(screenMeta.toggleEvent)},toggleEvent:function(c){var b;c.preventDefault();if(!screenMeta.map[this.id]){return}b=a("#"+screenMeta.map[this.id]);if(b.is(":visible")){screenMeta.close(b,a(this))}else{screenMeta.open(b,a(this))}},open:function(b,c){screenMeta.toggles.filter(".selected").click();c.addClass("selected");screenMeta.padding=parseInt(screenMeta.page.css("paddingTop"),10);screenMeta.top=parseInt(screenMeta.element.css("top"),10);b.show();screenMeta.refresh()},refresh:function(b,c){screenMeta.element.css({top:0});screenMeta.page.css({paddingTop:screenMeta.padding+screenMeta.element.outerHeight()})},close:function(b,c){screenMeta.element.css({top:screenMeta.top});screenMeta.page.css({paddingTop:screenMeta.padding});b.hide();c.removeClass("selected")}};a(".contextual-help-tabs").delegate("a","click focus",function(g){var f=a(this),c,d,b;g.preventDefault();if(f.is(".active a")){return false}a(".contextual-help-tabs .active").removeClass("active");f.parent("li").addClass("active");c=a(f.attr("href"));a(".help-tab-content").not(c).removeClass("active").hide();c.addClass("active").show();d=a("#contextual-help-wrap").children();d.height("auto");b=Math.max.apply(null,a.map(d,function(e){return a(e).height()}));d.height(b);screenMeta.refresh()});a(document).ready(function(){var i=false,c,e,j,h,b=a("#adminmenu"),d=a("input.current-page"),f=d.val(),g;a("#collapse-menu",b).click(function(){var k=a(document.body);if(k.hasClass("folded")){k.removeClass("folded");deleteUserSetting("mfold")}else{k.addClass("folded");setUserSetting("mfold","f")}return false});a("li.wp-has-submenu",b).hoverIntent({over:function(q){var l,n,r,p,k=a(this).find(".wp-submenu");l=a(this).offset().top+k.height()+1;n=a("#wpwrap").height();r=60+l-n;p=a(window).height()+a(window).scrollTop()-15;if(p<(l-r)){r=l-p}if(r>1){k.css({marginTop:"-"+r+"px"})}else{if(k.css("marginTop")){k.css({marginTop:""})}}k.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open")},timeout:200,sensitivity:7,interval:90});a("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2");a("div.updated, div.error").not(".below-h2, .inline").insertAfter(a("div.wrap h2:first"));screenMeta.init();a("tbody").children().children(".check-column").find(":checkbox").click(function(k){if("undefined"==k.shiftKey){return true}if(k.shiftKey){if(!i){return true}c=a(i).closest("form").find(":checkbox");e=c.index(i);j=c.index(this);h=a(this).prop("checked");if(0<e&&0<j&&e!=j){c.slice(e,j).prop("checked",function(){if(a(this).closest("tr").is(":visible")){return h}return false})}}i=this;return true});a("thead, tfoot").find(".check-column :checkbox").click(function(m){var n=a(this).prop("checked"),l="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,k=m.shiftKey||l;a(this).closest("table").children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){if(a(this).closest("tr").is(":hidden")){return false}if(k){return a(this).prop("checked")}else{if(n){return true}}return false});a(this).closest("table").children("thead,  tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){if(k){return false}else{if(n){return true}}return false})});a("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");a("div.default-password-nag").hide();return false});a("#newcontent").bind("keydown.wpevent_InsertTab",function(p){if(p.keyCode!=9){return true}var m=p.target,r=m.selectionStart,l=m.selectionEnd,q=m.value,k,o;try{this.lastKey=9}catch(n){}if(document.selection){m.focus();o=document.selection.createRange();o.text="\t"}else{if(r>=0){k=this.scrollTop;m.value=q.substring(0,r).concat("\t",q.substring(l));m.selectionStart=m.selectionEnd=r+1;this.scrollTop=k}}if(p.stopPropagation){p.stopPropagation()}if(p.preventDefault){p.preventDefault()}});a("#newcontent").bind("blur.wpevent_InsertTab",function(k){if(this.lastKey&&9==this.lastKey){this.focus()}});if(d.length){d.closest("form").submit(function(k){if(a('select[name="action"]').val()==-1&&a('select[name="action2"]').val()==-1&&d.val()==f){d.val("1")}})}a(window).bind("resize.autofold",function(){if(getUserSetting("mfold")=="f"){return}var k=a(window).width();if(k<=800){if(!g){a(document.body).addClass("folded");g=true}}else{if(g){a(document.body).removeClass("folded");g=false}}}).triggerHandler("resize")});a(document).bind("wp_CloseOnEscape",function(c,b){if(typeof(b.cb)!="function"){return}if(typeof(b.condition)!="function"||b.condition()){b.cb()}return true})})(jQuery);
     1var showNotice,adminMenu,columns,validateForm,screenMeta,autofold_menu;(function(a){adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}};columns={init:function(){var b=this;a(".hide-column-tog","#adv-settings").click(function(){var d=a(this),c=d.val();if(d.prop("checked")){b.checked(c)}else{b.unchecked(c)}columns.saveManageColumnsState()})},saveManageColumnsState:function(){var b=this.hidden();a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})},checked:function(b){a(".column-"+b).show();this.colSpanChange(+1)},unchecked:function(b){a(".column-"+b).hide();this.colSpanChange(-1)},hidden:function(){return a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return a(".hide-column-tog").not(":checked").map(function(){var b=this.id;return b.substring(b,b.length-5)}).get().join(",")}},colSpanChange:function(b){var d=a("table").find(".colspanchange"),c;if(!d.length){return}c=parseInt(d.attr("colspan"),10)+b;d.attr("colspan",c.toString())}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").find("input:visible").change(function(){a(this).closest(".form-invalid").removeClass("form-invalid")}).size()};showNotice={warn:function(){var b=commonL10n.warnDelete||"";if(confirm(b)){return true}return false},note:function(b){alert(b)}};screenMeta={element:null,toggles:null,page:null,padding:null,top:null,map:{"wp-admin-bar-screen-options":"screen-options-wrap","wp-admin-bar-help":"contextual-help-wrap"},init:function(){screenMeta.element=a("#screen-meta");screenMeta.toggles=a(".screen-meta-toggle");screenMeta.page=a("#wpcontent");screenMeta.toggles.click(screenMeta.toggleEvent)},toggleEvent:function(c){var b;c.preventDefault();if(!screenMeta.map[this.id]){return}b=a("#"+screenMeta.map[this.id]);if(b.is(":visible")){screenMeta.close(b,a(this))}else{screenMeta.open(b,a(this))}},open:function(b,c){screenMeta.toggles.filter(".selected").click();c.addClass("selected");screenMeta.padding=parseInt(screenMeta.page.css("paddingTop"),10);screenMeta.top=parseInt(screenMeta.element.css("top"),10);b.show();screenMeta.refresh()},refresh:function(b,c){screenMeta.element.css({top:0});screenMeta.page.css({paddingTop:screenMeta.padding+screenMeta.element.outerHeight()})},close:function(b,c){screenMeta.element.css({top:screenMeta.top});screenMeta.page.css({paddingTop:screenMeta.padding});b.hide();c.removeClass("selected")}};a(".contextual-help-tabs").delegate("a","click focus",function(g){var f=a(this),c,d,b;g.preventDefault();if(f.is(".active a")){return false}a(".contextual-help-tabs .active").removeClass("active");f.parent("li").addClass("active");c=a(f.attr("href"));a(".help-tab-content").not(c).removeClass("active").hide();c.addClass("active").show();d=a("#contextual-help-wrap").children();d.height("auto");b=Math.max.apply(null,a.map(d,function(e){return a(e).height()}));d.height(b);screenMeta.refresh()});a(document).ready(function(){var j=false,d,f,k,i,c=a("#adminmenu"),e=a("input.current-page"),g=e.val(),h,b=document.getElementById("ipad-viewportmeta");a("#collapse-menu",c).click(function(){var l=a(document.body);if(l.hasClass("folded")){l.removeClass("folded");deleteUserSetting("mfold")}else{l.addClass("folded");setUserSetting("mfold","f")}return false});a("li.wp-has-submenu",c).hoverIntent({over:function(r){var n,p,s,q,l=a(this).find(".wp-submenu");n=a(this).offset().top+l.height()+1;p=a("#wpwrap").height();s=60+n-p;q=a(window).height()+a(window).scrollTop()-15;if(q<(n-s)){s=n-q}if(s>1){l.css({marginTop:"-"+s+"px"})}else{if(l.css("marginTop")){l.css({marginTop:""})}}l.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open")},timeout:200,sensitivity:7,interval:90});a("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2");a("div.updated, div.error").not(".below-h2, .inline").insertAfter(a("div.wrap h2:first"));screenMeta.init();a("tbody").children().children(".check-column").find(":checkbox").click(function(l){if("undefined"==l.shiftKey){return true}if(l.shiftKey){if(!j){return true}d=a(j).closest("form").find(":checkbox");f=d.index(j);k=d.index(this);i=a(this).prop("checked");if(0<f&&0<k&&f!=k){d.slice(f,k).prop("checked",function(){if(a(this).closest("tr").is(":visible")){return i}return false})}}j=this;return true});a("thead, tfoot").find(".check-column :checkbox").click(function(n){var o=a(this).prop("checked"),m="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,l=n.shiftKey||m;a(this).closest("table").children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){if(a(this).closest("tr").is(":hidden")){return false}if(l){return a(this).prop("checked")}else{if(o){return true}}return false});a(this).closest("table").children("thead,  tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){if(l){return false}else{if(o){return true}}return false})});a("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");a("div.default-password-nag").hide();return false});a("#newcontent").bind("keydown.wpevent_InsertTab",function(q){if(q.keyCode!=9){return true}var n=q.target,s=n.selectionStart,m=n.selectionEnd,r=n.value,l,p;try{this.lastKey=9}catch(o){}if(document.selection){n.focus();p=document.selection.createRange();p.text="\t"}else{if(s>=0){l=this.scrollTop;n.value=r.substring(0,s).concat("\t",r.substring(m));n.selectionStart=n.selectionEnd=s+1;this.scrollTop=l}}if(q.stopPropagation){q.stopPropagation()}if(q.preventDefault){q.preventDefault()}});a("#newcontent").bind("blur.wpevent_InsertTab",function(l){if(this.lastKey&&9==this.lastKey){this.focus()}});if(e.length){e.closest("form").submit(function(l){if(a('select[name="action"]').val()==-1&&a('select[name="action2"]').val()==-1&&e.val()==g){e.val("1")}})}a(window).bind("resize.autofold",function(){if(getUserSetting("mfold")=="f"){return}var l=a(window).width();if(l<=800){if(!h){a(document.body).addClass("folded");h=true}}else{if(h){a(document.body).removeClass("folded");h=false}}}).triggerHandler("resize");if(b){document.body.addEventListener("gesturestart",function(){if(b.content.indexOf("maximum-scale=1")!=-1){b.content="width=750px, maximum-scale=5, initial-scale=1"}},false);document.body.addEventListener("gestureend",function(){setTimeout(function(){if(b.content.indexOf("maximum-scale=1")==-1){b.content="width=750px, maximum-scale=1, initial-scale=1"}},2000)},false)}});a(document).bind("wp_CloseOnEscape",function(c,b){if(typeof(b.cb)!="function"){return}if(typeof(b.condition)!="function"||b.condition()){b.cb()}return true})})(jQuery);
  • trunk/wp-admin/js/postbox.dev.js

    r18925 r18926  
    1 var postboxes;
     1var postboxes, is_iPad = navigator.userAgent.match(/iPad/);
    22
    33(function($) {
     
    66            this.init(page, args);
    77
    8             $('.postbox h3, .postbox .handlediv').click( function() {
     8            $('.postbox h3, .postbox .handlediv').bind('click.postboxes', function() {
    99                var p = $(this).parent('.postbox'), id = p.attr('id');
    1010
     
    2727            });
    2828
    29             $('.postbox a.dismiss').click( function(e) {
     29            $('.postbox a.dismiss').bind('click.postboxes', function(e) {
    3030                var hide_id = $(this).parents('.postbox').attr('id') + '-hide';
    3131                $( '#' + hide_id ).prop('checked', false).triggerHandler('click');
     
    3333            });
    3434
    35             $('.hide-postbox-tog').click( function() {
     35            $('.hide-postbox-tog').bind('click.postboxes', function() {
    3636                var box = $(this).val();
    3737
     
    4949            });
    5050
    51             $('.columns-prefs input[type="radio"]').click(function(){
    52                 var num = $(this).val(), i, el, done, ps = $('#poststuff'), move;
    53 
    54                 num = parseInt(num, 10);
    55 
    56                 if ( ps.length ) { // edit pages
    57 
    58                     if ( num == 2 ) {
    59                         $('.wrap').removeClass('columns-1').addClass('columns-2');
    60                         ps.addClass('has-right-sidebar');
    61 
    62                         if ( !$('#side-info-column #side-sortables').length )
    63                             $('#side-info-column').append( $('#side-sortables') );
    64 
    65                     } else if ( num == 1 ) {
    66                         $('.wrap').removeClass('columns-2').addClass('columns-1');
    67                         ps.removeClass('has-right-sidebar');
    68 
    69                         if ( !$('#post-body-content #side-sortables').length )
    70                             $('#normal-sortables').before( $('#side-sortables') );
    71                     }
    72 
    73                 } else { // dashboard
    74                     for ( i = 4; ( i > num && i > 1 ); i-- ) {
    75                         el = $('#' + postboxes._colname(i) + '-sortables');
    76                         $('#' + postboxes._colname(i-1) + '-sortables').append(el.children('.postbox'));
    77                         el.parent().hide();
    78                     }
    79 
    80                     for ( i = num; i > 0; i-- ) {
    81                         el = $('#' + postboxes._colname(i) + '-sortables');
    82                         done = false;
    83 
    84                         if ( el.parent().is(':hidden') ) {
    85                             switch ( i ) {
    86                                 case 4:
    87                                     move = $('.postbox:visible', $('#column3-sortables'));
    88                                     if ( move.length > 1 ) {
    89                                         el.append( move.last() );
    90                                         done = true;
    91                                     }
    92                                 case 3:
    93                                     move = $('.postbox:visible', $('#side-sortables'));
    94                                     if ( !done && move.length > 1 ) {
    95                                         el.append( move.last() );
    96                                         done = true;
    97                                     }
    98                                 case 2:
    99                                     move = $('.postbox:visible', $('#normal-sortables'));
    100                                     if ( !done && move.length > 1 ) {
    101                                         el.append( move.last() );
    102                                         done = true;
    103                                     }
    104                                 default:
    105                                     if ( !done )
    106                                         el.addClass('empty-container')
    107                             }
    108 
    109                             el.parent().show();
    110                         }
    111                     }
    112 
    113                     $('.postbox-container:visible').css('width', 100/num + '%');
    114                 }
    115                 postboxes.save_order(page);
     51            $('.columns-prefs input[type="radio"]').bind('click.postboxes', function(){
     52                var n = parseInt($(this).val(), 10), pb = postboxes;
     53
     54                if ( n ) {
     55                    pb._pb_edit(n);
     56                    pb.save_order(page);
     57                }
    11658            });
    11759        },
     
    13880
    13981                    postboxes.save_order(page);
    140                     ui.item.parent().removeClass('temp-border');
    14182                },
    14283                receive: function(e,ui) {
     
    14788                }
    14889            });
     90
     91            if ( navigator.userAgent.match(/iPad/) ) {
     92                $(document.body).bind('orientationchange', function(){ postboxes._pb_change(); });
     93                this._pb_change();
     94            }
     95
    14996            this._mark_area();
    15097        },
     
    196143            }
    197144        },
    198        
     145
    199146        _mark_area : function() {
    200147            $('#side-info-column .meta-box-sortables:visible, #dashboard-widgets .meta-box-sortables:visible').each(function(n, el){
     
    208155        },
    209156
     157        _pb_edit : function(n) {
     158            var ps = $('#poststuff'), i, el, done, pb = postboxes, visible = $('.postbox-container:visible').length;
     159
     160            if ( n == visible )
     161                return;
     162
     163            if ( ps.length ) {
     164                if ( n == 2 ) {
     165                    $('.wrap').removeClass('columns-1').addClass('columns-2');
     166                    ps.addClass('has-right-sidebar');
     167
     168                    if ( !$('#side-info-column #side-sortables').length )
     169                        $('#side-info-column').append( $('#side-sortables') );
     170
     171                } else if ( n == 1 ) {
     172                    $('.wrap').removeClass('columns-2').addClass('columns-1');
     173                    ps.removeClass('has-right-sidebar');
     174
     175                    if ( !$('#post-body-content #side-sortables').length )
     176                        $('#normal-sortables').before( $('#side-sortables') );
     177                }
     178            } else {
     179                for ( i = 4; ( i > n && i > 1 ); i-- ) {
     180                    el = $('#' + postboxes._colname(i) + '-sortables');
     181                    $('#' + postboxes._colname(i-1) + '-sortables').append(el.children('.postbox'));
     182                    el.parent().hide();
     183                }
     184
     185                for ( i = n; i > 0; i-- ) {
     186                    el = $('#' + postboxes._colname(i) + '-sortables');
     187                    done = false;
     188
     189                    if ( el.parent().is(':hidden') ) {
     190                        switch ( i ) {
     191                            case 4:
     192                                done = pb._move_one( el, $('.postbox:visible', $('#column3-sortables')) );
     193                            case 3:
     194                                if ( !done )
     195                                    done = pb._move_one( el, $('.postbox:visible', $('#side-sortables')) );
     196                            case 2:
     197                                if ( !done )
     198                                    done = pb._move_one( el, $('.postbox:visible', $('#normal-sortables')) );
     199                            default:
     200                                if ( !done )
     201                                    el.addClass('empty-container')
     202                        }
     203
     204                        el.parent().show();
     205                    }
     206                }
     207
     208                $('.postbox-container:visible').css('width', 100/n + '%');
     209            }
     210        },
     211
     212        _pb_change : function() {
     213            switch ( window.orientation ) {
     214                case 90:
     215                case -90:
     216                    this._pb_edit(2);
     217                    break;
     218                case 0:
     219                case 180:
     220                    if ( $('#poststuff').length )
     221                        this._pb_edit(1);
     222                    else
     223                        this._pb_edit(2);
     224                    break;
     225            }
     226        },
     227
     228        _move_one : function(el, move) {
     229            if ( move.length > 1 ) {
     230                el.append( move.last() );
     231                return true;
     232            }
     233            return false;
     234        },
     235
    210236        /* Callbacks */
    211237        pbshow : false,
  • trunk/wp-admin/js/postbox.js

    r18925 r18926  
    1 var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var d=a(this).parent(".postbox"),e=d.attr("id");if("dashboard_browser_nag"==e){return}d.toggleClass("closed");postboxes.save_state(c);if(e){if(!d.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}else{if(d.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}}});a(".postbox h3 a").click(function(d){d.stopPropagation()});a(".postbox a.dismiss").click(function(f){var d=a(this).parents(".postbox").attr("id")+"-hide";a("#"+d).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").click(function(){var d=a(this).val();if(a(this).prop("checked")){a("#"+d).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(d)}}else{a("#"+d).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(d)}}postboxes.save_state(c);postboxes._mark_area()});a('.columns-prefs input[type="radio"]').click(function(){var f=a(this).val(),g,h,e,j=a("#poststuff"),d;f=parseInt(f,10);if(j.length){if(f==2){a(".wrap").removeClass("columns-1").addClass("columns-2");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}}else{if(f==1){a(".wrap").removeClass("columns-2").addClass("columns-1");j.removeClass("has-right-sidebar");if(!a("#post-body-content #side-sortables").length){a("#normal-sortables").before(a("#side-sortables"))}}}}else{for(g=4;(g>f&&g>1);g--){h=a("#"+postboxes._colname(g)+"-sortables");a("#"+postboxes._colname(g-1)+"-sortables").append(h.children(".postbox"));h.parent().hide()}for(g=f;g>0;g--){h=a("#"+postboxes._colname(g)+"-sortables");e=false;if(h.parent().is(":hidden")){switch(g){case 4:d=a(".postbox:visible",a("#column3-sortables"));if(d.length>1){h.append(d.last());e=true}case 3:d=a(".postbox:visible",a("#side-sortables"));if(!e&&d.length>1){h.append(d.last());e=true}case 2:d=a(".postbox:visible",a("#normal-sortables"));if(!e&&d.length>1){h.append(d.last());e=true}default:if(!e){h.addClass("empty-container")}}h.parent().show()}}a(".postbox-container:visible").css("width",100/f+"%")}postboxes.save_order(c)})},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",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c);d.item.parent().removeClass("temp-border")},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}postboxes._mark_area()}});this._mark_area()},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(ajaxurl,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b)},_colname:function(b){switch(b){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}},_mark_area:function(){a("#side-info-column .meta-box-sortables:visible, #dashboard-widgets .meta-box-sortables:visible").each(function(d,c){var b=a(this);if(!b.children(".postbox:visible").length){b.addClass("empty-container")}else{b.removeClass("empty-container")}})},pbshow:false,pbhide:false}}(jQuery));
     1var postboxes,is_iPad=navigator.userAgent.match(/iPad/);(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").bind("click.postboxes",function(){var d=a(this).parent(".postbox"),e=d.attr("id");if("dashboard_browser_nag"==e){return}d.toggleClass("closed");postboxes.save_state(c);if(e){if(!d.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}else{if(d.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}}});a(".postbox h3 a").click(function(d){d.stopPropagation()});a(".postbox a.dismiss").bind("click.postboxes",function(f){var d=a(this).parents(".postbox").attr("id")+"-hide";a("#"+d).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").bind("click.postboxes",function(){var d=a(this).val();if(a(this).prop("checked")){a("#"+d).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(d)}}else{a("#"+d).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(d)}}postboxes.save_state(c);postboxes._mark_area()});a('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){var e=parseInt(a(this).val(),10),d=postboxes;if(e){d._pb_edit(e);d.save_order(c)}})},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",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c)},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}postboxes._mark_area()}});if(navigator.userAgent.match(/iPad/)){a(document.body).bind("orientationchange",function(){postboxes._pb_change()});this._pb_change()}this._mark_area()},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(ajaxurl,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b)},_colname:function(b){switch(b){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}},_mark_area:function(){a("#side-info-column .meta-box-sortables:visible, #dashboard-widgets .meta-box-sortables:visible").each(function(d,c){var b=a(this);if(!b.children(".postbox:visible").length){b.addClass("empty-container")}else{b.removeClass("empty-container")}})},_pb_edit:function(h){var g=a("#poststuff"),d,e,b,c=postboxes,f=a(".postbox-container:visible").length;if(h==f){return}if(g.length){if(h==2){a(".wrap").removeClass("columns-1").addClass("columns-2");g.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}}else{if(h==1){a(".wrap").removeClass("columns-2").addClass("columns-1");g.removeClass("has-right-sidebar");if(!a("#post-body-content #side-sortables").length){a("#normal-sortables").before(a("#side-sortables"))}}}}else{for(d=4;(d>h&&d>1);d--){e=a("#"+postboxes._colname(d)+"-sortables");a("#"+postboxes._colname(d-1)+"-sortables").append(e.children(".postbox"));e.parent().hide()}for(d=h;d>0;d--){e=a("#"+postboxes._colname(d)+"-sortables");b=false;if(e.parent().is(":hidden")){switch(d){case 4:b=c._move_one(e,a(".postbox:visible",a("#column3-sortables")));case 3:if(!b){b=c._move_one(e,a(".postbox:visible",a("#side-sortables")))}case 2:if(!b){b=c._move_one(e,a(".postbox:visible",a("#normal-sortables")))}default:if(!b){e.addClass("empty-container")}}e.parent().show()}}a(".postbox-container:visible").css("width",100/h+"%")}},_pb_change:function(){switch(window.orientation){case 90:case -90:this._pb_edit(2);break;case 0:case 180:if(a("#poststuff").length){this._pb_edit(1)}else{this._pb_edit(2)}break}},_move_one:function(c,b){if(b.length>1){c.append(b.last());return true}return false},pbshow:false,pbhide:false}}(jQuery));
  • trunk/wp-includes/script-loader.php

    r18925 r18926  
    6262    $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20101110' );
    6363
    64     $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20111005', 1 );
     64    $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20111009', 1 );
    6565    $scripts->add_script_data( 'common', 'commonL10n', array(
    6666        'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.")
     
    306306        $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20110524', 1 );
    307307
    308         $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20111009', 1 );
     308        $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20111009a', 1 );
    309309
    310310        $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110524', 1 );
Note: See TracChangeset for help on using the changeset viewer.