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

Cleanup liberator.open. Ted, please, just once, format your code correctly. Thanks.

This commit is contained in:
Kris Maglione
2009-01-06 12:41:55 -05:00
parent 850722d335
commit e7f86f893d
2 changed files with 11 additions and 23 deletions

View File

@@ -638,8 +638,6 @@ CompletionContext.prototype = {
for (let type in this.selectionTypes) for (let type in this.selectionTypes)
this.highlight(0, 0, type); this.highlight(0, 0, type);
this.cancelAll();
this.contextList = []; this.contextList = [];
this.offset = 0; this.offset = 0;
this.process = []; this.process = [];
@@ -649,6 +647,8 @@ CompletionContext.prototype = {
this.updateAsync = false; this.updateAsync = false;
this.waitingForTab = false; this.waitingForTab = false;
this.cancelAll();
if (this.editor) if (this.editor)
{ {
this.value = this.editor.selection.focusNode.textContent; this.value = this.editor.selection.focusNode.textContent;

View File

@@ -602,7 +602,6 @@ const liberator = (function () //{{{
NEW_TAB: 2, NEW_TAB: 2,
NEW_BACKGROUND_TAB: 3, NEW_BACKGROUND_TAB: 3,
NEW_WINDOW: 4, NEW_WINDOW: 4,
NEW_BACKGROUND_WIN_TAB: 6,
forceNewTab: false, forceNewTab: false,
@@ -1094,6 +1093,8 @@ const liberator = (function () //{{{
if (urls.length == 0) if (urls.length == 0)
return false; return false;
let browser = window.getBrowser();
function open(urls, where) function open(urls, where)
{ {
let url = Array.concat(urls)[0]; let url = Array.concat(urls)[0];
@@ -1103,7 +1104,7 @@ const liberator = (function () //{{{
switch (where) switch (where)
{ {
case liberator.CURRENT_TAB: case liberator.CURRENT_TAB:
getBrowser().loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, postdata); browser.loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, postdata);
break; break;
case liberator.NEW_BACKGROUND_TAB: case liberator.NEW_BACKGROUND_TAB:
@@ -1113,25 +1114,15 @@ const liberator = (function () //{{{
options.withContext(function () { options.withContext(function () {
options.setPref("browser.tabs.loadInBackground", true); options.setPref("browser.tabs.loadInBackground", true);
getBrowser().loadOneTab(url, null, null, postdata, where == liberator.NEW_BACKGROUND_TAB); browser.loadOneTab(url, null, null, postdata, where == liberator.NEW_BACKGROUND_TAB);
}); });
break; break;
case liberator.NEW_WINDOW: case liberator.NEW_WINDOW:
window.open(); window.open();
services.get("windowMediator").getMostRecentWindow("navigator:browser") let win = services.get("windowMediator").getMostRecentWindow("navigator:browser");
.loadURI(url, null, postdata); win.loadURI(url, null, postdata);
break; browser = win.getBrowser();
case liberator.NEW_BACKGROUND_WIN_TAB:
if (!liberator.has("tabs"))
return open(urls, liberator.NEW_WINDOW);
options.withContext(function () {
options.setPref("browser.tabs.loadInBackground", true);
services.get("windowMediator").getMostRecentWindow("navigator:browser")
.getBrowser().loadOneTab(url, null, null, postdata, true);
});
break; break;
default: default:
@@ -1144,13 +1135,10 @@ const liberator = (function () //{{{
else if (!where) else if (!where)
where = liberator.CURRENT_TAB; where = liberator.CURRENT_TAB;
for (let [i, url] in Iterator(urls)) for (let [,url] in Iterator(urls))
{ {
open(url, where); open(url, where);
if( liberator.NEW_WINDOW == where || liberator.NEW_BACKGROUND_WIN_TAB == where ) where = liberator.NEW_BACKGROUND_TAB;
where = liberator.NEW_BACKGROUND_WIN_TAB;
else
where = liberator.NEW_BACKGROUND_TAB;
} }
return true; return true;