--- qlookup/src/qlookup/content/qlookup.js 2001/11/26 04:26:36 1.3 +++ C:\Program Files\mozilla.org\Mozilla\chrome\qlookup\content\qlookup.js Fri May 24 20:24:18 2002 @@ -36,10 +36,18 @@ /* Quick Lookup for Mozilla * Contributor(s): * Jeremy Childs - * + * Kevin L Caswick * */ + +function openInTabOrWindow(href) +{ + if(getBrowser().mTabbedMode) + getBrowser().addTab(href, getReferrer(document)); + else + window.open(href); +} function dictionarylookup() { selection = window._content.document.getSelection(); @@ -48,7 +56,7 @@ return; } - window.open("http://www.dictionary.com/cgi-bin/dict.pl?term="+selection,'DICTIONARY'); + openInTabOrWindow("http://www.dictionary.com/cgi-bin/dict.pl?term="+selection,'DICTIONARY'); } function gotoURL() { @@ -58,11 +66,10 @@ return; } if (selection.indexOf("http:")) { - window.open("http://"+selection, 'NEWWIN'); + openInTabOrWindow("http://"+selection, 'NEWWIN'); } else { - window.open(selection, 'NEWWIN'); + openInTabOrWindow(selection, 'NEWWIN'); } - } function googleSearch() { @@ -71,9 +78,9 @@ alert("Please select a word or phrase first."); return; } - window.open("http://www.google.com/search?q="+selection,'GOOGLE'); + openInTabOrWindow("http://www.google.com/search?q="+selection,'GOOGLE'); } function wayBack() { - window.open("http://web.archive.org/archive_request_ng?collection=web&url="+window._content.location.href,'WAYBACK'); + openInTabOrWindow("http://web.archive.org/archive_request_ng?collection=web&url="+window._content.location.href,'WAYBACK'); }