home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 September
/
PCWorld_2008-09_cd.bin
/
komunikace
/
kmeleon
/
K-Meleon1.1.3en-US.exe
/
macros
/
reload.kmm
< prev
next >
Wrap
Text File
|
2007-05-04
|
3KB
|
53 lines
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
# ---------- Continuous Reload -------------------------------------------------------------------------------------
#
# Dependencies : main.kmm ($macroPrefBranch, $pref_Frames, ExecMacros, OpenURL)
# Resources : -
# Preferences : kmeleon.plugins.macros.reload.interval
#
# ------------------------------------------------------------------------------------------------------------------
Reload_Continuously{
$ExecMacros="_Reload_1st"; &ExecMacros_JavaScript;
}
# ----- PRIVATE
$_Reload_Interval=$macroPrefBranch."reload.interval";
$_Reload_OnLoad="";
_Reload_1st{
# When frames are toggled from disabled to enabled, the current page must be loaded into a new window/layer
$_Reload_OnLoad="_Reload_2nd";
$OpenURL=$URL; $ExecMacros=getpref(BOOL,$pref_Frames)==false?"OpenURL_InNew":$_Reload_OnLoad; &ExecMacros_Frames;
}
_Reload_2nd{
$_Reload_OnLoad="";
$__pre=getpref(INT,$_Reload_Interval);
$__sec=prompt(_("Enter number of seconds between reloads:"),_("Continuous Reload"),$__pre);
$__sec==""?0:injectJS("(function(){var t=parseInt('".$__sec."');if(!isNaN(t)&&(t>0))with(document){open();write('<html><head><style type=\"text/css\">#b{position:absolute;left:0;width:100%;height:2em;bottom:0;padding:0 0 0.25em;font:inherit;}#i{position:absolute;left:0;width:100%;bottom:2em;top:0;border:0;}</style></head><body style=\"font:menu\"><iframe id=\"i\" src=\"'+location.href+'\"></iframe><button id=\"b\" onclick=\"quit()\"></button></body><script type=\"text/javascript\">var tspan='+t+',tleft=tspan+1,buttn=document.getElementsByTagName(\"button\")[0],units=new Array(\""._("hours")."\",\""._("minutes")."\",\""._("seconds")."\"),title=\""._("Reloading: %s")."\",btext=\""._("Reloading in %t %u (Click to abort)")."\";doit();setInterval(\"doit()\",1000);function doit(){if(!--tleft){tleft=tspan;frames[0].location.reload()}var h=Math.floor(tleft/3600),m=Math.floor((tleft%3600)/60),s=tleft%60,ttext=((h)?(h+((m<10)?\":0\":\":\")+m):((m)?m:\"\"))+((h||m)?((s<10)?\":0\":\":\"):\"\")+s,utext=((h)?units[0]:((m)?units[1]:units[2]));buttn.innerHTML=btext.replace(/%t/,ttext).replace(/%u/,utext);document.title=title.replace(/%s/,frames[0].document.title)}function quit(){history.back()}</script></html>');close()}})()");
setpref(INT,$_Reload_Interval,$__sec); getpref(INT,$_Reload_Interval)>0?0:setpref(INT,$_Reload_Interval,$__pre);
}
_Reload_BuildMenu{
$__r="Reloa&ding";
$kLayers==true?0:setmenu(Nav,popup,$__r,ID_NAV_FORCE_RELOAD);
$kLayers==true?0:setmenu(Nav,command,"",ID_NAV_FORCE_RELOAD);
$kLayers==true?0:setmenu($__r,command,"&Force Reload",ID_NAV_FORCE_RELOAD);
setmenu($__r,macro,"&Continuous Reload...",Reload_Continuously);
}
$OnInit=$OnInit."_Reload_BuildMenu;";
_Reload_OnLoad{
macros($_Reload_OnLoad);
}
_Reload_SetDefaults{
getpref(INT,$_Reload_Interval)==0?setpref(INT,$_Reload_Interval,120):0;
$OnLoad=$OnLoad."_Reload_OnLoad;";
}
$OnStartup=$OnStartup."_Reload_SetDefaults;";
# ------------------------------------------------------------------------------------------------------------------
$macroModules=$macroModules."Reload;";