Giter VIP home page Giter VIP logo

toolbarwidget-jplib's Introduction

SDK Widgets on toolbars

This Jetpack module extends the sdk/widget module with one extra property, toolbarID, allowing Firefox Add-on developers to place widgets on toolbars.

Usage

The API is identical to sdk/widget (only new properties were added).

Here's an example, based on the first example from the sdk/widget documentation. The created widget is not placed on the addon bar, but on the navigation bar.

require("toolbarwidget").ToolbarWidget({
    toolbarID: "nav-bar", // <-- Place widget on Navigation bar
    id: "mozilla-icon",
    label: "My Mozilla Widget",
    contentURL: "http://www.mozilla.org/favicon.ico"
});

ToolbarWidget creates a sdk/widget instance, moves it to the desired toolbar, and returns the Widget instance.
This instance has a read-only property called toolbarID. If you want to move the widget, destroy it and create it again.

The standard Widget does not support setting the height of a widget. This module does support this feature, because there's no point in placing a tiny button on a toolbar. You can choose a preferred height by setting the height property. The widget's height cannot be bigger than the container's height.

Installation

You can add the module globally (in the packages directory under the SDK root), to make it available to all of your Jetpack projects, or add it to a single project (in the packages directory under your add-on's root).

The official documentation contains a tutorial on installing third-party modules, which suggests to download and extract an archive.
I strongly recommend to use git for this purpose, because it makes package management a lot easier. For example:

# Go to the packages directory of the SDK's root.
cd /opt/addon-sdk/packages
# Clone the repository (creates a directory "toolbarwidget-jplib")
git clone git://github.com/Rob--W/toolbarwidget-jplib.git
# Done! You may want to update and view the documentation...
addon-sdk && cfx sdocs
# Later, when you want to update the package to the latest version...
cd /opt/addon-sdk/packages/toolbarwidget-jplib
git pull

After installing the module, declare the dependency in package.json:

    ...
    "dependencies": ["toolbarwidget"],
    ...

Dependencies

The following standard Jetpack modules were used:

Related

  • browser-action - Jetpack module which brings Google Chrome's chrome.browserAction API to Firefox.

Credits

Created by Rob Wu [email protected].
Inspired by Erik Void's toolbarbutton, a module which allows one to easily create simple toolbar buttons.

Released under a MIT license.

toolbarwidget-jplib's People

Contributors

rob--w avatar

Watchers

James Cloos avatar Reuven Gonzales avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.