just cleanups
This commit is contained in:
parent
583a1402ea
commit
e25703a111
2 changed files with 12 additions and 23 deletions
|
|
@ -86,38 +86,27 @@ var leo_search = {
|
||||||
index < tabbrowser.tabContainer.childNodes.length && !found;
|
index < tabbrowser.tabContainer.childNodes.length && !found;
|
||||||
index++) {
|
index++) {
|
||||||
|
|
||||||
// Get the next tab
|
|
||||||
var currentTab = tabbrowser.tabContainer.childNodes[index];
|
var currentTab = tabbrowser.tabContainer.childNodes[index];
|
||||||
|
|
||||||
// Does this tab contain our custom attribute?
|
|
||||||
if (currentTab.hasAttribute(attrName)) {
|
if (currentTab.hasAttribute(attrName)) {
|
||||||
// Yes
|
|
||||||
found = true;
|
found = true;
|
||||||
gBrowser.getBrowserAtIndex(index).loadURI(url);
|
gBrowser.getBrowserAtIndex(index).loadURI(url);
|
||||||
|
|
||||||
if (foregroundTab) {
|
if (foregroundTab) {
|
||||||
// select and focus it.
|
|
||||||
tabbrowser.selectedTab = currentTab;
|
tabbrowser.selectedTab = currentTab;
|
||||||
|
|
||||||
// Focus *this* browser window in case another one is currently focused
|
|
||||||
tabbrowser.ownerDocument.defaultView.focus();
|
tabbrowser.ownerDocument.defaultView.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// Our tab isn't open. Open it now.
|
|
||||||
var browserEnumerator = wm.getEnumerator("navigator:browser");
|
var browserEnumerator = wm.getEnumerator("navigator:browser");
|
||||||
var tabbrowser = browserEnumerator.getNext().gBrowser;
|
var tabbrowser = browserEnumerator.getNext().gBrowser;
|
||||||
|
|
||||||
// Create tab
|
|
||||||
var newTab = tabbrowser.addTab(url);
|
var newTab = tabbrowser.addTab(url);
|
||||||
newTab.setAttribute(attrName, "leoOrg");
|
newTab.setAttribute(attrName, "leoOrg");
|
||||||
|
|
||||||
if (foregroundTab) {
|
if (foregroundTab) {
|
||||||
// Focus tab
|
|
||||||
tabbrowser.selectedTab = newTab;
|
tabbrowser.selectedTab = newTab;
|
||||||
|
|
||||||
// Focus *this* browser window in case another one is currently focused
|
|
||||||
tabbrowser.ownerDocument.defaultView.focus();
|
tabbrowser.ownerDocument.defaultView.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue