[Hastymail-cvs] SF.net SVN: hastymail:[1567] trunk/hastymail2/plugins/js_notice/work.php
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2010-06-10 13:17:48
|
Revision: 1567 http://hastymail.svn.sourceforge.net/hastymail/?rev=1567&view=rev Author: sailfrog Date: 2010-06-10 13:17:42 +0000 (Thu, 10 Jun 2010) Log Message: ----------- js_notice plugin change: dynamically determine how long to display the page notice based on how long it took to load the page, with a minimum of 5 seconds Modified Paths: -------------- trunk/hastymail2/plugins/js_notice/work.php Modified: trunk/hastymail2/plugins/js_notice/work.php =================================================================== --- trunk/hastymail2/plugins/js_notice/work.php 2010-06-10 04:11:06 UTC (rev 1566) +++ trunk/hastymail2/plugins/js_notice/work.php 2010-06-10 13:17:42 UTC (rev 1567) @@ -35,7 +35,7 @@ if (document.getElementById("js_notices")) { if (document.getElementById("js_notice_trigger").value == 1) { show_notice_div(); - setTimeout(hide_notice_div, 5000); + setTimeout(hide_notice_div, '.set_delay_time().'); } else { hide_notice_div(); @@ -54,4 +54,17 @@ document.getElementById("send_btn2").style.visibility = "hidden"; }'); } +function set_delay_time() { + global $page_start; + $max = 5; + list($dec, $secs) = explode(' ', $page_start); + list($cdec, $csecs) = explode(' ', microtime()); + if ($csecs - $secs > $max) { + $res = $csecs - $secs; + } + else { + $res = $max; + } + return $res*1000; +} ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |