Skip to content

Instantly share code, notes, and snippets.

@jtbandes
Created November 22, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtbandes/668f719223130f250bc3 to your computer and use it in GitHub Desktop.
Save jtbandes/668f719223130f250bc3 to your computer and use it in GitHub Desktop.
Be Productive — a barebones Chrome extension
var urlsToBlock = [
// matches manifest.json
"*://*.reddit.com/*"
];
function handleRequest(details) {
return {cancel: true};
}
chrome.webRequest.onBeforeRequest.addListener(handleRequest, {"urls": urlsToBlock}, ["blocking"]);
{
"manifest_version": 2,
"name": "Be Productive",
"author": "Jacob Bandes-Storch",
"version": "0.1",
"description": "Block Reddit and other such generally unproductive things.",
"permissions": [
"webRequest",
"webRequestBlocking",
"*://*.reddit.com/*"
],
"background": {
"scripts": ["background.js"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment