Please visit the homepage for location and information on open hours


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anybody have experience writing content scripts? I want to create a Chrome extension
01-16-2014, 10:21 AM,
#1
Question  Anybody have experience writing content scripts? I want to create a Chrome extension
but I have zero experience with Javascript or CSS (and only the most basic html)

Here's what I'd like to do (without, hopefully, having to learn lots of things about JS or CSS that won't be useful to me):

Bare Minimum
- Create an extension for Chrome that monitors all the content I view on Craigslist, and hide all ads that I don't click on the first time I see them.
- Extension saves all unclicked ads' listing ID's in a file on user's computer, and continues to hide ignored ads when renewed by their owners (I don't need to see the same 15 chainsaws listed by the same person every couple days, etc)

Ideally
- Extension features a click-activated drop down UI, allowing me to decide whether to:
  • completely hide unclicked listings, or just gray their links
  • switch extension's behavior, and only hide/gray listings that I select (via checkbox next to every listing)

I read through Google's Chrome Extension developer intro, and realized just how much I don't know. If you are reading this and can guess what elements of JS or CSS I'd need to learn to complete this project, I would very much appreciate your thoughts.

Any other questions or comments are, of course, welcome :)
Reply
01-17-2014, 08:50 AM,
#2
RE: Anybody have experience writing content scripts?
I know some CSS, but unfortunately only basic Javascript (what I can pilfer from the internets Smile )
-Dan

"If you didn't build it, you will never own it." - Barton Dring
Reply
01-18-2014, 10:33 AM, (This post was last modified: 01-18-2014, 11:27 AM by david tremaine.)
#3
RE: Anybody have experience writing content scripts?
Thanks for responding, Dan. Is this something you could imagine doing with CSS? From what little I've read about the two, it sounds like CSS is only really capable of altering visual elements ? Would it make sense to use CSS for everything except the data storage and access?

Here's a basic version of what I want to do:

- - - - - - - - - - -
1. Check url of page in open tab. If url matches this pattern: "http://*.craigslist.org/*/" then apply following rules:

2. (top of the listings page) insert form with radio button options -> View: o All o New to me o (maybe more options later)

3. (throughout listings page) check for elements in page source that match this pattern: " <p class="row" data-pid="??????????"> ". Cross reference with saved data sets: HideTheseListings and ShowTheseListings, present on user's computer. If data-pid for element on screen is present in HideTheseListings, change hyperlink color to light grey. If ShowTheseListings, make it green. Alter browser's color change for previously clicked links so that previously clicked Show listings will be one color (say, dark green) and p.c. Hide listings will be another (say, darker shade of grey).

4. Insert a checkbox next to the star (Craigslist user favorites) element in all listings. Cross reference data-pid of each listing. If new, unseen data-pid, leave checkbox blank. If present in Hide, leave checkbox blank; if present in Show, check checkbox. If user checks box next to previously unseen listing, save data-pid to ShowTheseListings. If user checks box next to listing saved in HideTheseListings, delete entry there and save entry to ShowTheseListings.

5. As user scrolls down page, save data-pid of each unchecked listing to HideTheseListings after it passes an arbitrary (user-definable? click and drag a little floating arrow?) point on screen (say, an inch from the top of the visible page) and instantly apply color rules from #3

- - - - - - - - - - -

Am I missing anything?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)