Browse Source

#717: prevent flicker of unstyled content: make the pane visible only when their content is ready... + watchdog in case of error.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2725 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 12 years ago
parent
commit
625a531e1a
2 changed files with 12 additions and 1 deletions
  1. 7 1
      application/itopwebpage.class.inc.php
  2. 5 0
      css/light-grey.css

+ 7 - 1
application/itopwebpage.class.inc.php

@@ -141,6 +141,7 @@ class iTopWebPage extends NiceWebPage
 				
 					}
 		});
+		window.clearTimeout(iPaneVisWatchDog);
 		myLayout.addPinBtn( "#tPinMenu", "west" );
 		//myLayout.open( "west" );
 		$('.ui-layout-resizer-west .ui-layout-toggler').css({background: 'transparent'});
@@ -391,6 +392,11 @@ EOF
 			
 		});
 
+		
+		function FixPaneVis()
+		{
+			$('.ui-layout-center, .ui-layout-north, .ui-layout-south').css({display: 'block'});
+		}
 EOF
 		);
 	}
@@ -562,7 +568,7 @@ EOF
 					}
 					$sHtml .= "<script type=\"text/javascript\" src=\"$s_script\"></script>\n";
 			}
-			$this->add_script("\$(document).ready(function() {\n{$this->m_sInitScript};\nwindow.setTimeout('onDelayedReady()',10)\n});");
+			$this->add_script("var iPaneVisWatchDog  = window.setTimeout('FixPaneVis()',5000);\n\$(document).ready(function() {\n{$this->m_sInitScript};\nwindow.setTimeout('onDelayedReady()',10)\n});");
 			if (count($this->m_aReadyScripts)>0)
 			{
 				$this->add_script("\nonDelayedReady = function() {\n".implode("\n", $this->m_aReadyScripts)."\n}\n");

+ 5 - 0
css/light-grey.css

@@ -8,6 +8,11 @@ body {
 	overflow: hidden;	/* Remove scroll bars on browser window */
 }
 
+/* to prevent flicker, hide the pane's content until it's ready */
+.ui-layout-center, .ui-layout-north, .ui-layout-south {
+    display: none;
+}
+
 .raw_output {
     font-family: Courier-New, Courier, Arial, Helvetica;
     font-size: 8pt;