WordPress/wp-admin/js/editor-expand.min.js

1 line
13 KiB
JavaScript
Raw Normal View History

!function(a,b){"use strict";var c=b(a),d=b(document),e=b("#wpadminbar"),f=b("#wpfooter");b(function(){function g(){var a=c.width();T={windowHeight:c.height(),windowWidth:a,adminBarHeight:a>600?e.outerHeight():0,toolsHeight:t.outerHeight()||0,menuBarHeight:A.outerHeight()||0,visualTopHeight:u.outerHeight()||0,textTopHeight:w.outerHeight()||0,bottomHeight:z.outerHeight()||0,statusBarHeight:B.outerHeight()||0,sideSortablesHeight:C.height()||0},T.menuBarHeight<3&&(T.menuBarHeight=0)}function h(b){var c,d,e,f,g,h=jQuery.ui.keyCode,i=b.keyCode,j=document.createRange(),k=x[0].selectionStart,l=x[0].selectionEnd,m=y[0].firstChild,n=10;if(!k||!l||k===l){try{j.setStart(m,k),j.setEnd(m,l+1)}catch(o){}c=j.getBoundingClientRect(),c.height&&(d=c.top-n,e=d+c.height+n,f=T.adminBarHeight+T.toolsHeight+T.textTopHeight,g=T.windowHeight-T.bottomHeight,f>d&&(i===h.UP||i===h.LEFT||i===h.BACKSPACE)?a.scrollTo(a.pageXOffset,d+a.pageYOffset-f):e>g&&a.scrollTo(a.pageXOffset,e+a.pageYOffset-g))}}function i(){if(!(p&&!p.isHidden()||!p&&"tinymce"===R)){var a,b=x.height();y.width(x.width()-22),y.text(x.val()+"&nbsp;"),a=y.height(),Q>a&&(a=Q),a!==b&&(x.height(a),j())}}function j(b){var e=b&&b.type;if(!F||!F.settings.visible){var h,j,k,l,m,n,o,q,r,G=c.scrollTop(),H="scroll"!==e,N=p&&!p.isHidden(),R=Q,U=E.offset().top,V=1,W=s.width();(H||!T.windowHeight)&&g(),N||"resize"!==e||i(),N?(h=u,j=v,o=T.visualTopHeight):(h=w,j=x,o=T.textTopHeight),n=h.parent().offset().top,q=j.offset().top,r=j.outerHeight(),m=N?Q+o:Q+20,m=r>m+5,m?((!I||H)&&G>=n-T.toolsHeight-T.adminBarHeight&&G<=n-T.toolsHeight-T.adminBarHeight+r-R?(I=!0,t.css({position:"fixed",top:T.adminBarHeight,width:W}),N&&A.length&&A.css({position:"fixed",top:T.adminBarHeight+T.toolsHeight,width:W-2*V-(N?0:h.outerWidth()-h.width())}),h.css({position:"fixed",top:T.adminBarHeight+T.toolsHeight+T.menuBarHeight,width:W-2*V-(N?0:h.outerWidth()-h.width())})):(I||H)&&(G<=n-T.toolsHeight-T.adminBarHeight?(I=!1,t.css({position:"absolute",top:0,width:W}),N&&A.length&&A.css({position:"absolute",top:0,width:W-2*V}),h.css({position:"absolute",top:T.menuBarHeight,width:W-2*V-(N?0:h.outerWidth()-h.width())})):G>=n-T.toolsHeight-T.adminBarHeight+r-R&&(I=!1,t.css({position:"absolute",top:r-R,width:W}),N&&A.length&&A.css({position:"absolute",top:r-R,width:W-2*V}),h.css({position:"absolute",top:r-R+T.menuBarHeight,width:W-2*V-(N?0:h.outerWidth()-h.width())}))),(!J||H&&S)&&G+T.windowHeight<=q+r+T.bottomHeight+T.statusBarHeight+V?b&&b.deltaHeight>0?a.scrollBy(0,b.deltaHeight):S&&(J=!0,B.css({position:"fixed",bottom:T.bottomHeight,visibility:"",width:W-2*V}),z.css({position:"fixed",bottom:0,width:W})):(!S&&J||(J||H)&&G+T.windowHeight>q+r+T.bottomHeight+T.statusBarHeight-V)&&(J=!1,B.add(z).attr("style",""),!S&&B.css("visibility","hidden"))):H&&(t.css({position:"absolute",top:0,width:W}),N&&A.length&&A.css({position:"absolute",top:0,width:W-2*V}),h.css({position:"absolute",top:T.menuBarHeight,width:W-2*V-(N?0:h.outerWidth()-h.width())}),B.add(z).attr("style","")),D.width()<300&&T.windowWidth>600&&d.height()>C.height()+U+120&&T.windowHeight<r?(T.sideSortablesHeight+O+P>T.windowHeight||K||L?U>=G+O?(C.attr("style",""),K=L=!1):G>M?K?(K=!1,k=C.offset().top-T.adminBarHeight,l=f.offset().top,l<k+T.sideSortablesHeight+P&&(k=l-T.sideSortablesHeight-12),C.css({position:"absolute",top:k,bottom:""})):!L&&T.sideSortablesHeight+C.offset().top+P<G+T.windowHeight&&(L=!0,C.css({position:"fixed",top:"auto",bottom:P})):M>G&&(L?(L=!1,k=C.offset().top-P,l=f.offset().top,l<k+T.sideSortablesHeight+P&&(k=l-T.sideSortablesHeight-12),C.css({position:"absolute",top:k,bottom:""})):!K&&C.offset().top>=G+O&&(K=!0,C.css({position:"fixed",top:O,bottom:""}))):(G>=U-O?C.css({position:"fixed",top:O}):C.attr("style",""),K=L=!1),M=G):(C.attr("style",""),K=L=!1),H&&(s.css({paddingTop:T.toolsHeight}),N?v.css({paddingTop:T.visualTopHeight+T.menuBarHeight}):(x.css({marginTop:T.textTopHeight}),y.width(W-20-2*V)))}}function k(){i(),j()}function l(a){for(var b=1;6>b;b++)setTimeout(a,500*b)}function m(){clearTimeout(q),q=setTimeout(j,100)}function n(){a.pageYOffset&&a.pageY