1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 21:17:58 +01:00

move reload() and reload_all() global functions to vimperator.tabs

This commit is contained in:
Doug Kearns
2007-07-02 12:40:56 +00:00
parent 5064fc7f44
commit 3ca1ee8651
3 changed files with 39 additions and 40 deletions

View File

@@ -601,7 +601,7 @@ function Commands() //{{{
}
));
addDefaultCommand(new Command(["re[load]"],
function(args, special) { reload(getBrowser().mCurrentTab, special); },
function(args, special) { vimperator.tabs.reload(getBrowser().mCurrentTab, special); },
{
usage: ["re[load][!]"],
short_help: "Reload current page",
@@ -609,7 +609,7 @@ function Commands() //{{{
}
));
addDefaultCommand(new Command(["reloada[ll]"],
function(args, special) { reload_all(special); },
function(args, special) { vimperator.tabs.reloadAll(special); },
{
usage: ["reloada[ll][!]"],
short_help: "Reload all pages",
@@ -1622,42 +1622,6 @@ Vimperator.prototype.quit = function(save_session)
goQuitApplication();
}
function reload(tab, bypass_cache)
{
if (bypass_cache)
{
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
const flags = nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY | nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
getBrowser().getBrowserForTab(tab).reloadWithFlags(flags);
}
else
{
getBrowser().reloadTab(tab);
}
}
function reload_all(bypass_cache)
{
if (bypass_cache)
{
for (var i = 0; i < getBrowser().mTabs.length; i++)
{
try
{
reload(getBrowser().mTabs[i], bypass_cache)
}
catch (e) {
// FIXME: can we do anything useful here without stopping the
// other tabs from reloading?
}
}
}
else
{
getBrowser().reloadAllTabs();
}
}
Vimperator.prototype.restart = function()
{
// if (!arguments[1]) return;

View File

@@ -373,14 +373,14 @@ function Mappings() //{{{
}
));
addDefaultMap(new Map(vimperator.modes.NORMAL, ["r"],
function(count) { reload(getBrowser().mCurrentTab, false); },
function(count) { vimperator.tabs.reload(getBrowser().mCurrentTab, false); },
{
short_help: "Reload",
help: "Forces reloading of the current page."
}
));
addDefaultMap(new Map(vimperator.modes.NORMAL, ["R"],
function(count) { reload(getBrowser().mCurrentTab, true); },
function(count) { vimperator.tabs.reload(getBrowser().mCurrentTab, true); },
{
short_help: "Reload while skipping the cache",
help: "Forces reloading of the current page skipping the cache."

View File

@@ -1021,6 +1021,41 @@ function Tabs() //{{{
this.alternate = this.getTab();
this.reload = function(tab, bypass_cache)
{
if (bypass_cache)
{
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
const flags = nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY | nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
getBrowser().getBrowserForTab(tab).reloadWithFlags(flags);
}
else
{
getBrowser().reloadTab(tab);
}
}
this.reloadAll = function(bypass_cache)
{
if (bypass_cache)
{
for (var i = 0; i < getBrowser().mTabs.length; i++)
{
try
{
this.reload(getBrowser().mTabs[i], bypass_cache)
}
catch (e) {
// FIXME: can we do anything useful here without stopping the
// other tabs from reloading?
}
}
}
else
{
getBrowser().reloadAllTabs();
}
}
//}}}
} //}}}