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:
@@ -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;
|
||||
|
||||
@@ -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."
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
//}}}
|
||||
} //}}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user