[Dictionarysearch] Suggestion for dictionary search

Khiraly khiraly123 at gmx.net
Tue May 23 14:38:19 EDT 2006


2006. 05. 17, szerda keltezéssel 11.44-kor Khiraly ezt írta:
> Or triple clicking like in scrapbook! (in scrapbook preferences there is
> a checkbox to enable/disable it).
> I think it is a valid shortcut (as scrapbook already imlemented it).
> 
> I think it is a really great idea!

Its not scrapbook, its reveal extension.

I have looked at the code, and it seems to be doable. (Sadly I have
really important uni stuff here, so cant investigate more time right now
into it).

Some things are unclear (what call the relevant function in reveal.
Im talking about this line(content/quickmag.js:29):
 observe: function (aSubject, aTopic, aData)

I dont see any this.observe or any other observe call in the source. I
think its some XUL thing there. A little help is needed here. I assume
its called at startup time, otherwise, does not make sense.

The relevant code would be look like:
(at the configuration load code):
 case "reveal.quickmag":
      if (getBoolPref("reveal.quickmag"))
        getBrowser().mPanelContainer.addEventListener("click", this.toggleMag, false);
      else
        getBrowser().mPanelContainer.removeEventListener("click", this.toggleMag, false);
      break; 

I think at dictionnary search would look like something:
case "dict.quicksearch":

The key thing here is addEventListener and the toggleMag code.

The toggleMag function is responsable for the triple-click handling.
The relevant part(I simplified it, and make it double-click):

toggleMag: function (e) {
    var good = false;
    if (!(getBrowser().selectedBrowser.contentDocument instanceof ImageDocument)) {
      if (e.detail == 2 && e.button == 0) {
        good = true;
      }
    }
    if (!good)
      return;

    if (QuickMag.magOn) // local variable, is the funtion enabled? 
                        // If so disable, it, and quit. If not execute
      QuickMag.disableMag(null);
    else if (e.currentTarget == getBrowser().mPanelContainer) {
      // execute the dictionnary code!    
    }

Jaap, can you help me please? Some help-hand would be really nice!

Khiraly




More information about the DictionarySearch mailing list