Access Keys:
Skip to content (Access Key - 0)
Log in (Access Key - 5)



Toggle Sidebar

Custom-History Component

General

The component consists of AutoCompleteTextBox.js, a Javascript XPCOM Component implementing nsIAutoCompleteSearch.

It interacts with PreferencesManager from preferences.js, being able to store and retrieve values from user profile.

As the amout of values to store is limited, PreferencesManager uses Last-In-First-Out priciple to ensure that recently used values overrule the older ones.

Code-Usage

Pushing data into user profile:

  var prefService = Components.classes["@mozilla.org/preferences-service;1"]
      .getService(Components.interfaces.nsIPrefService)
      .getBranch("extensions.molybdenum.");
  prefManager = new PreferencesManager(prefService);
  prefManager.addArrayElement("your-id", yourStringValue);
  // or: prefManager.addArray("your-id", yourStringArray);

You can inspect the values being stored by typing "about:config" in your browser's URL and filtering for "molybdenum.extension".

If more than PreferencesManager.MAX_ENTRIES are already stored, oldes entry gets replaced with new value.

XUL-Usage

<textbox
  id="your-xul-id"
  type="autocomplete"
  autocompletesearch="custom-history"
  autocompletesearchparam="your-id[;<display-count>]"
  enablehistory="true"
  tabscrolling="true"
  ...
 />    	         
  • your-xul-id - as name says, needed for referencing the GUI element
  • your-id - for user profile storage, values will be stored in user preferences under "extensions.molybdenum.your-id"
  • display-count - amount of NEWEST entries to display from those stored in profile
last edited on Sep 19, 2008 19:40
Adaptavist Theme Builder Powered by Atlassian Confluence