Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github-injection

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-injection

Tiny script which helps you to build better browser extensions for GitHub.com

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

injection

NPM version Build Status

Tiny script which helps you to build better browser extensions for GitHub.com

Why you need this package

GitHub.com is a huge web app with millions of visitors every day. To reduce the serve load, some parts are build as a single page app. This means, not every click results in a page reload. This is a big problem for some extension scenarios.

GitHub.com uses pjax which fires an event after replacing the requested page with the previous one. GitHub-inject will invoke the provided callback when pjax:end is dispatched and you can reinitialize your extension. For simplicity the callback is also executed on the first script execution.

Install

$ npm install --save github-injection

Usage

const gitHubInjection = require('github-injection');

gitHubInjection(() => {
  const el = window.document.getElementsByClassName('header')[0];
  const randomColor = '#' + ((1<<24) * Math.random()|0).toString(16);
  el.style.backgroundColor = randomColor;
});

License

Copyright (c) 2015 Stefan Buck. Licensed under the MIT license.

FAQs

Package last updated on 12 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc