Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's a simple way in Google Chrome to insert Javascript into sites?

Tags:

I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like:

  • Visit site See that sidebar overwrites content
  • Whip out developer tools, find div id for sidebar
  • Edit a snippet of javascript which is executed on document.ready for this domain:

    $('#sidebar-right').remove(); 

A bit of searching for user scripts tells me that I need to be writing a Chrome extension, which seems unfortunate and overkill. Is there not an easier way, or an extension which is nothing but a javascript editor that assigns snippets to domains? I'd really like to be able to edit in Chrome itself, or at least have a file that I can just leave open in MacVim all the time. An extension requires unloading/installing to update as far as I can tell.

If I just had one big javascript file, that would be fine. I'd just wrap my customizations in domain checks.

Bonus love if I can write in CoffeeScript.

like image 613
bhuga Avatar asked Aug 24 '11 06:08

bhuga


People also ask

How do you put JavaScript on a website?

To include an external JavaScript file, we can use the script tag with the attribute src . You've already used the src attribute when using images. The value for the src attribute should be the path to your JavaScript file. This script tag should be included between the <head> tags in your HTML document.


1 Answers

The answer was Tampermonkey.

https://chrome.google.com/webstore/detail/dhdgffkkebhmkfjojejmpbldmpobfkfo

like image 103
bhuga Avatar answered Oct 18 '22 16:10

bhuga