@@ -3,6 +3,7 @@ var updating = false;
33var pollTimer = null ;
44var blocekdInnerObj = { } ;
55var currentIdOfMainSidebar = "" ;
6+ var currentOpenMenu = "" ;
67
78function escapeHTML ( unsafeStr )
89{
@@ -1642,6 +1643,7 @@ function dropdownShow(nameOfElem)
16421643 {
16431644 $ ( '.dropdown-content' ) . hide ( ) ;
16441645 $ ( '.dropdown-content' ) . css ( 'margin-top' , "0px" ) ;
1646+ currentOpenMenu = "" ;
16451647 }
16461648 else
16471649 {
@@ -1657,17 +1659,51 @@ function dropdownShow(nameOfElem)
16571659 {
16581660 currentElement . style . marginTop = "-" + ( currentElement . offsetHeight + 25 ) + "px" ;
16591661 }
1662+ currentOpenMenu = nameOfElem ;
16601663 }
16611664}
16621665
1666+ $ ( "#windows" ) . scroll ( function ( ) {
1667+ let nameOfElem = currentOpenMenu ;
1668+ if ( nameOfElem === "" )
1669+ {
1670+ return ;
1671+ }
1672+ if ( document . getElementById ( "dropdown-" + nameOfElem ) . style . display === 'block' )
1673+ {
1674+ let heightWindow = window . innerHeight || document . documentElement . clientHeight || document . body . clientHeight ;
1675+ if ( $ ( "#innerFirstDevBox" + nameOfElem + " .expandMenu" ) . position ( ) . top < 0 || ( $ ( "#innerFirstDevBox" + nameOfElem + " .expandMenu" ) . position ( ) . top ) > heightWindow )
1676+ {
1677+ forceCloseDropdownMenu ( ) ;
1678+ }
1679+ else
1680+ {
1681+ let currentElement = document . getElementById ( "dropdown-" + nameOfElem ) ;
1682+ $ ( "#dropdown-" + nameOfElem ) . css ( "top" , "" + ( $ ( "#innerFirstDevBox" + nameOfElem + " .expandMenu" ) . position ( ) . top + $ ( "#innerFirstDevBox" + nameOfElem + " .expandMenu" ) . height ( ) ) + "px" )
1683+ let elementLowestPosition = ( currentElement . getBoundingClientRect ( ) . top + currentElement . offsetHeight ) ;
1684+ let heightWindow = window . innerHeight || document . documentElement . clientHeight || document . body . clientHeight ;
1685+ if ( elementLowestPosition > heightWindow )
1686+ {
1687+ currentElement . style . marginTop = "-" + ( currentElement . offsetHeight + 25 ) + "px" ;
1688+ }
1689+ }
1690+ }
1691+ } ) ;
1692+
16631693window . onclick = function ( event ) {
16641694 if ( ! event . target . matches ( '.expandMenu' ) )
16651695 {
1666- $ ( '.dropdown-content' ) . hide ( ) ;
1667- $ ( '.dropdown-content' ) . css ( 'margin-top' , "0px" ) ;
1696+ forceCloseDropdownMenu ( ) ;
16681697 }
16691698}
16701699
1700+ function forceCloseDropdownMenu ( )
1701+ {
1702+ $ ( '.dropdown-content' ) . hide ( ) ;
1703+ $ ( '.dropdown-content' ) . css ( 'margin-top' , "0px" ) ;
1704+ currentOpenMenu = "" ;
1705+ }
1706+
16711707function showUpdateCheckPopup ( data )
16721708{
16731709 showPopup ( ) ;
0 commit comments