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

1 line
13 KiB
JavaScript
Raw Normal View History

!function(I,L){"use strict";var M=L(I),V=L(document),N=L("#wpadminbar"),j=L("#wpfooter");L(function(){var m,e,u=L("#postdivrich"),w=L("#wp-content-wrap"),H=L("#wp-content-editor-tools"),b=L(),v=L(),x=L("#ed_toolbar"),y=L("#content"),i=y[0],o=0,T=L("#post-status-info"),B=L(),C=L(),S=L("#side-sortables"),O=L("#postbox-container-1"),z=L("#post-body"),E=I.wp.editor&&I.wp.editor.fullscreen,r=function(){},l=function(){},k=!1,A=!1,W=!1,K=!1,R=0,Y=56,U=20,D=300,n=w.hasClass("tmce-active")?"tinymce":"html",P=!!parseInt(I.getUserSetting("hidetb"),10),X={windowHeight:0,windowWidth:0,adminBarHeight:0,toolsHeight:0,menuBarHeight:0,visualTopHeight:0,textTopHeight:0,bottomHeight:0,statusBarHeight:0,sideSortablesHeight:0},s=I._.throttle(function(){var t=I.scrollX||document.documentElement.scrollLeft,e=I.scrollY||document.documentElement.scrollTop,o=parseInt(i.style.height,10);i.style.height=D+"px",i.scrollHeight>D&&(i.style.height=i.scrollHeight+"px"),void 0!==t&&I.scrollTo(t,e),i.scrollHeight<o&&p()},300);function F(){var t=i.value.length;m&&!m.isHidden()||!m&&"tinymce"===n||(t<o?s():parseInt(i.style.height,10)<i.scrollHeight&&(i.style.height=Math.ceil(i.scrollHeight)+"px",p()),o=t)}function p(t){if(!E||!E.settings.visible){var e,o,i,n,s,f,a,d,c=M.scrollTop(),u=t&&t.type,r="scroll"!==u,l=m&&!m.isHidden(),p=D,g=z.offset().top,h=w.width();!r&&X.windowHeight||function(){var t=M.width();(X={windowHeight:M.height(),windowWidth:t,adminBarHeight:600<t?N.outerHeight():0,toolsHeight:H.outerHeight()||0,menuBarHeight:B.outerHeight()||0,visualTopHeight:b.outerHeight()||0,textTopHeight:x.outerHeight()||0,bottomHeight:T.outerHeight()||0,statusBarHeight:C.outerHeight()||0,sideSortablesHeight:S.height()||0}).menuBarHeight<3&&(X.menuBarHeight=0)}(),l||"resize"!==u||F(),f=l?(e=b,o=v,X.visualTopHeight):(e=x,o=y,X.textTopHeight),(l||e.length)&&(s=e.parent().offset().top,a=o.offset().top,d=o.outerHeight(),(l?D+f:D+20)+5<d?((!k||r)&&c>=s-X.toolsHeight-X.adminBarHeight&&c<=s-X.toolsHeight-X.adminBarHeight+d-p?(k=!0,H.css({position:"fixed",top:X.adminBarHeight,width:h}),l&&B.length&&B.css({position:"fixed",top:X.adminBarHeight+X.toolsHeight,width:h-2-(l?0:e.outerWidth()-e.width())}),e.css({position:"fixed",top:X.adminBarHeight+X.toolsHeight+X.menuBarHeight,width:h-2-(l?0:e.outerWidth()-e.width())})):(k||r)&&(c<=s-X.toolsHeight-X.adminBarHeight?(k=!1,H.css({position:"absolute",top:0,width:h}),l&&B.length&&B.css({position:"absolute",top:0,width:h-2}),e.css({position:"absolute",top:X.menuBarHeight,width:h-2-(l?0:e.outerWidth()-e.width())})):c>=s-X.toolsHeight-X.adminBarHeight+d-p&&(k=!1,H.css({position:"absolute",top:d-p,width:h}),l&&B.length&&B.css({position:"absolute",top:d-p,width:h-2}),e.css({position:"absolute",top:d-p+X.menuBarHeight,width:h-2-(l?0:e.outerWidth()-e.width())}))),(!A||r&&P)&&c+X.windowHeight<=a+d+X.bottomHeight+X.statusBarHeight+1?t&&0<t.deltaHeight&&t.deltaHeight<100?I.scrollBy(0,t.deltaHeight):l&&P&&(A=!0,C.css({position:"fixed",bottom:X.bottomHeight,visibility:"",width:h-2}),T.css({position:"fixed",bottom:0,width:h})):(!P&&A||(A||r)&&c+X.windowHeight>a+d+X.bottomHeight+X.statusBarHeight-1)&&(A=!1,C.attr("style",P?"":"visibility: hidden;"),T.attr("style",""))):r&&(H.css({position:"absolute",top:0,width:h}),l&&B.length&&B.css({position:"absolute",top:0,width:h-2}),e.css({position:"absolute",top:X.menuBarHeight,width:h-2-(l?0:e.outerWidth()-e.width())}),C.attr("style",P?"":"visibility: hidden;"),T.attr("style","")),O.width()<300&&600<X.windowWidth&&V.height()>S.height()+g+120&&X.windowHeight<d?(X.sideSortablesHeight+Y+U>X.windowHeight||W||K?c+Y<=g?(S.attr("style",""),W=K=!1):R<c?W?(W=!1,i=S.offset().top-X.adminBarHeight,(n=j.offset().top)<i+X.sideSortablesHeight+U&&(i=n-X.sideSortablesHeight-12),S.css({position:"absolute",top:i,bottom:""})):!K&&X.sideSortablesHeight+S.offset().top+U<c+X.windowHeight&&(K=!0,S.css({position:"fixed",top:"auto",bottom:U})):c<R&&(K?(K=!1,i=S.offset().top-U,(n=j.offset().top)<i+X.sideSortablesHeight+U&&(i=n-X.sideSortablesHeight-12),S.css({position:"absolute",top:i,bottom:""})):!W&&S.offset().top>=c+Y&&(W=!0,S.cs