From pink-ink at web.de Mon Jul 28 15:56:20 2008 From: pink-ink at web.de (pink-ink at web.de) Date: Tue, 29 Jul 2008 00:56:20 +0200 Subject: [Dictionarysearch] Choose to open new tab or window Message-ID: <215642921@web.de> Hi Jaap, I like Dictionary Search very much and use it very often. But one thing irritating me is, that the links always open in a new tab (which is my global setting for Firefox) and I then have to click on the tab to view it. I'd like to have the option to choose whether DS opens a new tab or new window, maybe with a checkbox in the GUI. As a first step, added part of the functionaliy to your code, except for the GUI stuff, and it works. Small How-to for all users: I unpacked the xpi file "dictionarysearch_3_0_0.xpi", then unpacked the jar file "dictionarysearch.jar" inside. In the file "dictionarysearchOverlay.js", I changed the function "onDictionarySearch" as follows: function onDictionarySearch(n){ var opentype = dictionarySearchPrefs.getCharPref("opentype"); var url = dictionarySearchPrefs.getCharPref("url"+n); url = url.split("$"); url = url[0] + dictionarySearchGetSelectedText("+").toLocaleLowerCase() + url[1]; //log("onDictionarySearch() : url = " + url); if (!gInThunderbird){ if (opentype == "tab" ){ openNewTabWith(url, null, null, true); } else{ var newWindow = window.open( url, '_blank'); newWindow.focus(); } } else{ var messenger = Components.classes["@mozilla.org/messenger;1"].createInstance(); messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger); messenger.launchExternalURL(url); } } In prefs.js, I added the line user_pref("dictionarysearch.opentype", "window"); to be able to choose the open type between "window" or "tab" (which gets effective after restarting firefox). Then I packed the sources together into the jar and xpi file, installed DS over my existing installation and it works well. Best Regards, pink ink _______________________________________________________________________ Jetzt neu! Sch?tzen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220