Coder Social home page Coder Social logo

infomaniac's Introduction

Infomaniac is a Firefox extension for Fluidinfo.

Introduction

Infomaniac is a Firefox extension that makes it easy to follow web pages, see the info other people have stored and to add one's own info about them. The extension adds a sidebar to the browser and, as such, must be XUL-based. The sidebar contains a browser XUL element which displays a mini-object browser served from fluidinfo.com. As the user changes tabs and pages the sidebar is updated to show the relevant content.

Development and testing

Follow the instructions here to prepare a development profile and tweak some settings to get information about errors when the extension runs:

https://developer.mozilla.org/en/Setting_up_extension_development_environment

When that's done put a file in ~/.mozilla/firefox/<profile>/extensions called jid1-AiwVfZ6h5L6xsQ@jetpack with a single line containing the path to this repository. Start Firefox and hit Ctrl-Shift-f to see the extension in action:

/usr/bin/firefox -no-remote -P dev

You need to restart the browser whenever you make a change to the extension logic before it will be visible. When the browser is running install the Firebug extension.

When you use Firebug for the first time click on the little box next to "Console" to enable it. Then click on the little menu arrow beside "Console" and turn on the following options:

  • Show Javascript Errors
  • Show Chrome Errors
  • Show Chrome Messages
  • Show Stack Trace With Errors

They'll persist between browser restarts so you should only need to do this once.

Handling page and tab changes

The extension needs to detect a few several kinds of state changes and update itself to ensure that the content it displays always matches the current page:

  • A new tab is opened showing the empty about:blank page.
  • A new tab is opened showing a page that can be followed.
  • The active tab is switched from one to another.
  • The page in the active tab isn't loaded yet.
  • The page in the active tab finishes loading.
  • The page in the active tab is changed.
  • The page in an inactive tab has changed since the last time the extension updated itself (say because of an automatic refresh or because a page was loading slowly and the user switched away while it finished).

As you can see many things can happen that must result in the extension updating its state. The way it does this is by listening for and responding to a combination of events, which are described on these pages:

Setting the root URL

The root URL, used to fetch the extension content, is stored in the extensions.infomaniac.rootURL preference. Preferences are described in some detail here:

https://developer.mozilla.org/en/Code_snippets/Preferences

The default can be overridden by opening about:config and setting a new endpoint. It's quite useful to use a browser profile just for development, as described above, with the root URL set to a local instance of fluidinfo.com.

Making a new release

Create a .xpi file:

make

This will create an infomaniac.xpi file that's ready to deploy.

Further information

There are a number of resources you'll need to have on hand to understand and modify the extension:

infomaniac's People

Contributors

ceronman avatar gridaphobe avatar jkakar avatar terrycojones avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

infomaniac's Issues

Pressing Ctrl-Shift-f when the extension content is focused doesn't close the sidebar

It would be nice if this worked. I don't keep it open most of the
time, so my workflow is often:

  1. Look at webpage and decide I want to comment/tag it.
  2. Hit Ctrl-Shift-f to open the sidebar.
  3. Enter my comment.
  4. Hit Ctrl-Shift-f to close the sidebar... nothing happens, so I
    have to click in the page content area and then hit the keystroke
    again to make the sidebar go away.

Need to add styling to make the extension look nicer

Right now it's a bit meh because, for example, the fonts are serif and
too big. The styling is CSS-based, so we could theoretically do
whatever we want... on the other hand, the widgets displayed in the
extension are native to each OS the browser runs in, so we probably
don't want to muck around too much.

Elements in the sidebar need to wrap automatically

I'm not sure what's going on, but elements in the sidebar never seem
to wrap. It seems that the element containing entire sidebar has a
different width than what the browser displays and that the content
width expands infinitely as content is added. This needs to be fixed.

Default extensions.infomaniac.rootURL value is not working

Reproduce the problem by building an XPI, installing it and then
noticing that the sidebar is blank. When you look in about:config
you'll see that the extensions.infomaniac.rootURL value is undefined
and has no default.

I think the issue is that the defaults directory is not being
included in the built XPI.

Update logic to match the style used in other projects

The Javascript classes we have are defined by creating functions that
return objects and specifying methods on the prototype for those
objects. This is fine, but it's different than the method used in all
our other Javascript code, something @ceronman pointed out in one of
the recent reviews. While there isn't much code, it'd be nice to
update it to use the same style as everything else we have (that is, a
function which defines objects in a closure and returns them).

Need to display some feedback when data is being retrieved from Fluidinfo

At present there is no feedback to indicate that the extension is
waiting for data from Fluidinfo. Some of the time Fluidinfo responds
very quickly, but other times it takes awhile and the extension seems
to be dead. Showing a spinner, progress bar or some other indication
that something is happening would help improve the situation.

Need to detect and respond to tab changes

As a starting point we'll display the URL of the content page in the
sidebar and update it whenever the tab changes. This will form the
basis of the change detection that will cause the sidebar to update
its state depending on what you're looking at.

Need to wire the Follow button up with Fluidinfo

We have the basic pieces in place to wire up the Follow button. It
needs to do the following:

  • Show the current follow state of the page you're viewing.
  • Interact with Fluidinfo when you click it to toggle the follow
    state.
  • Update itself when the active tag or current page changes.

Add a debug flag.

The console object should not be overriden if the debug flag is false.

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.