Giter Club home page Giter Club logo

mouse_odometer's Introduction

Mouse Odometer

Squeak! - Keep track of how many pixels your mouse travels!

Setup locally

Load up extension in Chrome. Go to chrome://extensions/ or just find the "Manage Extensions" link from the plugins menu bar icon.

Click "Load Unpacked" in the top left and navigate to the root directory of this project. This option only appears when the "Developer mode" option is selected in the top right.

How this works

Each tab independently keeps track of mouse movements and sends updated movements to the background.js script every few seconds. There's a maximum number of storage.set values that can be called and that's why it must be throttled. Once an update is sent from the tab the currentValue is reset to start again. This allows one source of truth (background.js) of the overall distance to be maintained and allow each tab to not have to worry about it.

This communication is achieved using a simple request instead of dealing with achieving a long-term connection.

The overall movement distance is saved to chrome.storage that will be used to maintain your distance traveled over your entire Google account (i.e. synced).

Manifest options notes

content_scripts - This allows the JS to run within the main browser DOM

background - This script is running in the background to receive all mouse movement updates.

default_popup - This is the options page JS but it cannot receive any messages unless it is open, therefore we need the background script to be running. Thus the options page is only for displaying the current movement value.

web_accessible_resources - This allows the content_scripts to be loaded up correctly (I think). Whatever the case this is needed for now.

To Do

  • Add a mouse icon for the menu bar

  • Make the options page more flashy.

mouse_odometer's People

Contributors

travisl12 avatar

Stargazers

 avatar  avatar

Watchers

 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.