mahiki / sde-path

learning how to be good enough for my current role
2 stars 0 forks source link

chrome extension one-liner #38

Closed mahiki closed 8 years ago

mahiki commented 8 years ago

Comcast inserts a ton of js into web pages if you are a ISP user. One HN commenter provided a one-line chrome extension to remove it all:

I was hit with this a couple of months ago. A one-line Chrome extension handled it fairly well...

$> document.getElementById('comcast_content').remove();


Alternate version: Trump blocker
thisisbrians/gist

$(":contains(Trump),:contains(TRUMP),:contains(trump)")
    .filter(function(){return $(this).clone().children().remove()
    .end().text().toLowerCase().indexOf("trump")!=-1;}).remove();
mahiki commented 8 years ago

More help from hacker news comments:

I feel I should hand roll my own extensions from copies of favorites that I no longer trust (dead mouse, etc). Is there a good tutorial out there for this?

peterhartree 21 days ago

  1. You can download the source code of any extension on the Chrome Web Store using this extension: chrome store extension source viewer *which i don't like cuz permissions
  2. Review the source code.
  3. Visit chrome://extensions and enable developer mode.
  4. Click "Load unpacked extension" and point to the folder containing the extension source code you've reviewed. C.f. https://developer.chrome.com/extensions/getstarted#unpacked

*

1 point by banku_brougham 21 days ago

Awesome, thanks!!

mahiki commented 8 years ago

Gotta start from beginning, Chrome Getting Started.

Also see evernote saved "chrome extension hacking". Original link is dead
[._.]/ Hooray for evernote saving!

mahiki commented 8 years ago

Steps

  1. Getting started
  2. manifest.json file reference documentation.
  3. create resources files (icon.png in this case), popup.html
  4. popup.js needs setup

more steps to learning:
chrome extension developer's guide
chrome extensions overview chrome sample extensions

mahiki commented 8 years ago

OK extension is built and committed to the repo 'chromext'.

Packaging into a .crx file as per documentation

See here for setting up developer account and publishing extension to Chrome Web Store

mahiki commented 8 years ago

Closing, refer to new repo mahiki/chromext#1